ctrl entity rich hovering

This commit is contained in:
Ryan Fleury
2025-02-14 09:19:25 -08:00
parent 35ba41f712
commit c5de847fa5
5 changed files with 44 additions and 7 deletions
+6 -1
View File
@@ -4,7 +4,7 @@
//- GENERATED CODE
C_LINKAGE_BEGIN
RD_VocabInfo rd_vocab_info_table[277] =
RD_VocabInfo rd_vocab_info_table[282] =
{
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars},
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
@@ -17,6 +17,11 @@ RD_VocabInfo rd_vocab_info_table[277] =
{str8_lit_comp("target"), str8_lit_comp("targets"), str8_lit_comp("Target"), str8_lit_comp("Targets"), RD_IconKind_Target},
{str8_lit_comp("executable"), str8_lit_comp("executables"), str8_lit_comp("Executable"), str8_lit_comp("Executables"), RD_IconKind_Module},
{str8_lit_comp("arguments"), str8_lit_comp("arguments"), str8_lit_comp("Arguments"), str8_lit_comp("Arguments"), RD_IconKind_Null},
{str8_lit_comp("exe"), str8_lit_comp("exes"), str8_lit_comp("Executable"), str8_lit_comp("Executables"), RD_IconKind_Module},
{str8_lit_comp("dbg"), str8_lit_comp("dbgs"), str8_lit_comp("Debug Info Path"), str8_lit_comp("Debug Info Paths"), RD_IconKind_Module},
{str8_lit_comp("vaddr_range"), str8_lit_comp("vaddr_ranges"), str8_lit_comp("Virtual Address Range"), str8_lit_comp("Virtual Address Ranges"), RD_IconKind_Null},
{str8_lit_comp("min"), str8_lit_comp("mins"), str8_lit_comp("Minimum"), str8_lit_comp("Minimums"), RD_IconKind_Null},
{str8_lit_comp("max"), str8_lit_comp("maxs"), str8_lit_comp("Maximum"), str8_lit_comp("Maximums"), RD_IconKind_Null},
{str8_lit_comp("working_directory"), str8_lit_comp("working_directories"), str8_lit_comp("Working Directory"), str8_lit_comp("Working Directories"), RD_IconKind_FolderClosedFilled},
{str8_lit_comp("entry_point"), str8_lit_comp("entry_points"), str8_lit_comp("Entry Point"), str8_lit_comp("Entry Points"), RD_IconKind_Null},
{str8_lit_comp("stdout_path"), str8_lit_comp("stdout_paths"), str8_lit_comp("Standard Output Path"), str8_lit_comp("Standard Output Paths"), RD_IconKind_Null},
+1 -1
View File
@@ -554,7 +554,7 @@ RD_Query query;
.os_event = rd_regs()->os_event,\
C_LINKAGE_BEGIN
extern RD_VocabInfo rd_vocab_info_table[277];
extern RD_VocabInfo rd_vocab_info_table[282];
extern RD_NameSchemaInfo rd_name_schema_info_table[10];
extern Rng1U64 rd_reg_slot_range_table[38];
extern String8 rd_binding_version_remap_old_name_table[8];
+5
View File
@@ -29,6 +29,11 @@ RD_VocabTable:
{target _ "Target" _ Target }
{executable _ "Executable" _ Module }
{arguments arguments "Arguments" "Arguments" Null }
{exe exes "Executable" _ Module }
{dbg dbgs "Debug Info Path" _ Module }
{vaddr_range _ "Virtual Address Range" _ Null }
{min _ "Minimum" _ Null }
{max _ "Maximum" _ Null }
{working_directory working_directories "Working Directory" "Working Directories" FolderClosedFilled }
{entry_point _ "Entry Point" _ Null }
{stdout_path _ "Standard Output Path" _ Null }
+27
View File
@@ -2767,10 +2767,31 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
{
rgba = rd_rgba_from_theme_color(RD_ThemeColor_HighlightOverlay);
}
else
{
rgba.w *= 0.2f;
}
rgba.w *= ui_anim(ui_key_from_stringf(ui_key_zero(), "###cfg_hover_t_%p", cfg), 1.f, .rate = entity_hover_t_rate);
palette = ui_build_palette(ui_top_palette(), .overlay = rgba);
cell_flags |= UI_BoxFlag_DrawOverlay;
}
else if(ctrl_handle_match(cell_info.entity->handle, rd_get_hover_regs()->ctrl_entity) &&
rd_state->hover_regs_slot == RD_RegSlot_CtrlEntity)
{
CTRL_Entity *entity = cell_info.entity;
Vec4F32 rgba = rd_rgba_from_ctrl_entity(entity);
if(rgba.w == 0)
{
rgba = rd_rgba_from_theme_color(RD_ThemeColor_HighlightOverlay);
}
else
{
rgba.w *= 0.2f;
}
rgba.w *= ui_anim(ui_key_from_stringf(ui_key_zero(), "###entity_hover_t_%p", entity), 1.f, .rate = entity_hover_t_rate);
palette = ui_build_palette(ui_top_palette(), .overlay = rgba);
cell_flags |= UI_BoxFlag_DrawOverlay;
}
}
ProfEnd();
@@ -2910,6 +2931,12 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
RD_RegsScope(.cfg = cell_info.cfg->id) 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);
}
// rjf: dragging -> drag/drop
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()))
{
+5 -5
View File
@@ -751,8 +751,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: custom draw
{
RD_Regs *hover_regs = rd_get_hover_regs();
B32 is_hovering = (ctrl_handle_match(hover_regs->thread, thread->handle) &&
rd_state->hover_regs_slot == RD_RegSlot_Thread);
B32 is_hovering = (ctrl_handle_match(hover_regs->ctrl_entity, thread->handle) &&
rd_state->hover_regs_slot == RD_RegSlot_CtrlEntity);
RD_ThreadBoxDrawExtData *u = push_array(ui_build_arena(), RD_ThreadBoxDrawExtData, 1);
u->thread_color = color;
u->alive_t = ui_anim(ui_key_from_stringf(top_container_box->key, "###entity_alive_t_%p", thread), 1.f, .rate = entity_alive_t_rate);
@@ -899,8 +899,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: custom draw
{
RD_Regs *hover_regs = rd_get_hover_regs();
B32 is_hovering = (ctrl_handle_match(hover_regs->thread, thread->handle) &&
rd_state->hover_regs_slot == RD_RegSlot_Thread);
B32 is_hovering = (ctrl_handle_match(hover_regs->ctrl_entity, thread->handle) &&
rd_state->hover_regs_slot == RD_RegSlot_CtrlEntity);
RD_ThreadBoxDrawExtData *u = push_array(ui_build_arena(), RD_ThreadBoxDrawExtData, 1);
u->thread_color = color;
u->alive_t = ui_anim(ui_key_from_stringf(top_container_box->key, "###entity_alive_t_%p", thread), 1.f, .rate = entity_alive_t_rate);
@@ -938,7 +938,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
// rjf: interactions
if(ui_hovering(thread_sig) && !rd_drag_is_active())
{
RD_RegsScope(.thread = thread->handle) rd_set_hover_regs(RD_RegSlot_Thread);
RD_RegsScope(.ctrl_entity = thread->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
}
if(ui_right_clicked(thread_sig))
{