mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-30 11:00:02 +00:00
eliminate setup hook for views
This commit is contained in:
@@ -69,7 +69,7 @@ UI_TextPaddingNode text_padding_nil_stack_top;\
|
||||
UI_TextAlignmentNode text_alignment_nil_stack_top;\
|
||||
}
|
||||
#define UI_InitStackNils(state) \
|
||||
state->parent_nil_stack_top.v = &ui_g_nil_box;\
|
||||
state->parent_nil_stack_top.v = &ui_nil_box;\
|
||||
state->child_layout_axis_nil_stack_top.v = Axis2_X;\
|
||||
state->fixed_x_nil_stack_top.v = 0;\
|
||||
state->fixed_y_nil_stack_top.v = 0;\
|
||||
@@ -133,7 +133,7 @@ struct { UI_TextPaddingNode *top; F32 bottom_val; UI_TextPaddingNode *free; B32
|
||||
struct { UI_TextAlignmentNode *top; UI_TextAlign bottom_val; UI_TextAlignmentNode *free; B32 auto_pop; } text_alignment_stack;\
|
||||
}
|
||||
#define UI_InitStacks(state) \
|
||||
state->parent_stack.top = &state->parent_nil_stack_top; state->parent_stack.bottom_val = &ui_g_nil_box; state->parent_stack.free = 0; state->parent_stack.auto_pop = 0;\
|
||||
state->parent_stack.top = &state->parent_nil_stack_top; state->parent_stack.bottom_val = &ui_nil_box; state->parent_stack.free = 0; state->parent_stack.auto_pop = 0;\
|
||||
state->child_layout_axis_stack.top = &state->child_layout_axis_nil_stack_top; state->child_layout_axis_stack.bottom_val = Axis2_X; state->child_layout_axis_stack.free = 0; state->child_layout_axis_stack.auto_pop = 0;\
|
||||
state->fixed_x_stack.top = &state->fixed_x_nil_stack_top; state->fixed_x_stack.bottom_val = 0; state->fixed_x_stack.free = 0; state->fixed_x_stack.auto_pop = 0;\
|
||||
state->fixed_y_stack.top = &state->fixed_y_nil_stack_top; state->fixed_y_stack.bottom_val = 0; state->fixed_y_stack.free = 0; state->fixed_y_stack.auto_pop = 0;\
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
UI_StackTable:
|
||||
{
|
||||
//- rjf: parents
|
||||
{ Parent parent `UI_Box *` `&ui_g_nil_box` }
|
||||
{ Parent parent `UI_Box *` `&ui_nil_box` }
|
||||
|
||||
//- rjf: layout params
|
||||
{ ChildLayoutAxis child_layout_axis Axis2 `Axis2_X` }
|
||||
|
||||
@@ -1245,8 +1245,8 @@ ui_scroll_bar(Axis2 axis, UI_Size off_axis_size, UI_ScrollPt pt, Rng1S64 idx_ran
|
||||
UI_Signal space_before_sig = {0};
|
||||
UI_Signal space_after_sig = {0};
|
||||
UI_Signal scroller_sig = {0};
|
||||
UI_Box *scroll_area_box = &ui_g_nil_box;
|
||||
UI_Box *scroller_box = &ui_g_nil_box;
|
||||
UI_Box *scroll_area_box = &ui_nil_box;
|
||||
UI_Box *scroller_box = &ui_nil_box;
|
||||
UI_Parent(container_box)
|
||||
{
|
||||
ui_set_next_pref_size(axis, ui_pct(1, 0));
|
||||
@@ -1464,14 +1464,14 @@ ui_scroll_list_begin(UI_ScrollListParams *params, UI_ScrollPt *scroll_pt, Vec2S6
|
||||
ui_scroll_list_scroll_idx_rng = scroll_row_idx_range;
|
||||
|
||||
//- rjf: build top-level container
|
||||
UI_Box *container_box = &ui_g_nil_box;
|
||||
UI_Box *container_box = &ui_nil_box;
|
||||
UI_FixedWidth(params->dim_px.x) UI_FixedHeight(params->dim_px.y) UI_ChildLayoutAxis(Axis2_X)
|
||||
{
|
||||
container_box = ui_build_box_from_key(0, ui_key_zero());
|
||||
}
|
||||
|
||||
//- rjf: build scrollable container
|
||||
UI_Box *scrollable_container_box = &ui_g_nil_box;
|
||||
UI_Box *scrollable_container_box = &ui_nil_box;
|
||||
UI_Parent(container_box) UI_ChildLayoutAxis(Axis2_Y) UI_FixedWidth(params->dim_px.x-ui_scroll_list_scroll_bar_dim_px) UI_FixedHeight(params->dim_px.y)
|
||||
{
|
||||
scrollable_container_box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_Scroll, "###sp");
|
||||
|
||||
+16
-16
@@ -381,14 +381,14 @@ ui_scroll_pt_clamp_idx(UI_ScrollPt *v, Rng1S64 range)
|
||||
internal B32
|
||||
ui_box_is_nil(UI_Box *box)
|
||||
{
|
||||
return box == 0 || box == &ui_g_nil_box;
|
||||
return box == 0 || box == &ui_nil_box;
|
||||
}
|
||||
|
||||
internal UI_BoxRec
|
||||
ui_box_rec_df(UI_Box *box, UI_Box *root, U64 sib_member_off, U64 child_member_off)
|
||||
{
|
||||
UI_BoxRec result = {0};
|
||||
result.next = &ui_g_nil_box;
|
||||
result.next = &ui_nil_box;
|
||||
if(!ui_box_is_nil(*MemberFromOffset(UI_Box **, box, child_member_off)))
|
||||
{
|
||||
result.next = *MemberFromOffset(UI_Box **, box, child_member_off);
|
||||
@@ -765,7 +765,7 @@ internal UI_Box *
|
||||
ui_box_from_key(UI_Key key)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
UI_Box *result = &ui_g_nil_box;
|
||||
UI_Box *result = &ui_nil_box;
|
||||
if(!ui_key_match(key, ui_key_zero()))
|
||||
{
|
||||
U64 slot = key.u64[0] % ui_state->box_table_size;
|
||||
@@ -791,7 +791,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
|
||||
//- rjf: reset per-build ui state
|
||||
{
|
||||
UI_InitStacks(ui_state);
|
||||
ui_state->root = &ui_g_nil_box;
|
||||
ui_state->root = &ui_nil_box;
|
||||
ui_state->ctx_menu_touched_this_frame = 0;
|
||||
ui_state->is_animating = 0;
|
||||
ui_state->clipboard_copy_key = ui_key_zero();
|
||||
@@ -942,7 +942,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
|
||||
}
|
||||
if(last_box == box)
|
||||
{
|
||||
ui_box_list_push(scratch.arena, &next_focus_box_candidates, &ui_g_nil_box);
|
||||
ui_box_list_push(scratch.arena, &next_focus_box_candidates, &ui_nil_box);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -965,7 +965,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
|
||||
}
|
||||
}
|
||||
UI_Box *last_box = box;
|
||||
UI_Box *root_descendant = &ui_g_nil_box;
|
||||
UI_Box *root_descendant = &ui_nil_box;
|
||||
if(box == nav_root && box == search_start)
|
||||
{
|
||||
for(UI_Box *d = box->last; !ui_box_is_nil(d); d = d->last)
|
||||
@@ -974,7 +974,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
|
||||
root_descendant = d;
|
||||
}
|
||||
}
|
||||
UI_Box *prev_descendant = &ui_g_nil_box;
|
||||
UI_Box *prev_descendant = &ui_nil_box;
|
||||
for(UI_Box *d = box->prev; !ui_box_is_nil(d); d = d->last)
|
||||
{
|
||||
moved_in_axis[d->parent->child_layout_axis] += 1;
|
||||
@@ -995,7 +995,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
|
||||
}
|
||||
if(box == last_box)
|
||||
{
|
||||
ui_box_list_push(scratch.arena, &next_focus_box_candidates, &ui_g_nil_box);
|
||||
ui_box_list_push(scratch.arena, &next_focus_box_candidates, &ui_nil_box);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1179,7 +1179,7 @@ ui_end_build(void)
|
||||
if(box->last_touched_build_index < ui_state->build_index ||
|
||||
ui_key_match(box->key, ui_key_zero()))
|
||||
{
|
||||
DLLRemove_NPZ(&ui_g_nil_box, ui_state->box_table[slot_idx].hash_first, ui_state->box_table[slot_idx].hash_last, box, hash_next, hash_prev);
|
||||
DLLRemove_NPZ(&ui_nil_box, ui_state->box_table[slot_idx].hash_first, ui_state->box_table[slot_idx].hash_last, box, hash_next, hash_prev);
|
||||
SLLStackPush(ui_state->first_free_box, box);
|
||||
}
|
||||
}
|
||||
@@ -1604,7 +1604,7 @@ ui_calc_sizes_upwards_dependent__in_place_rec(UI_Box *root, Axis2 axis)
|
||||
case UI_SizeKind_ParentPct:
|
||||
{
|
||||
// rjf: find parent that has a fixed size
|
||||
UI_Box *fixed_parent = &ui_g_nil_box;
|
||||
UI_Box *fixed_parent = &ui_nil_box;
|
||||
for(UI_Box *p = root->parent; !ui_box_is_nil(p); p = p->parent)
|
||||
{
|
||||
if(p->flags & (UI_BoxFlag_FixedWidth<<axis) ||
|
||||
@@ -2182,7 +2182,7 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
//- rjf: zero key on duplicate
|
||||
if(!box_first_frame && box->last_touched_build_index == ui_state->build_index)
|
||||
{
|
||||
box = &ui_g_nil_box;
|
||||
box = &ui_nil_box;
|
||||
key = ui_key_zero();
|
||||
box_first_frame = 1;
|
||||
}
|
||||
@@ -2208,7 +2208,7 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
|
||||
//- rjf: zero out per-frame state
|
||||
{
|
||||
box->first = box->last = box->next = box->prev = box->parent = &ui_g_nil_box;
|
||||
box->first = box->last = box->next = box->prev = box->parent = &ui_nil_box;
|
||||
box->child_count = 0;
|
||||
box->flags = 0;
|
||||
box->hover_cursor = OS_Cursor_Pointer;
|
||||
@@ -2220,13 +2220,13 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
if(box_first_frame && !box_is_transient)
|
||||
{
|
||||
U64 slot = key.u64[0] % ui_state->box_table_size;
|
||||
DLLInsert_NPZ(&ui_g_nil_box, ui_state->box_table[slot].hash_first, ui_state->box_table[slot].hash_last, ui_state->box_table[slot].hash_last, box, hash_next, hash_prev);
|
||||
DLLInsert_NPZ(&ui_nil_box, ui_state->box_table[slot].hash_first, ui_state->box_table[slot].hash_last, ui_state->box_table[slot].hash_last, box, hash_next, hash_prev);
|
||||
}
|
||||
|
||||
//- rjf: hook into per-frame tree structure
|
||||
if(!ui_box_is_nil(parent))
|
||||
{
|
||||
DLLPushBack_NPZ(&ui_g_nil_box, parent->first, parent->last, box, next, prev);
|
||||
DLLPushBack_NPZ(&ui_nil_box, parent->first, parent->last, box, next, prev);
|
||||
parent->child_count += 1;
|
||||
box->parent = parent;
|
||||
}
|
||||
@@ -2337,7 +2337,7 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
internal UI_Key
|
||||
ui_active_seed_key(void)
|
||||
{
|
||||
UI_Box *keyed_ancestor = &ui_g_nil_box;
|
||||
UI_Box *keyed_ancestor = &ui_nil_box;
|
||||
{
|
||||
for(UI_Box *p = ui_top_parent(); !ui_box_is_nil(p); p = p->parent)
|
||||
{
|
||||
@@ -2923,7 +2923,7 @@ ui_signal_from_box(UI_Box *box)
|
||||
//////////////////////////////
|
||||
//- rjf: get default nav ancestor
|
||||
//
|
||||
UI_Box *default_nav_parent = &ui_g_nil_box;
|
||||
UI_Box *default_nav_parent = &ui_nil_box;
|
||||
for(UI_Box *p = ui_top_parent(); !ui_box_is_nil(p); p = p->parent)
|
||||
{
|
||||
if(p->flags & UI_BoxFlag_DefaultFocusNav)
|
||||
|
||||
+8
-8
@@ -753,15 +753,15 @@ internal void ui_scroll_pt_clamp_idx(UI_ScrollPt *v, Rng1S64 range);
|
||||
////////////////////////////////
|
||||
//~ rjf: Box Type Functions
|
||||
|
||||
read_only global UI_Box ui_g_nil_box =
|
||||
read_only global UI_Box ui_nil_box =
|
||||
{
|
||||
&ui_g_nil_box,
|
||||
&ui_g_nil_box,
|
||||
&ui_g_nil_box,
|
||||
&ui_g_nil_box,
|
||||
&ui_g_nil_box,
|
||||
&ui_g_nil_box,
|
||||
&ui_g_nil_box,
|
||||
&ui_nil_box,
|
||||
&ui_nil_box,
|
||||
&ui_nil_box,
|
||||
&ui_nil_box,
|
||||
&ui_nil_box,
|
||||
&ui_nil_box,
|
||||
&ui_nil_box,
|
||||
};
|
||||
internal B32 ui_box_is_nil(UI_Box *box);
|
||||
internal UI_BoxRec ui_box_rec_df(UI_Box *box, UI_Box *root, U64 sib_member_off, U64 child_member_off);
|
||||
|
||||
Reference in New Issue
Block a user