mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
config settings, for top-level toggles or simple numeric parameters; use to mask off animations, background blurs, and so on; use to control tab width
This commit is contained in:
@@ -248,21 +248,6 @@ df_expand_tree_table_init(Arena *arena, DF_ExpandTreeTable *table, U64 slot_coun
|
||||
table->slots = push_array(arena, DF_ExpandSlot, table->slots_count);
|
||||
}
|
||||
|
||||
internal void
|
||||
df_expand_tree_table_animate(DF_ExpandTreeTable *table, F32 dt)
|
||||
{
|
||||
F32 rate = 1 - pow_f32(2, (-50.f * dt));
|
||||
for(U64 slot_idx = 0; slot_idx < table->slots_count; slot_idx += 1)
|
||||
{
|
||||
for(DF_ExpandNode *node = table->slots[slot_idx].first;
|
||||
node != 0;
|
||||
node = node->hash_next)
|
||||
{
|
||||
node->expanded_t += (((F32)!!node->expanded) - node->expanded_t) * rate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal DF_ExpandNode *
|
||||
df_expand_node_from_key(DF_ExpandTreeTable *table, DF_ExpandKey key)
|
||||
{
|
||||
|
||||
@@ -1363,7 +1363,6 @@ internal B32 df_expand_key_match(DF_ExpandKey a, DF_ExpandKey b);
|
||||
|
||||
//- rjf: table
|
||||
internal void df_expand_tree_table_init(Arena *arena, DF_ExpandTreeTable *table, U64 slot_count);
|
||||
internal void df_expand_tree_table_animate(DF_ExpandTreeTable *table, F32 dt);
|
||||
internal DF_ExpandNode *df_expand_node_from_key(DF_ExpandTreeTable *table, DF_ExpandKey key);
|
||||
internal B32 df_expand_key_is_set(DF_ExpandTreeTable *table, DF_ExpandKey key);
|
||||
internal void df_expand_set_expansion(Arena *arena, DF_ExpandTreeTable *table, DF_ExpandKey parent_key, DF_ExpandKey key, B32 expanded);
|
||||
|
||||
+98
-11
@@ -3458,8 +3458,19 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
widget_palette_info.scrollbar_palette = df_palette_from_code(DF_PaletteCode_ScrollBarButton);
|
||||
}
|
||||
|
||||
// rjf: build animation info
|
||||
UI_AnimationInfo animation_info = {0};
|
||||
{
|
||||
if(df_setting_val_from_code(DF_SettingCode_HoverAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_HotAnimations;}
|
||||
if(df_setting_val_from_code(DF_SettingCode_PressAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_ActiveAnimations;}
|
||||
if(df_setting_val_from_code(DF_SettingCode_FocusAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_FocusAnimations;}
|
||||
if(df_setting_val_from_code(DF_SettingCode_TooltipAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_TooltipAnimations;}
|
||||
if(df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_ContextMenuAnimations;}
|
||||
if(df_setting_val_from_code(DF_SettingCode_ScrollingAnimations).s32) {animation_info.flags |= UI_AnimationInfoFlag_ScrollingAnimations;}
|
||||
}
|
||||
|
||||
// rjf: begin & push initial stack values
|
||||
ui_begin_build(ws->os, &events, &icon_info, &widget_palette_info, df_dt(), df_dt());
|
||||
ui_begin_build(ws->os, &events, &icon_info, &widget_palette_info, &animation_info, df_dt(), df_dt());
|
||||
ui_push_font(main_font);
|
||||
ui_push_font_size(main_font_size);
|
||||
ui_push_pref_width(ui_em(20.f, 1));
|
||||
@@ -4569,7 +4580,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
// rjf: animate target # of rows
|
||||
{
|
||||
F32 rate = 1 - pow_f32(2, (-60.f * df_dt()));
|
||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? (1 - pow_f32(2, (-60.f * df_dt()))) : 1.f;
|
||||
F32 target = Min((F32)item_array.count, 16.f);
|
||||
if(abs_f32(target - ws->autocomp_num_visible_rows_t) > 0.01f)
|
||||
{
|
||||
@@ -4584,7 +4595,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
|
||||
// rjf: animate open
|
||||
{
|
||||
F32 rate = 1 - pow_f32(2, (-60.f * df_dt()));
|
||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_dt())) : 1.f;
|
||||
F32 diff = 1.f-ws->autocomp_open_t;
|
||||
ws->autocomp_open_t += diff*rate;
|
||||
if(abs_f32(diff) < 0.05f)
|
||||
@@ -5690,7 +5701,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
//- rjf: animate query info
|
||||
//
|
||||
{
|
||||
F32 rate = 1 - pow_f32(2, (-60.f * df_dt()));
|
||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_dt())) : 1.f;
|
||||
|
||||
// rjf: animate query view selection transition
|
||||
{
|
||||
@@ -5965,7 +5976,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
// rjf: animate height
|
||||
{
|
||||
F32 fish_rate = 1 - pow_f32(2, (-60.f * df_dt()));
|
||||
F32 fish_rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_dt())) : 1.f;
|
||||
F32 hover_eval_container_height_target = row_height * Min(30, viz_blocks.total_visual_row_count);
|
||||
ws->hover_eval_num_visible_rows_t += (hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) * fish_rate;
|
||||
if(abs_f32(hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) > 0.5f)
|
||||
@@ -5980,7 +5991,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
|
||||
// rjf: animate open
|
||||
{
|
||||
F32 fish_rate = 1 - pow_f32(2, (-60.f * df_dt()));
|
||||
F32 fish_rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-60.f * df_dt())) : 1.f;
|
||||
F32 diff = 1.f - ws->hover_eval_open_t;
|
||||
ws->hover_eval_open_t += diff*fish_rate;
|
||||
if(abs_f32(diff) < 0.01f)
|
||||
@@ -6495,7 +6506,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
//- rjf: animate panels
|
||||
//
|
||||
{
|
||||
F32 rate = 1 - pow_f32(2, (-50.f * df_dt()));
|
||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-50.f * df_dt())) : 1.f;
|
||||
Vec2F32 content_rect_dim = dim_2f32(content_rect);
|
||||
for(DF_Panel *panel = ws->root_panel; !df_panel_is_nil(panel); panel = df_panel_rec_df_pre(panel).next)
|
||||
{
|
||||
@@ -7470,8 +7481,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
}
|
||||
view->loading_t += (view->loading_t_target - view->loading_t) * rate;
|
||||
view->is_filtering_t += ((F32)!!view->is_filtering - view->is_filtering_t) * fast_rate;
|
||||
view->scroll_pos.x.off -= view->scroll_pos.x.off*fast_rate;
|
||||
view->scroll_pos.y.off -= view->scroll_pos.y.off*fast_rate;
|
||||
view->scroll_pos.x.off -= view->scroll_pos.x.off * (df_setting_val_from_code(DF_SettingCode_ScrollingAnimations).s32 ? fast_rate : 1.f);
|
||||
view->scroll_pos.y.off -= view->scroll_pos.y.off * (df_setting_val_from_code(DF_SettingCode_ScrollingAnimations).s32 ? fast_rate : 1.f);
|
||||
if(abs_f32(view->scroll_pos.x.off) < 0.01f)
|
||||
{
|
||||
view->scroll_pos.x.off = 0;
|
||||
@@ -7677,7 +7688,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
}
|
||||
|
||||
// rjf: blur background
|
||||
if(box->flags & UI_BoxFlag_DrawBackgroundBlur)
|
||||
if(box->flags & UI_BoxFlag_DrawBackgroundBlur && df_setting_val_from_code(DF_SettingCode_BackgroundBlur).s32)
|
||||
{
|
||||
R_PassParams_Blur *params = d_blur(box->rect, box->blur_size*(1-box->transparency), 0);
|
||||
MemoryCopyArray(params->corner_radii, box->corner_radii);
|
||||
@@ -9343,6 +9354,23 @@ df_font_size_from_slot(DF_Window *ws, DF_FontSlot slot)
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: settings
|
||||
|
||||
internal DF_SettingVal
|
||||
df_setting_val_from_code(DF_SettingCode code)
|
||||
{
|
||||
DF_SettingVal result = {0};
|
||||
for(EachEnumVal(DF_CfgSrc, src))
|
||||
{
|
||||
if(df_gfx_state->cfg_setting_vals[src][code].set)
|
||||
{
|
||||
result = df_gfx_state->cfg_setting_vals[src][code];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: config serialization
|
||||
|
||||
internal int
|
||||
@@ -9638,6 +9666,29 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source)
|
||||
str8_list_push(arena, &strs, str8_lit("\n"));
|
||||
}
|
||||
|
||||
//- rjf: serialize settings
|
||||
{
|
||||
B32 first = 1;
|
||||
for(EachEnumVal(DF_SettingCode, code))
|
||||
{
|
||||
DF_SettingVal current = df_gfx_state->cfg_setting_vals[source][code];
|
||||
if(current.set)
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
first = 0;
|
||||
str8_list_push(arena, &strs, str8_lit("/// settings //////////////////////////////////////////////////////////////////\n"));
|
||||
str8_list_push(arena, &strs, str8_lit("\n"));
|
||||
}
|
||||
str8_list_pushf(arena, &strs, "%S: %i\n", df_g_setting_code_lower_string_table[code], current.s32);
|
||||
}
|
||||
}
|
||||
if(!first)
|
||||
{
|
||||
str8_list_push(arena, &strs, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return strs;
|
||||
}
|
||||
@@ -13226,7 +13277,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
|
||||
//- rjf: animate confirmation
|
||||
{
|
||||
F32 rate = 1 - pow_f32(2, (-10.f * df_dt()));
|
||||
F32 rate = df_setting_val_from_code(DF_SettingCode_MenuAnimations).s32 ? 1 - pow_f32(2, (-10.f * df_dt())) : 1.f;
|
||||
B32 confirm_open = df_gfx_state->confirm_active;
|
||||
df_gfx_state->confirm_t += rate * ((F32)!!confirm_open-df_gfx_state->confirm_t);
|
||||
if(abs_f32(df_gfx_state->confirm_t - (F32)!!confirm_open) > 0.005f)
|
||||
@@ -13980,6 +14031,42 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: apply settings
|
||||
B8 setting_codes_hit[DF_SettingCode_COUNT] = {0};
|
||||
MemoryZero(&df_gfx_state->cfg_setting_vals[src][0], sizeof(DF_SettingVal)*DF_SettingCode_COUNT);
|
||||
for(EachEnumVal(DF_SettingCode, code))
|
||||
{
|
||||
String8 name = df_g_setting_code_lower_string_table[code];
|
||||
DF_CfgVal *code_cfg_val = df_cfg_val_from_string(table, name);
|
||||
DF_CfgNode *root_node = code_cfg_val->last;
|
||||
if(root_node->source == src)
|
||||
{
|
||||
DF_CfgNode *val_node = root_node->first;
|
||||
S64 val = 0;
|
||||
if(try_s64_from_str8_c_rules(val_node->string, &val))
|
||||
{
|
||||
df_gfx_state->cfg_setting_vals[src][code].set = 1;
|
||||
df_gfx_state->cfg_setting_vals[src][code].s32 = (S32)val;
|
||||
}
|
||||
if(val_node != &df_g_nil_cfg_node)
|
||||
{
|
||||
setting_codes_hit[code] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: if config applied 0 settings, we need to do some sensible default
|
||||
if(src == DF_CfgSrc_User)
|
||||
{
|
||||
for(EachEnumVal(DF_SettingCode, code))
|
||||
{
|
||||
if(!setting_codes_hit[code])
|
||||
{
|
||||
df_gfx_state->cfg_setting_vals[src][code] = df_g_setting_code_default_val_table[code];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: if config opened 0 windows, we need to do some sensible default
|
||||
if(src == DF_CfgSrc_User && windows->first == &df_g_nil_cfg_node)
|
||||
{
|
||||
|
||||
@@ -66,6 +66,16 @@ struct DF_KeyMapSlot
|
||||
DF_KeyMapNode *last;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Setting Types
|
||||
|
||||
typedef struct DF_SettingVal DF_SettingVal;
|
||||
struct DF_SettingVal
|
||||
{
|
||||
B32 set;
|
||||
S32 s32;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: View Functions
|
||||
|
||||
@@ -766,6 +776,9 @@ struct DF_GfxState
|
||||
F_Tag cfg_font_tags[DF_FontSlot_COUNT]; // derivative from font paths
|
||||
UI_Palette cfg_palettes[DF_PaletteCode_COUNT]; // derivative from theme
|
||||
|
||||
// rjf: settings
|
||||
DF_SettingVal cfg_setting_vals[DF_CfgSrc_COUNT][DF_SettingCode_COUNT];
|
||||
|
||||
// rjf: icon texture
|
||||
R_Handle icon_texture;
|
||||
};
|
||||
@@ -1017,7 +1030,11 @@ internal UI_Palette *df_palette_from_code(DF_PaletteCode code);
|
||||
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);
|
||||
|
||||
//- rjf: config serialization
|
||||
internal int df_qsort_compare__cfg_string_bindings(DF_StringBindingPair *a, DF_StringBindingPair *b);
|
||||
internal String8List df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source);
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
+42
-5
@@ -602,11 +602,6 @@ DF_ThemePresetColorTable:
|
||||
(drop_shadow 0x0000007f 0x0000003b 0x0000007f 0x0000003b 0x0000007f 0x0000003b 0x0000007f 0x0000007f 0x0000007f )
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generators
|
||||
|
||||
//- rjf: theme color tables
|
||||
|
||||
@data(String8) df_g_theme_color_display_string_table:
|
||||
{
|
||||
@expand(DF_ThemeColorTable a) `str8_lit_comp("$(a.display_name)")`
|
||||
@@ -617,6 +612,48 @@ DF_ThemePresetColorTable:
|
||||
@expand(DF_ThemeColorTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Settings
|
||||
|
||||
@table(name name_lower display_string 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 }
|
||||
{TabWidth tab_width "Tab Width" 4 0 32 }
|
||||
}
|
||||
|
||||
@enum DF_SettingCode:
|
||||
{
|
||||
@expand(DF_SettingTable a) `$(a.name)`,
|
||||
COUNT
|
||||
}
|
||||
|
||||
@data(String8) df_g_setting_code_display_string_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `str8_lit_comp("$(a.display_string)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_setting_code_lower_string_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
}
|
||||
|
||||
@data(DF_SettingVal) df_g_setting_code_default_val_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `{1, $(a.default_s32)}`
|
||||
}
|
||||
|
||||
@data(Rng1S32) df_g_setting_code_s32_range_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `{$(a.s32_min), $(a.s32_max)}`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Help/Docs/README
|
||||
|
||||
|
||||
@@ -568,7 +568,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)*4.f;
|
||||
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.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;
|
||||
@@ -730,7 +730,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)*4.f;
|
||||
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.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;
|
||||
|
||||
@@ -5765,7 +5765,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
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)*4.f;
|
||||
F32 code_tab_size = f_column_size_from_tag_size(code_font, code_font_size)*df_setting_val_from_code(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;
|
||||
@@ -6837,7 +6837,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
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)*4.f;
|
||||
F32 code_tab_size = f_column_size_from_tag_size(code_font, code_font_size)*df_setting_val_from_code(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;
|
||||
@@ -7704,7 +7704,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
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)*4.f;
|
||||
F32 code_tab_size = f_column_size_from_tag_size(code_font, code_font_size)*df_setting_val_from_code(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;
|
||||
|
||||
@@ -1201,5 +1201,53 @@ str8_lit_comp("thread_error"),
|
||||
str8_lit_comp("breakpoint"),
|
||||
};
|
||||
|
||||
String8 df_g_setting_code_display_string_table[8] =
|
||||
{
|
||||
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("Tab Width"),
|
||||
};
|
||||
|
||||
String8 df_g_setting_code_lower_string_table[8] =
|
||||
{
|
||||
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("tab_width"),
|
||||
};
|
||||
|
||||
DF_SettingVal df_g_setting_code_default_val_table[8] =
|
||||
{
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 1},
|
||||
{1, 4},
|
||||
};
|
||||
|
||||
Rng1S32 df_g_setting_code_s32_range_table[8] =
|
||||
{
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 32},
|
||||
};
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
|
||||
@@ -136,6 +136,19 @@ DF_ThemePreset_FarManager,
|
||||
DF_ThemePreset_COUNT,
|
||||
} DF_ThemePreset;
|
||||
|
||||
typedef enum DF_SettingCode
|
||||
{
|
||||
DF_SettingCode_HoverAnimations,
|
||||
DF_SettingCode_PressAnimations,
|
||||
DF_SettingCode_FocusAnimations,
|
||||
DF_SettingCode_TooltipAnimations,
|
||||
DF_SettingCode_MenuAnimations,
|
||||
DF_SettingCode_ScrollingAnimations,
|
||||
DF_SettingCode_BackgroundBlur,
|
||||
DF_SettingCode_TabWidth,
|
||||
DF_SettingCode_COUNT,
|
||||
} DF_SettingCode;
|
||||
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Null);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Empty);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(GettingStarted);
|
||||
@@ -319,6 +332,10 @@ 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[8];
|
||||
extern String8 df_g_setting_code_lower_string_table[8];
|
||||
extern DF_SettingVal df_g_setting_code_default_val_table[8];
|
||||
extern Rng1S32 df_g_setting_code_s32_range_table[8];
|
||||
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,
|
||||
|
||||
+8
-7
@@ -720,7 +720,7 @@ ui_box_from_key(UI_Key key)
|
||||
//~ rjf: Top-Level Building API
|
||||
|
||||
internal void
|
||||
ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_WidgetPaletteInfo *widget_palette_info, F32 real_dt, F32 animation_dt)
|
||||
ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_WidgetPaletteInfo *widget_palette_info, UI_AnimationInfo *animation_info, F32 real_dt, F32 animation_dt)
|
||||
{
|
||||
//- rjf: reset per-build ui state
|
||||
{
|
||||
@@ -759,6 +759,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
|
||||
ui_state->icon_info.icon_kind_text_map[icon_kind] = push_str8_copy(ui_build_arena(), icon_info->icon_kind_text_map[icon_kind]);
|
||||
}
|
||||
MemoryCopyStruct(&ui_state->widget_palette_info, widget_palette_info);
|
||||
MemoryCopyStruct(&ui_state->animation_info, animation_info);
|
||||
}
|
||||
|
||||
//- rjf: do default navigation
|
||||
@@ -1200,13 +1201,13 @@ ui_end_build(void)
|
||||
F32 slow_rate = 1 - pow_f32(2, (-30.f * ui_state->animation_dt));
|
||||
F32 slug_rate = 1 - pow_f32(2, (-15.f * ui_state->animation_dt));
|
||||
F32 slaf_rate = 1 - pow_f32(2, (-8.f * ui_state->animation_dt));
|
||||
ui_state->ctx_menu_open_t += ((F32)!!ui_state->ctx_menu_open - ui_state->ctx_menu_open_t) * vast_rate;
|
||||
ui_state->ctx_menu_open_t += ((F32)!!ui_state->ctx_menu_open - ui_state->ctx_menu_open_t) * (ui_state->animation_info.flags & UI_AnimationInfoFlag_ContextMenuAnimations ? vast_rate : 1);
|
||||
ui_state->is_animating = (ui_state->is_animating || abs_f32((F32)!!ui_state->ctx_menu_open - ui_state->ctx_menu_open_t) > 0.01f);
|
||||
if(ui_state->ctx_menu_open_t >= 0.99f && ui_state->ctx_menu_open)
|
||||
{
|
||||
ui_state->ctx_menu_open_t = 1.f;
|
||||
}
|
||||
ui_state->tooltip_open_t += ((F32)!!ui_state->tooltip_open - ui_state->tooltip_open_t) * vast_rate;
|
||||
ui_state->tooltip_open_t += ((F32)!!ui_state->tooltip_open - ui_state->tooltip_open_t) * (ui_state->animation_info.flags & UI_AnimationInfoFlag_TooltipAnimations ? vast_rate : 1);
|
||||
ui_state->is_animating = (ui_state->is_animating || abs_f32((F32)!!ui_state->tooltip_open - ui_state->tooltip_open_t) > 0.01f);
|
||||
if(ui_state->tooltip_open_t >= 0.99f && ui_state->tooltip_open)
|
||||
{
|
||||
@@ -1228,10 +1229,10 @@ ui_end_build(void)
|
||||
B32 is_focus_active_disabled = !!(box->flags & UI_BoxFlag_FocusActiveDisabled);
|
||||
|
||||
// rjf: determine rates
|
||||
F32 hot_rate = fast_rate;
|
||||
F32 active_rate = fast_rate;
|
||||
F32 disabled_rate = slow_rate;
|
||||
F32 focus_rate = (is_focus_hot || is_focus_active) ? fast_rate : fast_rate;
|
||||
F32 hot_rate = (ui_state->animation_info.flags & UI_AnimationInfoFlag_HotAnimations ? fast_rate : 1);
|
||||
F32 active_rate = (ui_state->animation_info.flags & UI_AnimationInfoFlag_ActiveAnimations ? fast_rate : 1);
|
||||
F32 disabled_rate = (ui_state->animation_info.flags & UI_AnimationInfoFlag_HotAnimations ? slow_rate : 1);
|
||||
F32 focus_rate = (ui_state->animation_info.flags & UI_AnimationInfoFlag_FocusAnimations ? fast_rate : 1);
|
||||
|
||||
// rjf: determine animating status
|
||||
B32 box_is_animating = 0;
|
||||
|
||||
+23
-1
@@ -240,6 +240,27 @@ struct UI_WidgetPaletteInfo
|
||||
UI_Palette *scrollbar_palette;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Animation Info
|
||||
|
||||
typedef U32 UI_AnimationInfoFlags;
|
||||
enum
|
||||
{
|
||||
UI_AnimationInfoFlag_HotAnimations = (1<<0),
|
||||
UI_AnimationInfoFlag_ActiveAnimations = (1<<1),
|
||||
UI_AnimationInfoFlag_FocusAnimations = (1<<2),
|
||||
UI_AnimationInfoFlag_TooltipAnimations = (1<<3),
|
||||
UI_AnimationInfoFlag_ContextMenuAnimations = (1<<4),
|
||||
UI_AnimationInfoFlag_ScrollingAnimations = (1<<5),
|
||||
UI_AnimationInfoFlag_All = 0xffffffff,
|
||||
};
|
||||
|
||||
typedef struct UI_AnimationInfo UI_AnimationInfo;
|
||||
struct UI_AnimationInfo
|
||||
{
|
||||
UI_AnimationInfoFlags flags;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scroll Positions
|
||||
|
||||
@@ -575,6 +596,7 @@ struct UI_State
|
||||
//- rjf: build parameters
|
||||
UI_IconInfo icon_info;
|
||||
UI_WidgetPaletteInfo widget_palette_info;
|
||||
UI_AnimationInfo animation_info;
|
||||
OS_Handle window;
|
||||
UI_EventList *events;
|
||||
Vec2F32 mouse;
|
||||
@@ -739,7 +761,7 @@ internal UI_Box * ui_box_from_key(UI_Key key);
|
||||
////////////////////////////////
|
||||
//~ rjf: Top-Level Building API
|
||||
|
||||
internal void ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_WidgetPaletteInfo *widget_palette_info, F32 real_dt, F32 animation_dt);
|
||||
internal void ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_WidgetPaletteInfo *widget_palette_info, UI_AnimationInfo *animation_info, F32 real_dt, F32 animation_dt);
|
||||
internal void ui_end_build(void);
|
||||
internal void ui_calc_sizes_standalone__in_place_rec(UI_Box *root, Axis2 axis);
|
||||
internal void ui_calc_sizes_upwards_dependent__in_place_rec(UI_Box *root, Axis2 axis);
|
||||
|
||||
Reference in New Issue
Block a user