rich hover for thread-hover editors

This commit is contained in:
Ryan Fleury
2025-02-14 09:43:19 -08:00
parent c5de847fa5
commit ecb4e0d282
7 changed files with 35 additions and 9 deletions
+7
View File
@@ -151,6 +151,13 @@ ctrl_handle_list_copy(Arena *arena, CTRL_HandleList *src)
return dst; return dst;
} }
internal String8
ctrl_string_from_handle(Arena *arena, CTRL_Handle handle)
{
String8 result = push_str8f(arena, "$%I64x_%I64x", handle.machine_id, handle.dmn_handle.u64[0]);
return result;
}
//////////////////////////////// ////////////////////////////////
//~ rjf: Trap Type Functions //~ rjf: Trap Type Functions
+1
View File
@@ -726,6 +726,7 @@ internal CTRL_Handle ctrl_handle_make(CTRL_MachineID machine_id, DMN_Handle dmn_
internal B32 ctrl_handle_match(CTRL_Handle a, CTRL_Handle b); internal B32 ctrl_handle_match(CTRL_Handle a, CTRL_Handle b);
internal void ctrl_handle_list_push(Arena *arena, CTRL_HandleList *list, CTRL_Handle *pair); internal void ctrl_handle_list_push(Arena *arena, CTRL_HandleList *list, CTRL_Handle *pair);
internal CTRL_HandleList ctrl_handle_list_copy(Arena *arena, CTRL_HandleList *src); internal CTRL_HandleList ctrl_handle_list_copy(Arena *arena, CTRL_HandleList *src);
internal String8 ctrl_string_from_handle(Arena *arena, CTRL_Handle handle);
//////////////////////////////// ////////////////////////////////
//~ rjf: Trap Type Functions //~ rjf: Trap Type Functions
+1 -1
View File
@@ -867,7 +867,7 @@ rgba_from_u32_lit_comp(0xffffffff),
rgba_from_u32_lit_comp(0x0000007f), rgba_from_u32_lit_comp(0x0000007f),
rgba_from_u32_lit_comp(0x0000003f), rgba_from_u32_lit_comp(0x0000003f),
rgba_from_u32_lit_comp(0xffffff0c), rgba_from_u32_lit_comp(0xffffff0c),
rgba_from_u32_lit_comp(0x0000003f), rgba_from_u32_lit_comp(0x0000002f),
rgba_from_u32_lit_comp(0x99ccff4c), rgba_from_u32_lit_comp(0x99ccff4c),
rgba_from_u32_lit_comp(0xffffff1e), rgba_from_u32_lit_comp(0xffffff1e),
rgba_from_u32_lit_comp(0x5f12005f), rgba_from_u32_lit_comp(0x5f12005f),
+1 -1
View File
@@ -1010,7 +1010,7 @@ RD_ThemeColorTable:
{DropShadow "Drop Shadow" drop_shadow 0x0000007f 0x0000004c 0x0000007f 0xa3a3a37e 0x0000007f 0xc9bfa394 0x0000007f 0x0000007f 0x0000007f ""} {DropShadow "Drop Shadow" drop_shadow 0x0000007f 0x0000004c 0x0000007f 0xa3a3a37e 0x0000007f 0xc9bfa394 0x0000007f 0x0000007f 0x0000007f ""}
{DisabledOverlay "Disabled Overlay" disabled_overlay 0x0000003f 0xa6a6a63f 0x0000003f 0x0000003f 0x0000003f 0xe4dac090 0x0000003f 0x0000003f 0x0000003f ""} {DisabledOverlay "Disabled Overlay" disabled_overlay 0x0000003f 0xa6a6a63f 0x0000003f 0x0000003f 0x0000003f 0xe4dac090 0x0000003f 0x0000003f 0x0000003f ""}
{DropSiteOverlay "Drop Site Overlay" drop_site_overlay 0xffffff0c 0x4848480c 0xffffff0c 0x0000000c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c ""} {DropSiteOverlay "Drop Site Overlay" drop_site_overlay 0xffffff0c 0x4848480c 0xffffff0c 0x0000000c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c ""}
{InactivePanelOverlay "Inactive Panel Overlay" inactive_panel_overlay 0x0000003f 0xa4a4a43f 0x0000003f 0xfefefe53 0x0000003f 0x0000001c 0x0000003f 0x0000003f 0x0000003f ""} {InactivePanelOverlay "Inactive Panel Overlay" inactive_panel_overlay 0x0000002f 0xa4a4a43f 0x0000003f 0xfefefe53 0x0000003f 0x0000001c 0x0000003f 0x0000003f 0x0000003f ""}
{SelectionOverlay "Selection Overlay" selection_overlay 0x99ccff4c 0x003d7a48 0x99ccff4c 0x3d74ab4b 0x99ccff4c 0x678cb24c 0x99ccff4c 0x99ccff4c 0x99ccff4c ""} {SelectionOverlay "Selection Overlay" selection_overlay 0x99ccff4c 0x003d7a48 0x99ccff4c 0x3d74ab4b 0x99ccff4c 0x678cb24c 0x99ccff4c 0x99ccff4c 0x99ccff4c ""}
{HighlightOverlay "Highlight Overlay" highlight_overlay 0xffffff1e 0xffffff1e 0xffffff1e 0x0000001e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e ""} {HighlightOverlay "Highlight Overlay" highlight_overlay 0xffffff1e 0xffffff1e 0xffffff1e 0x0000001e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e ""}
{HighlightOverlayError "Error Highlight Overlay" error_highlight_overlay 0x5f12005f 0xff30005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f ""} {HighlightOverlayError "Error Highlight Overlay" error_highlight_overlay 0x5f12005f 0xff30005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f ""}
+1
View File
@@ -12589,6 +12589,7 @@ rd_frame(void)
expr->space = space; expr->space = space;
expr->mode = E_Mode_Offset; expr->mode = E_Mode_Offset;
expr->type_key = type_key; expr->type_key = type_key;
e_string2expr_map_insert(scratch.arena, ctx->macro_map, ctrl_string_from_handle(scratch.arena, entity->handle), expr);
if(entity->string.size != 0) if(entity->string.size != 0)
{ {
e_string2expr_map_insert(scratch.arena, ctx->macro_map, entity->string, expr); e_string2expr_map_insert(scratch.arena, ctx->macro_map, entity->string, expr);
+22 -6
View File
@@ -995,10 +995,13 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
// but does not evaluate them, from e.g. "targets", which uses the group of target // but does not evaluate them, from e.g. "targets", which uses the group of target
// cfgs, and the evaluations are of the targets themselves. // cfgs, and the evaluations are of the targets themselves.
// //
B32 row_eval_matches_group = 0; B32 row_cfg_eval_matches_group = 0;
RD_Cfg *evalled_cfg = rd_cfg_from_eval_space(info.eval.space); RD_Cfg *evalled_cfg = rd_cfg_from_eval_space(info.eval.space);
B32 row_entity_eval_matches_group = 0;
CTRL_Entity *evalled_entity = (info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity ? rd_ctrl_entity_from_eval_space(info.eval.space) : &ctrl_entity_nil);
{ {
row_eval_matches_group = (evalled_cfg == info.group_cfg_child); row_cfg_eval_matches_group = (evalled_cfg == info.group_cfg_child);
row_entity_eval_matches_group = (evalled_entity == info.group_entity);
} }
// rjf: determine view ui rule // rjf: determine view ui rule
@@ -1013,7 +1016,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
if(0){} if(0){}
// rjf: cfg rows // rjf: cfg rows
else if((info.eval.space.kind == RD_EvalSpaceKind_MetaCfg && row_eval_matches_group && info.group_cfg_parent == &rd_nil_cfg) || else if((info.eval.space.kind == RD_EvalSpaceKind_MetaCfg && row_cfg_eval_matches_group && info.group_cfg_parent == &rd_nil_cfg) ||
(row->block->parent == &ev_nil_block && evalled_cfg != &rd_nil_cfg)) (row->block->parent == &ev_nil_block && evalled_cfg != &rd_nil_cfg))
{ {
RD_Cfg *cfg = evalled_cfg; RD_Cfg *cfg = evalled_cfg;
@@ -1052,16 +1055,18 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
} }
// rjf: entity rows // rjf: entity rows
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity && info.group_entity != &ctrl_entity_nil) else if((info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity && row_entity_eval_matches_group && info.group_entity != &ctrl_entity_nil) ||
(row->block->parent == &ev_nil_block && evalled_entity != &ctrl_entity_nil))
{ {
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)); CTRL_Entity *entity = evalled_entity;
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));
} }
// rjf: singular button for commands // rjf: singular button for commands
else if((block_eval.space.kind == RD_EvalSpaceKind_MetaCmdCollection || else if((block_eval.space.kind == RD_EvalSpaceKind_MetaCmdCollection ||
block_eval.space.kind == RD_EvalSpaceKind_MetaCfgCollection) && block_eval.space.kind == RD_EvalSpaceKind_MetaCfgCollection) &&
info.eval.space.kind == RD_EvalSpaceKind_MetaCmd && info.eval.space.kind == RD_EvalSpaceKind_MetaCmd &&
row_eval_matches_group) row_cfg_eval_matches_group)
{ {
RD_CmdKind cmd_kind = e_value_eval_from_eval(info.eval).value.u64; RD_CmdKind cmd_kind = e_value_eval_from_eval(info.eval).value.u64;
RD_CmdKindInfo *cmd_kind_info = &rd_cmd_kind_info_table[cmd_kind]; RD_CmdKindInfo *cmd_kind_info = &rd_cmd_kind_info_table[cmd_kind];
@@ -2944,6 +2949,17 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
{ {
RD_RegsScope(.cfg = cell_info.cfg->id) rd_drag_begin(RD_RegSlot_Cfg); RD_RegsScope(.cfg = cell_info.cfg->id) rd_drag_begin(RD_RegSlot_Cfg);
} }
else if(cell_info.entity != &ctrl_entity_nil)
{
RD_RegsScope(.ctrl_entity = cell_info.entity->handle) switch(cell_info.entity->kind)
{
default:{rd_drag_begin(RD_RegSlot_CtrlEntity);}break;
case CTRL_EntityKind_Machine:{RD_RegsScope(.machine = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Machine);}break;
case CTRL_EntityKind_Process:{RD_RegsScope(.process = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Process);}break;
case CTRL_EntityKind_Module:{RD_RegsScope(.module = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Module);}break;
case CTRL_EntityKind_Thread:{RD_RegsScope(.thread = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Thread);}break;
}
}
} }
// rjf: (normally) single-click -> move selection here // rjf: (normally) single-click -> move selection here
+2 -1
View File
@@ -792,7 +792,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: interactions // rjf: interactions
if(ui_hovering(thread_sig) && !rd_drag_is_active()) if(ui_hovering(thread_sig) && !rd_drag_is_active())
{ {
RD_RegsScope(.thread = thread->handle) rd_set_hover_regs(RD_RegSlot_Thread); 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));
RD_RegsScope(.ctrl_entity = thread->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
} }
if(ui_right_clicked(thread_sig)) if(ui_right_clicked(thread_sig))
{ {