mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-15 00:22:23 -07:00
checkpoint in new universal regs-based rich hover / context menu / drag-drop systems
This commit is contained in:
+29
-4
@@ -2,7 +2,35 @@
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Tables
|
||||
//~ rjf: Entity Kinds
|
||||
|
||||
@table(name display_string)
|
||||
CTRL_EntityKindTable:
|
||||
{
|
||||
{Root "Root" }
|
||||
{Machine "Machine" }
|
||||
{Process "Process" }
|
||||
{Thread "Thread" }
|
||||
{Module "Module" }
|
||||
{EntryPoint "Entry Point" }
|
||||
{DebugInfoPath "Debug Info Path" }
|
||||
}
|
||||
|
||||
@enum CTRL_EntityKind:
|
||||
{
|
||||
Null,
|
||||
@expand(CTRL_EntityKindTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
@data(String8) ctrl_entity_kind_display_string_table:
|
||||
{
|
||||
`{0}`,
|
||||
@expand(CTRL_EntityKindTable a) `str8_lit_comp("$(a.display_name)")`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Exception Codes
|
||||
|
||||
@table(name lower_name code default display_string)
|
||||
CTRL_ExceptionCodeKindTable:
|
||||
@@ -46,9 +74,6 @@ CTRL_ExceptionCodeKindTable:
|
||||
{Win32DirectXDebugLayer win32_directx_debug_layer 0x0000087a 1 "(Win32) DirectX Debug Layer" }
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generators
|
||||
|
||||
@enum CTRL_ExceptionCodeKind:
|
||||
{
|
||||
Null,
|
||||
|
||||
+5
-20
@@ -38,22 +38,12 @@ struct CTRL_HandleList
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity Types
|
||||
//~ rjf: Generated Code
|
||||
|
||||
typedef enum CTRL_EntityKind
|
||||
{
|
||||
CTRL_EntityKind_Null,
|
||||
CTRL_EntityKind_Root,
|
||||
|
||||
CTRL_EntityKind_Machine,
|
||||
CTRL_EntityKind_Process,
|
||||
CTRL_EntityKind_Thread,
|
||||
CTRL_EntityKind_Module,
|
||||
CTRL_EntityKind_EntryPoint,
|
||||
CTRL_EntityKind_DebugInfoPath,
|
||||
CTRL_EntityKind_COUNT
|
||||
}
|
||||
CTRL_EntityKind;
|
||||
#include "generated/ctrl.meta.h"
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity Types
|
||||
|
||||
typedef struct CTRL_Entity CTRL_Entity;
|
||||
struct CTRL_Entity
|
||||
@@ -310,11 +300,6 @@ enum
|
||||
CTRL_EvalSpaceKind_Meta,
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generated Code
|
||||
|
||||
#include "generated/ctrl.meta.h"
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Message Types
|
||||
|
||||
|
||||
@@ -4,6 +4,18 @@
|
||||
//- GENERATED CODE
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
String8 ctrl_entity_kind_display_string_table[8] =
|
||||
{
|
||||
{0},
|
||||
str8_lit_comp("Root"),
|
||||
str8_lit_comp("Machine"),
|
||||
str8_lit_comp("Process"),
|
||||
str8_lit_comp("Thread"),
|
||||
str8_lit_comp("Module"),
|
||||
str8_lit_comp("EntryPoint"),
|
||||
str8_lit_comp("DebugInfoPath"),
|
||||
};
|
||||
|
||||
U32 ctrl_exception_code_kind_code_table[38] =
|
||||
{
|
||||
0,
|
||||
|
||||
@@ -6,6 +6,19 @@
|
||||
#ifndef CTRL_META_H
|
||||
#define CTRL_META_H
|
||||
|
||||
typedef enum CTRL_EntityKind
|
||||
{
|
||||
CTRL_EntityKind_Null,
|
||||
CTRL_EntityKind_Root,
|
||||
CTRL_EntityKind_Machine,
|
||||
CTRL_EntityKind_Process,
|
||||
CTRL_EntityKind_Thread,
|
||||
CTRL_EntityKind_Module,
|
||||
CTRL_EntityKind_EntryPoint,
|
||||
CTRL_EntityKind_DebugInfoPath,
|
||||
CTRL_EntityKind_COUNT,
|
||||
} CTRL_EntityKind;
|
||||
|
||||
typedef enum CTRL_ExceptionCodeKind
|
||||
{
|
||||
CTRL_ExceptionCodeKind_Null,
|
||||
@@ -50,6 +63,7 @@ CTRL_ExceptionCodeKind_COUNT,
|
||||
} CTRL_ExceptionCodeKind;
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 ctrl_entity_kind_display_string_table[8];
|
||||
extern U32 ctrl_exception_code_kind_code_table[38];
|
||||
extern String8 ctrl_exception_code_kind_display_string_table[38];
|
||||
extern String8 ctrl_exception_code_kind_lowercase_code_string_table[38];
|
||||
|
||||
@@ -109,6 +109,7 @@ internal U64 dr_hash_from_string(String8 string);
|
||||
//~ rjf: Fancy String Type Functions
|
||||
|
||||
internal void dr_fancy_string_list_push(Arena *arena, DR_FancyStringList *list, DR_FancyString *str);
|
||||
#define dr_fancy_string_list_push_new(arena, list, font_, size_, color_, string_, ...) dr_fancy_string_list_push((arena), (list), &(DR_FancyString){.font = (font_), .string = (string_), .color = (color_), .size = (size_), __VA_ARGS__})
|
||||
internal void dr_fancy_string_list_concat_in_place(DR_FancyStringList *dst, DR_FancyStringList *to_push);
|
||||
internal String8 dr_string_from_fancy_string_list(Arena *arena, DR_FancyStringList *list);
|
||||
internal DR_FancyRunList dr_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, FNT_RasterFlags flags, DR_FancyStringList *strs);
|
||||
|
||||
+210
-25
@@ -1050,12 +1050,13 @@ rd_drag_is_active(void)
|
||||
}
|
||||
|
||||
internal void
|
||||
rd_drag_begin(void)
|
||||
rd_drag_begin(RD_RegSlot slot)
|
||||
{
|
||||
if(!rd_drag_is_active())
|
||||
{
|
||||
arena_clear(rd_state->drag_drop_arena);
|
||||
rd_state->drag_drop_regs = rd_regs_copy(rd_state->drag_drop_arena, rd_regs());
|
||||
rd_state->drag_drop_regs_slot = slot;
|
||||
rd_state->drag_drop_state = RD_DragDropState_Dragging;
|
||||
}
|
||||
}
|
||||
@@ -1079,9 +1080,10 @@ rd_drag_kill(void)
|
||||
}
|
||||
|
||||
internal void
|
||||
rd_set_hover_regs(void)
|
||||
rd_set_hover_regs(RD_RegSlot slot)
|
||||
{
|
||||
rd_state->next_hover_regs = rd_regs_copy(rd_frame_arena(), rd_regs());
|
||||
rd_state->next_hover_regs_slot = slot;
|
||||
}
|
||||
|
||||
internal RD_Regs *
|
||||
@@ -1090,6 +1092,19 @@ rd_get_hover_regs(void)
|
||||
return rd_state->hover_regs;
|
||||
}
|
||||
|
||||
internal void
|
||||
rd_open_ctx_menu(UI_Key anchor_box_key, Vec2F32 anchor_box_off, RD_RegSlot slot)
|
||||
{
|
||||
RD_Window *window = rd_window_from_handle(rd_regs()->window);
|
||||
if(window != 0)
|
||||
{
|
||||
ui_ctx_menu_open(rd_state->ctx_menu_key, anchor_box_key, anchor_box_off);
|
||||
arena_clear(window->ctx_menu_arena);
|
||||
window->ctx_menu_regs = rd_regs_copy(window->ctx_menu_arena, rd_regs());
|
||||
window->ctx_menu_regs_slot = slot;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Name Allocation
|
||||
|
||||
@@ -1689,6 +1704,71 @@ rd_entity_from_name_and_kind(String8 string, RD_EntityKind kind)
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Control Entity Info Extraction
|
||||
|
||||
internal Vec4F32
|
||||
rd_rgba_from_ctrl_entity(CTRL_Entity *entity)
|
||||
{
|
||||
Vec4F32 result = rd_rgba_from_theme_color(RD_ThemeColor_Text);
|
||||
if(entity->rgba != 0)
|
||||
{
|
||||
result = rgba_from_u32(entity->rgba);
|
||||
}
|
||||
if(entity->rgba == 0) switch(entity->kind)
|
||||
{
|
||||
default:{}break;
|
||||
case CTRL_EntityKind_Thread:
|
||||
{
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(entity, CTRL_EntityKind_Process);
|
||||
CTRL_Entity *main_thread = ctrl_entity_child_from_kind(process, CTRL_EntityKind_Thread);
|
||||
if(main_thread != entity)
|
||||
{
|
||||
result = rd_rgba_from_theme_color(RD_ThemeColor_Thread1);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = rd_rgba_from_theme_color(RD_ThemeColor_Thread0);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rd_name_from_ctrl_entity(Arena *arena, CTRL_Entity *entity)
|
||||
{
|
||||
String8 string = entity->string;
|
||||
if(string.size == 0)
|
||||
{
|
||||
string = str8_lit("unnamed");
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
internal DR_FancyStringList
|
||||
rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, Vec4F32 secondary_color, F32 size)
|
||||
{
|
||||
DR_FancyStringList result = {0};
|
||||
RD_IconKind icon_kind = RD_IconKind_Null;
|
||||
Vec4F32 color = rd_rgba_from_ctrl_entity(entity);
|
||||
switch(entity->kind)
|
||||
{
|
||||
default:{}break;
|
||||
case CTRL_EntityKind_Thread: {icon_kind = RD_IconKind_Thread;}break;
|
||||
case CTRL_EntityKind_Process: {icon_kind = RD_IconKind_Threads;}break;
|
||||
case CTRL_EntityKind_Module: {icon_kind = RD_IconKind_Module;}break;
|
||||
}
|
||||
if(icon_kind != RD_IconKind_Null)
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Icons), size, secondary_color, rd_icon_kind_text_table[icon_kind]);
|
||||
}
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, secondary_color, str8_lit(" "));
|
||||
String8 name = rd_name_from_ctrl_entity(arena, entity);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, color, name);
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Spaces
|
||||
|
||||
@@ -2584,6 +2664,10 @@ rd_window_open(Vec2F32 size, OS_Handle preferred_monitor, RD_CfgSrc cfg_src)
|
||||
}
|
||||
window->r = r_window_equip(window->os);
|
||||
window->ui = ui_state_alloc();
|
||||
window->ctx_menu_arena = arena_alloc();
|
||||
window->ctx_menu_regs = push_array(window->ctx_menu_arena, RD_Regs, 1);
|
||||
window->ctx_menu_input_buffer_size = KB(4);
|
||||
window->ctx_menu_input_buffer = push_array(window->arena, U8, window->ctx_menu_input_buffer_size);
|
||||
window->code_ctx_menu_arena = arena_alloc();
|
||||
window->hover_eval_arena = arena_alloc();
|
||||
window->autocomp_lister_params_arena = arena_alloc();
|
||||
@@ -2927,6 +3011,109 @@ rd_window_frame(RD_Window *ws)
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: rich hover tooltips
|
||||
//
|
||||
if(rd_state->hover_regs_slot != RD_RegSlot_Null) UI_Tooltip
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
RD_Palette(RD_PaletteCode_Floating) switch(rd_state->hover_regs_slot)
|
||||
{
|
||||
default:{}break;
|
||||
|
||||
//- rjf: thread tooltips
|
||||
case RD_RegSlot_Thread:
|
||||
{
|
||||
// rjf: unpack
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread);
|
||||
U64 rip_vaddr = d_query_cached_rip_from_thread(thread);
|
||||
Arch arch = thread->arch;
|
||||
String8 arch_str = string_from_arch(arch);
|
||||
DR_FancyStringList fstrs = rd_title_fstrs_from_ctrl_entity(scratch.arena, thread,
|
||||
rd_rgba_from_theme_color(RD_ThemeColor_TextWeak),
|
||||
ui_top_font_size());
|
||||
|
||||
// TODO(rjf): @msgs show stop info (just icon or shortened description)
|
||||
|
||||
// rjf: title
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(5, 1))
|
||||
{
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(box, &fstrs);
|
||||
ui_spacer(ui_em(0.5f, 1.f));
|
||||
UI_FontSize(ui_top_font_size() - 1.f)
|
||||
UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
RD_Palette(RD_PaletteCode_NeutralPopButton)
|
||||
{
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_label(arch_str);
|
||||
ui_spacer(ui_em(0.5f, 1.f));
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_labelf("TID: %i", (U32)thread->id);
|
||||
}
|
||||
}
|
||||
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
|
||||
// rjf: unwind
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
|
||||
{
|
||||
D_UnwindFrame *f = &rich_unwind.frames.v[idx];
|
||||
RDI_Parsed *rdi = f->rdi;
|
||||
RDI_Procedure *procedure = f->procedure;
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(thread->arch, f->regs);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
|
||||
String8 module_name = module == &ctrl_entity_nil ? str8_lit("???") : str8_skip_last_slash(module->string);
|
||||
|
||||
// rjf: inline frames
|
||||
for(D_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row
|
||||
{
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(rdi, fin->inline_site->name_string_idx, &name.size);
|
||||
UI_TextAlignment(UI_TextAlign_Left) RD_Font(RD_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_em(12.f, 1)) ui_labelf("0x%I64x", rip_vaddr);
|
||||
RD_Font(RD_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_text_dim(10, 1)) ui_label(str8_lit("[inlined]"));
|
||||
if(name.size != 0)
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
rd_code_label(1.f, 0, rd_rgba_from_theme_color(RD_ThemeColor_CodeSymbol), name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("[??? in %S]", module_name);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: concrete frame
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row
|
||||
{
|
||||
String8 name = {0};
|
||||
name.str = rdi_name_from_procedure(rdi, procedure, &name.size);
|
||||
UI_TextAlignment(UI_TextAlign_Left) RD_Font(RD_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_em(12.f, 1)) ui_labelf("0x%I64x", rip_vaddr);
|
||||
if(name.size != 0)
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
rd_code_label(1.f, 0, rd_rgba_from_theme_color(RD_ThemeColor_CodeSymbol), name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("[??? in %S]", module_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
di_scope_close(di_scope);
|
||||
}break;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: drag/drop visualization tooltips
|
||||
//
|
||||
@@ -2941,7 +3128,7 @@ rd_window_frame(RD_Window *ws)
|
||||
RD_View *view = rd_view_from_handle(rd_state->drag_drop_regs->view);
|
||||
{
|
||||
//- rjf: tab dragging
|
||||
if(!rd_view_is_nil(view))
|
||||
if(rd_state->drag_drop_regs_slot == RD_RegSlot_View && !rd_view_is_nil(view))
|
||||
{
|
||||
UI_Size main_width = ui_top_pref_width();
|
||||
UI_Size main_height = ui_top_pref_height();
|
||||
@@ -2987,7 +3174,7 @@ rd_window_frame(RD_Window *ws)
|
||||
}
|
||||
|
||||
//- rjf: entity dragging
|
||||
else if(!rd_entity_is_nil(entity)) UI_Tooltip
|
||||
else if(rd_state->drag_drop_regs_slot == RD_RegSlot_Entity && !rd_entity_is_nil(entity)) UI_Tooltip
|
||||
{
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
UI_Row UI_HeightFill
|
||||
@@ -3118,9 +3305,23 @@ rd_window_frame(RD_Window *ws)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: top-level context menu
|
||||
//
|
||||
RD_Palette(RD_PaletteCode_Floating) UI_CtxMenu(rd_state->ctx_menu_key)
|
||||
UI_PrefWidth(ui_em(40.f, 1.f))
|
||||
RD_Palette(RD_PaletteCode_ImplicitButton)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: universal ctx menus
|
||||
//
|
||||
// TODO(rjf): @msgs to-be-gone:
|
||||
//
|
||||
RD_Palette(RD_PaletteCode_Floating)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
@@ -6613,7 +6814,7 @@ rd_window_frame(RD_Window *ws)
|
||||
RD_RegsScope(.panel = rd_handle_from_panel(panel),
|
||||
.view = rd_handle_from_view(view))
|
||||
{
|
||||
rd_drag_begin();
|
||||
rd_drag_begin(RD_RegSlot_View);
|
||||
}
|
||||
}
|
||||
else if(ui_right_clicked(sig))
|
||||
@@ -8324,26 +8525,6 @@ rd_theme_color_from_txt_token_kind(TXT_TokenKind kind)
|
||||
return color;
|
||||
}
|
||||
|
||||
internal Vec4F32
|
||||
rd_rgba_from_thread(CTRL_Entity *thread)
|
||||
{
|
||||
Vec4F32 result = rd_rgba_from_theme_color(RD_ThemeColor_Thread0);
|
||||
if(thread->rgba != 0)
|
||||
{
|
||||
result = rgba_from_u32(thread->rgba);
|
||||
}
|
||||
else
|
||||
{
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Entity *main_thread = ctrl_entity_child_from_kind(process, CTRL_EntityKind_Thread);
|
||||
if(main_thread != thread)
|
||||
{
|
||||
result = rd_rgba_from_theme_color(RD_ThemeColor_Thread1);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: code -> palette
|
||||
|
||||
internal UI_Palette *
|
||||
@@ -9426,6 +9607,7 @@ rd_init(CmdLine *cmdln)
|
||||
rd_state->entities_root = rd_entity_alloc(&d_nil_entity, RD_EntityKind_Root);
|
||||
rd_state->key_map_arena = arena_alloc();
|
||||
rd_state->popup_arena = arena_alloc();
|
||||
rd_state->ctx_menu_key = ui_key_from_string(ui_key_zero(), str8_lit("top_level_ctx_menu"));
|
||||
rd_state->code_ctx_menu_key = ui_key_from_string(ui_key_zero(), str8_lit("_code_ctx_menu_"));
|
||||
rd_state->entity_ctx_menu_key = ui_key_from_string(ui_key_zero(), str8_lit("_entity_ctx_menu_"));
|
||||
rd_state->tab_ctx_menu_key = ui_key_from_string(ui_key_zero(), str8_lit("_tab_ctx_menu_"));
|
||||
@@ -9590,11 +9772,13 @@ rd_frame(void)
|
||||
if(rd_state->next_hover_regs != 0)
|
||||
{
|
||||
rd_state->hover_regs = rd_regs_copy(rd_frame_arena(), rd_state->next_hover_regs);
|
||||
rd_state->hover_regs_slot = rd_state->next_hover_regs_slot;
|
||||
rd_state->next_hover_regs = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rd_state->hover_regs = push_array(rd_frame_arena(), RD_Regs, 1);
|
||||
rd_state->hover_regs_slot = RD_RegSlot_Null;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -10288,6 +10472,7 @@ rd_frame(void)
|
||||
r_window_unequip(ws->os, ws->r);
|
||||
os_window_close(ws->os);
|
||||
arena_release(ws->query_cmd_arena);
|
||||
arena_release(ws->ctx_menu_arena);
|
||||
arena_release(ws->code_ctx_menu_arena);
|
||||
arena_release(ws->hover_eval_arena);
|
||||
arena_release(ws->autocomp_lister_params_arena);
|
||||
|
||||
@@ -648,6 +648,16 @@ struct RD_Window
|
||||
B32 menu_bar_key_held;
|
||||
B32 menu_bar_focus_press_started;
|
||||
|
||||
// rjf: context menu state
|
||||
Arena *ctx_menu_arena;
|
||||
RD_Regs *ctx_menu_regs;
|
||||
RD_RegSlot ctx_menu_regs_slot;
|
||||
U8 *ctx_menu_input_buffer;
|
||||
U64 ctx_menu_input_buffer_size;
|
||||
U64 ctx_menu_input_string_size;
|
||||
TxtPt ctx_menu_input_cursor;
|
||||
TxtPt ctx_menu_input_mark;
|
||||
|
||||
// rjf: code context menu state
|
||||
Arena *code_ctx_menu_arena;
|
||||
String8 code_ctx_menu_file_path;
|
||||
@@ -696,7 +706,7 @@ struct RD_Window
|
||||
F32 query_view_selected_t;
|
||||
F32 query_view_t;
|
||||
|
||||
// rjf: hover eval stable state
|
||||
// rjf: hover eval state
|
||||
B32 hover_eval_focused;
|
||||
TxtPt hover_eval_txt_cursor;
|
||||
TxtPt hover_eval_txt_mark;
|
||||
@@ -705,12 +715,8 @@ struct RD_Window
|
||||
Arena *hover_eval_arena;
|
||||
Vec2F32 hover_eval_spawn_pos;
|
||||
String8 hover_eval_string;
|
||||
|
||||
// rjf: hover eval timer
|
||||
U64 hover_eval_first_frame_idx;
|
||||
U64 hover_eval_last_frame_idx;
|
||||
|
||||
// rjf: hover eval params
|
||||
String8 hover_eval_file_path;
|
||||
TxtPt hover_eval_file_pt;
|
||||
U64 hover_eval_vaddr;
|
||||
@@ -829,7 +835,9 @@ struct RD_State
|
||||
|
||||
// rjf: contextual hover info
|
||||
RD_Regs *hover_regs;
|
||||
RD_RegSlot hover_regs_slot;
|
||||
RD_Regs *next_hover_regs;
|
||||
RD_RegSlot next_hover_regs_slot;
|
||||
|
||||
// rjf: icon texture
|
||||
R_Handle icon_texture;
|
||||
@@ -838,9 +846,13 @@ struct RD_State
|
||||
Arena *current_path_arena;
|
||||
String8 current_path;
|
||||
|
||||
// rjf: fixed ui keys
|
||||
UI_Key ctx_menu_key;
|
||||
|
||||
// rjf: drag/drop state
|
||||
Arena *drag_drop_arena;
|
||||
RD_Regs *drag_drop_regs;
|
||||
RD_RegSlot drag_drop_regs_slot;
|
||||
RD_DragDropState drag_drop_state;
|
||||
|
||||
//-
|
||||
@@ -1103,13 +1115,15 @@ internal B32 rd_prefer_dasm_from_window(RD_Window *window);
|
||||
//~ rjf: Global Cross-Window UI Interaction State Functions
|
||||
|
||||
internal B32 rd_drag_is_active(void);
|
||||
internal void rd_drag_begin(void);
|
||||
internal void rd_drag_begin(RD_RegSlot slot);
|
||||
internal B32 rd_drag_drop(void);
|
||||
internal void rd_drag_kill(void);
|
||||
|
||||
internal void rd_set_hover_regs(void);
|
||||
internal void rd_set_hover_regs(RD_RegSlot slot);
|
||||
internal RD_Regs *rd_get_hover_regs(void);
|
||||
|
||||
internal void rd_open_ctx_menu(UI_Key anchor_box_key, Vec2F32 anchor_box_off, RD_RegSlot slot);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Name Allocation
|
||||
|
||||
@@ -1159,6 +1173,13 @@ internal RD_Entity *rd_entity_from_ctrl_handle(CTRL_Handle handle);
|
||||
internal RD_Entity *rd_entity_from_ctrl_id(CTRL_MachineID machine_id, U32 id);
|
||||
internal RD_Entity *rd_entity_from_name_and_kind(String8 string, RD_EntityKind kind);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Control Entity Info Extraction
|
||||
|
||||
internal Vec4F32 rd_rgba_from_ctrl_entity(CTRL_Entity *entity);
|
||||
internal String8 rd_name_from_ctrl_entity(Arena *arena, CTRL_Entity *entity);
|
||||
internal DR_FancyStringList rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, Vec4F32 secondary_color, F32 size);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Spaces
|
||||
|
||||
@@ -1309,7 +1330,6 @@ internal String8List rd_cmd_name_list_from_binding(Arena *arena, RD_Binding bind
|
||||
//- rjf: colors
|
||||
internal Vec4F32 rd_rgba_from_theme_color(RD_ThemeColor color);
|
||||
internal RD_ThemeColor rd_theme_color_from_txt_token_kind(TXT_TokenKind kind);
|
||||
internal Vec4F32 rd_rgba_from_thread(CTRL_Entity *thread);
|
||||
|
||||
//- rjf: code -> palette
|
||||
internal UI_Palette *rd_palette_from_code(RD_PaletteCode code);
|
||||
|
||||
@@ -2503,7 +2503,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, R
|
||||
{
|
||||
cell_icon = RD_IconKind_RightArrow;
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread);
|
||||
cell_base_color = rd_rgba_from_thread(thread);
|
||||
cell_base_color = rd_rgba_from_ctrl_entity(thread);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@@ -7182,7 +7182,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
|
||||
annotation->name_string = thread->string.size ? thread->string : push_str8f(scratch.arena, "TID: %I64u", thread->id);
|
||||
annotation->kind_string = str8_lit("Stack");
|
||||
annotation->color = rd_rgba_from_thread(thread);
|
||||
annotation->color = rd_rgba_from_ctrl_entity(thread);
|
||||
annotation->vaddr_range = stack_vaddr_range;
|
||||
for(U64 vaddr = stack_vaddr_range_in_viz.min; vaddr < stack_vaddr_range_in_viz.max; vaddr += 1)
|
||||
{
|
||||
|
||||
+18
-44
@@ -756,7 +756,7 @@ rd_entity_desc_button(RD_Entity *entity, FuzzyMatchRangeList *name_matches, Stri
|
||||
// rjf: drag+drop
|
||||
else if(ui_dragging(sig) && !contains_2f32(box->rect, ui_mouse()))
|
||||
{
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(entity)) rd_drag_begin();
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(entity)) rd_drag_begin(RD_RegSlot_Entity);
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
@@ -1059,7 +1059,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
|
||||
// rjf: thread info => color
|
||||
Vec4F32 color = rd_rgba_from_thread(thread);
|
||||
Vec4F32 color = rd_rgba_from_ctrl_entity(thread);
|
||||
{
|
||||
if(unwind_count != 0)
|
||||
{
|
||||
@@ -1136,30 +1136,18 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: hover tooltips
|
||||
// rjf: interactions
|
||||
if(ui_hovering(thread_sig) && !rd_drag_is_active())
|
||||
{
|
||||
// TODO(rjf): @msgs rd_entity_tooltips(thread); set rich hover info here!!!
|
||||
RD_RegsScope(.thread = thread->handle) rd_set_hover_regs(RD_RegSlot_Thread);
|
||||
}
|
||||
|
||||
// rjf: ip right-click menu
|
||||
if(ui_right_clicked(thread_sig))
|
||||
{
|
||||
// TODO(rjf): @msgs top-level regs-based ctx menu here!!!!
|
||||
// RD_Handle handle = rd_handle_from_entity(thread);
|
||||
// ui_ctx_menu_open(rd_state->entity_ctx_menu_key, thread_box->key, v2f32(0, thread_box->rect.y1-thread_box->rect.y0));
|
||||
// RD_Window *window = rd_window_from_handle(rd_regs()->window);
|
||||
// window->entity_ctx_menu_entity = handle;
|
||||
RD_RegsScope(.thread = thread->handle) rd_open_ctx_menu(thread_box->key, v2f32(0, thread_box->rect.y1-thread_box->rect.y0), RD_RegSlot_Thread);
|
||||
}
|
||||
|
||||
// rjf: drag start
|
||||
if(ui_dragging(thread_sig) && !contains_2f32(thread_box->rect, ui_mouse()))
|
||||
{
|
||||
// TODO(rjf): @msgs top-level regs-based drag/drop here!!!
|
||||
// RD_DragDropPayload payload = {0};
|
||||
// payload.key = thread_box->key;
|
||||
// payload.entity = rd_handle_from_entity(thread);
|
||||
// rd_drag_begin(&payload);
|
||||
RD_RegsScope(.thread = thread->handle) rd_drag_begin(RD_RegSlot_Thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1215,7 +1203,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
|
||||
// rjf: thread info => color
|
||||
Vec4F32 color = rd_rgba_from_thread(thread);
|
||||
Vec4F32 color = rd_rgba_from_ctrl_entity(thread);
|
||||
{
|
||||
if(unwind_count != 0)
|
||||
{
|
||||
@@ -1290,38 +1278,24 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: hover tooltips
|
||||
// rjf: interactions
|
||||
if(ui_hovering(thread_sig) && !rd_drag_is_active())
|
||||
{
|
||||
// TODO(rjf): @msgs rd_entity_tooltips(thread); set rich hover info here!!!
|
||||
RD_RegsScope(.thread = thread->handle) rd_set_hover_regs(RD_RegSlot_Thread);
|
||||
}
|
||||
|
||||
// rjf: ip right-click menu
|
||||
if(ui_right_clicked(thread_sig))
|
||||
{
|
||||
// TODO(rjf): @msgs top-level regs-based ctx menu here!!!!
|
||||
// RD_Handle handle = rd_handle_from_entity(thread);
|
||||
// ui_ctx_menu_open(rd_state->entity_ctx_menu_key, thread_box->key, v2f32(0, thread_box->rect.y1-thread_box->rect.y0));
|
||||
// RD_Window *window = rd_window_from_handle(rd_regs()->window);
|
||||
// window->entity_ctx_menu_entity = handle;
|
||||
RD_RegsScope(.thread = thread->handle) rd_open_ctx_menu(thread_box->key, v2f32(0, thread_box->rect.y1-thread_box->rect.y0), RD_RegSlot_Thread);
|
||||
}
|
||||
if(ui_dragging(thread_sig) && !contains_2f32(thread_box->rect, ui_mouse()))
|
||||
{
|
||||
RD_RegsScope(.thread = thread->handle) rd_drag_begin(RD_RegSlot_Thread);
|
||||
}
|
||||
|
||||
// rjf: double click => select
|
||||
if(ui_double_clicked(thread_sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_SelectThread, .thread = thread->handle);
|
||||
ui_kill_action();
|
||||
}
|
||||
|
||||
// rjf: drag start
|
||||
if(ui_dragging(thread_sig) && !contains_2f32(thread_box->rect, ui_mouse()))
|
||||
{
|
||||
// TODO(rjf): @msgs top-level regs-based drag/drop here!!!
|
||||
// RD_DragDropPayload payload = {0};
|
||||
// payload.key = thread_box->key;
|
||||
// payload.entity = rd_handle_from_entity(thread);
|
||||
// rd_drag_begin(&payload);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: build margin breakpoint ui
|
||||
@@ -1394,7 +1368,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
// rjf: drag start
|
||||
if(ui_dragging(bp_sig) && !contains_2f32(bp_box->rect, ui_mouse()))
|
||||
{
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(bp)) rd_drag_begin();
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(bp)) rd_drag_begin(RD_RegSlot_Entity);
|
||||
}
|
||||
|
||||
// rjf: bp right-click menu
|
||||
@@ -1450,7 +1424,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
// rjf: drag start
|
||||
if(ui_dragging(pin_sig) && !contains_2f32(pin_box->rect, ui_mouse()))
|
||||
{
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(pin)) rd_drag_begin();
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(pin)) rd_drag_begin(RD_RegSlot_Entity);
|
||||
}
|
||||
|
||||
// rjf: watch right-click menu
|
||||
@@ -1677,7 +1651,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
UI_Signal sig = ui_buttonf("%S###pin_nub", rd_icon_kind_text_table[RD_IconKind_Pin]);
|
||||
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()))
|
||||
{
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(pin)) rd_drag_begin();
|
||||
RD_RegsScope(.entity = rd_handle_from_entity(pin)) rd_drag_begin(RD_RegSlot_Entity);
|
||||
}
|
||||
if(ui_right_clicked(sig))
|
||||
{
|
||||
@@ -1957,7 +1931,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
.dbgi_key = lines->first->v.dbgi_key,
|
||||
.voff_range = lines->first->v.voff_range)
|
||||
{
|
||||
rd_set_hover_regs();
|
||||
rd_set_hover_regs(RD_RegSlot_Null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user