mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
basic entity right click menu for name/condition editing
This commit is contained in:
@@ -244,7 +244,7 @@ Rng1U64 rd_reg_slot_range_table[34] =
|
||||
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
|
||||
};
|
||||
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[215] =
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[216] =
|
||||
{
|
||||
{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("Launch and Run"), RD_IconKind_Play, (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_Required*1), RD_RegSlot_EntityList, str8_lit_comp(""), RD_EntityKind_Target}},
|
||||
@@ -409,6 +409,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[215] =
|
||||
{ str8_lit_comp("select_entity"), str8_lit_comp("Selects an entity, disabling all others of the same kind."), str8_lit_comp(""), str8_lit_comp("Select Entity"), RD_IconKind_CheckHollow, (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_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("remove_entity"), str8_lit_comp("Removes an entity."), str8_lit_comp(""), str8_lit_comp("Remove Entity"), RD_IconKind_Trash, (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_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("name_entity"), str8_lit_comp("Equips an entity with a name."), str8_lit_comp(""), str8_lit_comp("Name Entity"), RD_IconKind_Null, (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_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("condition_entity"), str8_lit_comp("Equips an entity with a condition string."), str8_lit_comp(""), str8_lit_comp("Condition Entity"), RD_IconKind_Null, (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_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("duplicate_entity"), str8_lit_comp("Duplicates an entity."), str8_lit_comp(""), str8_lit_comp("Duplicate Entity"), RD_IconKind_Null, (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_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("relocate_entity"), str8_lit_comp("Relocates an entity."), str8_lit_comp(""), str8_lit_comp("Relocate Entity"), RD_IconKind_Null, (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_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("add_breakpoint"), str8_lit_comp("Places a breakpoint at a given location (file path and line number, address, or symbol name)."), str8_lit_comp(""), str8_lit_comp("Add Breakpoint"), RD_IconKind_CircleFilled, (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_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
|
||||
@@ -254,6 +254,7 @@ RD_CmdKind_DisableEntity,
|
||||
RD_CmdKind_SelectEntity,
|
||||
RD_CmdKind_RemoveEntity,
|
||||
RD_CmdKind_NameEntity,
|
||||
RD_CmdKind_ConditionEntity,
|
||||
RD_CmdKind_DuplicateEntity,
|
||||
RD_CmdKind_RelocateEntity,
|
||||
RD_CmdKind_AddBreakpoint,
|
||||
|
||||
@@ -420,6 +420,7 @@ RD_CmdTable: // | | | |
|
||||
{SelectEntity 0 0 Null null Nil 0 0 0 0 0 0 CheckHollow "select_entity" "Select Entity" "Selects an entity, disabling all others of the same kind." "" }
|
||||
{RemoveEntity 0 0 Null null Nil 0 0 0 0 0 0 Trash "remove_entity" "Remove Entity" "Removes an entity." "" }
|
||||
{NameEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "name_entity" "Name Entity" "Equips an entity with a name." "" }
|
||||
{ConditionEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "condition_entity" "Condition Entity" "Equips an entity with a condition string." "" }
|
||||
{DuplicateEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "duplicate_entity" "Duplicate Entity" "Duplicates an entity." "" }
|
||||
{RelocateEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "relocate_entity" "Relocate Entity" "Relocates an entity." "" }
|
||||
|
||||
|
||||
@@ -3938,7 +3938,7 @@ rd_window_frame(RD_Window *ws)
|
||||
//- rjf: top-level registers context menu
|
||||
//
|
||||
RD_Palette(RD_PaletteCode_Floating) UI_CtxMenu(rd_state->ctx_menu_key)
|
||||
UI_PrefWidth(ui_em(40.f, 1.f))
|
||||
UI_PrefWidth(ui_em(50.f, 1.f))
|
||||
RD_Palette(RD_PaletteCode_ImplicitButton)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
@@ -4246,8 +4246,8 @@ rd_window_frame(RD_Window *ws)
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: copy name
|
||||
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Clipboard, 0, "Copy Name")))
|
||||
// rjf: copy full path
|
||||
if(ctrl_entity->kind == CTRL_EntityKind_Module) if(ui_clicked(rd_icon_buttonf(RD_IconKind_Clipboard, 0, "Copy Full Path")))
|
||||
{
|
||||
os_set_clipboard_text(ctrl_entity->string);
|
||||
ui_ctx_menu_close();
|
||||
@@ -4501,6 +4501,7 @@ rd_window_frame(RD_Window *ws)
|
||||
case RD_RegSlot_Entity:
|
||||
{
|
||||
RD_Entity *entity = rd_entity_from_handle(regs->entity);
|
||||
RD_EntityKindFlags kind_flags = rd_entity_kind_flags_table[entity->kind];
|
||||
|
||||
//- rjf: title
|
||||
UI_Row
|
||||
@@ -4525,6 +4526,28 @@ rd_window_frame(RD_Window *ws)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RD_Palette(RD_PaletteCode_Floating) ui_divider(ui_em(1.f, 1.f));
|
||||
|
||||
//- rjf: name editor
|
||||
if(kind_flags & RD_EntityKindFlag_CanRename) RD_Font(RD_FontSlot_Code) UI_TextPadding(ui_top_font_size()*1.5f)
|
||||
{
|
||||
UI_Signal sig = rd_line_editf(RD_LineEditFlag_Border|RD_LineEditFlag_CodeContents, 0, 0, &ws->ctx_menu_input_cursor, &ws->ctx_menu_input_mark, ws->ctx_menu_input_buffer, ws->ctx_menu_input_buffer_size, &ws->ctx_menu_input_string_size, 0, entity->string, "Name###entity_string_edit_%p", ctrl_entity);
|
||||
if(ui_committed(sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_NameEntity, .entity = regs->entity, .string = str8(ws->ctx_menu_input_buffer, ws->ctx_menu_input_string_size));
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: condition editor
|
||||
if(kind_flags & RD_EntityKindFlag_CanCondition) RD_Font(RD_FontSlot_Code) UI_TextPadding(ui_top_font_size()*1.5f)
|
||||
{
|
||||
UI_Signal sig = rd_line_editf(RD_LineEditFlag_Border|RD_LineEditFlag_CodeContents, 0, 0, &ws->ctx_menu_input_cursor, &ws->ctx_menu_input_mark, ws->ctx_menu_input_buffer, ws->ctx_menu_input_buffer_size, &ws->ctx_menu_input_string_size, 0, rd_entity_child_from_kind(entity, RD_EntityKind_Condition)->string, "Condition###entity_condition_edit_%p", entity);
|
||||
if(ui_committed(sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_ConditionEntity, .entity = regs->entity, .string = str8(ws->ctx_menu_input_buffer, ws->ctx_menu_input_string_size));
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
}
|
||||
@@ -14998,6 +15021,21 @@ rd_frame(void)
|
||||
String8 string = rd_regs()->string;
|
||||
rd_entity_equip_name(entity, string);
|
||||
}break;
|
||||
case RD_CmdKind_ConditionEntity:
|
||||
{
|
||||
RD_Entity *entity = rd_entity_from_handle(rd_regs()->entity);
|
||||
String8 string = rd_regs()->string;
|
||||
if(string.size != 0)
|
||||
{
|
||||
RD_Entity *child = rd_entity_child_from_kind_or_alloc(entity, RD_EntityKind_Condition);
|
||||
rd_entity_equip_name(child, string);
|
||||
}
|
||||
else
|
||||
{
|
||||
RD_Entity *child = rd_entity_child_from_kind(entity, RD_EntityKind_Condition);
|
||||
rd_entity_mark_for_deletion(child);
|
||||
}
|
||||
}break;
|
||||
case RD_CmdKind_DuplicateEntity:
|
||||
{
|
||||
RD_Entity *src = rd_entity_from_handle(rd_regs()->entity);
|
||||
|
||||
@@ -214,10 +214,6 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Cold, Unsorted Notes (Deferred Until Existing Lists Mostly Exhausted)
|
||||
//
|
||||
// [ ] @feature types -> auto view rules (don't statefully fill view rules
|
||||
// given types, just query if no other view rule is present, & autofill
|
||||
// when editing)
|
||||
//
|
||||
// [ ] @feature disasm view improvement features
|
||||
// [ ] visualize jump destinations in disasm
|
||||
//
|
||||
@@ -522,6 +518,9 @@
|
||||
// [x] @feature entity views: filtering & reordering
|
||||
// [x] @feature eval system -> somehow evaluate breakpoint hit counts? "meta"
|
||||
// variables?
|
||||
// [x] @feature types -> auto view rules (don't statefully fill view rules
|
||||
// given types, just query if no other view rule is present, & autofill
|
||||
// when editing)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Build Options
|
||||
|
||||
Reference in New Issue
Block a user