mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
more watch view work
This commit is contained in:
@@ -243,7 +243,7 @@ Rng1U64 rd_reg_slot_range_table[33] =
|
||||
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
|
||||
};
|
||||
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[213] =
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[214] =
|
||||
{
|
||||
{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}},
|
||||
@@ -404,6 +404,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[213] =
|
||||
{ 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("Toggle Code Bytes Visibility"), RD_IconKind_Thumbnails, (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}},
|
||||
{ str8_lit_comp("enable_entity"), str8_lit_comp("Enables an entity."), str8_lit_comp(""), str8_lit_comp("Enable 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("disable_entity"), str8_lit_comp("Disables an entity."), str8_lit_comp(""), str8_lit_comp("Disable 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("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_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("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("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}},
|
||||
|
||||
@@ -249,6 +249,7 @@ RD_CmdKind_ToggleAddressVisibility,
|
||||
RD_CmdKind_ToggleCodeBytesVisibility,
|
||||
RD_CmdKind_EnableEntity,
|
||||
RD_CmdKind_DisableEntity,
|
||||
RD_CmdKind_SelectEntity,
|
||||
RD_CmdKind_RemoveEntity,
|
||||
RD_CmdKind_NameEntity,
|
||||
RD_CmdKind_DuplicateEntity,
|
||||
|
||||
@@ -415,6 +415,7 @@ RD_CmdTable: // | | | |
|
||||
//- rjf: general entity operations
|
||||
{EnableEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "enable_entity" "Enable Entity" "Enables an entity." "" }
|
||||
{DisableEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "disable_entity" "Disable Entity" "Disables an entity." "" }
|
||||
{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 Null "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." "" }
|
||||
{DuplicateEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "duplicate_entity" "Duplicate Entity" "Duplicates an entity." "" }
|
||||
|
||||
@@ -5162,25 +5162,11 @@ rd_window_frame(RD_Window *ws)
|
||||
}
|
||||
|
||||
//- rjf: step over button
|
||||
UI_TextAlignment(UI_TextAlign_Center) UI_Flags(can_step ? 0 : UI_BoxFlag_Disabled)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_StepOver]);
|
||||
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
|
||||
if(ui_hovering(sig) && !can_step && can_pause)
|
||||
{
|
||||
UI_Tooltip
|
||||
RD_Font(RD_FontSlot_Main)
|
||||
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Main))
|
||||
ui_labelf("Disabled: Running");
|
||||
}
|
||||
if(ui_hovering(sig) && !can_step && !can_stop)
|
||||
{
|
||||
UI_Tooltip
|
||||
RD_Font(RD_FontSlot_Main)
|
||||
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Main))
|
||||
ui_labelf("Disabled: No processes are running");
|
||||
}
|
||||
if(ui_hovering(sig) && can_step)
|
||||
if(ui_hovering(sig))
|
||||
{
|
||||
UI_Tooltip
|
||||
RD_Font(RD_FontSlot_Main)
|
||||
@@ -5194,25 +5180,11 @@ rd_window_frame(RD_Window *ws)
|
||||
}
|
||||
|
||||
//- rjf: step into button
|
||||
UI_TextAlignment(UI_TextAlign_Center) UI_Flags(can_step ? 0 : UI_BoxFlag_Disabled)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_StepInto]);
|
||||
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
|
||||
if(ui_hovering(sig) && !can_step && can_pause)
|
||||
{
|
||||
UI_Tooltip
|
||||
RD_Font(RD_FontSlot_Main)
|
||||
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Main))
|
||||
ui_labelf("Disabled: Running");
|
||||
}
|
||||
if(ui_hovering(sig) && !can_step && !can_stop)
|
||||
{
|
||||
UI_Tooltip
|
||||
RD_Font(RD_FontSlot_Main)
|
||||
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Main))
|
||||
ui_labelf("Disabled: No processes are running");
|
||||
}
|
||||
if(ui_hovering(sig) && can_step)
|
||||
if(ui_hovering(sig))
|
||||
{
|
||||
UI_Tooltip
|
||||
RD_Font(RD_FontSlot_Main)
|
||||
|
||||
@@ -1050,6 +1050,14 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
{
|
||||
string_flags |= EV_StringFlag_PrettyNames;
|
||||
}
|
||||
RD_WatchViewRowCtrl row_ctrls_[] =
|
||||
{
|
||||
{RD_EntityKind_Target, RD_CmdKind_LaunchAndRun },
|
||||
{RD_EntityKind_Target, RD_CmdKind_LaunchAndInit },
|
||||
{RD_EntityKind_Target, RD_CmdKind_SelectEntity },
|
||||
};
|
||||
RD_WatchViewRowCtrl *row_ctrls = row_ctrls_;
|
||||
U64 row_ctrls_count = ArrayCount(row_ctrls_);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: root-level view rule which has a ui hook? call into that to build the UI
|
||||
@@ -1203,16 +1211,16 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
ui_scroll_list_row_from_item(&row_blocks, mark_tbl.y)+1));
|
||||
|
||||
// rjf: compute legal coordinate range, given selection-defining row
|
||||
U64 num_x_positions = ewv->column_count;
|
||||
Rng1S64 cursor_x_range = r1s64(0, ewv->column_count-1);
|
||||
if(mark_rows.first != 0)
|
||||
{
|
||||
RD_WatchViewRowKind row_kind = rd_watch_view_row_kind_from_row(flags, mark_rows.first);
|
||||
if(row_kind == RD_WatchViewRowKind_PrettyEntityControls)
|
||||
{
|
||||
num_x_positions = 2;
|
||||
cursor_x_range = r1s64(1, 1+row_ctrls_count);
|
||||
}
|
||||
}
|
||||
cursor_tbl_range = r2s64(v2s64(0, 0), v2s64(num_x_positions-1, block_tree.total_item_count-1));
|
||||
cursor_tbl_range = r2s64(v2s64(cursor_x_range.min, 0), v2s64(cursor_x_range.max, block_tree.total_item_count-1));
|
||||
|
||||
// rjf: clamp x positions of cursor/mark tbl
|
||||
for EachEnumVal(Axis2, axis)
|
||||
@@ -1385,7 +1393,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
//- rjf: entity controls -> do operation depending on extra control selection
|
||||
case RD_WatchViewRowKind_PrettyEntityControls:
|
||||
{
|
||||
if(selection_tbl.min.x != 0 || selection_tbl.max.x != 0)
|
||||
if(selection_tbl.min.x != 1 || selection_tbl.max.x != 1)
|
||||
{
|
||||
kind = OpKind_Null;
|
||||
}
|
||||
@@ -2327,7 +2335,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
{
|
||||
//- rjf: unpack
|
||||
RD_Entity *entity = row_meta_entity;
|
||||
B32 entity_box_selected = (row_selected);
|
||||
B32 entity_box_selected = (row_selected && selection_tbl.min.x <= 1 && 1 <= selection_tbl.max.x);
|
||||
|
||||
//- rjf: build entity box
|
||||
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
|
||||
@@ -2358,9 +2366,19 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
//- rjf: build extra entity controls
|
||||
UI_PrefWidth(ui_em(3.f, 1.f))
|
||||
{
|
||||
UI_FocusHot(row_selected && selection_tbl.min.x <= 1 && 1 <= selection_tbl.max.x ? UI_FocusKind_On : UI_FocusKind_Off) rd_icon_buttonf(RD_IconKind_Play, 0, "###run");
|
||||
UI_FocusHot(row_selected && selection_tbl.min.x <= 2 && 2 <= selection_tbl.max.x ? UI_FocusKind_On : UI_FocusKind_Off) rd_icon_buttonf(RD_IconKind_StepInto, 0, "###step_into");
|
||||
UI_FocusHot(row_selected && selection_tbl.min.x <= 3 && 3 <= selection_tbl.max.x ? UI_FocusKind_On : UI_FocusKind_Off) rd_icon_buttonf(RD_IconKind_CheckHollow, 0, "###select");
|
||||
U64 ctrl_idx = 1;
|
||||
for EachIndex(idx, row_ctrls_count)
|
||||
{
|
||||
RD_WatchViewRowCtrl *ctrl = &row_ctrls[idx];
|
||||
if(ctrl->entity_kind == entity->kind)
|
||||
{
|
||||
UI_FocusHot(row_selected && selection_tbl.min.x <= ctrl_idx+1 && ctrl_idx+1 <= selection_tbl.max.x ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
{
|
||||
rd_icon_buttonf(rd_cmd_kind_info_table[ctrl->kind].icon_kind, 0, "###row_ctrl_%I64x", idx);
|
||||
}
|
||||
ctrl_idx += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@ enum
|
||||
RD_WatchViewFlag_PrettyNameMembers = (1<<0),
|
||||
RD_WatchViewFlag_PrettyEntityRows = (1<<1),
|
||||
RD_WatchViewFlag_DisableCacheLines = (1<<2),
|
||||
|
||||
RD_WatchViewFlag_PrettyCtrlRun = (1<<3),
|
||||
RD_WatchViewFlag_PrettyCtrlStepInto = (1<<4),
|
||||
RD_WatchViewFlag_PrettyCtrlSelect = (1<<5),
|
||||
};
|
||||
|
||||
typedef enum RD_WatchViewColumnKind
|
||||
@@ -95,6 +91,13 @@ struct RD_WatchViewColumn
|
||||
B32 rangify_braces;
|
||||
};
|
||||
|
||||
typedef struct RD_WatchViewRowCtrl RD_WatchViewRowCtrl;
|
||||
struct RD_WatchViewRowCtrl
|
||||
{
|
||||
RD_EntityKind entity_kind;
|
||||
RD_CmdKind kind;
|
||||
};
|
||||
|
||||
typedef enum RD_WatchViewRowKind
|
||||
{
|
||||
RD_WatchViewRowKind_Normal,
|
||||
|
||||
Reference in New Issue
Block a user