Skip to content

Commit ecb4e0d

Browse files
committed
rich hover for thread-hover editors
1 parent c5de847 commit ecb4e0d

File tree

7 files changed

+35
-9
lines changed

7 files changed

+35
-9
lines changed

src/ctrl/ctrl_core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ ctrl_handle_list_copy(Arena *arena, CTRL_HandleList *src)
151151
return dst;
152152
}
153153

154+
internal String8
155+
ctrl_string_from_handle(Arena *arena, CTRL_Handle handle)
156+
{
157+
String8 result = push_str8f(arena, "$%I64x_%I64x", handle.machine_id, handle.dmn_handle.u64[0]);
158+
return result;
159+
}
160+
154161
////////////////////////////////
155162
//~ rjf: Trap Type Functions
156163

src/ctrl/ctrl_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ internal CTRL_Handle ctrl_handle_make(CTRL_MachineID machine_id, DMN_Handle dmn_
726726
internal B32 ctrl_handle_match(CTRL_Handle a, CTRL_Handle b);
727727
internal void ctrl_handle_list_push(Arena *arena, CTRL_HandleList *list, CTRL_Handle *pair);
728728
internal CTRL_HandleList ctrl_handle_list_copy(Arena *arena, CTRL_HandleList *src);
729+
internal String8 ctrl_string_from_handle(Arena *arena, CTRL_Handle handle);
729730

730731
////////////////////////////////
731732
//~ rjf: Trap Type Functions

src/raddbg/generated/raddbg.meta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ rgba_from_u32_lit_comp(0xffffffff),
867867
rgba_from_u32_lit_comp(0x0000007f),
868868
rgba_from_u32_lit_comp(0x0000003f),
869869
rgba_from_u32_lit_comp(0xffffff0c),
870-
rgba_from_u32_lit_comp(0x0000003f),
870+
rgba_from_u32_lit_comp(0x0000002f),
871871
rgba_from_u32_lit_comp(0x99ccff4c),
872872
rgba_from_u32_lit_comp(0xffffff1e),
873873
rgba_from_u32_lit_comp(0x5f12005f),

src/raddbg/raddbg.mdesk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ RD_ThemeColorTable:
10101010
{DropShadow "Drop Shadow" drop_shadow 0x0000007f 0x0000004c 0x0000007f 0xa3a3a37e 0x0000007f 0xc9bfa394 0x0000007f 0x0000007f 0x0000007f ""}
10111011
{DisabledOverlay "Disabled Overlay" disabled_overlay 0x0000003f 0xa6a6a63f 0x0000003f 0x0000003f 0x0000003f 0xe4dac090 0x0000003f 0x0000003f 0x0000003f ""}
10121012
{DropSiteOverlay "Drop Site Overlay" drop_site_overlay 0xffffff0c 0x4848480c 0xffffff0c 0x0000000c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c ""}
1013-
{InactivePanelOverlay "Inactive Panel Overlay" inactive_panel_overlay 0x0000003f 0xa4a4a43f 0x0000003f 0xfefefe53 0x0000003f 0x0000001c 0x0000003f 0x0000003f 0x0000003f ""}
1013+
{InactivePanelOverlay "Inactive Panel Overlay" inactive_panel_overlay 0x0000002f 0xa4a4a43f 0x0000003f 0xfefefe53 0x0000003f 0x0000001c 0x0000003f 0x0000003f 0x0000003f ""}
10141014
{SelectionOverlay "Selection Overlay" selection_overlay 0x99ccff4c 0x003d7a48 0x99ccff4c 0x3d74ab4b 0x99ccff4c 0x678cb24c 0x99ccff4c 0x99ccff4c 0x99ccff4c ""}
10151015
{HighlightOverlay "Highlight Overlay" highlight_overlay 0xffffff1e 0xffffff1e 0xffffff1e 0x0000001e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e ""}
10161016
{HighlightOverlayError "Error Highlight Overlay" error_highlight_overlay 0x5f12005f 0xff30005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f ""}

src/raddbg/raddbg_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12589,6 +12589,7 @@ rd_frame(void)
1258912589
expr->space = space;
1259012590
expr->mode = E_Mode_Offset;
1259112591
expr->type_key = type_key;
12592+
e_string2expr_map_insert(scratch.arena, ctx->macro_map, ctrl_string_from_handle(scratch.arena, entity->handle), expr);
1259212593
if(entity->string.size != 0)
1259312594
{
1259412595
e_string2expr_map_insert(scratch.arena, ctx->macro_map, entity->string, expr);

src/raddbg/raddbg_views.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -995,10 +995,13 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
995995
// but does not evaluate them, from e.g. "targets", which uses the group of target
996996
// cfgs, and the evaluations are of the targets themselves.
997997
//
998-
B32 row_eval_matches_group = 0;
998+
B32 row_cfg_eval_matches_group = 0;
999999
RD_Cfg *evalled_cfg = rd_cfg_from_eval_space(info.eval.space);
1000+
B32 row_entity_eval_matches_group = 0;
1001+
CTRL_Entity *evalled_entity = (info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity ? rd_ctrl_entity_from_eval_space(info.eval.space) : &ctrl_entity_nil);
10001002
{
1001-
row_eval_matches_group = (evalled_cfg == info.group_cfg_child);
1003+
row_cfg_eval_matches_group = (evalled_cfg == info.group_cfg_child);
1004+
row_entity_eval_matches_group = (evalled_entity == info.group_entity);
10021005
}
10031006

10041007
// rjf: determine view ui rule
@@ -1013,7 +1016,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
10131016
if(0){}
10141017

10151018
// rjf: cfg rows
1016-
else if((info.eval.space.kind == RD_EvalSpaceKind_MetaCfg && row_eval_matches_group && info.group_cfg_parent == &rd_nil_cfg) ||
1019+
else if((info.eval.space.kind == RD_EvalSpaceKind_MetaCfg && row_cfg_eval_matches_group && info.group_cfg_parent == &rd_nil_cfg) ||
10171020
(row->block->parent == &ev_nil_block && evalled_cfg != &rd_nil_cfg))
10181021
{
10191022
RD_Cfg *cfg = evalled_cfg;
@@ -1052,16 +1055,18 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
10521055
}
10531056

10541057
// rjf: entity rows
1055-
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity && info.group_entity != &ctrl_entity_nil)
1058+
else if((info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity && row_entity_eval_matches_group && info.group_entity != &ctrl_entity_nil) ||
1059+
(row->block->parent == &ev_nil_block && evalled_entity != &ctrl_entity_nil))
10561060
{
1057-
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button, .pct = 1.f, .fstrs = rd_title_fstrs_from_ctrl_entity(arena, info.group_entity, ui_top_palette()->text_weak, ui_top_font_size(), 1));
1061+
CTRL_Entity *entity = evalled_entity;
1062+
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button, .pct = 1.f, .fstrs = rd_title_fstrs_from_ctrl_entity(arena, entity, ui_top_palette()->text_weak, ui_top_font_size(), 1));
10581063
}
10591064

