mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
add view_insert to provide greater control over view order
This commit is contained in:
parent
b2bbcb30c6
commit
f12f4a8898
2 changed files with 18 additions and 2 deletions
|
@ -63,6 +63,7 @@ struct view_s {
|
||||||
|
|
||||||
|
|
||||||
view_t *view_new (int xp, int yp, int xl, int yl, grav_t grav);
|
view_t *view_new (int xp, int yp, int xl, int yl, grav_t grav);
|
||||||
|
void view_insert (view_t *par, view_t *view, int pos);
|
||||||
void view_add (view_t *par, view_t *view);
|
void view_add (view_t *par, view_t *view);
|
||||||
void view_remove (view_t *par, view_t *view);
|
void view_remove (view_t *par, view_t *view);
|
||||||
void view_delete (view_t *view);
|
void view_delete (view_t *view);
|
||||||
|
|
|
@ -116,9 +116,15 @@ setgeometry (view_t *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_add (view_t *par, view_t *view)
|
view_insert (view_t *par, view_t *view, int pos)
|
||||||
{
|
{
|
||||||
view->parent = par;
|
view->parent = par;
|
||||||
|
if (pos < 0)
|
||||||
|
pos = par->num_children + 1 + pos;
|
||||||
|
if (pos < 0)
|
||||||
|
pos = 0;
|
||||||
|
if (pos > par->num_children)
|
||||||
|
pos = par->num_children;
|
||||||
if (par->num_children == par->max_children) {
|
if (par->num_children == par->max_children) {
|
||||||
par->max_children += 8;
|
par->max_children += 8;
|
||||||
par->children = realloc (par->children,
|
par->children = realloc (par->children,
|
||||||
|
@ -126,10 +132,19 @@ view_add (view_t *par, view_t *view)
|
||||||
memset (par->children + par->num_children, 0,
|
memset (par->children + par->num_children, 0,
|
||||||
(par->max_children - par->num_children) * sizeof (view_t *));
|
(par->max_children - par->num_children) * sizeof (view_t *));
|
||||||
}
|
}
|
||||||
par->children[par->num_children++] = view;
|
memmove (par->children + pos + 1, par->children + pos,
|
||||||
|
(par->num_children - pos) * sizeof (view_t *));
|
||||||
|
par->num_children++;
|
||||||
|
par->children[pos] = view;
|
||||||
setgeometry (view);
|
setgeometry (view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
view_add (view_t *par, view_t *view)
|
||||||
|
{
|
||||||
|
view_insert (par, view, -1);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_remove (view_t *par, view_t *view)
|
view_remove (view_t *par, view_t *view)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue