further work on rich hover vs. hover eval vs. ctx menu arrangements; it's a bit too noisy/annoying when hover eval for breakpoints/threads/etc. is just turned on all the time, and now that we have the ability to hover-eval-style query views, because of tabs, we can just do that with breakpoints etc. too. the old rich hover tooltips / highlights / etc. can then just be used normally. also put in some mechanisms to block rich hover tooltips when it is strictly redundant information.

This commit is contained in:
Ryan Fleury
2025-03-20 15:01:40 -07:00
parent 43d8fd4886
commit e2bfecc384
6 changed files with 48 additions and 13 deletions
@@ -1117,6 +1117,7 @@ internal B32
ev_row_is_expandable(EV_Row *row)
{
B32 result = 0;
if(!ev_key_match(ev_key_root(), row->block->key))
{
Temp scratch = scratch_begin(0, 0);
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, row->expr);
+2 -1
View File
@@ -331,7 +331,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[16] =
{str8_lit_comp("thread"), str8_lit_comp("x:{'label':code_string, 'id':u64, 'frozen':bool, 'call_stack':query}")},
};
Rng1U64 rd_reg_slot_range_table[40] =
Rng1U64 rd_reg_slot_range_table[41] =
{
{0},
{OffsetOf(RD_Regs, machine), OffsetOf(RD_Regs, machine) + sizeof(CTRL_Handle)},
@@ -368,6 +368,7 @@ Rng1U64 rd_reg_slot_range_table[40] =
{OffsetOf(RD_Regs, pid), OffsetOf(RD_Regs, pid) + sizeof(U32)},
{OffsetOf(RD_Regs, force_confirm), OffsetOf(RD_Regs, force_confirm) + sizeof(B32)},
{OffsetOf(RD_Regs, prefer_disasm), OffsetOf(RD_Regs, prefer_disasm) + sizeof(B32)},
{OffsetOf(RD_Regs, no_rich_tooltip), OffsetOf(RD_Regs, no_rich_tooltip) + sizeof(B32)},
{OffsetOf(RD_Regs, dir2), OffsetOf(RD_Regs, dir2) + sizeof(Dir2)},
{OffsetOf(RD_Regs, string), OffsetOf(RD_Regs, string) + sizeof(String8)},
{OffsetOf(RD_Regs, cmd_name), OffsetOf(RD_Regs, cmd_name) + sizeof(String8)},
+4 -1
View File
@@ -43,6 +43,7 @@ RD_RegSlot_RegSlot,
RD_RegSlot_PID,
RD_RegSlot_ForceConfirm,
RD_RegSlot_PreferDisasm,
RD_RegSlot_NoRichTooltip,
RD_RegSlot_Dir2,
RD_RegSlot_String,
RD_RegSlot_CmdName,
@@ -564,6 +565,7 @@ RD_RegSlot reg_slot;
U32 pid;
B32 force_confirm;
B32 prefer_disasm;
B32 no_rich_tooltip;
Dir2 dir2;
String8 string;
String8 cmd_name;
@@ -627,6 +629,7 @@ RD_Query query;
.pid = rd_regs()->pid,\
.force_confirm = rd_regs()->force_confirm,\
.prefer_disasm = rd_regs()->prefer_disasm,\
.no_rich_tooltip = rd_regs()->no_rich_tooltip,\
.dir2 = rd_regs()->dir2,\
.string = rd_regs()->string,\
.cmd_name = rd_regs()->cmd_name,\
@@ -636,7 +639,7 @@ RD_Query query;
C_LINKAGE_BEGIN
extern RD_VocabInfo rd_vocab_info_table[303];
extern RD_NameSchemaInfo rd_name_schema_info_table[16];
extern Rng1U64 rd_reg_slot_range_table[40];
extern Rng1U64 rd_reg_slot_range_table[41];
extern String8 rd_binding_version_remap_old_name_table[8];
extern String8 rd_binding_version_remap_new_name_table[8];
extern String8 rd_icon_kind_text_table[69];
+1
View File
@@ -369,6 +369,7 @@ RD_RegTable:
{U32 pid PID }
{B32 force_confirm ForceConfirm }
{B32 prefer_disasm PreferDisasm }
{B32 no_rich_tooltip NoRichTooltip }
{Dir2 dir2 Dir2 }
{String8 string String }
{String8 cmd_name CmdName }
+8 -7
View File
@@ -2136,7 +2136,8 @@ rd_color_from_cfg(RD_Cfg *cfg)
internal B32
rd_disabled_from_cfg(RD_Cfg *cfg)
{
B32 is_disabled = (rd_cfg_child_from_string(cfg, str8_lit("disabled")) != &rd_nil_cfg);
String8 disabled_value_string = rd_cfg_child_from_string(cfg, str8_lit("disabled"))->first->string;
B32 is_disabled = (disabled_value_string.size != 0 && !str8_match(disabled_value_string, str8_lit("0"), 0));
return is_disabled;
}
@@ -5409,13 +5410,13 @@ rd_view_ui(Rng2F32 rect)
// rjf: hover -> rich hover cfgs
if(ui_hovering(sig) && cell_info.cfg != &rd_nil_cfg)
{
RD_RegsScope(.cfg = cell_info.cfg->id) rd_set_hover_regs(RD_RegSlot_Cfg);
RD_RegsScope(.cfg = cell_info.cfg->id, .no_rich_tooltip = 1) rd_set_hover_regs(RD_RegSlot_Cfg);
}
// rjf: hover -> rich hover entities
if(ui_hovering(sig) && cell_info.entity != &ctrl_entity_nil)
{
RD_RegsScope(.ctrl_entity = cell_info.entity->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
RD_RegsScope(.ctrl_entity = cell_info.entity->handle, .no_rich_tooltip = 1) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
}
// rjf: dragging -> drag/drop
@@ -6546,9 +6547,9 @@ rd_window_frame(void)
}
////////////////////////////
//- rjf: @window_ui_part drag/drop tooltips
//- rjf: @window_ui_part rich hover / drag/drop tooltips
//
if(rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active())
if((rd_state->hover_regs_slot != RD_RegSlot_Null && !rd_state->hover_regs->no_rich_tooltip) || (rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()))
{
Temp scratch = scratch_begin(0, 0);
RD_RegSlot slot = ((rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()) ? rd_state->drag_drop_regs_slot : rd_state->hover_regs_slot);
@@ -8261,7 +8262,7 @@ rd_window_frame(void)
}
// rjf: based on query expression, determine if we have an explicit root
if(0 && (query_expr.size == 0 || !query_is_lister))
if(query_expr.size == 0 || !query_is_lister)
{
RD_Cfg *explicit_root = rd_cfg_child_from_string_or_alloc(view, str8_lit("explicit_root"));
rd_cfg_new(explicit_root, str8_lit("1"));
@@ -8287,7 +8288,7 @@ rd_window_frame(void)
F32 query_height_px = max_query_height_px;
if(size_query_by_expr_eval)
{
query_height_px = row_height_px * (predicted_block_tree.total_row_count-1);
query_height_px = row_height_px * predicted_block_tree.total_row_count;
query_height_px = Min(query_height_px, max_query_height_px);
}
rect = r2f32p(content_rect_center.x - query_width_px/2,
+32 -4
View File
@@ -1388,9 +1388,15 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: interactions
if(ui_hovering(thread_sig) && !rd_drag_is_active())
{
rd_set_hover_eval(v2f32(thread_box->rect.x0, thread_box->rect.y1-2.f), ctrl_string_from_handle(scratch.arena, thread->handle), str8_zero());
RD_RegsScope(.ctrl_entity = thread->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
}
if(ui_right_clicked(thread_sig))
{
rd_cmd(RD_CmdKind_PushQuery,
.ui_key = thread_box->key,
.off_px = v2f32(0, dim_2f32(thread_box->rect).y),
.expr = ctrl_string_from_handle(scratch.arena, thread->handle));
}
if(ui_dragging(thread_sig) && !contains_2f32(thread_box->rect, ui_mouse()))
{
RD_RegsScope(.thread = thread->handle) rd_drag_begin(RD_RegSlot_Thread);
@@ -1536,9 +1542,15 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: interactions
if(ui_hovering(thread_sig) && !rd_drag_is_active())
{
rd_set_hover_eval(v2f32(thread_box->rect.x0, thread_box->rect.y1-2.f), ctrl_string_from_handle(scratch.arena, thread->handle), str8_zero());
RD_RegsScope(.ctrl_entity = thread->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
}
if(ui_right_clicked(thread_sig))
{
rd_cmd(RD_CmdKind_PushQuery,
.ui_key = thread_box->key,
.off_px = v2f32(0, dim_2f32(thread_box->rect).y),
.expr = ctrl_string_from_handle(scratch.arena, thread->handle));
}
if(ui_dragging(thread_sig) && !contains_2f32(thread_box->rect, ui_mouse()))
{
RD_RegsScope(.thread = thread->handle) rd_drag_begin(RD_RegSlot_Thread);
@@ -1611,10 +1623,18 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: bp hovering
if(ui_hovering(bp_sig) && !rd_drag_is_active())
{
rd_set_hover_eval(v2f32(bp_box->rect.x0, bp_box->rect.y1-2.f), push_str8f(scratch.arena, "$%I64x", bp->id), str8_zero());
RD_RegsScope(.cfg = bp->id) rd_set_hover_regs(RD_RegSlot_Cfg);
}
// rjf: bp right-click => open query
if(ui_right_clicked(bp_sig))
{
rd_cmd(RD_CmdKind_PushQuery,
.ui_key = bp_box->key,
.off_px = v2f32(0, dim_2f32(bp_box->rect).y),
.expr = push_str8f(scratch.arena, "$%I64x", bp->id));
}
// rjf: shift+click => enable breakpoint
if(ui_clicked(bp_sig) && bp_sig.event_flags & OS_Modifier_Shift)
{
@@ -1662,10 +1682,18 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: watch hovering
if(ui_hovering(pin_sig) && !rd_drag_is_active())
{
rd_set_hover_eval(v2f32(pin_box->rect.x0, pin_box->rect.y1-2.f), push_str8f(scratch.arena, "$%I64x", pin->id), str8_zero());
RD_RegsScope(.cfg = pin->id) rd_set_hover_regs(RD_RegSlot_Cfg);
}
// rjf: pin right-click => open query
if(ui_right_clicked(pin_sig))
{
rd_cmd(RD_CmdKind_PushQuery,
.ui_key = pin_box->key,
.off_px = v2f32(0, dim_2f32(pin_box->rect).y),
.expr = push_str8f(scratch.arena, "$%I64x", pin->id));
}
// rjf: click => remove pin
if(ui_clicked(pin_sig))
{