From 9719688bb312abea4ca685b3c4c8321f090e84ef Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Sat, 13 Apr 2024 11:46:55 -0700 Subject: [PATCH] improve query visualization in tabs; don't collapse title before query string --- src/demon/win32/demon_core_win32.c | 4 +-- src/df/gfx/df_gfx.c | 50 +++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/demon/win32/demon_core_win32.c b/src/demon/win32/demon_core_win32.c index d48d7571..578edffa 100644 --- a/src/demon/win32/demon_core_win32.c +++ b/src/demon/win32/demon_core_win32.c @@ -2114,7 +2114,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) U64 total_string_size = 0; for(;total_string_size < KB(4);) { - U8 *buffer = push_array_no_zero(scratch.arena, U8, 256); + U8 *buffer = push_array(scratch.arena, U8, 256); B32 good_read = dmn_w32_process_read(process->handle, r1u64(read_addr, read_addr+256), buffer); if(good_read) { @@ -2138,7 +2138,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) } else { - read_addr += 256; + break; } } } diff --git a/src/df/gfx/df_gfx.c b/src/df/gfx/df_gfx.c index e59611d1..f7eb9f27 100644 --- a/src/df/gfx/df_gfx.c +++ b/src/df/gfx/df_gfx.c @@ -5869,16 +5869,52 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D UI_PrefWidth(ui_em(2.25f, 1.f)) ui_label(df_g_icon_kind_text_table[icon_kind]); } - UI_TextColor(df_rgba_from_theme_color(view_is_selected ? DF_ThemeColor_PlainText : DF_ThemeColor_WeakText)) - UI_PrefWidth(ui_text_dim(10, 0)) - ui_label(label); if(view->query_string_size != 0) { - UI_Font(df_font_from_slot(DF_FontSlot_Code)) - UI_FontSize(ui_top_font_size()*0.8f) - UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) + UI_PrefWidth(ui_text_dim(10, 0)) + { + Temp scratch = scratch_begin(0, 0); + D_FancyStringList fstrs = {0}; + { + D_FancyString view_title = + { + df_font_from_slot(DF_FontSlot_Main), + label, + df_rgba_from_theme_color(view_is_selected ? DF_ThemeColor_PlainText : DF_ThemeColor_WeakText), + ui_top_font_size(), + }; + d_fancy_string_list_push(scratch.arena, &fstrs, &view_title); + } + { + D_FancyString space = + { + df_font_from_slot(DF_FontSlot_Code), + str8_lit(" "), + v4f32(0, 0, 0, 0), + ui_top_font_size(), + }; + d_fancy_string_list_push(scratch.arena, &fstrs, &space); + } + { + D_FancyString query = + { + df_font_from_slot(DF_FontSlot_Code), + str8(view->query_buffer, view->query_string_size), + df_rgba_from_theme_color(DF_ThemeColor_WeakText), + ui_top_font_size(), + }; + d_fancy_string_list_push(scratch.arena, &fstrs, &query); + } + UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero()); + ui_box_equip_display_fancy_strings(box, &fstrs); + scratch_end(scratch); + } + } + else + { + UI_TextColor(df_rgba_from_theme_color(view_is_selected ? DF_ThemeColor_PlainText : DF_ThemeColor_WeakText)) UI_PrefWidth(ui_text_dim(10, 0)) - ui_label(str8(view->query_buffer, view->query_string_size)); + ui_label(label); } } UI_PrefWidth(ui_em(2.35f, 1.f)) UI_TextAlignment(UI_TextAlign_Center)