mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-16 00:52:23 -07:00
pull out decision of autocompletion list expression, so that we can begin basing it on destination evaluations; adjust top-level theme editing controls to be less annoying
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -236,9 +236,10 @@ RD_CmdKind_AddWatchPin,
|
||||
RD_CmdKind_ToggleWatchPin,
|
||||
RD_CmdKind_AddTypeView,
|
||||
RD_CmdKind_AddFilePathMap,
|
||||
RD_CmdKind_OpenTheme,
|
||||
RD_CmdKind_EditUserTheme,
|
||||
RD_CmdKind_EditProjectTheme,
|
||||
RD_CmdKind_AddThemeColor,
|
||||
RD_CmdKind_ForkLoadedTheme,
|
||||
RD_CmdKind_ForkTheme,
|
||||
RD_CmdKind_SaveTheme,
|
||||
RD_CmdKind_SetNextStatement,
|
||||
RD_CmdKind_AddTarget,
|
||||
@@ -387,6 +388,7 @@ RD_CodeColorSlot_COUNT,
|
||||
|
||||
typedef enum RD_ThemePreset
|
||||
{
|
||||
RD_ThemePreset_None,
|
||||
RD_ThemePreset_DefaultDark,
|
||||
RD_ThemePreset_DefaultLight,
|
||||
RD_ThemePreset_VSDark,
|
||||
@@ -559,16 +561,16 @@ Z(getting_started)\
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 rd_tab_fast_path_view_name_table[24];
|
||||
extern String8 rd_tab_fast_path_query_name_table[24];
|
||||
extern RD_VocabInfo rd_vocab_info_table[333];
|
||||
extern RD_VocabInfo rd_vocab_info_table[334];
|
||||
extern RD_NameSchemaInfo rd_name_schema_info_table[24];
|
||||
extern Rng1U64 rd_reg_slot_range_table[43];
|
||||
extern String8 rd_binding_version_remap_old_name_table[8];
|
||||
extern String8 rd_binding_version_remap_new_name_table[8];
|
||||
extern String8 rd_icon_kind_text_table[75];
|
||||
extern String8 rd_code_color_slot_name_table[14];
|
||||
extern String8 rd_theme_preset_display_string_table[10];
|
||||
extern String8 rd_theme_preset_code_string_table[10];
|
||||
extern String8 rd_theme_preset_cfg_string_table[10];
|
||||
extern String8 rd_theme_preset_display_string_table[11];
|
||||
extern String8 rd_theme_preset_code_string_table[11];
|
||||
extern String8 rd_theme_preset_cfg_string_table[11];
|
||||
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,0x43,0x62,0x25,0x00,0x00,0x01,0x50,0x00,0x00,0x00,0x60,0x63,0x6d,0x61,0x70,0xa3,0x60,0xa4,0x23,0x00,0x00,0x01,0xb0,0x00,0x00,0x06,0x12,0x63,0x76,0x74,0x20,
|
||||
|
||||
+13
-9
@@ -220,7 +220,7 @@ RD_VocabTable:
|
||||
{
|
||||
user
|
||||
```
|
||||
x:
|
||||
@expand_commands(edit_user_theme) x:
|
||||
{
|
||||
//- rjf: animations
|
||||
@default(1) 'hover_animations': bool,
|
||||
@@ -237,8 +237,8 @@ RD_VocabTable:
|
||||
'code_font': string,
|
||||
|
||||
//- rjf: theme
|
||||
@no_expand 'theme': string,
|
||||
@display_name('User Theme') @description("The user's theme, which describes all colors used throughout the UI.")
|
||||
@display_name('User Theme') 'theme': string,
|
||||
@no_expand @display_name('User Theme') @description("The user's theme, which describes all colors used throughout the UI.")
|
||||
'theme_colors': query,
|
||||
|
||||
//- rjf: autocompletion
|
||||
@@ -283,7 +283,7 @@ RD_VocabTable:
|
||||
{
|
||||
project
|
||||
```
|
||||
x:
|
||||
@expand_commands(edit_project_theme) x:
|
||||
{
|
||||
@default(2) @display_name('Project Tab Width') 'tab_width': @range[1, 32] u64,
|
||||
|
||||
@@ -294,8 +294,8 @@ RD_VocabTable:
|
||||
@default(1) use_default_ue_type_views: bool,
|
||||
|
||||
//- rjf: theme
|
||||
@no_expand 'theme': string,
|
||||
@display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.")
|
||||
@display_name('Project Theme') 'theme': string,
|
||||
@no_expand @display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.")
|
||||
'theme_colors': query,
|
||||
|
||||
//- rjf: exception settings
|
||||
@@ -381,7 +381,7 @@ RD_VocabTable:
|
||||
{
|
||||
theme_color,
|
||||
```
|
||||
@collection_commands(open_theme, add_theme_color, fork_loaded_theme, save_theme)
|
||||
@collection_commands(add_theme_color, fork_theme, save_theme)
|
||||
@row_commands(duplicate_cfg, remove_cfg)
|
||||
x:
|
||||
{
|
||||
@@ -982,9 +982,10 @@ RD_CmdTable: // | | | |
|
||||
{AddFilePathMap 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 FileOutline "add_file_path_map" "Add File Path Map" "Adds a new file path map." "" "" }
|
||||
|
||||
//- rjf: themes
|
||||
{OpenTheme 0 0 0 0 "query:themes" String null Nil Null 1 0 0 0 0 1 1 Palette "open_theme" "Open Theme" "Opens a theme." "color" "" }
|
||||
{EditUserTheme 0 0 0 0 "query:themes" String null Nil Null 0 0 0 0 0 0 0 Palette "edit_user_theme" "Edit User Theme" "Edits the current user's theme." "color" "" }
|
||||
{EditProjectTheme 0 0 0 0 "query:themes" String null Nil Null 0 0 0 0 0 0 0 Palette "edit_project_theme" "Edit Project Theme" "Edits the current project's theme." "color" "" }
|
||||
{AddThemeColor 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Palette "add_theme_color" "Add Theme Color" "Adds a new theme color." "" "" }
|
||||
{ForkLoadedTheme 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Palette "fork_loaded_theme" "Fork Loaded Theme" "Imports all colors from the loaded color theme file or color theme preset, so they can be individually edited." "" "" }
|
||||
{ForkTheme 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Palette "fork_theme" "Fork Theme" "Imports all colors from the current theme so they can be individually edited." "" "" }
|
||||
{SaveTheme 0 0 0 0 "" String null Nil Null 1 0 0 0 0 1 1 Save "save_theme" "Save Theme" "Saves all theme colors to a new theme file." "" "" }
|
||||
|
||||
//- rjf: line operations
|
||||
@@ -1364,6 +1365,9 @@ RD_IconTable:
|
||||
@table(name_upper name_lower display_string cfg)
|
||||
RD_ThemePresetTable:
|
||||
{
|
||||
//- rjf: stub
|
||||
{None none "None" ""}
|
||||
|
||||
//- rjf: default dark theme
|
||||
{
|
||||
DefaultDark default_dark "Default (Dark)",
|
||||
|
||||
+47
-17
@@ -4962,10 +4962,15 @@ rd_view_ui(Rng2F32 rect)
|
||||
txt_pt_match(cell_edit_state->cursor, cell_edit_state->mark))
|
||||
{
|
||||
String8 input = str8(cell_edit_state->input_buffer, cell_edit_state->input_size);
|
||||
String8 list_expr = rd_autocomp_primary_list_expr_from_dst_eval(scratch.arena, cell->eval);
|
||||
RD_AutocompCursorInfo cursor_info = rd_autocomp_cursor_info_from_input_string_off(scratch.arena, input, cell_edit_state->cursor.column-1);
|
||||
if(cursor_info.list_expr.size != 0)
|
||||
{
|
||||
list_expr = cursor_info.list_expr;
|
||||
}
|
||||
rd_set_autocomp_regs(.ui_key = sig.box->key,
|
||||
.string = cursor_info.filter,
|
||||
.expr = cursor_info.list_expr);
|
||||
.expr = list_expr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5760,28 +5765,26 @@ rd_window_frame(void)
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
|
||||
//- rjf: try to find theme settings from the project, then the user.
|
||||
RD_Cfg *theme_cfg = &rd_nil_cfg;
|
||||
RD_CfgList colors_cfgs = {0};
|
||||
RD_Cfg *theme_parents[] =
|
||||
{
|
||||
rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project")),
|
||||
rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"))
|
||||
};
|
||||
U64 theme_parents_count = ArrayCount(theme_parents);
|
||||
if(!rd_setting_b32_from_name(str8_lit("use_project_theme")))
|
||||
RD_Cfg *theme_cfgs[] =
|
||||
{
|
||||
theme_parents[0] = theme_parents[1];
|
||||
theme_parents_count -= 1;
|
||||
}
|
||||
for EachIndex(idx, theme_parents_count)
|
||||
&rd_nil_cfg,
|
||||
&rd_nil_cfg,
|
||||
};
|
||||
for EachIndex(idx, ArrayCount(theme_parents))
|
||||
{
|
||||
RD_Cfg *parent_cfg = theme_parents[idx];
|
||||
if(theme_cfg == &rd_nil_cfg)
|
||||
if(theme_cfgs[idx] == &rd_nil_cfg)
|
||||
{
|
||||
RD_Cfg *possible_theme_cfg = rd_cfg_child_from_string(parent_cfg, str8_lit("theme"));
|
||||
if(possible_theme_cfg != &rd_nil_cfg)
|
||||
{
|
||||
theme_cfg = possible_theme_cfg;
|
||||
theme_cfgs[idx] = possible_theme_cfg;
|
||||
}
|
||||
}
|
||||
for(RD_Cfg *child = parent_cfg->first; child != &rd_nil_cfg; child = child->next)
|
||||
@@ -5793,6 +5796,17 @@ rd_window_frame(void)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: choose which theme cfg to use
|
||||
RD_Cfg *theme_cfg = theme_cfgs[1];
|
||||
if(rd_setting_b32_from_name(str8_lit("use_project_theme")))
|
||||
{
|
||||
theme_cfg = theme_cfgs[0];
|
||||
if(theme_cfg == &rd_nil_cfg || str8_match(theme_cfg->first->string, rd_theme_preset_display_string_table[RD_ThemePreset_None], 0))
|
||||
{
|
||||
theme_cfg = theme_cfgs[1];
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: map the theme config to the associated tree (either from a preset, or from a file)
|
||||
MD_Node *theme_tree = rd_state->theme_preset_trees[RD_ThemePreset_DefaultDark];
|
||||
if(theme_cfg != &rd_nil_cfg)
|
||||
@@ -5800,7 +5814,7 @@ rd_window_frame(void)
|
||||
String8 theme_name = theme_cfg->first->string;
|
||||
if(theme_name.size != 0)
|
||||
{
|
||||
for EachEnumVal(RD_ThemePreset, p)
|
||||
for EachNonZeroEnumVal(RD_ThemePreset, p)
|
||||
{
|
||||
if(str8_match(theme_name, rd_theme_preset_display_string_table[p], 0))
|
||||
{
|
||||
@@ -9623,12 +9637,24 @@ rd_set_hover_eval(Vec2F32 pos, String8 string)
|
||||
////////////////////////////////
|
||||
//~ rjf: Autocompletion Lister
|
||||
|
||||
internal String8
|
||||
rd_autocomp_primary_list_expr_from_dst_eval(Arena *arena, E_Eval dst_eval)
|
||||
{
|
||||
String8 result = str8_lit("query:locals, query:globals, query:thread_locals, query:procedures, query:types");
|
||||
{
|
||||
if(dst_eval.space.kind == RD_EvalSpaceKind_MetaCfg && str8_match(e_string_from_id(dst_eval.space.u64s[1]), str8_lit("theme"), 0))
|
||||
{
|
||||
result = str8_lit("query:themes");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal RD_AutocompCursorInfo
|
||||
rd_autocomp_cursor_info_from_input_string_off(Arena *arena, String8 input, U64 cursor_off)
|
||||
{
|
||||
RD_AutocompCursorInfo result = {0};
|
||||
{
|
||||
result.list_expr = str8_lit("query:locals, query:globals, query:thread_locals, query:procedures, query:types");
|
||||
result.filter = input;
|
||||
result.replaced_range = r1u64(0, input.size);
|
||||
}
|
||||
@@ -14697,11 +14723,15 @@ rd_frame(void)
|
||||
}break;
|
||||
|
||||
//- rjf: themes
|
||||
case RD_CmdKind_OpenTheme:
|
||||
case RD_CmdKind_EditUserTheme:
|
||||
{
|
||||
RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg);
|
||||
RD_Cfg *theme = rd_cfg_child_from_string_or_alloc(parent, str8_lit("theme"));
|
||||
rd_cfg_new_replace(theme, rd_regs()->string);
|
||||
RD_Cfg *parent = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"));
|
||||
rd_cmd(RD_CmdKind_PushQuery, .expr = push_str8f(scratch.arena, "query:config.$%I64x.theme_colors", parent->id));
|
||||
}break;
|
||||
case RD_CmdKind_EditProjectTheme:
|
||||
{
|
||||
RD_Cfg *parent = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project"));
|
||||
rd_cmd(RD_CmdKind_PushQuery, .expr = push_str8f(scratch.arena, "query:config.$%I64x.theme_colors", parent->id));
|
||||
}break;
|
||||
case RD_CmdKind_AddThemeColor:
|
||||
{
|
||||
@@ -14711,7 +14741,7 @@ rd_frame(void)
|
||||
RD_Cfg *value = rd_cfg_new(color, str8_lit("value"));
|
||||
rd_cfg_new(value, str8_lit("0xffffffff"));
|
||||
}break;
|
||||
case RD_CmdKind_ForkLoadedTheme:
|
||||
case RD_CmdKind_ForkTheme:
|
||||
{
|
||||
RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg);
|
||||
RD_CfgList colors = rd_cfg_child_list_from_string(scratch.arena, parent, str8_lit("theme_color"));
|
||||
|
||||
@@ -959,6 +959,7 @@ internal void rd_set_hover_eval(Vec2F32 pos, String8 string);
|
||||
////////////////////////////////
|
||||
//~ rjf: Autocompletion Lister
|
||||
|
||||
internal String8 rd_autocomp_primary_list_expr_from_dst_eval(Arena *arena, E_Eval dst_eval);
|
||||
internal RD_AutocompCursorInfo rd_autocomp_cursor_info_from_input_string_off(Arena *arena, String8 input, U64 cursor_off);
|
||||
internal void rd_set_autocomp_regs_(RD_Regs *regs);
|
||||
#define rd_set_autocomp_regs(...) rd_set_autocomp_regs_(&(RD_Regs){rd_regs_lit_init_top __VA_ARGS__})
|
||||
|
||||
Reference in New Issue
Block a user