tweaks / improvements to watch windows & lister ui - display controls, appearance, remove redundant visual info

This commit is contained in:
Ryan Fleury
2026-06-03 10:28:47 -07:00
parent e7153e8910
commit 737ceb1313
6 changed files with 149 additions and 43 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ commands =
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [raddbg wsl]
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+107 -22
View File
@@ -1685,34 +1685,47 @@ rd_view_ui(Rng2F32 rect)
//- rjf: build container
UI_Box *search_row = &ui_nil_box;
UI_PrefHeight(ui_px(search_row_height, 1.f))
UI_PrefHeight(ui_px(search_row_height, 1.f)) UI_TagF("focus")
{
search_row = ui_build_box_from_stringf(UI_BoxFlag_DrawSideBottom|UI_BoxFlag_DrawDropShadow, "###search");
if(!vs->contents_are_focused)
{
ui_set_next_border_color(ui_color_from_name(s("border")));
}
search_row = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawDropShadow, "###search");
}
//- rjf: build contents
UI_Parent(search_row) UI_WidthFill UI_HeightFill UI_Focus(vs->query_is_open && !vs->contents_are_focused ? UI_FocusKind_On : UI_FocusKind_Off)
RD_Font(cmd_kind_info->query.flags & RD_QueryFlag_CodeInput ? RD_FontSlot_Code : RD_FontSlot_Main)
UI_Flags(UI_BoxFlag_DisableFocusOverlay|UI_BoxFlag_DisableFocusBorder)
{
if(cmd_name.size != 0)
UI_TagF("weak")
{
ui_spacer(ui_em(0.5f, 1.f));
UI_TextAlignment(UI_TextAlign_Center)
if(cmd_name.size != 0)
{
ui_spacer(ui_em(0.5f, 1.f));
UI_TextAlignment(UI_TextAlign_Center)
UI_Transparency(1-search_row_open_t)
UI_PrefWidth(ui_em(3.f, 1.f))
RD_Font(RD_FontSlot_Icons)
ui_label(rd_icon_kind_text_table[icon == RD_IconKind_Null ? RD_IconKind_Find : icon]);
UI_Transparency(1-search_row_open_t)
UI_PrefWidth(ui_em(3.f, 1.f))
UI_TagF("weak")
RD_Font(RD_FontSlot_Icons)
ui_label(rd_icon_kind_text_table[icon == RD_IconKind_Null ? RD_IconKind_Find : icon]);
UI_Transparency(1-search_row_open_t)
RD_Font(RD_FontSlot_Main) UI_PrefWidth(ui_text_dim(1, 1))
ui_label(rd_display_from_code_name(cmd_name));
ui_spacer(ui_em(0.5f, 1.f));
RD_Font(RD_FontSlot_Main) UI_PrefWidth(ui_text_dim(1, 1))
UI_FontSize(ui_top_font_size()*0.85f)
ui_label(rd_display_from_code_name(cmd_name));
}
else
{
ui_spacer(ui_em(0.5f, 1.f));
UI_TextAlignment(UI_TextAlign_Center) RD_Font(RD_FontSlot_Icons) UI_PrefWidth(ui_em(2.f, 1.f))
ui_label(rd_icon_kind_text_table[RD_IconKind_Find]);
}
}
UI_Key line_edit_key = {0};
RD_CellParams params = {0};
{
params.flags |= !!(cmd_kind_info->query.flags & RD_QueryFlag_CodeInput) * RD_CellFlag_CodeContents;
params.flags |= RD_CellFlag_Border;
params.flags |= RD_CellFlag_NoBackground;
params.cursor = &vs->query_cursor;
params.mark = &vs->query_mark;
params.edit_buffer = vs->query_buffer;
@@ -1888,7 +1901,7 @@ rd_view_ui(Rng2F32 rect)
UI_Padding(ui_pct(1, 0))
{
ui_labelf("use");
UI_TextAlignment(UI_TextAlign_Center) rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenPalette].string, str8_zero(), 1);
UI_TextAlignment(UI_TextAlign_Center) rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenPalette].string, s(""), 1, 0);
ui_labelf("to search for commands and options");
}
}
@@ -2026,7 +2039,7 @@ rd_view_ui(Rng2F32 rect)
{
if(expr_string.size == 0)
{
expr_string = push_str8f(scratch.arena, "query:config.$%I64x.watches", rd_regs()->view);
expr_string = str8f(scratch.arena, "query:config.$%I64x.watches", rd_regs()->view);
}
E_Eval eval = e_eval_from_string(expr_string);
RD_WatchViewState *ewv = rd_view_state(RD_WatchViewState);
@@ -5547,7 +5560,7 @@ rd_window_frame(void)
{
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
ui_box_equip_display_fstrs(box, &fstrs);
rd_cmd_binding_buttons(cmd_name, str8_zero(), 0);
rd_cmd_binding_buttons(cmd_name, str8_zero(), 4, RD_CmdBindingButtonFlag_NoEdit);
}
}break;
@@ -6505,10 +6518,11 @@ rd_window_frame(void)
for(FloatingViewTask *t = first_floating_view_task; t != 0; t = t->next)
{
// rjf: unpack
CFG_Node *view = t->view;
CFG_Node *view = t->view;
Rng2F32 rect = t->rect;
B32 is_focused = t->is_focused;
B32 is_anchored = t->is_anchored;
B32 is_lister = (cfg_node_child_from_string(view, str8_lit("lister")) != &cfg_nil_node);
B32 only_secondary_navigation = t->only_secondary_navigation;
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,
@@ -6602,18 +6616,51 @@ rd_window_frame(void)
}
// rjf: build contents
F32 total_height_px = dim_2f32(rect).y;
F32 footer_height_px = 0;
if(is_lister && !is_anchored)
{
footer_height_px = ui_top_font_size()*4.f;
}
UI_Parent(container) UI_Focus(is_focused ? UI_FocusKind_Null : UI_FocusKind_Off)
{
ui_set_next_pref_width(ui_pct(1, 0));
ui_set_next_pref_height(ui_pct(1, 0));
ui_set_next_pref_height(ui_px(total_height_px - footer_height_px, 1));
ui_set_next_child_layout_axis(Axis2_Y);
UI_Box *view_contents_container = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_Clip, "###view_contents_container");
UI_Box *view_contents_container = ui_build_box_from_stringf(UI_BoxFlag_Clip, "###view_contents_container");
UI_Parent(view_contents_container) UI_WidthFill
{
rd_view_ui(rect);
}
}
// rjf: build footer
if(is_lister && !is_anchored) UI_Parent(container) UI_WidthFill UI_HeightFill UI_Focus(UI_FocusKind_Off)
{
ui_set_next_flags(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBorder);
UI_Column UI_Padding(ui_em(1, 1))
{
UI_Row UI_Padding(ui_pct(1, 0)) RD_Font(RD_FontSlot_Main) UI_FontSize(ui_top_font_size()*0.8f) UI_TagF("alt")
UI_PrefWidth(ui_text_dim(1, 1)) UI_TextAlignment(UI_TextAlign_Center)
{
rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_MoveUp].string, s(""), 1, RD_CmdBindingButtonFlag_NoEdit);
ui_label(s("/"));
rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_MoveDown].string, s(""), 1, RD_CmdBindingButtonFlag_NoEdit);
ui_label(s("to navigate"));
ui_spacer(ui_em(1, 1));
rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_Accept].string, s(""), 1, RD_CmdBindingButtonFlag_NoEdit);
ui_label(s("to use"));
ui_spacer(ui_em(1, 1));
rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_Cancel].string, s(""), 1, RD_CmdBindingButtonFlag_NoEdit);
ui_label(s("to cancel"));
}
}
}
// rjf: build loading overlay
{
RD_ViewState *vs = rd_view_state_from_cfg(view);
@@ -8708,8 +8755,7 @@ rd_window_frame(void)
F32 border_softness = 1.f;
B32 do_background_blur = rd_setting_b32_from_name(str8_lit("background_blur"));
B32 force_opaque_floating_backgrounds = rd_setting_b32_from_name(str8_lit("opaque_backgrounds"));
B32 do_drop_shadows =
rd_setting_b32_from_name(str8_lit("drop_shadows"));
B32 do_drop_shadows = rd_setting_b32_from_name(str8_lit("drop_shadows"));
Vec4F32 base_background_color = ui_color_from_name(str8_lit("background"));
Vec4F32 base_border_color = ui_color_from_name(str8_lit("border"));
Vec4F32 drop_shadow_color = ui_color_from_name(str8_lit("drop_shadow"));
@@ -9080,6 +9126,45 @@ rd_window_frame(void)
}
}
// rjf: draw scroll fade
if(b->flags & (UI_BoxFlag_DrawFadeTop|UI_BoxFlag_DrawFadeBottom|UI_BoxFlag_DrawFadeLeft|UI_BoxFlag_DrawFadeRight))
{
Vec2F32 fade_dim = scale_2f32(dim_2f32(b->rect), 0.05f);
Vec4F32 fade_color = drop_shadow_color;
if(b->flags & UI_BoxFlag_DrawFadeTop)
{
F32 t = ui_anim(ui_key_from_string(b->key, s("fade_top")), 1.f, .rate = rd_state->catchall_animation_rate);
Rng2F32 rect = r2f32p(b->rect.x0, b->rect.y0, b->rect.x1, b->rect.y0 + fade_dim.y*t);
R_Rect2DInst *r = dr_rect(rect, fade_color, 0, 0, 0);
MemoryCopyArray(r->corner_radii, b_corner_radii);
r->colors[Corner_01] = r->colors[Corner_11] = v4f32(0, 0, 0, 0);
}
if(b->flags & UI_BoxFlag_DrawFadeBottom)
{
F32 t = ui_anim(ui_key_from_string(b->key, s("fade_bottom")), 1.f, .rate = rd_state->catchall_animation_rate);
Rng2F32 rect = r2f32p(b->rect.x0, b->rect.y1 - fade_dim.y*t, b->rect.x1, b->rect.y1);
R_Rect2DInst *r = dr_rect(rect, fade_color, 0, 0, 0);
MemoryCopyArray(r->corner_radii, b_corner_radii);
r->colors[Corner_00] = r->colors[Corner_10] = v4f32(0, 0, 0, 0);
}
if(b->flags & UI_BoxFlag_DrawFadeLeft)
{
F32 t = ui_anim(ui_key_from_string(b->key, s("fade_left")), 1.f, .rate = rd_state->catchall_animation_rate);
Rng2F32 rect = r2f32p(b->rect.x0, b->rect.y0, b->rect.x1+fade_dim.x*t, b->rect.y1);
R_Rect2DInst *r = dr_rect(rect, fade_color, 0, 0, 0);
MemoryCopyArray(r->corner_radii, b_corner_radii);
r->colors[Corner_11] = r->colors[Corner_10] = v4f32(0, 0, 0, 0);
}
if(b->flags & UI_BoxFlag_DrawFadeRight)
{
F32 t = ui_anim(ui_key_from_string(b->key, s("fade_right")), 1.f, .rate = rd_state->catchall_animation_rate);
Rng2F32 rect = r2f32p(b->rect.x1 - fade_dim.x*t, b->rect.y0, b->rect.x1, b->rect.y1);
R_Rect2DInst *r = dr_rect(rect, fade_color, 0, 0, 0);
MemoryCopyArray(r->corner_radii, b_corner_radii);
r->colors[Corner_00] = r->colors[Corner_01] = v4f32(0, 0, 0, 0);
}
}
// rjf: debug border rendering
if(b->flags & UI_BoxFlag_Debug)
{
+8 -6
View File
@@ -772,14 +772,16 @@ rd_loading_overlay(Rng2F32 rect, F32 loading_t, U64 progress_v, U64 progress_v_t
//~ rjf: UI Widgets: Fancy Buttons
internal void
rd_cmd_binding_buttons(String8 name, String8 filter, B32 add_new)
rd_cmd_binding_buttons(String8 name, String8 filter, U64 limit, RD_CmdBindingButtonFlags flags)
{
Temp scratch = scratch_begin(0, 0);
CFG_KeyMapNodePtrList key_map_nodes = cfg_key_map_node_ptr_list_from_name(scratch.arena, rd_state->key_map, name);
//- rjf: build buttons for each binding
UI_CornerRadius(ui_top_font_size()*0.5f) for(CFG_KeyMapNodePtr *n = key_map_nodes.first; n != 0; n = n->next)
U64 key_map_idx = 0;
UI_CornerRadius(ui_top_font_size()*0.5f) for(CFG_KeyMapNodePtr *n = key_map_nodes.first; n != 0; n = n->next, key_map_idx += 1)
{
if(key_map_idx >= limit) { break; }
ui_spacer(ui_em(1.f, 1.f));
CFG_Binding binding = n->v->binding;
B32 rebinding_active_for_this_binding = (rd_state->bind_change_active &&
@@ -826,7 +828,7 @@ rd_cmd_binding_buttons(String8 name, String8 filter, B32 add_new)
ui_set_next_group_key(ui_key_zero());
ui_set_next_pref_width(ui_text_dim(ui_top_font_size()*1.f, 1));
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|
UI_BoxFlag_Clickable|
(!(flags & RD_CmdBindingButtonFlag_NoEdit) * UI_BoxFlag_Clickable)|
UI_BoxFlag_DrawActiveEffects|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder|
@@ -888,7 +890,7 @@ rd_cmd_binding_buttons(String8 name, String8 filter, B32 add_new)
}
//- rjf: build "add new binding" button
if(add_new)
if(flags & RD_CmdBindingButtonFlag_AddNew)
{
B32 adding_new_binding = (rd_state->bind_change_active &&
str8_match(rd_state->bind_change_cmd_name, name, 0) &&
@@ -973,7 +975,7 @@ rd_cmd_spec_button(String8 name)
UI_TagF("weak")
UI_FastpathCodepoint(0)
{
rd_cmd_binding_buttons(name, str8_zero(), 1);
rd_cmd_binding_buttons(name, str8_zero(), max_U64, RD_CmdBindingButtonFlag_AddNew);
}
}
}
@@ -3935,7 +3937,7 @@ rd_cell(RD_CellParams *params, String8 string)
{
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_Padding(ui_em(1.f, 1.f))
{
rd_cmd_binding_buttons(params->bindings_name, params->search_needle, 1);
rd_cmd_binding_buttons(params->bindings_name, params->search_needle, max_U64, RD_CmdBindingButtonFlag_AddNew);
}
}
}
+7 -1
View File
@@ -152,7 +152,13 @@ internal void rd_loading_overlay(Rng2F32 rect, F32 loading_t, U64 progress_v, U6
////////////////////////////////
//~ rjf: UI Widgets: Fancy Buttons
internal void rd_cmd_binding_buttons(String8 name, String8 filter, B32 add_new);
typedef U32 RD_CmdBindingButtonFlags;
enum
{
RD_CmdBindingButtonFlag_AddNew = (1<<0),
RD_CmdBindingButtonFlag_NoEdit = (1<<1),
};
internal void rd_cmd_binding_buttons(String8 name, String8 filter, U64 limit, RD_CmdBindingButtonFlags flags);
internal UI_Signal rd_menu_bar_button(String8 string);
internal UI_Signal rd_cmd_spec_button(String8 name);
internal void rd_cmd_list_menu_buttons(U64 count, String8 *cmd_names, U32 *fastpath_codepoints);
+10 -1
View File
@@ -1526,7 +1526,16 @@ ui_scroll_list_begin(UI_ScrollListParams *params, UI_ScrollPt *scroll_pt, Vec2S6
UI_Box *scrollable_container_box = &ui_nil_box;
UI_Parent(container_box) UI_ChildLayoutAxis(Axis2_Y) UI_FixedWidth(params->dim_px.x-ui_scroll_list_scroll_bar_dim_px) UI_FixedHeight(params->dim_px.y)
{
scrollable_container_box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_Scroll, "###sp");
UI_BoxFlags fade_flags = 0;
if(scroll_pt->idx > params->item_range.min)
{
fade_flags |= UI_BoxFlag_DrawFadeTop;
}
if(scroll_pt->idx + num_possible_visible_rows < params->item_range.max)
{
fade_flags |= UI_BoxFlag_DrawFadeBottom;
}
scrollable_container_box = ui_build_box_from_stringf(fade_flags|UI_BoxFlag_Clip|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_Scroll, "###sp");
scrollable_container_box->view_off.y = scrollable_container_box->view_off_target.y = params->row_height_px*mod_f32(scroll_pt->off, 1.f) + params->row_height_px*(scroll_pt->off < 0) - params->row_height_px*(scroll_pt->off == -1.f && scroll_pt->idx == 1);
}
+16 -12
View File
@@ -336,20 +336,24 @@ typedef U64 UI_BoxFlags;
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<39)
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<40)
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<41)
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<42)
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<43)
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<44)
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<45)
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<46)
# define UI_BoxFlag_DisableFocusBorder (UI_BoxFlags)(1ull<<47)
# define UI_BoxFlag_DisableFocusOverlay (UI_BoxFlags)(1ull<<48)
# 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)
# define UI_BoxFlag_DrawFadeTop (UI_BoxFlags)(1ull<<42)
# define UI_BoxFlag_DrawFadeBottom (UI_BoxFlags)(1ull<<43)
# define UI_BoxFlag_DrawFadeLeft (UI_BoxFlags)(1ull<<44)
# define UI_BoxFlag_DrawFadeRight (UI_BoxFlags)(1ull<<45)
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<46)
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<47)
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<48)
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<49)
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<50)
# define UI_BoxFlag_DisableFocusBorder (UI_BoxFlags)(1ull<<51)
# define UI_BoxFlag_DisableFocusOverlay (UI_BoxFlags)(1ull<<52)
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<53)
# define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<54)
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<55)
# define UI_BoxFlag_SquishAnchored (UI_BoxFlags)(1ull<<56)
//- rjf: debug
# define UI_BoxFlag_Debug (UI_BoxFlags)(1ull<<53)
# define UI_BoxFlag_Debug (UI_BoxFlags)(1ull<<63)
//- rjf: bundles
# define UI_BoxFlag_Clickable (UI_BoxFlag_MouseClickable|UI_BoxFlag_KeyboardClickable)