From d3e25567acc3dfe27ab50c20d05b14b1659b7964 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Wed, 19 Mar 2025 15:30:47 -0700 Subject: [PATCH] convergence on listers / visual fixes --- src/raddbg/generated/raddbg.meta.c | 6 +- src/raddbg/generated/raddbg.meta.h | 3 +- src/raddbg/raddbg.mdesk | 1 + src/raddbg/raddbg_core.c | 115 ++++++++++++++++++++--------- src/raddbg/raddbg_core.h | 12 --- src/raddbg/raddbg_widgets.c | 10 +-- src/ui/ui_core.c | 18 ++--- src/ui/ui_core.h | 1 + 8 files changed, 96 insertions(+), 70 deletions(-) diff --git a/src/raddbg/generated/raddbg.meta.c b/src/raddbg/generated/raddbg.meta.c index 7ea36428..7efc35bd 100644 --- a/src/raddbg/generated/raddbg.meta.c +++ b/src/raddbg/generated/raddbg.meta.c @@ -4,7 +4,7 @@ //- GENERATED CODE C_LINKAGE_BEGIN -RD_VocabInfo rd_vocab_info_table[297] = +RD_VocabInfo rd_vocab_info_table[298] = { {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}, @@ -143,6 +143,7 @@ RD_VocabInfo rd_vocab_info_table[297] = {str8_lit_comp("popup_cancel"), str8_lit_comp(""), str8_lit_comp("Popup Cancel"), str8_lit_comp(""), RD_IconKind_Null}, {str8_lit_comp("reset_to_default_panels"), str8_lit_comp(""), str8_lit_comp("Reset To Default Panel Layout"), str8_lit_comp(""), RD_IconKind_Window}, {str8_lit_comp("reset_to_compact_panels"), str8_lit_comp(""), str8_lit_comp("Reset To Compact Panel Layout"), str8_lit_comp(""), RD_IconKind_Window}, +{str8_lit_comp("reset_to_simple_panels"), str8_lit_comp(""), str8_lit_comp("Reset To Simple Panel Layout"), str8_lit_comp(""), RD_IconKind_Window}, {str8_lit_comp("new_panel_left"), str8_lit_comp(""), str8_lit_comp("Split Panel Left"), str8_lit_comp(""), RD_IconKind_XSplit}, {str8_lit_comp("new_panel_up"), str8_lit_comp(""), str8_lit_comp("Split Panel Up"), str8_lit_comp(""), RD_IconKind_YSplit}, {str8_lit_comp("new_panel_right"), str8_lit_comp(""), str8_lit_comp("Split Panel Right"), str8_lit_comp(""), RD_IconKind_XSplit}, @@ -365,7 +366,7 @@ Rng1U64 rd_reg_slot_range_table[40] = {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(""), (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}}, @@ -422,6 +423,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[215] = { str8_lit_comp("popup_cancel"), str8_lit_comp("Cancels the active popup prompt."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(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("reset_to_default_panels"), str8_lit_comp("Resets the window to the default panel layout."), str8_lit_comp("panel"), 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("reset_to_compact_panels"), str8_lit_comp("Resets the window to the compact panel layout."), str8_lit_comp("panel"), 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("reset_to_simple_panels"), str8_lit_comp("Resets the window to the simple panel layout."), str8_lit_comp("panel"), 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("new_panel_left"), str8_lit_comp("Creates a new panel to the left of the active panel."), str8_lit_comp("panel"), 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("new_panel_up"), str8_lit_comp("Creates a new panel at the top of the active panel."), str8_lit_comp("panel"), 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("new_panel_right"), str8_lit_comp("Creates a new panel to the right of the active panel."), str8_lit_comp("panel"), 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}}, diff --git a/src/raddbg/generated/raddbg.meta.h b/src/raddbg/generated/raddbg.meta.h index 6a70cc3f..73ba2718 100644 --- a/src/raddbg/generated/raddbg.meta.h +++ b/src/raddbg/generated/raddbg.meta.h @@ -108,6 +108,7 @@ RD_CmdKind_PopupAccept, RD_CmdKind_PopupCancel, RD_CmdKind_ResetToDefaultPanels, RD_CmdKind_ResetToCompactPanels, +RD_CmdKind_ResetToSimplePanels, RD_CmdKind_NewPanelLeft, RD_CmdKind_NewPanelUp, RD_CmdKind_NewPanelRight, @@ -633,7 +634,7 @@ RD_Query query; .os_event = rd_regs()->os_event,\ C_LINKAGE_BEGIN -extern RD_VocabInfo rd_vocab_info_table[297]; +extern RD_VocabInfo rd_vocab_info_table[298]; extern RD_NameSchemaInfo rd_name_schema_info_table[12]; extern Rng1U64 rd_reg_slot_range_table[40]; extern String8 rd_binding_version_remap_old_name_table[8]; diff --git a/src/raddbg/raddbg.mdesk b/src/raddbg/raddbg.mdesk index 42feaf07..a8719278 100644 --- a/src/raddbg/raddbg.mdesk +++ b/src/raddbg/raddbg.mdesk @@ -394,6 +394,7 @@ RD_CmdTable: // | | | | //- rjf: panel splitting {ResetToDefaultPanels 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Window "reset_to_default_panels" "Reset To Default Panel Layout" "Resets the window to the default panel layout." "panel" "" } {ResetToCompactPanels 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Window "reset_to_compact_panels" "Reset To Compact Panel Layout" "Resets the window to the compact panel layout." "panel" "" } + {ResetToSimplePanels 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Window "reset_to_simple_panels" "Reset To Simple Panel Layout" "Resets the window to the simple panel layout." "panel" "" } {NewPanelLeft 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 XSplit "new_panel_left" "Split Panel Left" "Creates a new panel to the left of the active panel." "panel" "" } {NewPanelUp 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 YSplit "new_panel_up" "Split Panel Up" "Creates a new panel at the top of the active panel." "panel" "" } {NewPanelRight 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 XSplit "new_panel_right" "Split Panel Right" "Creates a new panel to the right of the active panel." "panel" "" } diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 77c5d55c..7730d628 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -1241,20 +1241,6 @@ 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_Cfg *window_cfg = rd_cfg_from_id(rd_regs()->window); - RD_WindowState *ws = rd_window_state_from_cfg(window_cfg); - if(ws != 0) - { - ui_ctx_menu_open(rd_state->ctx_menu_key, anchor_box_key, anchor_box_off); - arena_clear(ws->ctx_menu_arena); - ws->ctx_menu_regs = rd_regs_copy(ws->ctx_menu_arena, rd_regs()); - ws->ctx_menu_regs_slot = slot; - } -} - //////////////////////////////// //~ rjf: Name Allocation @@ -6280,10 +6266,6 @@ rd_window_state_from_cfg(RD_Cfg *cfg) } ws->r = r_window_equip(ws->os); ws->ui = ui_state_alloc(); - ws->ctx_menu_arena = arena_alloc(); - ws->ctx_menu_regs = push_array(ws->ctx_menu_arena, RD_Regs, 1); - ws->ctx_menu_input_buffer_size = KB(4); - ws->ctx_menu_input_buffer = push_array(ws->arena, U8, ws->ctx_menu_input_buffer_size); ws->drop_completion_arena = arena_alloc(); ws->hover_eval_arena = arena_alloc(); ws->query_arena = arena_alloc(); @@ -7063,6 +7045,7 @@ rd_window_frame(void) //////////////////////////// //- rjf: @window_ui_part top-level registers context menu // +#if 0 UI_CtxMenu(rd_state->ctx_menu_key) UI_PrefWidth(ui_em(50.f, 1.f)) { Temp scratch = scratch_begin(0, 0); @@ -7321,6 +7304,7 @@ rd_window_frame(void) scratch_end(scratch); } +#endif //////////////////////////// //- rjf: @window_ui_part drop-completion context menu @@ -7462,6 +7446,7 @@ rd_window_frame(void) String8 view_name; String8 expr; B32 is_focused; + B32 is_anchored; UI_Signal signal; // NOTE(rjf): output, from build }; FloatingViewTask *hover_eval_floating_view_task = 0; @@ -7472,7 +7457,6 @@ rd_window_frame(void) UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Main)) { //- rjf: try to add hover eval first - if(ws->hover_eval_string.size != 0) { B32 build_hover_eval = (hover_eval_is_open && (!rd_drag_is_active() || rd_state->drag_drop_regs_slot == RD_RegSlot_View)); @@ -7550,12 +7534,6 @@ rd_window_frame(void) rd_request_frame(); } - // rjf: reset focus state if hover eval is not being built - if(!build_hover_eval || ws->hover_eval_string.size == 0 || !hover_eval_is_open) - { - ws->hover_eval_focused = 0; - } - // rjf: determine size of hover evaluation container EV_BlockTree predicted_block_tree = {0}; RD_RegsScope(.view = view->id) @@ -7597,6 +7575,13 @@ rd_window_frame(void) t->view_name = view_name; t->expr = hover_eval_expr; t->is_focused = ws->hover_eval_focused; + t->is_anchored = 1; + } + + // rjf: reset focus state if hover eval is not being built + if(!build_hover_eval || ws->hover_eval_string.size == 0 || !hover_eval_is_open) + { + ws->hover_eval_focused = 0; } } @@ -7675,6 +7660,17 @@ rd_window_frame(void) content_rect_center.y - max_query_height_px/2.f, content_rect_center.x + query_width_px/2, content_rect_center.y - max_query_height_px/2.f + query_height_px); + if(!ui_key_match(ui_key_zero(), ws->query_regs->ui_key)) + { + UI_Box *anchor_box = ui_box_from_key(ws->query_regs->ui_key); + if(anchor_box != &ui_nil_box) + { + rect.x0 = anchor_box->rect.x0; + rect.y0 = anchor_box->rect.y1; + rect.x1 = rect.x0 + ui_top_font_size()*40.f; + rect.y1 = rect.y0 + query_height_px; + } + } } // rjf: push query task @@ -7688,6 +7684,7 @@ rd_window_frame(void) t->view_name = str8_lit("watch"); t->expr = query_expression; t->is_focused = 1; + t->is_anchored = query_is_anchored; } } } @@ -7700,6 +7697,8 @@ rd_window_frame(void) UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Main)) UI_TagF("floating") { + F32 fast_open_rate = 1 - pow_f32(2, (-70.f * ui_state->animation_dt)); + F32 slow_open_rate = 1 - pow_f32(2, (-40.f * ui_state->animation_dt)); for(FloatingViewTask *t = first_floating_view_task; t != 0; t = t->next) { // rjf: unpack @@ -7709,7 +7708,8 @@ rd_window_frame(void) String8 view_name = t->view_name; String8 expr = t->expr; B32 is_focused = t->is_focused; - F32 open_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "floating_view_open_%p", view), 1.f); + B32 is_anchored = t->is_anchored; + F32 open_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "floating_view_open_%p", view), 1.f, .rate = is_anchored ? fast_open_rate : slow_open_rate); // rjf: build cfg tree RD_Cfg *expr_root = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression")); @@ -7737,14 +7737,15 @@ rd_window_frame(void) { // rjf: build top-level container box UI_Box *container = &ui_nil_box; - UI_Rect(rect) UI_ChildLayoutAxis(Axis2_Y) UI_Squish(0.25f-0.25f*open_t) UI_Transparency(1.f-open_t) + UI_Rect(rect) UI_ChildLayoutAxis(Axis2_Y) UI_Squish(0.1f-0.1f*open_t) UI_Transparency(1.f-open_t) { container = ui_build_box_from_stringf(UI_BoxFlag_Clickable| UI_BoxFlag_DrawBorder| UI_BoxFlag_DrawBackground| UI_BoxFlag_DrawBackgroundBlur| UI_BoxFlag_DisableFocusOverlay| - UI_BoxFlag_DrawDropShadow, + UI_BoxFlag_DrawDropShadow| + (UI_BoxFlag_SquishAnchored*!!is_anchored), "floating_view_container_%p", view); } @@ -7971,6 +7972,7 @@ rd_window_frame(void) rd_cmd_kind_info_table[RD_CmdKind_TabBarBottom].string, rd_cmd_kind_info_table[RD_CmdKind_ResetToDefaultPanels].string, rd_cmd_kind_info_table[RD_CmdKind_ResetToCompactPanels].string, + rd_cmd_kind_info_table[RD_CmdKind_ResetToSimplePanels].string, }; U32 codepoints[] = { @@ -7989,6 +7991,7 @@ rd_window_frame(void) 0, 0, 0, + 0, }; Assert(ArrayCount(codepoints) == ArrayCount(cmds)); rd_cmd_list_menu_buttons(ArrayCount(cmds), cmds, codepoints); @@ -8786,7 +8789,7 @@ rd_window_frame(void) UI_Box *site_box = &ui_nil_box; { F32 site_open_t = ui_anim(ui_key_from_stringf(key, "open_t"), 1.f); - UI_Rect(site_rect) UI_Squish(0.25f-0.25f*site_open_t) UI_Transparency(1-site_open_t) + UI_Rect(site_rect) UI_Squish(0.1f-0.1f*site_open_t) UI_Transparency(1-site_open_t) { site_box = ui_build_box_from_key(UI_BoxFlag_DropSite|UI_BoxFlag_DrawHotEffects, key); ui_signal_from_box(site_box); @@ -8877,7 +8880,7 @@ rd_window_frame(void) UI_Box *site_box = &ui_nil_box; { F32 site_open_t = ui_anim(ui_key_from_stringf(key, "open_t"), 1.f); - UI_Rect(site_rect) UI_Squish(0.25f-0.25f*site_open_t) UI_Transparency(1-site_open_t) + UI_Rect(site_rect) UI_Squish(0.1f-0.1f*site_open_t) UI_Transparency(1-site_open_t) { site_box = ui_build_box_from_key(UI_BoxFlag_DropSite|UI_BoxFlag_DrawHotEffects, key); ui_signal_from_box(site_box); @@ -9195,7 +9198,7 @@ rd_window_frame(void) UI_Box *site_box = &ui_nil_box; { F32 site_open_t = ui_anim(ui_key_from_stringf(key, "open_t"), 1.f); - UI_Rect(rect) UI_Squish(0.25f-0.25f*site_open_t) UI_Transparency(1-site_open_t) + UI_Rect(rect) UI_Squish(0.1f-0.1f*site_open_t) UI_Transparency(1-site_open_t) { site_box = ui_build_box_from_key(UI_BoxFlag_DropSite|UI_BoxFlag_DrawHotEffects, key); ui_signal_from_box(site_box); @@ -9851,6 +9854,7 @@ rd_window_frame(void) { MemoryZeroStruct(&ws->hover_eval_string); arena_clear(ws->hover_eval_arena); + ws->hover_eval_focused = 0; rd_request_frame(); } @@ -9870,7 +9874,7 @@ rd_window_frame(void) ProfScope("draw UI") { Temp scratch = scratch_begin(0, 0); - F32 box_squish_epsilon = 0.01f; + F32 box_squish_epsilon = 0.001f; Rng2F32 window_rect = os_client_rect_from_window(ws->os); //- rjf: unpack settings @@ -9934,9 +9938,18 @@ rd_window_frame(void) if(box->squish > box_squish_epsilon) { Vec2F32 box_dim = dim_2f32(box->rect); - Mat3x3F32 box2origin_xform = make_translate_3x3f32(v2f32(-box->rect.x0 - box_dim.x/2, -box->rect.y0)); + Vec2F32 anchor_off = {0}; + if(box->flags & UI_BoxFlag_SquishAnchored) + { + anchor_off.x = box_dim.x/2.f; + } + else + { + anchor_off.y = -box_dim.y/8.f; + } + Mat3x3F32 box2origin_xform = make_translate_3x3f32(v2f32(-box->rect.x0 - box_dim.x/2 + anchor_off.x, -box->rect.y0 + anchor_off.y)); Mat3x3F32 scale_xform = make_scale_3x3f32(v2f32(1-box->squish, 1-box->squish)); - Mat3x3F32 origin2box_xform = make_translate_3x3f32(v2f32(box->rect.x0 + box_dim.x/2, box->rect.y0)); + Mat3x3F32 origin2box_xform = make_translate_3x3f32(v2f32(box->rect.x0 + box_dim.x/2 - anchor_off.x, box->rect.y0 - anchor_off.y)); Mat3x3F32 xform = mul_3x3f32(origin2box_xform, mul_3x3f32(scale_xform, box2origin_xform)); dr_push_xform2d(xform); dr_push_tex2d_sample_kind(R_Tex2DSampleKind_Linear); @@ -12776,7 +12789,6 @@ rd_frame(void) { arena_release(lister->arena); } - arena_release(ws->ctx_menu_arena); arena_release(ws->drop_completion_arena); arena_release(ws->hover_eval_arena); arena_release(ws->query_arena); @@ -15254,6 +15266,7 @@ rd_frame(void) //- rjf: panel built-in layout builds case RD_CmdKind_ResetToDefaultPanels: case RD_CmdKind_ResetToCompactPanels: + case RD_CmdKind_ResetToSimplePanels: { RD_Cfg *window = rd_cfg_from_id(rd_regs()->window); RD_Cfg *panels = rd_cfg_child_from_string(window, str8_lit("panels")); @@ -15474,6 +15487,38 @@ Z(getting_started) // rjf: set main panel as selected rd_cfg_new(main_panel, str8_lit("selected")); }break; + + //- rjf: simple layout + case RD_CmdKind_ResetToSimplePanels: + { + // rjf: root split + rd_cfg_child_from_string_or_alloc(window, str8_lit("split_x")); + RD_Cfg *root_0 = rd_cfg_new(panels, str8_lit("0.25")); + RD_Cfg *root_1 = rd_cfg_new(panels, str8_lit("0.75")); + + // rjf: fill smaller panel with watch + rd_cfg_insert_child(root_0, root_0->last, watches); + rd_cfg_new(watches, str8_lit("selected")); + + // rjf: fill main panel with getting started, OR all collected code views + RD_Cfg *main_panel = root_1; + if(getting_started != &rd_nil_cfg) + { + rd_cfg_insert_child(main_panel, main_panel->last, getting_started); + rd_cfg_new(getting_started, str8_lit("selected")); + } + else if(texts.first) + { + rd_cfg_new(texts.first->v, str8_lit("selected")); + } + for(RD_CfgNode *n = texts.first; n != 0; n = n->next) + { + rd_cfg_insert_child(main_panel, main_panel->last, n->v); + } + + // rjf: set main panel as selected + rd_cfg_new(main_panel, str8_lit("selected")); + }break; } //- rjf: release any unused views from the previous layout diff --git a/src/raddbg/raddbg_core.h b/src/raddbg/raddbg_core.h index aad81239..ce58fcee 100644 --- a/src/raddbg/raddbg_core.h +++ b/src/raddbg/raddbg_core.h @@ -545,16 +545,6 @@ struct RD_WindowState RD_Lister *autocomp_lister; U64 autocomp_lister_last_frame_idx; - // 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: drop-completion state Arena *drop_completion_arena; String8List drop_completion_paths; @@ -899,8 +889,6 @@ internal void rd_drag_kill(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 diff --git a/src/raddbg/raddbg_widgets.c b/src/raddbg/raddbg_widgets.c index 347e15b3..70ff3203 100644 --- a/src/raddbg/raddbg_widgets.c +++ b/src/raddbg/raddbg_widgets.c @@ -1149,7 +1149,7 @@ internal UI_BOX_CUSTOM_DRAW(rd_bp_box_draw_extensions) { Temp scratch = scratch_begin(0, 0); Vec4F32 color = ui_color_from_name(str8_lit("text")); - FNT_Run run = fnt_push_run_from_string(scratch.arena, rd_font_from_slot(RD_FontSlot_Code), box->font_size*0.95f, 0, 0, FNT_RasterFlag_Smooth, str8_lit("?")); + FNT_Run run = fnt_push_run_from_string(scratch.arena, rd_font_from_slot(RD_FontSlot_Code), box->font_size*0.8f, 0, 0, FNT_RasterFlag_Smooth, str8_lit("if")); Vec2F32 p = center_2f32(box->rect); p.x -= run.dim.x*0.5f; p.y += run.descent; @@ -1391,10 +1391,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe rd_set_hover_eval(v2f32(thread_box->rect.x0, thread_box->rect.y1-2.f), ctrl_string_from_handle(scratch.arena, thread->handle), str8_zero()); RD_RegsScope(.ctrl_entity = thread->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity); } - if(ui_right_clicked(thread_sig)) - { - 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); @@ -1543,10 +1539,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe rd_set_hover_eval(v2f32(thread_box->rect.x0, thread_box->rect.y1-2.f), ctrl_string_from_handle(scratch.arena, thread->handle), str8_zero()); RD_RegsScope(.ctrl_entity = thread->handle) rd_set_hover_regs(RD_RegSlot_CtrlEntity); } - if(ui_right_clicked(thread_sig)) - { - 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); diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 89490c01..8b55ffd7 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -795,7 +795,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U ui_state->build_box_count = 0; ui_state->tooltip_open = 0; ui_state->ctx_menu_changed = 0; - ui_state->default_animation_rate = 1 - pow_f32(2, (-70.f * ui_state->animation_dt)); + ui_state->default_animation_rate = 1 - pow_f32(2, (-60.f * ui_state->animation_dt)); ui_state->tooltip_can_overflow_window = 0; ui_state->tags_key_stack_top = ui_state->tags_key_stack_free = 0; ui_state->tags_cache_slots_count = 512; @@ -1117,11 +1117,15 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U Vec2F32 anchor = add_2f32(ui_state->ctx_menu_anchor_box_last_pos, ui_state->ctx_menu_anchor_off); UI_FixedX(anchor.x) UI_FixedY(anchor.y) UI_PrefWidth(ui_children_sum(1.f)) UI_PrefHeight(ui_children_sum(1.f)) UI_Focus(UI_FocusKind_On) - UI_Squish(0.25f-ui_state->ctx_menu_open_t*0.25f) + UI_Squish(0.1f-ui_state->ctx_menu_open_t*0.1f) UI_Transparency(1-ui_state->ctx_menu_open_t) { ui_set_next_child_layout_axis(Axis2_Y); - ui_state->ctx_menu_root = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawDropShadow|(ui_state->ctx_menu_open*UI_BoxFlag_DefaultFocusNavY), "###ctx_menu_%I64x", window.u64[0]); + ui_state->ctx_menu_root = ui_build_box_from_stringf(UI_BoxFlag_Clickable| + UI_BoxFlag_SquishAnchored| + UI_BoxFlag_DrawDropShadow| + (ui_state->ctx_menu_open*UI_BoxFlag_DefaultFocusNavY), + "###ctx_menu_%I64x", window.u64[0]); } } @@ -1434,14 +1438,6 @@ ui_end_build(void) } } - //- rjf: animate context menu - if(ui_state->ctx_menu_open && !ui_box_is_nil(ui_state->ctx_menu_root) && !ui_state->ctx_menu_changed) - { - UI_Box *root = ui_state->ctx_menu_root; - Rng2F32 rect = root->rect; - root->rect.y1 = root->rect.y0 + dim_2f32(rect).y * ui_state->ctx_menu_open_t; - } - //- rjf: fall-through interact with context menu if(ui_state->ctx_menu_open) { diff --git a/src/ui/ui_core.h b/src/ui/ui_core.h index fcfcc0b2..bfe298e8 100644 --- a/src/ui/ui_core.h +++ b/src/ui/ui_core.h @@ -350,6 +350,7 @@ typedef U64 UI_BoxFlags; # define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<49) # define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<50) # define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<51) +# define UI_BoxFlag_SquishAnchored (UI_BoxFlags)(1ull<<52) //- rjf: bundles # define UI_BoxFlag_Clickable (UI_BoxFlag_MouseClickable|UI_BoxFlag_KeyboardClickable)