mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-18 01:52:22 -07:00
begin sketching out watch row button cells, for intermixing fancy buttons for cfgs/entities/etc. with regular watch rows
This commit is contained in:
@@ -1287,6 +1287,7 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
|
||||
if(target.exe.size != 0)
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), running_size, running_rgba, target.exe);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, secondary_color, str8_lit(" "));
|
||||
start_secondary();
|
||||
}
|
||||
|
||||
@@ -1294,6 +1295,7 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
|
||||
if(target.args.size != 0)
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), secondary_size, secondary_rgba, target.args);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, secondary_color, str8_lit(" "));
|
||||
}
|
||||
|
||||
//- rjf: push conditions
|
||||
@@ -1302,6 +1304,7 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
|
||||
if(condition.size != 0)
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), secondary_size, secondary_rgba, condition);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, secondary_color, str8_lit(" "));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1309,6 +1312,7 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
|
||||
if(is_disabled)
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), secondary_size, secondary_rgba, str8_lit("(Disabled)"));
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, secondary_color, str8_lit(" "));
|
||||
}
|
||||
|
||||
//- rjf: push hit count
|
||||
|
||||
@@ -958,6 +958,17 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
info.group_cfg_child = rd_cfg_from_id(id);
|
||||
}
|
||||
|
||||
// rjf: determine if the row's evaluation matches the group configuration
|
||||
// this distinguishes between e.g. "watches", which uses the group of watch cfgs,
|
||||
// but does not evaluate them, from e.g. "targets", which uses the group of target
|
||||
// cfgs, and the evaluations are of the targets themselves.
|
||||
//
|
||||
B32 row_eval_matches_group = 0;
|
||||
{
|
||||
RD_Cfg *evalled_cfg = rd_cfg_from_eval_space(info.eval.space);
|
||||
row_eval_matches_group = (evalled_cfg == info.group_cfg_child);
|
||||
}
|
||||
|
||||
// rjf: determine view ui rule
|
||||
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)
|
||||
@@ -967,14 +978,25 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
|
||||
// rjf: fill row's cells
|
||||
{
|
||||
#if 0
|
||||
// rjf: singular cell for cfgs
|
||||
if(info.group_cfg != &rd_nil_cfg)
|
||||
if(0){}
|
||||
|
||||
// rjf: singular button for top-level cfgs
|
||||
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaCfg && row_eval_matches_group && info.group_cfg_parent == &rd_nil_cfg)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Button, .pct = 1.f, .fancy_strings = rd_title_fstrs_from_cfg(arena, info.group_cfg_child, ui_top_palette()->text_weak, ui_top_font_size()));
|
||||
}
|
||||
|
||||
// rjf: singular button for entities
|
||||
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity && info.group_entity != &ctrl_entity_nil)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Button, .pct = 1.f);
|
||||
}
|
||||
|
||||
// rjf: singular button for commands
|
||||
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaCmd)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Button, .pct = 1.f);
|
||||
}
|
||||
#endif
|
||||
if(0){}
|
||||
|
||||
// rjf: singular cell for view ui
|
||||
else if(info.view_ui_rule != &rd_nil_view_ui_rule)
|
||||
@@ -1127,6 +1149,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
RD_WatchRowCellInfo result = {0};
|
||||
result.view_ui_rule = &rd_nil_view_ui_rule;
|
||||
result.view_ui_tag = &e_expr_nil;
|
||||
result.fancy_strings = cell->fancy_strings;
|
||||
switch(cell->kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -1248,6 +1271,12 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
result.view_ui_rule = row_info->view_ui_rule;
|
||||
result.view_ui_tag = row_info->view_ui_tag;
|
||||
}break;
|
||||
|
||||
//- rjf: button cells
|
||||
case RD_WatchCellKind_Button:
|
||||
{
|
||||
result.is_button = 1;
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -2104,6 +2133,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
|
||||
{
|
||||
default:{}break;
|
||||
case RD_WatchCellKind_Expr:
|
||||
case RD_WatchCellKind_Button:
|
||||
{
|
||||
RD_Cfg *cfg = row_info.group_cfg_child;
|
||||
if(cfg != &rd_nil_cfg)
|
||||
@@ -2695,10 +2725,12 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
|
||||
RD_LineEditParams line_edit_params = {0};
|
||||
{
|
||||
line_edit_params.flags = (RD_LineEditFlag_CodeContents|
|
||||
RD_LineEditFlag_NoBackground|
|
||||
RD_LineEditFlag_NoBackground*!(cell_info.is_button)|
|
||||
RD_LineEditFlag_Border*!!(cell_info.is_button)|
|
||||
RD_LineEditFlag_Button*!!(cell_info.is_button)|
|
||||
RD_LineEditFlag_KeyboardClickable|
|
||||
RD_LineEditFlag_Expander*!!(cell_x == 0 && row_is_expandable && cell == row_info.cells.first)|
|
||||
RD_LineEditFlag_ExpanderPlaceholder*(cell_x == 0 && row_depth==0 && cell == row_info.cells.first)|
|
||||
RD_LineEditFlag_ExpanderPlaceholder*(cell_x == 0 && row_depth==0 && cell == row_info.cells.first && !cell_info.is_button)|
|
||||
RD_LineEditFlag_ExpanderSpace*(cell_x == 0 && row_depth!=0 && cell == row_info.cells.first));
|
||||
line_edit_params.depth = (cell_x == 0 ? row_depth : 0);
|
||||
line_edit_params.cursor = &cell_edit_state->cursor;
|
||||
@@ -2708,6 +2740,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
|
||||
line_edit_params.edit_string_size_out = &cell_edit_state->input_size;
|
||||
line_edit_params.expanded_out = &next_row_expanded;
|
||||
line_edit_params.pre_edit_value = cell_info.string;
|
||||
line_edit_params.fancy_strings = cell_info.fancy_strings;
|
||||
}
|
||||
sig = rd_line_editf(&line_edit_params, "%S###%I64x_row_%I64x", str8_zero(), cell_x, row_hash);
|
||||
#if 0 // TODO(rjf): @cfg
|
||||
|
||||
@@ -57,6 +57,7 @@ struct RD_WatchCell
|
||||
RD_WatchCell *next;
|
||||
RD_WatchCellKind kind;
|
||||
String8 string;
|
||||
DR_FancyStringList fancy_strings;
|
||||
F32 pct;
|
||||
};
|
||||
|
||||
@@ -90,6 +91,8 @@ struct RD_WatchRowCellInfo
|
||||
{
|
||||
E_Eval eval;
|
||||
String8 string;
|
||||
DR_FancyStringList fancy_strings;
|
||||
B32 is_button;
|
||||
B32 can_edit;
|
||||
B32 is_errored;
|
||||
String8 error_tooltip;
|
||||
|
||||
@@ -2449,10 +2449,15 @@ rd_line_edit(RD_LineEditParams *params, String8 string)
|
||||
{
|
||||
ui_set_next_hover_cursor(OS_Cursor_IBar);
|
||||
}
|
||||
if(params->flags & RD_LineEditFlag_Button)
|
||||
{
|
||||
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
|
||||
}
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_MouseClickable|
|
||||
(!!(params->flags & RD_LineEditFlag_KeyboardClickable)*UI_BoxFlag_KeyboardClickable)|
|
||||
UI_BoxFlag_ClickToFocus|
|
||||
UI_BoxFlag_DrawHotEffects|
|
||||
//(!!(params->flags & RD_LineEditFlag_Button)*UI_BoxFlag_DrawActiveEffects)|
|
||||
(!(params->flags & RD_LineEditFlag_NoBackground)*UI_BoxFlag_DrawBackground)|
|
||||
(!!(params->flags & RD_LineEditFlag_Border)*UI_BoxFlag_DrawBorder)|
|
||||
((is_auto_focus_hot || is_auto_focus_active)*UI_BoxFlag_KeyboardClickable)|
|
||||
@@ -2645,7 +2650,12 @@ rd_line_edit(RD_LineEditParams *params, String8 string)
|
||||
F32 cursor_off = 0;
|
||||
UI_Parent(scrollable_box)
|
||||
{
|
||||
if(!is_focus_active && !is_focus_active_disabled && params->flags & RD_LineEditFlag_CodeContents)
|
||||
if(!is_focus_active && !is_focus_active_disabled && params->fancy_strings.total_size != 0)
|
||||
{
|
||||
UI_Box *label = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(label, ¶ms->fancy_strings);
|
||||
}
|
||||
else if(!is_focus_active && !is_focus_active_disabled && params->flags & RD_LineEditFlag_CodeContents)
|
||||
{
|
||||
String8 display_string = ui_display_part_from_key_string(string);
|
||||
if(!(params->flags & RD_LineEditFlag_PreferDisplayString) && params->pre_edit_value.size != 0)
|
||||
|
||||
@@ -18,8 +18,9 @@ enum
|
||||
RD_LineEditFlag_KeyboardClickable = (1<<5),
|
||||
RD_LineEditFlag_Border = (1<<6),
|
||||
RD_LineEditFlag_NoBackground = (1<<7),
|
||||
RD_LineEditFlag_PreferDisplayString = (1<<8),
|
||||
RD_LineEditFlag_DisplayStringIsCode = (1<<9),
|
||||
RD_LineEditFlag_Button = (1<<8),
|
||||
RD_LineEditFlag_PreferDisplayString = (1<<9),
|
||||
RD_LineEditFlag_DisplayStringIsCode = (1<<10),
|
||||
};
|
||||
|
||||
typedef struct RD_LineEditParams RD_LineEditParams;
|
||||
|
||||
@@ -1264,7 +1264,7 @@ ui_scroll_bar(Axis2 axis, UI_Size off_axis_size, UI_ScrollPt pt, Rng1S64 idx_ran
|
||||
}
|
||||
|
||||
// rjf: scroller
|
||||
UI_Flags(disabled_flags) UI_PrefSize(axis, ui_pct(Clamp(0.01f, (F32)((F64)Max(view_num_indices, 1)/(F64)idx_range_dim), 1.f), 0.f))
|
||||
UI_Flags(disabled_flags) UI_PrefSize(axis, ui_pct(Clamp(0.05f, (F32)((F64)Max(view_num_indices, 1)/(F64)idx_range_dim), 1.f), 0.f))
|
||||
{
|
||||
scroller_sig = ui_buttonf("##_scroller_%i", axis);
|
||||
scroller_box = scroller_sig.box;
|
||||
|
||||
Reference in New Issue
Block a user