mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-04 04:48:40 +00:00
adjust metagen to support correctly-escaped multiline string generations; sketch out setting schemas; eliminate old settings hack, move to using cfg tree & settings schema
This commit is contained in:
@@ -73,11 +73,12 @@ RD_VocabularyInfo rd_vocabulary_info_table[41] =
|
||||
{str8_lit_comp("label"), str8_lit_comp("labels"), str8_lit_comp("Label"), str8_lit_comp("Labels"), RD_IconKind_Null},
|
||||
};
|
||||
|
||||
RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[5] =
|
||||
RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[6] =
|
||||
{
|
||||
{str8_lit_comp("target"), str8_lit_comp("x:{'label':code_string, 'exe':path, 'args':string, 'working_directory':path, 'entry_point':code_string, 'stdout_path':path, 'stderr_path':path, 'stdin_path':path, 'debug_subprocesses':bool}")},
|
||||
{str8_lit_comp("breakpoint"), str8_lit_comp("x:{'label':code_string, 'condition':code_string, 'location':location, 'hit_count':u64, 'enabled':bool}")},
|
||||
{str8_lit_comp("watch_pin"), str8_lit_comp("x:{'expression':code_string, 'view_rule':code_string, 'location':location}")},
|
||||
{str8_lit_comp("settings"), str8_lit_comp("x:\n{\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n @default(1) 'background_blur': bool,\n @default(1) 'thread_lines': bool,\n @default(1) 'breakpoint_lines': bool,\n @default(1) 'thread_glow': bool,\n @default(1) 'breakpoint_glow': bool,\n @default(0) 'opaque_backgrounds': bool,\n @default(1) 'smooth_main_text': bool,\n @default(0) 'smooth_code_text': bool,\n @default(1) 'hint_main_text': bool,\n @default(1) 'hint_code_text': bool,\n @default(2) 'tab_width': @range[1, 32] u64,\n @can_be_per_window 'main_font_size': @range[6, 72] u64,\n @can_be_per_window 'code_font_size': @range[1, 32] u64,\n}\n")},
|
||||
{str8_lit_comp("target"), str8_lit_comp("x:\n{\n 'label': code_string,\n 'exe': path,\n 'args': string,\n 'working_directory': path,\n 'entry_point': code_string,\n 'stdout_path': path,\n 'stderr_path': path,\n 'stdin_path': path,\n 'debug_subprocesses': bool,\n}\n")},
|
||||
{str8_lit_comp("breakpoint"), str8_lit_comp("x:\n{\n 'label': code_string,\n 'condition': code_string,\n 'location': location,\n 'hit_count': u64,\n 'disabled': bool,\n}\n")},
|
||||
{str8_lit_comp("watch_pin"), str8_lit_comp("x:\n{\n 'expression':code_string,\n 'view_rule':code_string,\n 'location':location,\n}\n")},
|
||||
{str8_lit_comp("file_path_map"), str8_lit_comp("x:{'source':path, 'dest':path}")},
|
||||
{str8_lit_comp("auto_view_rule"), str8_lit_comp("x:{'source':code_string, 'dest':code_string}")},
|
||||
};
|
||||
@@ -1897,120 +1898,5 @@ str8_lit_comp("breakpoint"),
|
||||
str8_lit_comp("cache_line_boundary"),
|
||||
};
|
||||
|
||||
String8 rd_setting_code_display_string_table[19] =
|
||||
{
|
||||
str8_lit_comp("Hover Animations"),
|
||||
str8_lit_comp("Press Animations"),
|
||||
str8_lit_comp("Focus Animations"),
|
||||
str8_lit_comp("Tooltip Animations"),
|
||||
str8_lit_comp("Menu Animations"),
|
||||
str8_lit_comp("Scrolling Animations"),
|
||||
str8_lit_comp("Background Blur"),
|
||||
str8_lit_comp("Thread Lines"),
|
||||
str8_lit_comp("Breakpoint Lines"),
|
||||
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 rd_setting_code_lower_string_table[19] =
|
||||
{
|
||||
str8_lit_comp("hover_animations"),
|
||||
str8_lit_comp("press_animations"),
|
||||
str8_lit_comp("focus_animations"),
|
||||
str8_lit_comp("tooltip_animations"),
|
||||
str8_lit_comp("menu_animations"),
|
||||
str8_lit_comp("scrolling_animations"),
|
||||
str8_lit_comp("background_blur"),
|
||||
str8_lit_comp("thread_lines"),
|
||||
str8_lit_comp("breakpoint_lines"),
|
||||
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"),
|
||||
};
|
||||
|
||||
B8 rd_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,
|
||||
};
|
||||
|
||||
RD_SettingVal rd_setting_code_default_val_table[19] =
|
||||
{
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 0},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 0},
|
||||
{1, 4},
|
||||
{1, 11},
|
||||
{1, 11},
|
||||
{1, 1},
|
||||
{1, 0},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
};
|
||||
|
||||
Rng1S32 rd_setting_code_s32_range_table[19] =
|
||||
{
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{1, 32},
|
||||
{6, 72},
|
||||
{6, 72},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
};
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
|
||||
@@ -512,30 +512,6 @@ RD_ThemePreset_FarManager,
|
||||
RD_ThemePreset_COUNT,
|
||||
} RD_ThemePreset;
|
||||
|
||||
typedef enum RD_SettingCode
|
||||
{
|
||||
RD_SettingCode_HoverAnimations,
|
||||
RD_SettingCode_PressAnimations,
|
||||
RD_SettingCode_FocusAnimations,
|
||||
RD_SettingCode_TooltipAnimations,
|
||||
RD_SettingCode_MenuAnimations,
|
||||
RD_SettingCode_ScrollingAnimations,
|
||||
RD_SettingCode_BackgroundBlur,
|
||||
RD_SettingCode_ThreadLines,
|
||||
RD_SettingCode_BreakpointLines,
|
||||
RD_SettingCode_ThreadGlow,
|
||||
RD_SettingCode_BreakpointGlow,
|
||||
RD_SettingCode_OpaqueBackgrounds,
|
||||
RD_SettingCode_TabWidth,
|
||||
RD_SettingCode_MainFontSize,
|
||||
RD_SettingCode_CodeFontSize,
|
||||
RD_SettingCode_SmoothUIText,
|
||||
RD_SettingCode_SmoothCodeText,
|
||||
RD_SettingCode_HintUIText,
|
||||
RD_SettingCode_HintCodeText,
|
||||
RD_SettingCode_COUNT,
|
||||
} RD_SettingCode;
|
||||
|
||||
typedef struct RD_VocabularyInfo RD_VocabularyInfo;
|
||||
struct RD_VocabularyInfo
|
||||
{
|
||||
@@ -781,7 +757,7 @@ extern String8 rd_cfg_src_string_table[4];
|
||||
extern RD_CmdKind rd_cfg_src_load_cmd_kind_table[4];
|
||||
extern RD_CmdKind rd_cfg_src_write_cmd_kind_table[4];
|
||||
extern RD_VocabularyInfo rd_vocabulary_info_table[41];
|
||||
extern RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[5];
|
||||
extern RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[6];
|
||||
extern String8 d_entity_kind_display_string_table[27];
|
||||
extern String8 d_entity_kind_name_lower_table[27];
|
||||
extern String8 d_entity_kind_name_lower_plural_table[27];
|
||||
@@ -817,11 +793,6 @@ extern Vec4F32 rd_theme_preset_colors__far_manager[76];
|
||||
extern Vec4F32* rd_theme_preset_colors_table[9];
|
||||
extern String8 rd_theme_color_display_string_table[76];
|
||||
extern String8 rd_theme_color_cfg_string_table[76];
|
||||
extern String8 rd_setting_code_display_string_table[19];
|
||||
extern String8 rd_setting_code_lower_string_table[19];
|
||||
extern B8 rd_setting_code_default_is_per_window_table[19];
|
||||
extern RD_SettingVal rd_setting_code_default_val_table[19];
|
||||
extern Rng1S32 rd_setting_code_s32_range_table[19];
|
||||
read_only global U8 rd_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,
|
||||
|
||||
+79
-88
@@ -111,42 +111,91 @@ RD_VocabularyMap:
|
||||
////////////////////////////////
|
||||
//~ rjf: Configuration Tree Schemas
|
||||
|
||||
/*
|
||||
@table(name schema) RD_CfgSchemaTable:
|
||||
{
|
||||
//- rjf: settings
|
||||
{
|
||||
top_level,
|
||||
settings,
|
||||
```x:
|
||||
{
|
||||
'hover_animations': bool,
|
||||
'press_animations': bool,
|
||||
'focus_animations': bool,
|
||||
'tooltip_animations': bool,
|
||||
'menu_animations': bool,
|
||||
'scrolling_animations': bool,
|
||||
'background_blur': bool,
|
||||
'thread_lines': bool,
|
||||
'breakpoint_lines': bool,
|
||||
'thread_glow': bool,
|
||||
'breakpoint_glow': bool,
|
||||
'opaque_backgrounds': bool,
|
||||
'smooth_main_text': bool,
|
||||
'smooth_code_text': bool,
|
||||
'hint_main_text': bool,
|
||||
'hint_code_text': bool,
|
||||
'tab_width': @range[1, 32] u64,
|
||||
'main_font_size': @range[6, 72] u64,
|
||||
'code_font_size': @range[1, 32] u64,
|
||||
@default(1) 'hover_animations': bool,
|
||||
@default(1) 'press_animations': bool,
|
||||
@default(0) 'focus_animations': bool,
|
||||
@default(1) 'tooltip_animations': bool,
|
||||
@default(1) 'menu_animations': bool,
|
||||
@default(1) 'scrolling_animations': bool,
|
||||
@default(1) 'background_blur': bool,
|
||||
@default(1) 'thread_lines': bool,
|
||||
@default(1) 'breakpoint_lines': bool,
|
||||
@default(1) 'thread_glow': bool,
|
||||
@default(1) 'breakpoint_glow': bool,
|
||||
@default(0) 'opaque_backgrounds': bool,
|
||||
@default(1) 'smooth_main_text': bool,
|
||||
@default(0) 'smooth_code_text': bool,
|
||||
@default(1) 'hint_main_text': bool,
|
||||
@default(1) 'hint_code_text': bool,
|
||||
@default(2) 'tab_width': @range[1, 32] u64,
|
||||
@can_be_per_window 'main_font_size': @range[6, 72] u64,
|
||||
@can_be_per_window 'code_font_size': @range[1, 32] u64,
|
||||
}
|
||||
```
|
||||
}
|
||||
*/
|
||||
|
||||
@table(name schema) RD_CfgSchemaTable:
|
||||
{
|
||||
{target "x:{'label':code_string, 'exe':path, 'args':string, 'working_directory':path, 'entry_point':code_string, 'stdout_path':path, 'stderr_path':path, 'stdin_path':path, 'debug_subprocesses':bool}"}
|
||||
{breakpoint "x:{'label':code_string, 'condition':code_string, 'location':location, 'hit_count':u64, 'enabled':bool}"}
|
||||
{watch_pin "x:{'expression':code_string, 'view_rule':code_string, 'location':location}"}
|
||||
{file_path_map "x:{'source':path, 'dest':path}"}
|
||||
{auto_view_rule "x:{'source':code_string, 'dest':code_string}"}
|
||||
|
||||
//- rjf: targets
|
||||
{
|
||||
target,
|
||||
```x:
|
||||
{
|
||||
'label': code_string,
|
||||
'exe': path,
|
||||
'args': string,
|
||||
'working_directory': path,
|
||||
'entry_point': code_string,
|
||||
'stdout_path': path,
|
||||
'stderr_path': path,
|
||||
'stdin_path': path,
|
||||
'debug_subprocesses': bool,
|
||||
}
|
||||
```
|
||||
}
|
||||
|
||||
//- rjf: breakpoints
|
||||
{
|
||||
breakpoint,
|
||||
```x:
|
||||
{
|
||||
'label': code_string,
|
||||
'condition': code_string,
|
||||
'location': location,
|
||||
'hit_count': u64,
|
||||
'disabled': bool,
|
||||
}
|
||||
```
|
||||
}
|
||||
|
||||
//- rjf: watch pins
|
||||
{
|
||||
watch_pin,
|
||||
```x:
|
||||
{
|
||||
'expression':code_string,
|
||||
'view_rule':code_string,
|
||||
'location':location,
|
||||
}
|
||||
```
|
||||
}
|
||||
|
||||
//- rjf: file path maps
|
||||
{
|
||||
file_path_map,
|
||||
```x:{'source':path, 'dest':path}```
|
||||
}
|
||||
|
||||
//- rjf: auto view rules
|
||||
{
|
||||
auto_view_rule,
|
||||
```x:{'source':code_string, 'dest':code_string}```
|
||||
}
|
||||
}
|
||||
|
||||
@struct RD_CfgNameSchemaPair:
|
||||
@@ -1290,64 +1339,6 @@ RD_ThemeColorVersionRemapTable:
|
||||
@expand(RD_ThemeColorTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Settings
|
||||
|
||||
@table(name name_lower display_string default_per_window default_s32 s32_min s32_max)
|
||||
RD_SettingTable:
|
||||
{
|
||||
{HoverAnimations hover_animations "Hover Animations" 0 1 0 1 }
|
||||
{PressAnimations press_animations "Press Animations" 0 1 0 1 }
|
||||
{FocusAnimations focus_animations "Focus Animations" 0 0 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 11 6 72 }
|
||||
{CodeFontSize code_font_size "Code Font Size" 1 11 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 RD_SettingCode:
|
||||
{
|
||||
@expand(RD_SettingTable a) `$(a.name)`,
|
||||
COUNT
|
||||
}
|
||||
|
||||
@data(String8) rd_setting_code_display_string_table:
|
||||
{
|
||||
@expand(RD_SettingTable a) `str8_lit_comp("$(a.display_string)")`
|
||||
}
|
||||
|
||||
@data(String8) rd_setting_code_lower_string_table:
|
||||
{
|
||||
@expand(RD_SettingTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
}
|
||||
|
||||
@data(B8) rd_setting_code_default_is_per_window_table:
|
||||
{
|
||||
@expand(RD_SettingTable a) `$(a.default_per_window)`
|
||||
}
|
||||
|
||||
@data(RD_SettingVal) rd_setting_code_default_val_table:
|
||||
{
|
||||
@expand(RD_SettingTable a) `{1, $(a.default_s32)}`
|
||||
}
|
||||
|
||||
@data(Rng1S32) rd_setting_code_s32_range_table:
|
||||
{
|
||||
@expand(RD_SettingTable a) `{$(a.s32_min), $(a.s32_max)}`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Help/Docs/README
|
||||
|
||||
|
||||
+76
-76
@@ -1479,6 +1479,49 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rd_setting_from_key(String8 key)
|
||||
{
|
||||
String8 result = {0};
|
||||
{
|
||||
// rjf: find most-granular config scope to begin looking for the setting
|
||||
RD_Cfg *start_cfg = rd_cfg_from_handle(rd_regs()->view);
|
||||
if(start_cfg == &rd_nil_cfg) { start_cfg = rd_cfg_from_handle(rd_regs()->panel); }
|
||||
if(start_cfg == &rd_nil_cfg) { start_cfg = rd_cfg_from_handle(rd_regs()->window); }
|
||||
|
||||
// rjf: scan upwards the config tree until we find the setting
|
||||
RD_Cfg *setting = &rd_nil_cfg;
|
||||
for(RD_Cfg *cfg = start_cfg; cfg != &rd_nil_cfg && setting == &rd_nil_cfg; cfg = cfg->parent)
|
||||
{
|
||||
setting = rd_cfg_child_from_string(cfg, key);
|
||||
}
|
||||
|
||||
// rjf: return resultant child string stored under this key
|
||||
result = setting->first->string;
|
||||
|
||||
// rjf: no result -> look for default in settings schema
|
||||
if(result.size == 0) ProfScope("default setting schema lookup")
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 schema_string = {0};
|
||||
for EachElement(idx, rd_cfg_name_schema_pair_table)
|
||||
{
|
||||
if(str8_match(rd_cfg_name_schema_pair_table[idx].name, str8_lit("settings"), 0))
|
||||
{
|
||||
schema_string = rd_cfg_name_schema_pair_table[idx].schema;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MD_Node *schema = md_tree_from_string(scratch.arena, schema_string)->first;
|
||||
MD_Node *setting = md_child_from_string(schema, key, 0);
|
||||
MD_Node *default_tag = md_tag_from_string(setting, str8_lit("default"), 0);
|
||||
result = default_tag->first->string;
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity State Functions
|
||||
|
||||
@@ -3415,17 +3458,6 @@ rd_window_state_from_cfg(RD_Cfg *cfg)
|
||||
ws->drop_completion_arena = arena_alloc();
|
||||
ws->hover_eval_arena = arena_alloc();
|
||||
ws->last_dpi = os_dpi_from_window(ws->os);
|
||||
for EachEnumVal(RD_SettingCode, code)
|
||||
{
|
||||
if(rd_setting_code_default_is_per_window_table[code])
|
||||
{
|
||||
ws->setting_vals[code] = rd_setting_code_default_val_table[code];
|
||||
}
|
||||
}
|
||||
ws->setting_vals[RD_SettingCode_MainFontSize].s32 = ws->setting_vals[RD_SettingCode_MainFontSize].s32 * (ws->last_dpi / 96.f);
|
||||
ws->setting_vals[RD_SettingCode_CodeFontSize].s32 = ws->setting_vals[RD_SettingCode_CodeFontSize].s32 * (ws->last_dpi / 96.f);
|
||||
ws->setting_vals[RD_SettingCode_MainFontSize].s32 = ClampBot(ws->setting_vals[RD_SettingCode_MainFontSize].s32, rd_setting_code_default_val_table[RD_SettingCode_MainFontSize].s32);
|
||||
ws->setting_vals[RD_SettingCode_CodeFontSize].s32 = ClampBot(ws->setting_vals[RD_SettingCode_CodeFontSize].s32, rd_setting_code_default_val_table[RD_SettingCode_CodeFontSize].s32);
|
||||
OS_Handle zero_monitor = {0};
|
||||
if(!os_handle_match(zero_monitor, preferred_monitor))
|
||||
{
|
||||
@@ -3616,7 +3648,7 @@ rd_window_frame(void)
|
||||
ws->cfg_palettes[RD_PaletteCode_DropSiteOverlay].text = current->colors[RD_ThemeColor_DropSiteOverlay];
|
||||
ws->cfg_palettes[RD_PaletteCode_DropSiteOverlay].text_weak = current->colors[RD_ThemeColor_DropSiteOverlay];
|
||||
ws->cfg_palettes[RD_PaletteCode_DropSiteOverlay].border = current->colors[RD_ThemeColor_DropSiteOverlay];
|
||||
if(rd_setting_val_from_code(RD_SettingCode_OpaqueBackgrounds).s32)
|
||||
if(rd_setting_b32_from_key(str8_lit("opaque_backgrounds")))
|
||||
{
|
||||
for EachEnumVal(RD_PaletteCode, code)
|
||||
{
|
||||
@@ -3703,12 +3735,12 @@ rd_window_frame(void)
|
||||
// rjf: build animation info
|
||||
UI_AnimationInfo animation_info = {0};
|
||||
{
|
||||
if(rd_setting_val_from_code(RD_SettingCode_HoverAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_HotAnimations;}
|
||||
if(rd_setting_val_from_code(RD_SettingCode_PressAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_ActiveAnimations;}
|
||||
if(rd_setting_val_from_code(RD_SettingCode_FocusAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_FocusAnimations;}
|
||||
if(rd_setting_val_from_code(RD_SettingCode_TooltipAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_TooltipAnimations;}
|
||||
if(rd_setting_val_from_code(RD_SettingCode_MenuAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_ContextMenuAnimations;}
|
||||
if(rd_setting_val_from_code(RD_SettingCode_ScrollingAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_ScrollingAnimations;}
|
||||
if(rd_setting_b32_from_key(str8_lit("hover_animations"))) {animation_info.flags |= UI_AnimationInfoFlag_HotAnimations;}
|
||||
if(rd_setting_b32_from_key(str8_lit("press_animations"))) {animation_info.flags |= UI_AnimationInfoFlag_ActiveAnimations;}
|
||||
if(rd_setting_b32_from_key(str8_lit("focus_animations"))) {animation_info.flags |= UI_AnimationInfoFlag_FocusAnimations;}
|
||||
if(rd_setting_b32_from_key(str8_lit("tooltip_animations"))) {animation_info.flags |= UI_AnimationInfoFlag_TooltipAnimations;}
|
||||
if(rd_setting_b32_from_key(str8_lit("menu_animations"))) {animation_info.flags |= UI_AnimationInfoFlag_ContextMenuAnimations;}
|
||||
if(rd_setting_b32_from_key(str8_lit("scrolling_animations"))) {animation_info.flags |= UI_AnimationInfoFlag_ScrollingAnimations;}
|
||||
}
|
||||
|
||||
// rjf: begin & push initial stack values
|
||||
@@ -3721,8 +3753,8 @@ rd_window_frame(void)
|
||||
ui_push_palette(rd_palette_from_code(RD_PaletteCode_Base));
|
||||
ui_push_blur_size(10.f);
|
||||
FNT_RasterFlags text_raster_flags = 0;
|
||||
if(rd_setting_val_from_code(RD_SettingCode_SmoothUIText).s32) {text_raster_flags |= FNT_RasterFlag_Smooth;}
|
||||
if(rd_setting_val_from_code(RD_SettingCode_HintUIText).s32) {text_raster_flags |= FNT_RasterFlag_Hinted;}
|
||||
if(rd_setting_b32_from_key(str8_lit("smooth_main_text"))) {text_raster_flags |= FNT_RasterFlag_Smooth;}
|
||||
if(rd_setting_b32_from_key(str8_lit("hint_main_text"))) {text_raster_flags |= FNT_RasterFlag_Hinted;}
|
||||
ui_push_text_raster_flags(text_raster_flags);
|
||||
}
|
||||
|
||||
@@ -6322,11 +6354,13 @@ rd_window_frame(void)
|
||||
|
||||
//- rjf: animate
|
||||
{
|
||||
B32 do_menu_animations = rd_setting_b32_from_key(str8_lit("menu_animations"));
|
||||
F32 rate = do_menu_animations ? 1 - pow_f32(2, (-60.f * rd_state->frame_dt)) : 1.f;
|
||||
|
||||
// rjf: animate height
|
||||
{
|
||||
F32 fish_rate = rd_setting_val_from_code(RD_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * rd_state->frame_dt)) : 1.f;
|
||||
F32 hover_eval_container_height_target = row_height * Min(30, block_tree.total_row_count);
|
||||
ws->hover_eval_num_visible_rows_t += (hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) * fish_rate;
|
||||
ws->hover_eval_num_visible_rows_t += (hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) * rate;
|
||||
if(abs_f32(hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) > 0.5f)
|
||||
{
|
||||
rd_request_frame();
|
||||
@@ -6339,9 +6373,8 @@ rd_window_frame(void)
|
||||
|
||||
// rjf: animate open
|
||||
{
|
||||
F32 fish_rate = rd_setting_val_from_code(RD_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * rd_state->frame_dt)) : 1.f;
|
||||
F32 diff = 1.f - ws->hover_eval_open_t;
|
||||
ws->hover_eval_open_t += diff*fish_rate;
|
||||
ws->hover_eval_open_t += diff*rate;
|
||||
if(abs_f32(diff) < 0.01f)
|
||||
{
|
||||
ws->hover_eval_open_t = 1.f;
|
||||
@@ -7885,6 +7918,9 @@ rd_window_frame(void)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
//- rjf: unpack settings
|
||||
B32 do_background_blur = rd_setting_b32_from_key(str8_lit("background_blur"));
|
||||
|
||||
//- rjf: set up heatmap buckets
|
||||
F32 heatmap_bucket_size = 32.f;
|
||||
U64 *heatmap_buckets = 0;
|
||||
@@ -7959,7 +7995,7 @@ rd_window_frame(void)
|
||||
}
|
||||
|
||||
// rjf: blur background
|
||||
if(box->flags & UI_BoxFlag_DrawBackgroundBlur && rd_setting_val_from_code(RD_SettingCode_BackgroundBlur).s32)
|
||||
if(box->flags & UI_BoxFlag_DrawBackgroundBlur && do_background_blur)
|
||||
{
|
||||
R_PassParams_Blur *params = dr_blur(pad_2f32(box->rect, 1.f), box->blur_size*(1-box->transparency), 0);
|
||||
MemoryCopyArray(params->corner_radii, box->corner_radii);
|
||||
@@ -10672,7 +10708,6 @@ rd_font_from_slot(RD_FontSlot slot)
|
||||
internal F32
|
||||
rd_font_size_from_slot(RD_FontSlot slot)
|
||||
{
|
||||
B32 explicit_config_found = 0;
|
||||
F32 result = 9.f;
|
||||
|
||||
// rjf: determine config key based on slot
|
||||
@@ -10685,32 +10720,23 @@ rd_font_size_from_slot(RD_FontSlot slot)
|
||||
case RD_FontSlot_Code:{key = str8_lit("code_font_size");}break;
|
||||
}
|
||||
|
||||
// rjf: find most-granular config scope to begin looking for the setting
|
||||
RD_Cfg *start_cfg = rd_cfg_from_handle(rd_regs()->view);
|
||||
if(start_cfg == &rd_nil_cfg) { start_cfg = rd_cfg_from_handle(rd_regs()->panel); }
|
||||
if(start_cfg == &rd_nil_cfg) { start_cfg = rd_cfg_from_handle(rd_regs()->window); }
|
||||
// rjf: given key, find setting string
|
||||
String8 setting_string = rd_setting_from_key(key);
|
||||
|
||||
// rjf: scan upwards the config tree until we find the setting
|
||||
for(RD_Cfg *parent = start_cfg; parent != &rd_nil_cfg; parent = parent->parent)
|
||||
{
|
||||
RD_Cfg *child = rd_cfg_child_from_string(parent, key);
|
||||
if(child != &rd_nil_cfg)
|
||||
{
|
||||
result = (F32)f64_from_str8(child->first->string);
|
||||
explicit_config_found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: if we haven't found any explicit config, then use the window's monitor's DPI
|
||||
// rjf: if found, map setting string -> f64; otherwise use the window's monitor's DPI
|
||||
// based on some default size.
|
||||
if(explicit_config_found == 0)
|
||||
if(setting_string.size)
|
||||
{
|
||||
result = (F32)f64_from_str8(setting_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
RD_Cfg *window_cfg = rd_cfg_from_handle(rd_regs()->window);
|
||||
RD_WindowState *ws = rd_window_state_from_cfg(window_cfg);
|
||||
F32 dpi = os_dpi_from_window(ws->os);
|
||||
result *= (dpi / 96.f);
|
||||
result = 9.f * (dpi / 96.f);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -10722,38 +10748,12 @@ rd_raster_flags_from_slot(RD_FontSlot slot)
|
||||
{
|
||||
default:{}break;
|
||||
case RD_FontSlot_Icons:{flags = FNT_RasterFlag_Smooth;}break;
|
||||
case RD_FontSlot_Main: {flags = (!!rd_setting_val_from_code(RD_SettingCode_SmoothUIText).s32*FNT_RasterFlag_Smooth)|(!!rd_setting_val_from_code(RD_SettingCode_HintUIText).s32*FNT_RasterFlag_Hinted);}break;
|
||||
case RD_FontSlot_Code: {flags = (!!rd_setting_val_from_code(RD_SettingCode_SmoothCodeText).s32*FNT_RasterFlag_Smooth)|(!!rd_setting_val_from_code(RD_SettingCode_HintCodeText).s32*FNT_RasterFlag_Hinted);}break;
|
||||
case RD_FontSlot_Main: {flags = (rd_setting_b32_from_key(str8_lit("smooth_main_text"))*FNT_RasterFlag_Smooth)|(rd_setting_b32_from_key(str8_lit("hint_main_text"))*FNT_RasterFlag_Hinted);}break;
|
||||
case RD_FontSlot_Code: {flags = (rd_setting_b32_from_key(str8_lit("smooth_code_text"))*FNT_RasterFlag_Smooth)|(rd_setting_b32_from_key(str8_lit("hint_code_text"))*FNT_RasterFlag_Hinted);}break;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
//- rjf: settings
|
||||
|
||||
internal RD_SettingVal
|
||||
rd_setting_val_from_code(RD_SettingCode code)
|
||||
{
|
||||
RD_Cfg *wcfg = rd_cfg_from_handle(rd_regs()->window);
|
||||
RD_WindowState *ws = rd_window_state_from_cfg(wcfg);
|
||||
RD_SettingVal result = {0};
|
||||
if(ws != 0)
|
||||
{
|
||||
result = ws->setting_vals[code];
|
||||
}
|
||||
if(result.set == 0)
|
||||
{
|
||||
for EachEnumVal(RD_CfgSrc, src)
|
||||
{
|
||||
if(rd_state->cfg_setting_vals[src][code].set)
|
||||
{
|
||||
result = rd_state->cfg_setting_vals[src][code];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: config serialization
|
||||
|
||||
internal int
|
||||
@@ -13316,7 +13316,7 @@ rd_frame(void)
|
||||
case RD_CmdKind_IncCodeFontScale:
|
||||
{
|
||||
fnt_reset();
|
||||
F32 current_font_size = rd_font_size_from_slot(RD_FontSlot_Main);
|
||||
F32 current_font_size = rd_font_size_from_slot(RD_FontSlot_Code);
|
||||
F32 new_font_size = clamp_1f32(r1f32(6, 72), current_font_size+1);
|
||||
RD_Cfg *window = rd_cfg_from_handle(rd_regs()->window);
|
||||
RD_Cfg *code_font_size = rd_cfg_child_from_string_or_alloc(window, str8_lit("code_font_size"));
|
||||
@@ -13326,7 +13326,7 @@ rd_frame(void)
|
||||
case RD_CmdKind_DecCodeFontScale:
|
||||
{
|
||||
fnt_reset();
|
||||
F32 current_font_size = rd_font_size_from_slot(RD_FontSlot_Main);
|
||||
F32 current_font_size = rd_font_size_from_slot(RD_FontSlot_Code);
|
||||
F32 new_font_size = clamp_1f32(r1f32(6, 72), current_font_size-1);
|
||||
RD_Cfg *window = rd_cfg_from_handle(rd_regs()->window);
|
||||
RD_Cfg *code_font_size = rd_cfg_child_from_string_or_alloc(window, str8_lit("code_font_size"));
|
||||
@@ -16610,7 +16610,7 @@ X(getting_started)
|
||||
//- rjf: animate confirmation
|
||||
//
|
||||
{
|
||||
F32 rate = rd_setting_val_from_code(RD_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-10.f * rd_state->frame_dt)) : 1.f;
|
||||
F32 rate = rd_setting_b32_from_key(str8_lit("menu_animations")) ? 1 - pow_f32(2, (-10.f * rd_state->frame_dt)) : 1.f;
|
||||
B32 popup_open = rd_state->popup_active;
|
||||
rd_state->popup_t += rate * ((F32)!!popup_open-rd_state->popup_t);
|
||||
if(abs_f32(rd_state->popup_t - (F32)!!popup_open) > 0.005f)
|
||||
|
||||
@@ -652,7 +652,6 @@ struct RD_WindowState
|
||||
B32 window_temporarily_focused_ipc;
|
||||
|
||||
// rjf: config/settings
|
||||
RD_SettingVal setting_vals[RD_SettingCode_COUNT];
|
||||
UI_Palette cfg_palettes[RD_PaletteCode_COUNT]; // derivative from theme
|
||||
|
||||
// rjf: dev interface state
|
||||
@@ -936,9 +935,6 @@ struct RD_State
|
||||
String8 bind_change_cmd_name;
|
||||
RD_Binding bind_change_binding;
|
||||
|
||||
// rjf: global settings
|
||||
RD_SettingVal cfg_setting_vals[RD_CfgSrc_COUNT][RD_SettingCode_COUNT];
|
||||
|
||||
//-
|
||||
// TODO(rjf): TO BE ELIMINATED OR REPLACED ^^^^^^^^^^^^^^^^^^
|
||||
//-
|
||||
@@ -1148,6 +1144,10 @@ internal String8 rd_expr_from_cfg(RD_Cfg *cfg);
|
||||
internal D_Target rd_target_from_cfg(Arena *arena, RD_Cfg *cfg);
|
||||
internal DR_FancyStringList rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg, Vec4F32 secondary_color, F32 size);
|
||||
|
||||
internal String8 rd_setting_from_key(String8 key);
|
||||
#define rd_setting_b32_from_key(key) (str8_match(rd_setting_from_key(key), str8_lit("1"), 0))
|
||||
#define rd_setting_u64_from_key(key) (u64_from_str8(rd_setting_from_key(key), 10))
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity Stateful Functions
|
||||
|
||||
@@ -1352,9 +1352,6 @@ internal FNT_Tag rd_font_from_slot(RD_FontSlot slot);
|
||||
internal F32 rd_font_size_from_slot(RD_FontSlot slot);
|
||||
internal FNT_RasterFlags rd_raster_flags_from_slot(RD_FontSlot slot);
|
||||
|
||||
//- rjf: settings
|
||||
internal RD_SettingVal rd_setting_val_from_code(RD_SettingCode code);
|
||||
|
||||
//- rjf: config serialization
|
||||
internal int rd_qsort_compare__cfg_string_bindings(RD_StringBindingPair *a, RD_StringBindingPair *b);
|
||||
internal String8List rd_cfg_strings_from_gfx(Arena *arena, String8 root_path, RD_CfgSrc source);
|
||||
|
||||
@@ -35,7 +35,7 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
|
||||
//
|
||||
FNT_Tag code_font = rd_font_from_slot(RD_FontSlot_Code);
|
||||
F32 code_font_size = rd_font_size_from_slot(RD_FontSlot_Code);
|
||||
F32 code_tab_size = fnt_column_size_from_tag_size(code_font, code_font_size)*rd_setting_val_from_code(RD_SettingCode_TabWidth).s32;
|
||||
F32 code_tab_size = fnt_column_size_from_tag_size(code_font, code_font_size)*rd_setting_u64_from_key(str8_lit("tab_width"));
|
||||
FNT_Metrics code_font_metrics = fnt_metrics_from_tag_size(code_font, code_font_size);
|
||||
F32 code_line_height = ceil_f32(fnt_line_height_from_metrics(&code_font_metrics) * 1.5f);
|
||||
F32 big_glyph_advance = fnt_dim_from_tag_size_string(code_font, code_font_size, 0, 0, str8_lit("H")).x;
|
||||
@@ -1268,7 +1268,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
UI_ScrollPt2 scroll_pos = rd_view_scroll_pos();
|
||||
F32 entity_hover_t_rate = rd_setting_val_from_code(RD_SettingCode_HoverAnimations).s32 ? (1 - pow_f32(2, (-20.f * rd_state->frame_dt))) : 1.f;
|
||||
F32 entity_hover_t_rate = rd_setting_b32_from_key(str8_lit("hover_animations")) ? (1 - pow_f32(2, (-20.f * rd_state->frame_dt))) : 1.f;
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack arguments
|
||||
@@ -6053,6 +6053,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(geo3d)
|
||||
////////////////////////////////
|
||||
//~ rjf: settings @view_hook_impl
|
||||
|
||||
#if 0 // TODO(rjf): @cfg
|
||||
typedef enum RD_SettingsItemKind
|
||||
{
|
||||
RD_SettingsItemKind_CategoryHeader,
|
||||
@@ -6123,6 +6124,7 @@ rd_qsort_compare_settings_item(RD_SettingsItem *a, RD_SettingsItem *b)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
RD_VIEW_RULE_UI_FUNCTION_DEF(settings)
|
||||
{
|
||||
|
||||
@@ -614,7 +614,11 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
margin_contents_palette->background = v4f32(0, 0, 0, 0);
|
||||
F32 line_num_padding_px = ui_top_font_size()*1.f;
|
||||
F32 entity_alive_t_rate = (1 - pow_f32(2, (-30.f * rd_state->frame_dt)));
|
||||
F32 entity_hover_t_rate = rd_setting_val_from_code(RD_SettingCode_HoverAnimations).s32 ? (1 - pow_f32(2, (-20.f * rd_state->frame_dt))) : 1.f;
|
||||
F32 entity_hover_t_rate = rd_setting_b32_from_key(str8_lit("hover_animations")) ? (1 - pow_f32(2, (-20.f * rd_state->frame_dt))) : 1.f;
|
||||
B32 do_thread_lines = rd_setting_b32_from_key(str8_lit("thread_lines"));
|
||||
B32 do_thread_glow = rd_setting_b32_from_key(str8_lit("thread_glow"));
|
||||
B32 do_bp_lines = rd_setting_b32_from_key(str8_lit("breakpoint_lines"));
|
||||
B32 do_bp_glow = rd_setting_b32_from_key(str8_lit("breakpoint_glow"));
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build top-level container
|
||||
@@ -755,8 +759,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
u->hover_t = ui_anim(ui_key_from_stringf(top_container_box->key, "###thread_hover_t_%p", thread), (F32)!!is_hovering, .rate = entity_hover_t_rate);
|
||||
u->is_selected = (thread == selected_thread);
|
||||
u->is_frozen = !!thread->is_frozen;
|
||||
u->do_lines = rd_setting_val_from_code(RD_SettingCode_ThreadLines).s32;
|
||||
u->do_glow = rd_setting_val_from_code(RD_SettingCode_ThreadGlow).s32;
|
||||
u->do_lines = do_thread_lines;
|
||||
u->do_glow = do_thread_glow;
|
||||
ui_box_equip_custom_draw(thread_box, rd_thread_box_draw_extensions, u);
|
||||
|
||||
// rjf: fill out progress t (progress into range of current line's
|
||||
@@ -974,8 +978,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
bp_draw->color = bp_rgba;
|
||||
bp_draw->alive_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "bp_alive_t_%p", bp), 1.f, .rate = entity_alive_t_rate);
|
||||
bp_draw->hover_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "bp_hover_t_%p", bp), (F32)!!is_hovering, .rate = entity_hover_t_rate);
|
||||
bp_draw->do_lines = rd_setting_val_from_code(RD_SettingCode_BreakpointLines).s32;
|
||||
bp_draw->do_glow = rd_setting_val_from_code(RD_SettingCode_BreakpointGlow).s32;
|
||||
bp_draw->do_lines = do_bp_lines;
|
||||
bp_draw->do_glow = do_bp_glow;
|
||||
if(params->line_vaddrs[line_idx] == 0)
|
||||
{
|
||||
D_LineList *lines = ¶ms->line_infos[line_idx];
|
||||
|
||||
Reference in New Issue
Block a user