10601065
// rjf: singular button for commands
10611066
else if((block_eval.space.kind == RD_EvalSpaceKind_MetaCmdCollection ||
10621067
block_eval.space.kind == RD_EvalSpaceKind_MetaCfgCollection) &&
10631068
info.eval.space.kind == RD_EvalSpaceKind_MetaCmd &&
1064-
row_eval_matches_group)
1069+
row_cfg_eval_matches_group)
10651070
{
10661071
RD_CmdKind cmd_kind = e_value_eval_from_eval(info.eval).value.u64;
10671072
RD_CmdKindInfo *cmd_kind_info = &rd_cmd_kind_info_table[cmd_kind];
@@ -2944,6 +2949,17 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
29442949
{
29452950
RD_RegsScope(.cfg = cell_info.cfg->id) rd_drag_begin(RD_RegSlot_Cfg);
29462951
}
2952+
else if(cell_info.entity != &ctrl_entity_nil)
2953+
{
2954+
RD_RegsScope(.ctrl_entity = cell_info.entity->handle) switch(cell_info.entity->kind)
2955+
{
2956+
default:{rd_drag_begin(RD_RegSlot_CtrlEntity);}break;
2957+
case CTRL_EntityKind_Machine:{RD_RegsScope(.machine = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Machine);}break;
2958+
case CTRL_EntityKind_Process:{RD_RegsScope(.process = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Process);}break;
2959+
case CTRL_EntityKind_Module:{RD_RegsScope(.module = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Module);}break;
2960+
case CTRL_EntityKind_Thread:{RD_RegsScope(.thread = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Thread);}break;
2961+
}
2962+
}
29472963
}
29482964

29492965
// rjf: (normally) single-click -> move selection here

src/raddbg/raddbg_widgets.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
792792
// rjf: interactions
793793
if(ui_hovering(thread_sig) && !rd_drag_is_active())
794794
{
795-
RD_RegsScope(.thread = thread->handle) rd_set_hover_regs(RD_RegSlot_Thread);
795+
rd_set_hover_eval(v2f32(thread_box->rect.x0, thread_box->rect.y1-2.f), str8_zero(), txt_pt(0, 0), 0, ctrl_string_from_handle(scratch.arena, thread->handle));
796+
RD_RegsScope(.ctrl_entity = thread->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
796797
}
797798
if(ui_right_clicked(thread_sig))
798799
{

0 commit comments

Comments
 (0)