use meta-display-names in cell rendering, fix small command buttons

This commit is contained in:
Ryan Fleury
2025-04-19 21:23:48 -07:00
parent 657f5edb31
commit c45bd364eb
4 changed files with 42 additions and 28 deletions
+4 -10
View File
@@ -4,7 +4,7 @@
//- GENERATED CODE
C_LINKAGE_BEGIN
RD_VocabInfo rd_vocab_info_table[323] =
RD_VocabInfo rd_vocab_info_table[320] =
{
{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},
@@ -269,9 +269,6 @@ RD_VocabInfo rd_vocab_info_table[323] =
{str8_lit_comp("toggle_watch_expr"), str8_lit_comp(""), str8_lit_comp("Toggle Watch Expression"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("toggle_watch_expr_at_cursor"), str8_lit_comp(""), str8_lit_comp("Toggle Watch Expression At Cursor"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("toggle_watch_expr_at_mouse"), str8_lit_comp(""), str8_lit_comp("Toggle Watch Expression At Mouse"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("set_columns"), str8_lit_comp(""), str8_lit_comp("Set Columns"), str8_lit_comp(""), RD_IconKind_Thumbnails},
{str8_lit_comp("toggle_address_visibility"), str8_lit_comp(""), str8_lit_comp("Toggle Address Visibility"), str8_lit_comp(""), RD_IconKind_Thumbnails},
{str8_lit_comp("toggle_code_bytes_visibility"), str8_lit_comp(""), str8_lit_comp("Toggle Code Bytes Visibility"), str8_lit_comp(""), RD_IconKind_Thumbnails},
{str8_lit_comp("enable_cfg"), str8_lit_comp(""), str8_lit_comp("Enable Config Tree"), str8_lit_comp(""), RD_IconKind_CheckHollow},
{str8_lit_comp("disable_cfg"), str8_lit_comp(""), str8_lit_comp("Disable Config Tree"), str8_lit_comp(""), RD_IconKind_CheckFilled},
{str8_lit_comp("select_cfg"), str8_lit_comp(""), str8_lit_comp("Select Config Tree"), str8_lit_comp(""), RD_IconKind_RadioHollow},
@@ -335,8 +332,8 @@ RD_NameSchemaInfo rd_name_schema_info_table[20] =
{
{str8_lit_comp("settings"), str8_lit_comp("x:\n{\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n @default(1) 'background_blur': bool,\n @default(1) 'thread_lines': bool,\n @default(1) 'breakpoint_lines': bool,\n @default(1) 'thread_glow': bool,\n @default(1) 'breakpoint_glow': bool,\n @default(0) 'opaque_backgrounds': bool,\n @default(1) 'smooth_ui_text': bool,\n @default(0) 'smooth_code_text': bool,\n @default(1) 'hint_ui_text': bool,\n @default(1) 'hint_code_text': bool,\n @default(2) 'tab_width': @range[1, 32] u64,\n @default(11) 'font_size': @range[6, 72] u64,\n @default(3.f) 'row_height': @range[1.75f, 5.f] f32,\n @default(3.f) 'tab_height': @range[1.75f, 5.f] f32,\n}\n")},
{str8_lit_comp("window"), str8_lit_comp("x:\n{\n //- rjf: animations\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n\n //- rjf: thread & breakpoint decorations\n @default(1) 'thread_lines': bool,\n @default(1) 'thread_glow': bool,\n @default(1) 'breakpoint_lines': bool,\n @default(1) 'breakpoint_glow': bool,\n\n //- rjf: occluding background settings\n @default(0) 'opaque_backgrounds': bool,\n @default(1) 'background_blur': bool,\n\n //- rjf: text rasterization settings\n @default(1) 'smooth_ui_text': bool,\n @default(1) 'hint_ui_text': bool,\n @default(0) 'smooth_code_text': bool,\n @default(1) 'hint_code_text': bool,\n @default(11) @display_name('Window Font Size') 'font_size': @range[6, 72] u64,\n\n //- rjf: size settings\n @default(3.f) @display_name('Window Row Height') 'row_height': @range[1.75f, 5.f] f32,\n @default(3.f) 'tab_height': @range[1.75f, 5.f] f32,\n}\n")},
{str8_lit_comp("tab"), str8_lit_comp("x:\n{\n @default(11) @display_name('Tab Font Size') 'font_size': @range[6, 72] u64,\n @default(3.f) @display_name('Tab Row Height') 'row_height': @range[1.75f, 5.f] f32,\n}\n")},
{str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{}\n")},
{str8_lit_comp("tab"), str8_lit_comp("x:\n{\n @default(11) @display_name('Tab Font Size') 'font_size': @range[6, 72] u64,\n}\n")},
{str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @default(3.f) @display_name('Tab Row Height') 'row_height': @range[1.75f, 5.f] f32,\n}\n")},
{str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n 'lang':lang,\n 'size':code_string,\n @default(1) 'show_line_numbers':bool,\n}\n")},
{str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n 'arch': arch,\n 'syntax': dasm_syntax,\n 'size': code_string,\n @default(1) 'show_addresses': bool,\n @default(0) 'show_code_bytes': bool,\n @default(1) 'show_source_lines': bool,\n @default(1) 'show_symbol_names': bool,\n @default(1) 'show_line_numbers': bool,\n}\n")},
{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n 'size': code_string,\n @default(16) 'num_columns': @range[1, 64] u64,\n @default(1) 'bytes_per_cell': @range[1, 8] u64,\n}\n")},
@@ -400,7 +397,7 @@ Rng1U64 rd_reg_slot_range_table[41] =
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
};
RD_CmdKindInfo rd_cmd_kind_info_table[214] =
RD_CmdKindInfo rd_cmd_kind_info_table[211] =
{
{0},
{ str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}},
@@ -556,9 +553,6 @@ RD_CmdKindInfo rd_cmd_kind_info_table[214] =
{ str8_lit_comp("toggle_watch_expr"), str8_lit_comp("Adds or removes an expression to an opened watch view."), str8_lit_comp(""), str8_lit_comp("$text_pt,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("toggle_watch_expr_at_cursor"), str8_lit_comp("Adds or removes the expression that the cursor or selection is currently over to an opened watch view."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("toggle_watch_expr_at_mouse"), str8_lit_comp("Adds or removes the expression that the mouse is currently over to an opened watch view."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("set_columns"), str8_lit_comp("Sets the number of columns for a memory view."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("toggle_address_visibility"), str8_lit_comp("Toggles the visibility of addresses in a disassembly view."), str8_lit_comp(""), str8_lit_comp("$disasm,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("toggle_code_bytes_visibility"), str8_lit_comp("Toggles the visibility of machine code bytes in a disassembly view."), str8_lit_comp(""), str8_lit_comp("$disasm,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("enable_cfg"), str8_lit_comp("Enables a config tree."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("disable_cfg"), str8_lit_comp("Disables a config tree."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("select_cfg"), str8_lit_comp("Selects a config tree, disabling all others of the same kind."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
+1 -4
View File
@@ -208,9 +208,6 @@ RD_CmdKind_GoToNameAtCursor,
RD_CmdKind_ToggleWatchExpression,
RD_CmdKind_ToggleWatchExpressionAtCursor,
RD_CmdKind_ToggleWatchExpressionAtMouse,
RD_CmdKind_SetColumns,
RD_CmdKind_ToggleAddressVisibility,
RD_CmdKind_ToggleCodeBytesVisibility,
RD_CmdKind_EnableCfg,
RD_CmdKind_DisableCfg,
RD_CmdKind_SelectCfg,
@@ -640,7 +637,7 @@ RD_Query query;
.os_event = rd_regs()->os_event,\
C_LINKAGE_BEGIN
extern RD_VocabInfo rd_vocab_info_table[323];
extern RD_VocabInfo rd_vocab_info_table[320];
extern RD_NameSchemaInfo rd_name_schema_info_table[20];
extern Rng1U64 rd_reg_slot_range_table[41];
extern String8 rd_binding_version_remap_old_name_table[8];
+3 -9
View File
@@ -226,7 +226,6 @@ RD_VocabTable:
x:
{
@default(11) @display_name('Tab Font Size') 'font_size': @range[6, 72] u64,
@default(3.f) @display_name('Tab Row Height') 'row_height': @range[1.75f, 5.f] f32,
}
```
}
@@ -236,7 +235,9 @@ RD_VocabTable:
watch,
```
@inherit(tab) x:
{}
{
@default(3.f) @display_name('Tab Row Height') 'row_height': @range[1.75f, 5.f] f32,
}
```
}
{
@@ -684,13 +685,6 @@ RD_CmdTable: // | | | |
{ToggleWatchExpressionAtCursor 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Binoculars "toggle_watch_expr_at_cursor" "Toggle Watch Expression At Cursor" "Adds or removes the expression that the cursor or selection is currently over to an opened watch view." "" "" }
{ToggleWatchExpressionAtMouse 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Binoculars "toggle_watch_expr_at_mouse" "Toggle Watch Expression At Mouse" "Adds or removes the expression that the mouse is currently over to an opened watch view." "" "" }
//- rjf: memory view parameterization
{SetColumns 1 1 "" Null null Nil Null 0 0 0 0 1 1 1 Thumbnails "set_columns" "Set Columns" "Sets the number of columns for a memory view." "" "" }
//- rjf: disassembly view parameterization
{ToggleAddressVisibility 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Thumbnails "toggle_address_visibility" "Toggle Address Visibility" "Toggles the visibility of addresses in a disassembly view." "" "$disasm," }
{ToggleCodeBytesVisibility 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Thumbnails "toggle_code_bytes_visibility""Toggle Code Bytes Visibility" "Toggles the visibility of machine code bytes in a disassembly view." "" "$disasm," }
//- rjf: general config operations
{EnableCfg 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 CheckHollow "enable_cfg" "Enable Config Tree" "Enables a config tree." "" "" }
{DisableCfg 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 CheckFilled "disable_cfg" "Disable Config Tree" "Disables a config tree." "" "" }
+34 -5
View File
@@ -1499,7 +1499,24 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
//- rjf: buttons -> button for command
else if(result.cmd_name.size != 0)
{
result.fstrs = rd_title_fstrs_from_code_name(arena, result.cmd_name);
if(cell->px != 0)
{
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_color_from_name(str8_lit("text")), ui_top_font_size()};
DR_FStrList fstrs = {0};
UI_TagF("weak")
{
dr_fstrs_push_new(arena, &fstrs, &params,
rd_icon_kind_text_table[rd_icon_kind_from_code_name(result.cmd_name)],
.font = rd_font_from_slot(RD_FontSlot_Icons),
.raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons),
.color = ui_color_from_name(str8_lit("text")));
}
result.fstrs = fstrs;
}
else
{
result.fstrs = rd_title_fstrs_from_code_name(arena, result.cmd_name);
}
result.flags |= RD_WatchCellFlag_Button;
}
@@ -1517,6 +1534,22 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
B32 is_non_code = 0;
String8 expr_string = cell->string;
// rjf: if this cell has a meta-display-name, then use that
if(expr_string.size == 0)
{
for(E_Type *t = e_type_from_key__cached(cell->eval.irtree.type_key);
t != &e_type_nil;
t = e_type_from_key__cached(t->direct_type_key))
{
if(t->kind == E_TypeKind_MetaDisplayName)
{
is_non_code = 1;
expr_string = t->name;
break;
}
}
}
// rjf: if this cell has no string specified, then we need to synthesize one from the evaluation
if(expr_string.size == 0)
{
@@ -2563,10 +2596,6 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
cursor = mark = cmd->regs->vaddr;
mv->center_cursor = 1;
}break;
case RD_CmdKind_SetColumns:
{
// TODO(rjf)
}break;
}
}