From 91ac59b3ec6595dbb60f9e4967239eac7eb50742 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 16 Jan 2021 16:26:14 -0800 Subject: [PATCH] Load themes from search list --- custom/4coder_config.cpp | 10 ---------- custom/4coder_default_framework.cpp | 13 ++++++++++--- custom/generated/command_metadata.h | 8 ++++---- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/custom/4coder_config.cpp b/custom/4coder_config.cpp index 707c2315..0ed583ca 100644 --- a/custom/4coder_config.cpp +++ b/custom/4coder_config.cpp @@ -1441,16 +1441,6 @@ theme_parse__buffer(Application_Links *app, Arena *arena, Buffer_ID buffer, Aren return(parsed); } -function Config* -theme_parse__file_handle(Application_Links *app, Arena *arena, String_Const_u8 file_name, FILE *file, Arena *color_arena, Color_Table *color_table){ - String_Const_u8 data = dump_file_handle(arena, file); - Config *parsed = 0; - if (data.str != 0){ - parsed = theme_parse__data(app, arena, file_name, data, color_arena, color_table); - } - return(parsed); -} - function Config* theme_parse__file_name(Application_Links *app, Arena *arena, char *file_name, Arena *color_arena, Color_Table *color_table){ Config *parsed = 0; diff --git a/custom/4coder_default_framework.cpp b/custom/4coder_default_framework.cpp index e95edc88..767924cd 100644 --- a/custom/4coder_default_framework.cpp +++ b/custom/4coder_default_framework.cpp @@ -539,9 +539,16 @@ CUSTOM_DOC("Loads all the theme files in the default theme folder.") save_all_dirty_buffers_with_postfix(app, fcoder_extension); Scratch_Block scratch(app); - String_Const_u8 bin_path = system_get_path(scratch, SystemPath_Binary); - String_Const_u8 path = push_u8_stringf(scratch, "%.*sthemes", string_expand(bin_path)); - load_folder_of_themes_into_live_set(app, path); + String8List list = {}; + def_search_normal_load_list(scratch, &list); + + for (String8Node *node = list.first; + node != 0; + node = node->next){ + String8 folder_path = node->string; + String8 themes_path = push_u8_stringf(scratch, "%.*sthemes", string_expand(folder_path)); + load_folder_of_themes_into_live_set(app, themes_path); + } } CUSTOM_COMMAND_SIG(load_themes_hot_directory) diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index 62551a48..c686e857 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -290,7 +290,7 @@ static Command_Metadata fcoder_metacmd_table[252] = { { PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "W:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 181 }, { PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines and removes all blank lines in the current buffer.", 93, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 646 }, { PROC_LINKS(clean_trailing_whitespace, 0), false, "clean_trailing_whitespace", 25, "Removes trailing whitespace from all lines in the current buffer.", 65, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 655 }, -{ PROC_LINKS(clear_all_themes, 0), false, "clear_all_themes", 16, "Clear the theme list", 20, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 558 }, +{ PROC_LINKS(clear_all_themes, 0), false, "clear_all_themes", 16, "Clear the theme list", 20, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 565 }, { PROC_LINKS(clear_clipboard, 0), false, "clear_clipboard", 15, "Clears the history of the clipboard", 35, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 221 }, { PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 233 }, { PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 223 }, @@ -326,7 +326,7 @@ static Command_Metadata fcoder_metacmd_table[252] = { { PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, { PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, { PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 846 }, -{ PROC_LINKS(go_to_user_directory, 0), false, "go_to_user_directory", 20, "Go to the 4coder user directory", 31, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1648 }, +{ PROC_LINKS(go_to_user_directory, 0), false, "go_to_user_directory", 20, "Go to the 4coder user directory", 31, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1638 }, { PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2247 }, { PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2255 }, { PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 525 }, @@ -375,9 +375,9 @@ static Command_Metadata fcoder_metacmd_table[252] = { { PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 174 }, { PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 186 }, { PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 823 }, -{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1604 }, +{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1594 }, { PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 535 }, -{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 547 }, +{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 554 }, { PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1495 }, { PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 }, { PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 237 },