re-add special-case watch cell style for call stack frame selection

This commit is contained in:
Ryan Fleury
2025-02-12 17:50:18 -08:00
parent 374317abd7
commit 4dfa4a120f
2 changed files with 21 additions and 1 deletions
+20 -1
View File
@@ -1065,8 +1065,9 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
RD_Cfg *w_cfg = style->first;
F32 next_pct = 0;
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_CallStackFrame, .default_pct = 0.05f, .pct = take_pct());
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .default_pct = 0.65f, .pct = take_pct());
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .string = str8_lit("(U64)($expr) => hex"), .default_pct = 0.35f, .pct = take_pct());
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .string = str8_lit("(U64)($expr) => hex"), .default_pct = 0.30f, .pct = take_pct());
#undef take_pct
}
@@ -3010,6 +3011,24 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
sig = ui_signal_from_box(box);
}
// rjf: cell is call stack frame? -> build arrow if this is the selected frame, otherwise leave empty
else if(cell->kind == RD_WatchCellKind_CallStackFrame)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clickable, "###%I64x_%I64x", cell_id, row_hash);
sig = ui_signal_from_box(box);
if(row_info->callstack_unwind_index == rd_regs()->unwind_count &&
row_info->callstack_inline_depth == rd_regs()->inline_depth)
{
UI_Parent(box) UI_Flags(0) UI_TextAlignment(UI_TextAlign_Center)
{
RD_Font(RD_FontSlot_Icons)
UI_Flags(UI_BoxFlag_DisableTextTrunc)
UI_Palette(ui_build_palette(ui_top_palette(), .text = rd_rgba_from_ctrl_entity(row_info->callstack_thread)))
ui_label(rd_icon_kind_text_table[RD_IconKind_RightArrow]);
}
}
}
// rjf: build cell line edit
else RD_Font(cell_info.is_non_code ? RD_FontSlot_Main : RD_FontSlot_Code)
{
+1
View File
@@ -48,6 +48,7 @@ typedef enum RD_WatchCellKind
RD_WatchCellKind_Eval, // an evaluation of the expression, with some optional modification - e.g. `$expr.some_member`, or `typeof($expr)`
RD_WatchCellKind_ViewUI, // an arbitrary user interface, supplied by a hook
RD_WatchCellKind_Button, // a fancy button dedicated to the entire row's evaluation, used for listers/etc.
RD_WatchCellKind_CallStackFrame, // a slot for a yellow arrow, to show call stack frame selection
}
RD_WatchCellKind;