mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-04 21:08:40 +00:00
extend font provider backend with ability to independently toggle hinting & full anti-aliasing; fix up ui text measurement/placement; introduce per-window settings for adjusting font rendering parameters
This commit is contained in:
+488
-256
File diff suppressed because it is too large
Load Diff
+12
-10
@@ -555,10 +555,13 @@ struct DF_Window
|
||||
OS_Handle os;
|
||||
R_Handle r;
|
||||
UI_State *ui;
|
||||
F32 code_font_size_delta;
|
||||
F32 main_font_size_delta;
|
||||
F32 last_dpi;
|
||||
B32 window_temporarily_focused_ipc;
|
||||
|
||||
// rjf: config/settings
|
||||
DF_SettingVal setting_vals[DF_SettingCode_COUNT];
|
||||
UI_Palette cfg_palettes[DF_PaletteCode_COUNT]; // derivative from theme
|
||||
|
||||
// rjf: view state delta history
|
||||
DF_StateDeltaHistory *view_state_hist;
|
||||
|
||||
@@ -627,7 +630,6 @@ struct DF_Window
|
||||
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;
|
||||
@@ -786,10 +788,9 @@ struct DF_GfxState
|
||||
Arena *cfg_code_font_path_arena;
|
||||
String8 cfg_main_font_path;
|
||||
String8 cfg_code_font_path;
|
||||
F_Tag cfg_font_tags[DF_FontSlot_COUNT]; // derivative from font paths
|
||||
UI_Palette cfg_palettes[DF_PaletteCode_COUNT]; // derivative from theme
|
||||
F_Tag cfg_font_tags[DF_FontSlot_COUNT]; // derivative from font paths
|
||||
|
||||
// rjf: settings
|
||||
// rjf: global settings
|
||||
DF_SettingVal cfg_setting_vals[DF_CfgSrc_COUNT][DF_SettingCode_COUNT];
|
||||
|
||||
// rjf: icon texture
|
||||
@@ -1039,14 +1040,14 @@ internal Vec4F32 df_rgba_from_theme_color(DF_ThemeColor color);
|
||||
internal DF_ThemeColor df_theme_color_from_txt_token_kind(TXT_TokenKind kind);
|
||||
|
||||
//- rjf: code -> palette
|
||||
internal UI_Palette *df_palette_from_code(DF_PaletteCode code);
|
||||
internal UI_Palette *df_palette_from_code(DF_Window *ws, DF_PaletteCode code);
|
||||
|
||||
//- rjf: fonts/sizes
|
||||
internal F_Tag df_font_from_slot(DF_FontSlot slot);
|
||||
internal F32 df_font_size_from_slot(DF_Window *ws, DF_FontSlot slot);
|
||||
|
||||
//- rjf: settings
|
||||
internal DF_SettingVal df_setting_val_from_code(DF_SettingCode code);
|
||||
internal DF_SettingVal df_setting_val_from_code(DF_Window *optional_window, DF_SettingCode code);
|
||||
|
||||
//- rjf: config serialization
|
||||
internal int df_qsort_compare__cfg_string_bindings(DF_StringBindingPair *a, DF_StringBindingPair *b);
|
||||
@@ -1061,18 +1062,19 @@ internal String8 df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, C
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Building Helpers
|
||||
|
||||
#define DF_Palette(code) UI_Palette(df_palette_from_code(code))
|
||||
#define DF_Palette(ws, code) UI_Palette(df_palette_from_code((ws), (code)))
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Widgets: Fancy Buttons
|
||||
|
||||
internal void df_cmd_binding_buttons(DF_CmdSpec *spec);
|
||||
internal void df_cmd_binding_button(DF_CmdSpec *spec);
|
||||
internal UI_Signal df_menu_bar_button(String8 string);
|
||||
internal UI_Signal df_cmd_spec_button(DF_CmdSpec *spec);
|
||||
internal void df_cmd_list_menu_buttons(DF_Window *ws, U64 count, DF_CoreCmdKind *cmds, U32 *fastpath_codepoints);
|
||||
internal UI_Signal df_icon_button(DF_IconKind kind, FuzzyMatchRangeList *matches, String8 string);
|
||||
internal UI_Signal df_icon_buttonf(DF_IconKind kind, FuzzyMatchRangeList *matches, char *fmt, ...);
|
||||
internal void df_entity_tooltips(DF_Entity *entity);
|
||||
internal void df_entity_tooltips(DF_Window *ws, DF_Entity *entity);
|
||||
internal UI_Signal df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *name_matches, String8 fuzzy_query, B32 is_implicit);
|
||||
internal void df_entity_src_loc_button(DF_Window *ws, DF_Entity *entity, TxtPt point);
|
||||
|
||||
|
||||
+25
-14
@@ -547,22 +547,28 @@ DF_ThemeColorVersionRemapTable:
|
||||
////////////////////////////////
|
||||
//~ rjf: Settings
|
||||
|
||||
@table(name name_lower display_string default_s32 s32_min s32_max)
|
||||
@table(name name_lower display_string default_per_window default_s32 s32_min s32_max)
|
||||
DF_SettingTable:
|
||||
{
|
||||
{HoverAnimations hover_animations "Hover Animations" 1 0 1 }
|
||||
{PressAnimations press_animations "Press Animations" 1 0 1 }
|
||||
{FocusAnimations focus_animations "Focus Animations" 1 0 1 }
|
||||
{TooltipAnimations tooltip_animations "Tooltip Animations" 1 0 1 }
|
||||
{MenuAnimations menu_animations "Menu Animations" 1 0 1 }
|
||||
{ScrollingAnimations scrolling_animations "Scrolling Animations" 1 0 1 }
|
||||
{BackgroundBlur background_blur "Background Blur" 1 0 1 }
|
||||
{ThreadLines thread_lines "Thread Lines" 1 0 1 }
|
||||
{BreakpointLines breakpoint_lines "Breakpoint Lines" 1 0 1 }
|
||||
{ThreadGlow thread_glow "Thread Glow" 1 0 1 }
|
||||
{BreakpointGlow breakpoint_glow "Breakpoint Glow" 1 0 1 }
|
||||
{OpaqueBackgrounds opaque_backgrounds "Opaque Backgrounds" 0 0 1 }
|
||||
{TabWidth tab_width "Tab Width" 4 1 32 }
|
||||
{HoverAnimations hover_animations "Hover Animations" 0 1 0 1 }
|
||||
{PressAnimations press_animations "Press Animations" 0 1 0 1 }
|
||||
{FocusAnimations focus_animations "Focus Animations" 0 1 0 1 }
|
||||
{TooltipAnimations tooltip_animations "Tooltip Animations" 0 1 0 1 }
|
||||
{MenuAnimations menu_animations "Menu Animations" 0 1 0 1 }
|
||||
{ScrollingAnimations scrolling_animations "Scrolling Animations" 0 1 0 1 }
|
||||
{BackgroundBlur background_blur "Background Blur" 0 1 0 1 }
|
||||
{ThreadLines thread_lines "Thread Lines" 0 1 0 1 }
|
||||
{BreakpointLines breakpoint_lines "Breakpoint Lines" 0 1 0 1 }
|
||||
{ThreadGlow thread_glow "Thread Glow" 0 1 0 1 }
|
||||
{BreakpointGlow breakpoint_glow "Breakpoint Glow" 0 1 0 1 }
|
||||
{OpaqueBackgrounds opaque_backgrounds "Opaque Backgrounds" 0 0 0 1 }
|
||||
{TabWidth tab_width "Tab Width" 0 4 1 32 }
|
||||
{MainFontSize main_font_size "Main Font Size" 1 12 6 72 }
|
||||
{CodeFontSize code_font_size "Code Font Size" 1 12 6 72 }
|
||||
{SmoothUIText smooth_ui_text "Smooth UI Text" 1 1 0 1 }
|
||||
{SmoothCodeText smooth_code_text "Smooth Code Text" 1 0 0 1 }
|
||||
{HintUIText hint_ui_text "Hint UI Text" 1 1 0 1 }
|
||||
{HintCodeText hint_code_text "Hint Code Text" 1 1 0 1 }
|
||||
}
|
||||
|
||||
@enum DF_SettingCode:
|
||||
@@ -581,6 +587,11 @@ DF_SettingTable:
|
||||
@expand(DF_SettingTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
}
|
||||
|
||||
@data(B8) df_g_setting_code_default_is_per_window_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `$(a.default_per_window)`
|
||||
}
|
||||
|
||||
@data(DF_SettingVal) df_g_setting_code_default_val_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `{1, $(a.default_s32)}`
|
||||
|
||||
@@ -577,7 +577,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
}
|
||||
code_slice_params.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
code_slice_params.font_size = ui_top_font_size();
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(ws, DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.line_height_px = ui_top_font_size()*1.5f;
|
||||
code_slice_params.priority_margin_width_px = 0;
|
||||
code_slice_params.catchall_margin_width_px = 0;
|
||||
@@ -740,7 +740,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
}
|
||||
code_slice_params.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
code_slice_params.font_size = ui_top_font_size();
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(ws, DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.line_height_px = ui_top_font_size()*1.5f;
|
||||
code_slice_params.priority_margin_width_px = 0;
|
||||
code_slice_params.catchall_margin_width_px = 0;
|
||||
|
||||
+100
-44
@@ -473,7 +473,7 @@ df_code_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_CodeViewSta
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
F_Tag code_font = df_font_from_slot(DF_FontSlot_Code);
|
||||
F32 code_font_size = df_font_size_from_slot(ws, DF_FontSlot_Code);
|
||||
F32 code_tab_size = f_column_size_from_tag_size(code_font, code_font_size)*df_setting_val_from_code(DF_SettingCode_TabWidth).s32;
|
||||
F32 code_tab_size = f_column_size_from_tag_size(code_font, code_font_size)*df_setting_val_from_code(ws, DF_SettingCode_TabWidth).s32;
|
||||
F_Metrics code_font_metrics = f_metrics_from_tag_size(code_font, code_font_size);
|
||||
F32 code_line_height = ceil_f32(f_line_height_from_metrics(&code_font_metrics) * 1.5f);
|
||||
F32 big_glyph_advance = f_dim_from_tag_size_string(code_font, code_font_size, 0, 0, str8_lit("H")).x;
|
||||
@@ -2965,7 +2965,7 @@ DF_VIEW_UI_FUNCTION_DEF(Empty)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_PrefWidth(ui_em(15.f, 1.f))
|
||||
UI_CornerRadius(ui_top_font_size()/2.f)
|
||||
DF_Palette(DF_PaletteCode_NegativePopButton)
|
||||
DF_Palette(ws, DF_PaletteCode_NegativePopButton)
|
||||
{
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_X, 0, "Close Panel")))
|
||||
{
|
||||
@@ -3039,7 +3039,7 @@ DF_VIEW_UI_FUNCTION_DEF(GettingStarted)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_PrefWidth(ui_em(22.f, 1.f))
|
||||
UI_CornerRadius(ui_top_font_size()/2.f)
|
||||
DF_Palette(DF_PaletteCode_NeutralPopButton)
|
||||
DF_Palette(ws, DF_PaletteCode_NeutralPopButton)
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_Add, 0, "Add Target")))
|
||||
{
|
||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||
@@ -3061,7 +3061,7 @@ DF_VIEW_UI_FUNCTION_DEF(GettingStarted)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_PrefWidth(ui_em(22.f, 1.f))
|
||||
UI_CornerRadius(ui_top_font_size()/2.f)
|
||||
DF_Palette(DF_PaletteCode_PositivePopButton)
|
||||
DF_Palette(ws, DF_PaletteCode_PositivePopButton)
|
||||
{
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_Play, 0, "Launch %S", target_name)))
|
||||
{
|
||||
@@ -3108,7 +3108,7 @@ DF_VIEW_UI_FUNCTION_DEF(GettingStarted)
|
||||
{
|
||||
ui_labelf("use");
|
||||
DF_CmdSpec *spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_RunCommand);
|
||||
UI_Flags(UI_BoxFlag_DrawBorder) UI_TextAlignment(UI_TextAlign_Center) df_cmd_binding_button(spec);
|
||||
UI_Flags(UI_BoxFlag_DrawBorder) UI_TextAlignment(UI_TextAlign_Center) df_cmd_binding_buttons(spec);
|
||||
ui_labelf("to open command menu");
|
||||
}
|
||||
}
|
||||
@@ -3216,7 +3216,7 @@ DF_VIEW_UI_FUNCTION_DEF(Commands)
|
||||
UI_Column
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
UI_HeightFill
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
@@ -3248,10 +3248,15 @@ DF_VIEW_UI_FUNCTION_DEF(Commands)
|
||||
ui_box_equip_fuzzy_match_ranges(desc_box, &item->desc_match_ranges);
|
||||
}
|
||||
|
||||
//- rjf: binding
|
||||
UI_PrefWidth(ui_pct(0.15f, 1.f)) UI_HeightFill UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
//- rjf: bindings
|
||||
ui_set_next_flags(UI_BoxFlag_Clickable);
|
||||
UI_PrefWidth(ui_children_sum(1.f)) UI_HeightFill UI_NamedColumn(str8_lit("binding_column")) UI_Padding(ui_em(1.f, 1.f))
|
||||
{
|
||||
df_cmd_binding_button(item->cmd_spec);
|
||||
ui_set_next_flags(UI_BoxFlag_Clickable);
|
||||
UI_NamedRow(str8_lit("binding_row")) UI_Padding(ui_em(1.f, 1.f))
|
||||
{
|
||||
df_cmd_binding_buttons(item->cmd_spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3610,7 +3615,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
// rjf: icons
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_PrefWidth(ui_em(3.f, 1.f))
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
@@ -3659,7 +3664,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
// rjf: icon to signify directory
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_PrefWidth(ui_em(3.f, 1.f))
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
@@ -3848,7 +3853,7 @@ DF_VIEW_UI_FUNCTION_DEF(SystemProcesses)
|
||||
// rjf: icon
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_PrefWidth(ui_em(3.f, 1.f))
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
@@ -4022,7 +4027,7 @@ DF_VIEW_UI_FUNCTION_DEF(EntityLister)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
ui_label(df_g_icon_kind_text_table[icon_kind]);
|
||||
@@ -5545,11 +5550,11 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
|
||||
UI_Palette *palette = ui_top_palette();
|
||||
if(frozen)
|
||||
{
|
||||
palette = df_palette_from_code(DF_PaletteCode_NegativePopButton);
|
||||
palette = df_palette_from_code(ws, DF_PaletteCode_NegativePopButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
palette = df_palette_from_code(DF_PaletteCode_PositivePopButton);
|
||||
palette = df_palette_from_code(ws, DF_PaletteCode_PositivePopButton);
|
||||
}
|
||||
UI_Signal sig = {0};
|
||||
UI_Palette(palette) sig = df_icon_buttonf(frozen ? DF_IconKind_Locked : DF_IconKind_Unlocked, 0, "###lock_%p", entity);
|
||||
@@ -5602,7 +5607,7 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
|
||||
}
|
||||
UI_TableCellSized(ui_em(2.25f, 1.f)) UI_FocusHot((row_is_selected && cursor.x == 4) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
{
|
||||
DF_Palette(DF_PaletteCode_NegativePopButton)
|
||||
DF_Palette(ws, DF_PaletteCode_NegativePopButton)
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_X, 0, "###kill")))
|
||||
{
|
||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||
@@ -5777,7 +5782,7 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
|
||||
UI_TableCell
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_WidthFill
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_FocusHot((row_selected && cs->cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
@@ -6504,7 +6509,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
UI_Palette(ui_build_palette(ui_top_palette(), .text = df_rgba_from_theme_color(DF_ThemeColor_TextNegative)))
|
||||
{
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
ui_label(df_g_icon_kind_text_table[DF_IconKind_WarningBig]);
|
||||
ui_labelf("Could not find \"%S\".", full_path);
|
||||
}
|
||||
@@ -6514,7 +6519,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
UI_CornerRadius(ui_top_font_size()/3)
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
UI_Focus(UI_FocusKind_On)
|
||||
DF_Palette(DF_PaletteCode_NeutralPopButton)
|
||||
DF_Palette(ws, DF_PaletteCode_NeutralPopButton)
|
||||
if(ui_clicked(ui_buttonf("Find alternative...")))
|
||||
{
|
||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||
@@ -6567,7 +6572,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
UI_Box *box = &ui_g_nil_box;
|
||||
UI_Palette(ui_build_palette(ui_top_palette(), .text = df_rgba_from_theme_color(DF_ThemeColor_TextNegative)))
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
{
|
||||
box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_Clickable, "%S###file_ood_warning", df_g_icon_kind_text_table[DF_IconKind_WarningBig]);
|
||||
}
|
||||
@@ -8520,24 +8525,28 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
{
|
||||
DF_SettingsItemList items_list = {0};
|
||||
|
||||
//- rjf: settings header
|
||||
//- rjf: global settings header
|
||||
if(query.size == 0)
|
||||
{
|
||||
DF_SettingsItemNode *n = push_array(scratch.arena, DF_SettingsItemNode, 1);
|
||||
SLLQueuePush(items_list.first, items_list.last, n);
|
||||
items_list.count += 1;
|
||||
n->v.kind = DF_SettingsItemKind_CategoryHeader;
|
||||
n->v.string = str8_lit("Interface Settings");
|
||||
n->v.icon_kind = sv->category_opened[DF_SettingsItemKind_Setting] ? DF_IconKind_DownCaret : DF_IconKind_RightCaret;
|
||||
n->v.category = DF_SettingsItemKind_Setting;
|
||||
n->v.string = str8_lit("Global Interface Settings");
|
||||
n->v.icon_kind = sv->category_opened[DF_SettingsItemKind_GlobalSetting] ? DF_IconKind_DownCaret : DF_IconKind_RightCaret;
|
||||
n->v.category = DF_SettingsItemKind_GlobalSetting;
|
||||
}
|
||||
|
||||
//- rjf: gather all settings
|
||||
if(sv->category_opened[DF_SettingsItemKind_Setting] || query.size != 0)
|
||||
//- rjf: gather all global settings
|
||||
if(sv->category_opened[DF_SettingsItemKind_GlobalSetting] || query.size != 0)
|
||||
{
|
||||
for(EachEnumVal(DF_SettingCode, code))
|
||||
{
|
||||
String8 kind_string = str8_lit("Interface");
|
||||
if(df_g_setting_code_default_is_per_window_table[code])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String8 kind_string = str8_lit("Global Interface Setting");
|
||||
String8 string = df_g_setting_code_display_string_table[code];
|
||||
FuzzyMatchRangeList kind_string_matches = fuzzy_match_find(scratch.arena, query, kind_string);
|
||||
FuzzyMatchRangeList string_matches = fuzzy_match_find(scratch.arena, query, string);
|
||||
@@ -8547,7 +8556,49 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
DF_SettingsItemNode *n = push_array(scratch.arena, DF_SettingsItemNode, 1);
|
||||
SLLQueuePush(items_list.first, items_list.last, n);
|
||||
items_list.count += 1;
|
||||
n->v.kind = DF_SettingsItemKind_Setting;
|
||||
n->v.kind = DF_SettingsItemKind_GlobalSetting;
|
||||
n->v.kind_string = kind_string;
|
||||
n->v.string = string;
|
||||
n->v.kind_string_matches = kind_string_matches;
|
||||
n->v.string_matches = string_matches;
|
||||
n->v.icon_kind = DF_IconKind_Window;
|
||||
n->v.code = code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: window settings header
|
||||
if(query.size == 0)
|
||||
{
|
||||
DF_SettingsItemNode *n = push_array(scratch.arena, DF_SettingsItemNode, 1);
|
||||
SLLQueuePush(items_list.first, items_list.last, n);
|
||||
items_list.count += 1;
|
||||
n->v.kind = DF_SettingsItemKind_CategoryHeader;
|
||||
n->v.string = str8_lit("Window Interface Settings");
|
||||
n->v.icon_kind = sv->category_opened[DF_SettingsItemKind_WindowSetting] ? DF_IconKind_DownCaret : DF_IconKind_RightCaret;
|
||||
n->v.category = DF_SettingsItemKind_WindowSetting;
|
||||
}
|
||||
|
||||
//- rjf: gather all window settings
|
||||
if(sv->category_opened[DF_SettingsItemKind_WindowSetting] || query.size != 0)
|
||||
{
|
||||
for(EachEnumVal(DF_SettingCode, code))
|
||||
{
|
||||
if(!df_g_setting_code_default_is_per_window_table[code])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String8 kind_string = str8_lit("Window Interface Setting");
|
||||
String8 string = df_g_setting_code_display_string_table[code];
|
||||
FuzzyMatchRangeList kind_string_matches = fuzzy_match_find(scratch.arena, query, kind_string);
|
||||
FuzzyMatchRangeList string_matches = fuzzy_match_find(scratch.arena, query, string);
|
||||
if(string_matches.count == string_matches.needle_part_count ||
|
||||
kind_string_matches.count == kind_string_matches.needle_part_count)
|
||||
{
|
||||
DF_SettingsItemNode *n = push_array(scratch.arena, DF_SettingsItemNode, 1);
|
||||
SLLQueuePush(items_list.first, items_list.last, n);
|
||||
items_list.count += 1;
|
||||
n->v.kind = DF_SettingsItemKind_WindowSetting;
|
||||
n->v.kind_string = kind_string;
|
||||
n->v.string = string;
|
||||
n->v.kind_string_matches = kind_string_matches;
|
||||
@@ -8674,7 +8725,7 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
color < DF_ThemeColor_COUNT;
|
||||
color = (DF_ThemeColor)(color+1))
|
||||
{
|
||||
DF_Palette(DF_PaletteCode_Floating)
|
||||
DF_Palette(ws, DF_PaletteCode_Floating)
|
||||
UI_CtxMenu(color_ctx_menu_keys[color])
|
||||
UI_Padding(ui_em(1.5f, 1.f))
|
||||
UI_PrefWidth(ui_em(28.5f, 1)) UI_PrefHeight(ui_children_sum(1.f))
|
||||
@@ -8878,6 +8929,7 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
S32 slider_s32_val = 0;
|
||||
F32 slider_pct = 0.f;
|
||||
UI_BoxFlags flags = UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawHotEffects|UI_BoxFlag_DrawActiveEffects;
|
||||
DF_SettingVal *val_table = &df_gfx_state->cfg_setting_vals[DF_CfgSrc_User][0];
|
||||
switch(item->kind)
|
||||
{
|
||||
case DF_SettingsItemKind_COUNT:{}break;
|
||||
@@ -8903,20 +8955,22 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
{
|
||||
rgba = df_rgba_from_theme_color(item->color);
|
||||
}break;
|
||||
case DF_SettingsItemKind_Setting:
|
||||
case DF_SettingsItemKind_WindowSetting: {val_table = &ws->setting_vals[0];}goto setting;
|
||||
case DF_SettingsItemKind_GlobalSetting:{}goto setting;
|
||||
setting:;
|
||||
{
|
||||
s32_range = df_g_setting_code_s32_range_table[item->code];
|
||||
if(s32_range.min != 0 || s32_range.max != 1)
|
||||
{
|
||||
cursor = OS_Cursor_LeftRight;
|
||||
is_slider = 1;
|
||||
slider_s32_val = df_setting_val_from_code(item->code).s32;
|
||||
slider_s32_val = val_table[item->code].s32;
|
||||
slider_pct = (F32)(slider_s32_val - s32_range.min) / dim_1s32(s32_range);
|
||||
}
|
||||
else
|
||||
{
|
||||
is_toggler = 1;
|
||||
is_toggled = !!df_setting_val_from_code(item->code).s32;
|
||||
is_toggled = !!val_table[item->code].s32;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@@ -8940,11 +8994,11 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
{
|
||||
UI_PrefWidth(ui_em(2.f, 1.f))
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_Palette(ui_build_palette(ui_top_palette(), .text = rgba))
|
||||
ui_label(df_g_icon_kind_text_table[item->icon_kind]);
|
||||
}
|
||||
if(item->kind_string.size != 0) UI_PrefWidth(ui_text_dim(10, 1))
|
||||
if(query.size != 0 && item->kind_string.size != 0) UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_DrawTextWeak, "%S", item->kind_string);
|
||||
ui_box_equip_fuzzy_match_ranges(box, &item->kind_string_matches);
|
||||
@@ -8967,7 +9021,7 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
ui_spacer(ui_pct(1, 0));
|
||||
UI_PrefWidth(ui_em(2.5f, 1.f))
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Icons))
|
||||
UI_RunFlags(F_RunFlag_Smooth)
|
||||
UI_TextRasterFlags(F_RasterFlag_Smooth)
|
||||
UI_Flags(UI_BoxFlag_DrawTextWeak)
|
||||
ui_label(df_g_icon_kind_text_table[is_toggled ? DF_IconKind_CheckFilled : DF_IconKind_CheckHollow]);
|
||||
}
|
||||
@@ -8975,7 +9029,7 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
{
|
||||
ui_spacer(ui_pct(1, 0));
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
DF_Palette(DF_PaletteCode_NegativePopButton)
|
||||
DF_Palette(ws, DF_PaletteCode_NegativePopButton)
|
||||
UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
UI_FontSize(ui_top_font_size()*0.9f)
|
||||
ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_DrawBackground, "Click Again To Apply");
|
||||
@@ -8997,12 +9051,14 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
|
||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
|
||||
}
|
||||
if(item->kind == DF_SettingsItemKind_Setting && is_toggler && ui_clicked(sig))
|
||||
if((item->kind == DF_SettingsItemKind_GlobalSetting || item->kind == DF_SettingsItemKind_WindowSetting) &&
|
||||
is_toggler && ui_clicked(sig))
|
||||
{
|
||||
df_gfx_state->cfg_setting_vals[DF_CfgSrc_User][item->code].s32 ^= 1;
|
||||
df_gfx_state->cfg_setting_vals[DF_CfgSrc_User][item->code].set = 1;
|
||||
val_table[item->code].s32 ^= 1;
|
||||
val_table[item->code].set = 1;
|
||||
}
|
||||
if(item->kind == DF_SettingsItemKind_Setting && is_slider && ui_dragging(sig))
|
||||
if((item->kind == DF_SettingsItemKind_GlobalSetting || item->kind == DF_SettingsItemKind_WindowSetting) &&
|
||||
is_slider && ui_dragging(sig))
|
||||
{
|
||||
if(ui_pressed(sig))
|
||||
{
|
||||
@@ -9012,8 +9068,8 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
Vec2F32 delta = ui_drag_delta();
|
||||
S32 pst_drag_val = pre_drag_val + (S32)(delta.x/(ui_top_font_size()*2.f));
|
||||
pst_drag_val = clamp_1s32(s32_range, pst_drag_val);
|
||||
df_gfx_state->cfg_setting_vals[DF_CfgSrc_User][item->code].s32 = pst_drag_val;
|
||||
df_gfx_state->cfg_setting_vals[DF_CfgSrc_User][item->code].set = 1;
|
||||
val_table[item->code].s32 = pst_drag_val;
|
||||
val_table[item->code].set = 1;
|
||||
}
|
||||
if(item->kind == DF_SettingsItemKind_ThemePreset && ui_clicked(sig))
|
||||
{
|
||||
@@ -9068,7 +9124,7 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
|
||||
//- rjf: build preset ctx menu
|
||||
UI_Key preset_ctx_menu_key = ui_key_from_stringf(ui_key_zero(), "%p_preset_ctx_menu", view);
|
||||
DF_Palette(DF_PaletteCode_Floating) UI_CtxMenu(preset_ctx_menu_key) UI_PrefWidth(ui_em(30.f, 1.f))
|
||||
DF_Palette(ws, DF_PaletteCode_Floating) UI_CtxMenu(preset_ctx_menu_key) UI_PrefWidth(ui_em(30.f, 1.f))
|
||||
{
|
||||
for(DF_ThemePreset preset = (DF_ThemePreset)0;
|
||||
preset < DF_ThemePreset_COUNT;
|
||||
@@ -9104,7 +9160,7 @@ DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
color < DF_ThemeColor_COUNT;
|
||||
color = (DF_ThemeColor)(color+1))
|
||||
{
|
||||
DF_Palette(DF_PaletteCode_Floating)
|
||||
DF_Palette(ws, DF_PaletteCode_Floating)
|
||||
UI_CtxMenu(color_ctx_menu_keys[color])
|
||||
UI_Padding(ui_em(1.5f, 1.f))
|
||||
UI_PrefWidth(ui_em(28.5f, 1)) UI_PrefHeight(ui_children_sum(1.f))
|
||||
|
||||
@@ -441,7 +441,8 @@ struct DF_MemoryViewState
|
||||
typedef enum DF_SettingsItemKind
|
||||
{
|
||||
DF_SettingsItemKind_CategoryHeader,
|
||||
DF_SettingsItemKind_Setting,
|
||||
DF_SettingsItemKind_GlobalSetting,
|
||||
DF_SettingsItemKind_WindowSetting,
|
||||
DF_SettingsItemKind_ThemeColor,
|
||||
DF_SettingsItemKind_ThemePreset,
|
||||
DF_SettingsItemKind_COUNT
|
||||
|
||||
@@ -1186,7 +1186,7 @@ str8_lit_comp("thread_error"),
|
||||
str8_lit_comp("breakpoint"),
|
||||
};
|
||||
|
||||
String8 df_g_setting_code_display_string_table[13] =
|
||||
String8 df_g_setting_code_display_string_table[19] =
|
||||
{
|
||||
str8_lit_comp("Hover Animations"),
|
||||
str8_lit_comp("Press Animations"),
|
||||
@@ -1201,9 +1201,15 @@ str8_lit_comp("Thread Glow"),
|
||||
str8_lit_comp("Breakpoint Glow"),
|
||||
str8_lit_comp("Opaque Backgrounds"),
|
||||
str8_lit_comp("Tab Width"),
|
||||
str8_lit_comp("Main Font Size"),
|
||||
str8_lit_comp("Code Font Size"),
|
||||
str8_lit_comp("Smooth UI Text"),
|
||||
str8_lit_comp("Smooth Code Text"),
|
||||
str8_lit_comp("Hint UI Text"),
|
||||
str8_lit_comp("Hint Code Text"),
|
||||
};
|
||||
|
||||
String8 df_g_setting_code_lower_string_table[13] =
|
||||
String8 df_g_setting_code_lower_string_table[19] =
|
||||
{
|
||||
str8_lit_comp("hover_animations"),
|
||||
str8_lit_comp("press_animations"),
|
||||
@@ -1218,9 +1224,38 @@ str8_lit_comp("thread_glow"),
|
||||
str8_lit_comp("breakpoint_glow"),
|
||||
str8_lit_comp("opaque_backgrounds"),
|
||||
str8_lit_comp("tab_width"),
|
||||
str8_lit_comp("main_font_size"),
|
||||
str8_lit_comp("code_font_size"),
|
||||
str8_lit_comp("smooth_ui_text"),
|
||||
str8_lit_comp("smooth_code_text"),
|
||||
str8_lit_comp("hint_ui_text"),
|
||||
str8_lit_comp("hint_code_text"),
|
||||
};
|
||||
|
||||
DF_SettingVal df_g_setting_code_default_val_table[13] =
|
||||
B8 df_g_setting_code_default_is_per_window_table[19] =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
};
|
||||
|
||||
DF_SettingVal df_g_setting_code_default_val_table[19] =
|
||||
{
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
@@ -1235,9 +1270,15 @@ DF_SettingVal df_g_setting_code_default_val_table[13] =
|
||||
{1, 1},
|
||||
{1, 0},
|
||||
{1, 4},
|
||||
{1, 12},
|
||||
{1, 12},
|
||||
{1, 1},
|
||||
{1, 0},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
};
|
||||
|
||||
Rng1S32 df_g_setting_code_s32_range_table[13] =
|
||||
Rng1S32 df_g_setting_code_s32_range_table[19] =
|
||||
{
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
@@ -1252,6 +1293,12 @@ Rng1S32 df_g_setting_code_s32_range_table[13] =
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{1, 32},
|
||||
{6, 72},
|
||||
{6, 72},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
};
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
@@ -151,6 +151,12 @@ DF_SettingCode_ThreadGlow,
|
||||
DF_SettingCode_BreakpointGlow,
|
||||
DF_SettingCode_OpaqueBackgrounds,
|
||||
DF_SettingCode_TabWidth,
|
||||
DF_SettingCode_MainFontSize,
|
||||
DF_SettingCode_CodeFontSize,
|
||||
DF_SettingCode_SmoothUIText,
|
||||
DF_SettingCode_SmoothCodeText,
|
||||
DF_SettingCode_HintUIText,
|
||||
DF_SettingCode_HintCodeText,
|
||||
DF_SettingCode_COUNT,
|
||||
} DF_SettingCode;
|
||||
|
||||
@@ -337,10 +343,11 @@ extern Vec4F32 df_g_theme_preset_colors__far_manager[75];
|
||||
extern Vec4F32* df_g_theme_preset_colors_table[9];
|
||||
extern String8 df_g_theme_color_display_string_table[75];
|
||||
extern String8 df_g_theme_color_cfg_string_table[75];
|
||||
extern String8 df_g_setting_code_display_string_table[13];
|
||||
extern String8 df_g_setting_code_lower_string_table[13];
|
||||
extern DF_SettingVal df_g_setting_code_default_val_table[13];
|
||||
extern Rng1S32 df_g_setting_code_s32_range_table[13];
|
||||
extern String8 df_g_setting_code_display_string_table[19];
|
||||
extern String8 df_g_setting_code_lower_string_table[19];
|
||||
extern B8 df_g_setting_code_default_is_per_window_table[19];
|
||||
extern DF_SettingVal df_g_setting_code_default_val_table[19];
|
||||
extern Rng1S32 df_g_setting_code_s32_range_table[19];
|
||||
read_only global U8 df_g_icon_font_bytes__data[] =
|
||||
{
|
||||
0x00,0x01,0x00,0x00,0x00,0x0f,0x00,0x80,0x00,0x03,0x00,0x70,0x47,0x53,0x55,0x42,0x20,0x8b,0x25,0x7a,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x54,0x4f,0x53,0x2f,0x32,0x56,0x44,0x49,0xa0,0x00,0x00,0x01,0x50,0x00,0x00,0x00,0x60,0x63,0x6d,0x61,0x70,0x2a,0x09,0xe2,0xc2,0x00,0x00,0x01,0xb0,0x00,0x00,0x05,0xec,0x63,0x76,0x74,0x20,
|
||||
|
||||
Reference in New Issue
Block a user