mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
eliminate old watch view column state; plug in on-the-fly computed per-row cells; eliminate old table helper usage in watch window; plug in visualizers to watch window
This commit is contained in:
@@ -950,7 +950,8 @@ ev_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8
|
|||||||
{
|
{
|
||||||
range_exprs[idx] = &e_expr_nil;
|
range_exprs[idx] = &e_expr_nil;
|
||||||
}
|
}
|
||||||
if(n->v.block->lookup_rule == &e_lookup_rule__nil)
|
if(n->v.block->lookup_rule == &e_lookup_rule__nil ||
|
||||||
|
n->v.block->single_item)
|
||||||
{
|
{
|
||||||
is_root = 1;
|
is_root = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ RD_CmdKind_Null,
|
|||||||
RD_CmdKind_Null,
|
RD_CmdKind_Null,
|
||||||
};
|
};
|
||||||
|
|
||||||
RD_VocabularyInfo rd_vocabulary_info_table[57] =
|
RD_VocabularyInfo rd_vocabulary_info_table[60] =
|
||||||
{
|
{
|
||||||
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars},
|
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars},
|
||||||
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
|
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
|
||||||
@@ -87,6 +87,9 @@ RD_VocabularyInfo rd_vocabulary_info_table[57] =
|
|||||||
{str8_lit_comp("call_stack"), str8_lit_comp("call_stacks"), str8_lit_comp("Call Stack"), str8_lit_comp("Call Stacks"), RD_IconKind_Thread},
|
{str8_lit_comp("call_stack"), str8_lit_comp("call_stacks"), str8_lit_comp("Call Stack"), str8_lit_comp("Call Stacks"), RD_IconKind_Thread},
|
||||||
{str8_lit_comp("output"), str8_lit_comp("outputs"), str8_lit_comp("Output"), str8_lit_comp("Outputs"), RD_IconKind_List},
|
{str8_lit_comp("output"), str8_lit_comp("outputs"), str8_lit_comp("Output"), str8_lit_comp("Outputs"), RD_IconKind_List},
|
||||||
{str8_lit_comp("scheduler"), str8_lit_comp("schedulers"), str8_lit_comp("Scheduler"), str8_lit_comp("Schedulers"), RD_IconKind_Scheduler},
|
{str8_lit_comp("scheduler"), str8_lit_comp("schedulers"), str8_lit_comp("Scheduler"), str8_lit_comp("Schedulers"), RD_IconKind_Scheduler},
|
||||||
|
{str8_lit_comp("register"), str8_lit_comp("registers"), str8_lit_comp("Register"), str8_lit_comp("Registers"), RD_IconKind_Null},
|
||||||
|
{str8_lit_comp("local"), str8_lit_comp("locals"), str8_lit_comp("Local"), str8_lit_comp("Locals"), RD_IconKind_Null},
|
||||||
|
{str8_lit_comp("memory"), str8_lit_comp("memories"), str8_lit_comp("Memory"), str8_lit_comp("Memories"), RD_IconKind_Grid},
|
||||||
};
|
};
|
||||||
|
|
||||||
RD_NameSchemaInfo rd_name_schema_info_table[10] =
|
RD_NameSchemaInfo rd_name_schema_info_table[10] =
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ C_LINKAGE_BEGIN
|
|||||||
extern String8 rd_cfg_src_string_table[4];
|
extern String8 rd_cfg_src_string_table[4];
|
||||||
extern RD_CmdKind rd_cfg_src_load_cmd_kind_table[4];
|
extern RD_CmdKind rd_cfg_src_load_cmd_kind_table[4];
|
||||||
extern RD_CmdKind rd_cfg_src_write_cmd_kind_table[4];
|
extern RD_CmdKind rd_cfg_src_write_cmd_kind_table[4];
|
||||||
extern RD_VocabularyInfo rd_vocabulary_info_table[57];
|
extern RD_VocabularyInfo rd_vocabulary_info_table[60];
|
||||||
extern RD_NameSchemaInfo rd_name_schema_info_table[10];
|
extern RD_NameSchemaInfo rd_name_schema_info_table[10];
|
||||||
extern Rng1U64 rd_reg_slot_range_table[38];
|
extern Rng1U64 rd_reg_slot_range_table[38];
|
||||||
extern RD_StringBindingPair rd_default_binding_table[111];
|
extern RD_StringBindingPair rd_default_binding_table[111];
|
||||||
|
|||||||
@@ -108,6 +108,9 @@ RD_VocabularyMap:
|
|||||||
{call_stack _ "Call Stack" _ Thread }
|
{call_stack _ "Call Stack" _ Thread }
|
||||||
{output _ "Output" _ List }
|
{output _ "Output" _ List }
|
||||||
{scheduler _ "Scheduler" _ Scheduler }
|
{scheduler _ "Scheduler" _ Scheduler }
|
||||||
|
{register _ "Register" _ Null }
|
||||||
|
{local _ "Local" _ Null }
|
||||||
|
{memory memories "Memory" "Memories" Grid }
|
||||||
}
|
}
|
||||||
|
|
||||||
@struct RD_VocabularyInfo:
|
@struct RD_VocabularyInfo:
|
||||||
|
|||||||
+99
-119
@@ -816,24 +816,6 @@ rd_watch_cell_list_push_new_(Arena *arena, RD_WatchCellList *list, RD_WatchCell
|
|||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: index -> column
|
|
||||||
|
|
||||||
internal RD_WatchViewColumn *
|
|
||||||
rd_watch_view_column_from_x(RD_WatchViewState *wv, S64 index)
|
|
||||||
{
|
|
||||||
RD_WatchViewColumn *result = wv->first_column;
|
|
||||||
S64 idx = 0;
|
|
||||||
for(RD_WatchViewColumn *c = wv->first_column; c != 0; c = c->next, idx += 1)
|
|
||||||
{
|
|
||||||
result = c;
|
|
||||||
if(idx == index)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: watch view points <-> table coordinates
|
//- rjf: watch view points <-> table coordinates
|
||||||
|
|
||||||
internal B32
|
internal B32
|
||||||
@@ -910,6 +892,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
.group_entity = &ctrl_entity_nil,
|
.group_entity = &ctrl_entity_nil,
|
||||||
.callstack_thread = &ctrl_entity_nil,
|
.callstack_thread = &ctrl_entity_nil,
|
||||||
.view_ui_rule = &rd_nil_view_ui_rule,
|
.view_ui_rule = &rd_nil_view_ui_rule,
|
||||||
|
.view_ui_tag = &e_expr_nil,
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
@@ -967,6 +950,10 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
|
|
||||||
// rjf: determine view ui rule
|
// rjf: determine view ui rule
|
||||||
info.view_ui_rule = rd_view_ui_rule_from_string(row->block->expand_rule->string);
|
info.view_ui_rule = rd_view_ui_rule_from_string(row->block->expand_rule->string);
|
||||||
|
if(info.view_ui_rule != &rd_nil_view_ui_rule)
|
||||||
|
{
|
||||||
|
info.view_ui_tag = row->block->expand_tag;
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: fill row's cells
|
// rjf: fill row's cells
|
||||||
{
|
{
|
||||||
@@ -1119,8 +1106,12 @@ internal RD_WatchRowCellInfo
|
|||||||
rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_flags, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px)
|
rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_flags, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px)
|
||||||
{
|
{
|
||||||
RD_WatchRowCellInfo result = {0};
|
RD_WatchRowCellInfo result = {0};
|
||||||
|
result.view_ui_rule = &rd_nil_view_ui_rule;
|
||||||
|
result.view_ui_tag = &e_expr_nil;
|
||||||
switch(cell->kind)
|
switch(cell->kind)
|
||||||
{
|
{
|
||||||
|
default:{}break;
|
||||||
|
|
||||||
//- rjf: expression cells -> if no string attached to row itself, form one from the
|
//- rjf: expression cells -> if no string attached to row itself, form one from the
|
||||||
// expression tree.
|
// expression tree.
|
||||||
case RD_WatchCellKind_Expr:
|
case RD_WatchCellKind_Expr:
|
||||||
@@ -1230,6 +1221,14 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
|||||||
result.string = ev_view_rule_from_key(ev_view, row->key);
|
result.string = ev_view_rule_from_key(ev_view, row->key);
|
||||||
result.can_edit = 1;
|
result.can_edit = 1;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
//- rjf: view ui cells
|
||||||
|
case RD_WatchCellKind_ViewUI:
|
||||||
|
{
|
||||||
|
result.eval = e_eval_from_expr(arena, row->expr);
|
||||||
|
result.view_ui_rule = row_info->view_ui_rule;
|
||||||
|
result.view_ui_tag = row_info->view_ui_tag;
|
||||||
|
}break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1457,62 +1456,44 @@ rd_watch_view_text_edit_state_from_pt(RD_WatchViewState *wv, RD_WatchPt pt)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: watch view column state mutation
|
|
||||||
|
|
||||||
internal RD_WatchViewColumn *
|
|
||||||
rd_watch_view_column_alloc_(RD_WatchViewState *wv, RD_WatchViewColumnKind kind, F32 pct, RD_WatchViewColumnParams *params)
|
|
||||||
{
|
|
||||||
if(!wv->free_column)
|
|
||||||
{
|
|
||||||
RD_WatchViewColumn *col = push_array(wv->column_arena, RD_WatchViewColumn, 1);
|
|
||||||
SLLStackPush(wv->free_column, col);
|
|
||||||
}
|
|
||||||
RD_WatchViewColumn *col = wv->free_column;
|
|
||||||
SLLStackPop(wv->free_column);
|
|
||||||
DLLPushBack(wv->first_column, wv->last_column, col);
|
|
||||||
wv->column_count += 1;
|
|
||||||
col->kind = kind;
|
|
||||||
col->pct = pct;
|
|
||||||
col->string_size = Min(sizeof(col->string_buffer), params->string.size);
|
|
||||||
MemoryCopy(col->string_buffer, params->string.str, col->string_size);
|
|
||||||
col->display_string_size = Min(sizeof(col->display_string_buffer), params->display_string.size);
|
|
||||||
MemoryCopy(col->display_string_buffer, params->display_string.str, col->display_string_size);
|
|
||||||
col->view_rule_size = Min(sizeof(col->view_rule_buffer), params->view_rule.size);
|
|
||||||
MemoryCopy(col->view_rule_buffer, params->view_rule.str, col->view_rule_size);
|
|
||||||
col->is_non_code = params->is_non_code;
|
|
||||||
col->dequote_string = params->dequote_string;
|
|
||||||
col->rangify_braces = params->rangify_braces;
|
|
||||||
return col;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
rd_watch_view_column_release(RD_WatchViewState *wv, RD_WatchViewColumn *col)
|
|
||||||
{
|
|
||||||
DLLRemove(wv->first_column, wv->last_column, col);
|
|
||||||
SLLStackPush(wv->free_column, col);
|
|
||||||
wv->column_count -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: watch view main hooks
|
//- rjf: watch view main hooks
|
||||||
|
|
||||||
internal void
|
|
||||||
rd_watch_view_init(RD_WatchViewState *ewv)
|
|
||||||
{
|
|
||||||
if(ewv->initialized == 0)
|
|
||||||
{
|
|
||||||
ewv->initialized = 1;
|
|
||||||
ewv->column_arena = rd_push_view_arena();
|
|
||||||
ewv->text_edit_arena = rd_push_view_arena();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||||
{
|
{
|
||||||
ProfBeginFunction();
|
ProfBeginFunction();
|
||||||
|
|
||||||
|
ProfEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: null @view_hook_impl
|
||||||
|
|
||||||
|
RD_VIEW_UI_FUNCTION_DEF(null) {}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: watch @view_hook_impl
|
||||||
|
|
||||||
|
EV_EXPAND_RULE_INFO_FUNCTION_DEF(watch)
|
||||||
|
{
|
||||||
|
EV_ExpandInfo info = {0};
|
||||||
|
info.row_count = 8;
|
||||||
|
info.single_item = 1;
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
RD_VIEW_UI_FUNCTION_DEF(watch)
|
||||||
|
{
|
||||||
|
ProfBeginFunction();
|
||||||
|
RD_WatchViewState *ewv = rd_view_state(RD_WatchViewState);
|
||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
UI_ScrollPt2 scroll_pos = rd_view_scroll_pos();
|
UI_ScrollPt2 scroll_pos = rd_view_scroll_pos();
|
||||||
F32 entity_hover_t_rate = rd_setting_b32_from_name(str8_lit("hover_animations")) ? (1 - pow_f32(2, (-20.f * rd_state->frame_dt))) : 1.f;
|
F32 entity_hover_t_rate = rd_setting_b32_from_name(str8_lit("hover_animations")) ? (1 - pow_f32(2, (-20.f * rd_state->frame_dt))) : 1.f;
|
||||||
|
if(ewv->initialized == 0)
|
||||||
|
{
|
||||||
|
ewv->initialized = 1;
|
||||||
|
ewv->text_edit_arena = rd_push_view_arena();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: unpack arguments
|
//- rjf: unpack arguments
|
||||||
@@ -2390,22 +2371,14 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
B32 pressed = 0;
|
B32 pressed = 0;
|
||||||
ProfScope("build ui")
|
ProfScope("build ui")
|
||||||
{
|
{
|
||||||
F32 **col_pcts = push_array(scratch.arena, F32*, ewv->column_count);
|
|
||||||
{
|
|
||||||
S64 x = 0;
|
|
||||||
for(RD_WatchViewColumn *c = ewv->first_column; c != 0; c = c->next, x += 1)
|
|
||||||
{
|
|
||||||
col_pcts[x] = &c->pct;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Rng1S64 visible_row_rng = {0};
|
Rng1S64 visible_row_rng = {0};
|
||||||
UI_ScrollListParams scroll_list_params = {0};
|
UI_ScrollListParams scroll_list_params = {0};
|
||||||
{
|
{
|
||||||
scroll_list_params.flags = UI_ScrollListFlag_All;
|
scroll_list_params.flags = UI_ScrollListFlag_All;
|
||||||
scroll_list_params.row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
scroll_list_params.row_height_px = row_height_px;
|
||||||
scroll_list_params.dim_px = dim_2f32(rect);
|
scroll_list_params.dim_px = dim_2f32(rect);
|
||||||
scroll_list_params.cursor_range = r2s64(v2s64(0, 0), v2s64(ewv->column_count-1, block_tree.total_item_count));
|
scroll_list_params.cursor_range = r2s64(v2s64(0, 0), v2s64(0, 0));
|
||||||
scroll_list_params.item_range = r1s64(0, block_tree.total_row_count);
|
scroll_list_params.item_range = r1s64(0, block_tree.total_row_count - !!implicit_root);
|
||||||
scroll_list_params.cursor_min_is_empty_selection[Axis2_Y] = 1;
|
scroll_list_params.cursor_min_is_empty_selection[Axis2_Y] = 1;
|
||||||
scroll_list_params.row_blocks = row_blocks;
|
scroll_list_params.row_blocks = row_blocks;
|
||||||
}
|
}
|
||||||
@@ -2422,7 +2395,11 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
&visible_row_rng,
|
&visible_row_rng,
|
||||||
&scroll_list_sig)
|
&scroll_list_sig)
|
||||||
UI_Focus(UI_FocusKind_Null)
|
UI_Focus(UI_FocusKind_Null)
|
||||||
UI_TableF(ewv->column_count, col_pcts, "table")
|
{
|
||||||
|
ui_set_next_pref_height(ui_children_sum(1));
|
||||||
|
ui_set_next_child_layout_axis(Axis2_Y);
|
||||||
|
UI_Box *table = ui_build_box_from_string(0, str8_lit("table"));
|
||||||
|
UI_Parent(table)
|
||||||
{
|
{
|
||||||
Vec2F32 scroll_list_view_off_px = ui_top_parent()->parent->view_off;
|
Vec2F32 scroll_list_view_off_px = ui_top_parent()->parent->view_off;
|
||||||
|
|
||||||
@@ -2529,11 +2506,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
ui_set_next_palette(palette);
|
ui_set_next_palette(palette);
|
||||||
ui_set_next_flags(disabled_flags);
|
ui_set_next_flags(disabled_flags);
|
||||||
ui_set_next_pref_width(ui_pct(1, 0));
|
ui_set_next_pref_width(ui_pct(1, 0));
|
||||||
ui_set_next_pref_height(ui_px(scroll_list_params.row_height_px*row->visual_size, 1.f));
|
ui_set_next_pref_height(ui_px(row_height_px*row->visual_size, 1.f));
|
||||||
ui_set_next_focus_hot(row_selected ? UI_FocusKind_On : UI_FocusKind_Off);
|
ui_set_next_focus_hot(row_selected ? UI_FocusKind_On : UI_FocusKind_Off);
|
||||||
UI_Box *row_box = ui_build_box_from_stringf(row_flags|(!row_node->next)*UI_BoxFlag_DrawSideBottom|UI_BoxFlag_Clickable, "row_%I64x", row_hash);
|
UI_Box *row_box = ui_build_box_from_stringf(row_flags|(!row_node->next)*UI_BoxFlag_DrawSideBottom|UI_BoxFlag_Clickable, "row_%I64x", row_hash);
|
||||||
ui_ts_vector_idx += 1;
|
|
||||||
ui_ts_cell_idx = 0;
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
//- rjf: build row contents
|
//- rjf: build row contents
|
||||||
@@ -2543,6 +2518,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
////////////////////
|
////////////////////
|
||||||
//- rjf: draw start of cache lines in expansions
|
//- rjf: draw start of cache lines in expansions
|
||||||
//
|
//
|
||||||
|
if(row_info.view_ui_rule == &rd_nil_view_ui_rule)
|
||||||
{
|
{
|
||||||
U64 row_offset = row_info.eval.value.u64;
|
U64 row_offset = row_info.eval.value.u64;
|
||||||
if((row_info.eval.mode == E_Mode_Offset || row_info.eval.mode == E_Mode_Null) &&
|
if((row_info.eval.mode == E_Mode_Offset || row_info.eval.mode == E_Mode_Null) &&
|
||||||
@@ -2559,6 +2535,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
////////////////////
|
////////////////////
|
||||||
//- rjf: draw mid-row cache line boundaries in expansions
|
//- rjf: draw mid-row cache line boundaries in expansions
|
||||||
//
|
//
|
||||||
|
if(row_info.view_ui_rule == &rd_nil_view_ui_rule)
|
||||||
{
|
{
|
||||||
if((row_info.eval.mode == E_Mode_Offset || row_info.eval.mode == E_Mode_Null) &&
|
if((row_info.eval.mode == E_Mode_Offset || row_info.eval.mode == E_Mode_Null) &&
|
||||||
row_info.eval.value.u64%64 != 0 &&
|
row_info.eval.value.u64%64 != 0 &&
|
||||||
@@ -2569,7 +2546,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
if(next_off%64 != 0 && row_info.eval.value.u64/64 < next_off/64)
|
if(next_off%64 != 0 && row_info.eval.value.u64/64 < next_off/64)
|
||||||
{
|
{
|
||||||
ui_set_next_fixed_x(0);
|
ui_set_next_fixed_x(0);
|
||||||
ui_set_next_fixed_y(scroll_list_params.row_height_px - ui_top_font_size()*0.5f);
|
ui_set_next_fixed_y(row_height_px - ui_top_font_size()*0.5f);
|
||||||
ui_set_next_fixed_height(ui_top_font_size()*1.f);
|
ui_set_next_fixed_height(ui_top_font_size()*1.f);
|
||||||
Vec4F32 boundary_color = rd_rgba_from_theme_color(RD_ThemeColor_CacheLineBoundary);
|
Vec4F32 boundary_color = rd_rgba_from_theme_color(RD_ThemeColor_CacheLineBoundary);
|
||||||
boundary_color.w *= 0.5f;
|
boundary_color.w *= 0.5f;
|
||||||
@@ -2611,11 +2588,18 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
ProfEnd();
|
ProfEnd();
|
||||||
|
|
||||||
|
//- rjf: build cell
|
||||||
|
UI_Box *cell_box = &ui_nil_box;
|
||||||
|
UI_Palette(palette)
|
||||||
|
{
|
||||||
|
ui_set_next_fixed_height(row->visual_size * row_height_px);
|
||||||
|
cell_box = ui_build_box_from_stringf(UI_BoxFlag_DrawSideLeft, "cell_%I64x_%I64x", row_hash, cell_id);
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: build cell
|
//- rjf: build cell
|
||||||
UI_Signal sig = {0};
|
UI_Signal sig = {0};
|
||||||
ProfScope("build cell")
|
ProfScope("build cell")
|
||||||
UI_Palette(palette)
|
UI_Parent(cell_box)
|
||||||
UI_TableCell
|
|
||||||
UI_FocusHot(cell_selected ? UI_FocusKind_On : UI_FocusKind_Off)
|
UI_FocusHot(cell_selected ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||||
UI_FocusActive((cell_selected && ewv->text_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
|
UI_FocusActive((cell_selected && ewv->text_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||||
RD_Font(RD_FontSlot_Code)
|
RD_Font(RD_FontSlot_Code)
|
||||||
@@ -2635,13 +2619,40 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: cell has hook? -> build ui by calling hook
|
// rjf: cell has hook? -> build ui by calling hook
|
||||||
else if(cell_info.ui != 0)
|
else if(cell_info.view_ui_rule != &rd_nil_view_ui_rule)
|
||||||
{
|
{
|
||||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###val_%I64x", row_hash);
|
Rng2F32 cell_rect = r2f32p(cell_x_px, 0, cell_x_px + cell->pct*(dim_2f32(rect).x - floor_f32(ui_top_font_size()*1.5f)), row_height_px*(row_node->visual_size_skipped + row->visual_size + row_node->visual_size_chopped));
|
||||||
|
ui_set_next_fixed_y(-1.f * (row_node->visual_size_skipped) * row_height_px);
|
||||||
|
ui_set_next_fixed_height((row_node->visual_size_skipped + row->visual_size + row_node->visual_size_chopped) * row_height_px);
|
||||||
|
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable|UI_BoxFlag_FloatingY, "###val_%I64x", row_hash);
|
||||||
UI_Parent(box)
|
UI_Parent(box)
|
||||||
{
|
{
|
||||||
String8 row_expr = e_string_from_expr(scratch.arena, row->expr);
|
RD_Cfg *root = rd_immediate_cfg_from_keyf("view_%I64x_%I64x", rd_regs()->view, row_hash);
|
||||||
cell_info.ui(row_expr, cell_info.ui_params, r2f32p(cell_x_px, 0, cell_x_px + cell->pct*dim_2f32(rect).x, row_height_px));
|
RD_Cfg *view = rd_cfg_child_from_string_or_alloc(root, cell_info.view_ui_rule->name);
|
||||||
|
RD_Cfg *expr = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression"));
|
||||||
|
rd_cfg_new(expr, e_string_from_expr(scratch.arena, cell_info.eval.expr));
|
||||||
|
rd_cfg_new(view, str8_lit("selected"));
|
||||||
|
RD_RegsScope(.panel = 0, .view = view->id)
|
||||||
|
UI_PermissionFlags(UI_PermissionFlag_Clicks|UI_PermissionFlag_ScrollX)
|
||||||
|
{
|
||||||
|
// rjf: loading animation container
|
||||||
|
UI_Box *loading_overlay_container = &ui_nil_box;
|
||||||
|
UI_Parent(box) UI_WidthFill UI_HeightFill
|
||||||
|
{
|
||||||
|
loading_overlay_container = ui_build_box_from_key(UI_BoxFlag_FloatingX|UI_BoxFlag_FloatingY, ui_key_zero());
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: view ui contents
|
||||||
|
cell_info.view_ui_rule->ui(cell_info.eval, cell_info.view_ui_tag, cell_rect);
|
||||||
|
|
||||||
|
// rjf: loading fill
|
||||||
|
UI_Parent(loading_overlay_container)
|
||||||
|
{
|
||||||
|
RD_ViewState *vs = rd_view_state_from_cfg(view);
|
||||||
|
rd_loading_overlay(cell_rect, vs->loading_t, vs->loading_progress_v, vs->loading_progress_v_target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
sig = ui_signal_from_box(box);
|
sig = ui_signal_from_box(box);
|
||||||
}
|
}
|
||||||
@@ -3986,6 +3997,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: general table-wide press logic
|
//- rjf: general table-wide press logic
|
||||||
@@ -4000,38 +4012,6 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
|||||||
ProfEnd();
|
ProfEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ rjf: null @view_hook_impl
|
|
||||||
|
|
||||||
RD_VIEW_UI_FUNCTION_DEF(null) {}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ rjf: watch @view_hook_impl
|
|
||||||
|
|
||||||
EV_EXPAND_RULE_INFO_FUNCTION_DEF(watch)
|
|
||||||
{
|
|
||||||
EV_ExpandInfo info = {0};
|
|
||||||
info.row_count = 8;
|
|
||||||
info.single_item = 1;
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
RD_VIEW_UI_FUNCTION_DEF(watch)
|
|
||||||
{
|
|
||||||
ProfBeginFunction();
|
|
||||||
RD_WatchViewState *wv = rd_view_state(RD_WatchViewState);
|
|
||||||
if(!wv->initialized)
|
|
||||||
{
|
|
||||||
rd_watch_view_init(wv);
|
|
||||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
|
|
||||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.3f);
|
|
||||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Type, 0.15f);
|
|
||||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.30f);
|
|
||||||
}
|
|
||||||
rd_watch_view_build(wv, rect);
|
|
||||||
ProfEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: text @view_hook_impl
|
//~ rjf: text @view_hook_impl
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ struct RD_WatchRowInfo
|
|||||||
U64 callstack_inline_depth;
|
U64 callstack_inline_depth;
|
||||||
RD_WatchCellList cells;
|
RD_WatchCellList cells;
|
||||||
RD_ViewUIRule *view_ui_rule;
|
RD_ViewUIRule *view_ui_rule;
|
||||||
|
E_Expr *view_ui_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct RD_WatchRowCellInfo RD_WatchRowCellInfo;
|
typedef struct RD_WatchRowCellInfo RD_WatchRowCellInfo;
|
||||||
@@ -91,8 +92,8 @@ struct RD_WatchRowCellInfo
|
|||||||
B32 is_errored;
|
B32 is_errored;
|
||||||
String8 error_tooltip;
|
String8 error_tooltip;
|
||||||
String8 inheritance_tooltip;
|
String8 inheritance_tooltip;
|
||||||
RD_ViewRuleUIFunctionType *ui;
|
RD_ViewUIRule *view_ui_rule;
|
||||||
MD_Node *ui_params;
|
E_Expr *view_ui_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum RD_WatchViewColumnKind
|
typedef enum RD_WatchViewColumnKind
|
||||||
@@ -164,13 +165,6 @@ struct RD_WatchViewState
|
|||||||
{
|
{
|
||||||
B32 initialized;
|
B32 initialized;
|
||||||
|
|
||||||
// rjf: column state
|
|
||||||
Arena *column_arena;
|
|
||||||
RD_WatchViewColumn *first_column;
|
|
||||||
RD_WatchViewColumn *last_column;
|
|
||||||
RD_WatchViewColumn *free_column;
|
|
||||||
U64 column_count;
|
|
||||||
|
|
||||||
// rjf; table cursor state
|
// rjf; table cursor state
|
||||||
RD_WatchPt cursor;
|
RD_WatchPt cursor;
|
||||||
RD_WatchPt mark;
|
RD_WatchPt mark;
|
||||||
@@ -200,9 +194,6 @@ internal RD_WatchCell *rd_watch_cell_list_push(Arena *arena, RD_WatchCellList *l
|
|||||||
internal RD_WatchCell *rd_watch_cell_list_push_new_(Arena *arena, RD_WatchCellList *list, RD_WatchCell *params);
|
internal RD_WatchCell *rd_watch_cell_list_push_new_(Arena *arena, RD_WatchCellList *list, RD_WatchCell *params);
|
||||||
#define rd_watch_cell_list_push_new(arena, list, kind_, ...) rd_watch_cell_list_push_new_((arena), (list), &(RD_WatchCell){.kind = (kind_), __VA_ARGS__})
|
#define rd_watch_cell_list_push_new(arena, list, kind_, ...) rd_watch_cell_list_push_new_((arena), (list), &(RD_WatchCell){.kind = (kind_), __VA_ARGS__})
|
||||||
|
|
||||||
//- rjf: index -> column
|
|
||||||
internal RD_WatchViewColumn *rd_watch_view_column_from_x(RD_WatchViewState *wv, S64 index);
|
|
||||||
|
|
||||||
//- rjf: watch view points <-> table coordinates
|
//- rjf: watch view points <-> table coordinates
|
||||||
internal B32 rd_watch_pt_match(RD_WatchPt a, RD_WatchPt b);
|
internal B32 rd_watch_pt_match(RD_WatchPt a, RD_WatchPt b);
|
||||||
internal RD_WatchPt rd_watch_pt_from_tbl(EV_BlockRangeList *block_ranges, Vec2S64 tbl);
|
internal RD_WatchPt rd_watch_pt_from_tbl(EV_BlockRangeList *block_ranges, Vec2S64 tbl);
|
||||||
@@ -228,15 +219,6 @@ internal String8 rd_string_from_eval_viz_row_column(Arena *arena, EV_Row *row, R
|
|||||||
//- rjf: table coordinates -> text edit state
|
//- rjf: table coordinates -> text edit state
|
||||||
internal RD_WatchViewTextEditState *rd_watch_view_text_edit_state_from_pt(RD_WatchViewState *wv, RD_WatchPt pt);
|
internal RD_WatchViewTextEditState *rd_watch_view_text_edit_state_from_pt(RD_WatchViewState *wv, RD_WatchPt pt);
|
||||||
|
|
||||||
//- rjf: watch view column state mutation
|
|
||||||
internal RD_WatchViewColumn *rd_watch_view_column_alloc_(RD_WatchViewState *wv, RD_WatchViewColumnKind kind, F32 pct, RD_WatchViewColumnParams *params);
|
|
||||||
#define rd_watch_view_column_alloc(wv, kind, pct, ...) rd_watch_view_column_alloc_((wv), (kind), (pct), &(RD_WatchViewColumnParams){.string = str8_zero(), __VA_ARGS__})
|
|
||||||
internal void rd_watch_view_column_release(RD_WatchViewState *wv, RD_WatchViewColumn *col);
|
|
||||||
|
|
||||||
//- rjf: watch view main hooks
|
|
||||||
internal void rd_watch_view_init(RD_WatchViewState *ewv);
|
|
||||||
internal void rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect);
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: View Hooks
|
//~ rjf: View Hooks
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user