diff --git a/4coder_API/types.h b/4coder_API/types.h index 994d88ce..25175e26 100644 --- a/4coder_API/types.h +++ b/4coder_API/types.h @@ -386,17 +386,28 @@ GLOBAL_VAR Mouse_State null_mouse_state = {0}; Throughout the API ranges are thought of in the form [min,max) where max is "one past the end" of the range that is actually read/edited/modified.) */ UNION Range{ STRUCT{ - /* DOC(This is the smaller value in the range, it is also the 'start'.) */ + /* DOC(This is the smaller value in the range.) */ int32_t min; - /* DOC(This is the larger value in the range, it is also the 'end'.) */ + /* DOC(This is the larger value in the range.) */ int32_t max; }; STRUCT{ - /* DOC(This is the start of the range, it is also the 'min'.) */ + /* DOC(This is the start of the range, unioned with min.) */ int32_t start; - /* DOC(This is the end of the range, it is also the 'max'.) */ + /* DOC(This is the end of the range, unioned with max.) */ int32_t end; }; + STRUCT{ + /* DOC(This is the first value in the range, unioned with min.) */ + int32_t first; + /* DOC(This is one_past_the_last value in the range, unioned with max.) */ + int32_t one_past_last; + }; +}; + +STRUCT Range_Array{ + Range *ranges; + int32_t count; }; /* DOC(Parser_String_And_Type contains a string and type integer used to specify information about keywords to the parser.) */ @@ -688,16 +699,29 @@ STRUCT Query_Bar{ String string; }; -/* DOC(This feature is not implemented.) */ -STRUCT Event_Message{ - /* DOC(This feature is not implemented.) */ - int32_t type; +TYPEDEF int32_t Managed_Variable_ID; +static Managed_Variable_ID ManagedVariableIndex_ERROR = -1; + +ENUM(int32_t, Dynamic_Scope_Type){ + DynamicScopeType_Global = 0, + DynamicScopeType_Intersected = 1, + DynamicScopeType_Buffer = 2, + DynamicScopeType_View = 3, +}; + +STRUCT Dynamic_Scope{ + Dynamic_Scope_Type type; + union{ + uint64_t intersected_opaque_handle; + View_ID view_id; + Buffer_ID buffer_id; + }; }; ENUM(int16_t, UI_Item_Type){ UIType_Option = 0, UIType_TextField = 1, - UIType_ThemePreview = 2, + UIType_ColorTheme = 2, }; ENUM(int8_t, UI_Activation_Level){ @@ -727,8 +751,9 @@ STRUCT UI_Item{ String string; } text_field; struct{ - int32_t theme_index; - } theme_preview; + String string; + int32_t index; + } color_theme; }; void *user_data; i32_Rect rectangle; @@ -840,7 +865,7 @@ STRUCT Buffer_Batch_Edit{ TYPEDEF void Custom_Command_Function(struct Application_Links *app); #if defined(CUSTOM_COMMAND_SIG) || defined(CUSTOM_DOC) || defined(CUSTOM_ALIAS) -#error Please don't define CUSTOM_COMMAND_SIG, CUSTOM_DOC, or CUSTOM_ALIAS +#error Please do not define CUSTOM_COMMAND_SIG, CUSTOM_DOC, or CUSTOM_ALIAS #endif #if !defined(META_PASS) diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index 720136c9..6a2117a2 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -974,18 +974,30 @@ CUSTOM_DOC("Queries the user for a string, and incrementally replace every occur //////////////////////////////// -CUSTOM_COMMAND_SIG(save_all_dirty_buffers) -CUSTOM_DOC("Saves all buffers marked dirty (showing the '*' indicator).") -{ +static void +save_all_dirty_buffers_with_postfix(Application_Links *app, String postfix){ for (Buffer_Summary buffer = get_buffer_first(app, AccessOpen); buffer.exists; get_buffer_next(app, &buffer, AccessOpen)){ if (buffer.dirty == DirtyState_UnsavedChanges){ - save_buffer(app, &buffer, buffer.file_name, buffer.file_name_len, 0); + String file_name = make_string(buffer.file_name, buffer.file_name_len); + if (file_name.size >= postfix.size){ + String file_name_post = substr_tail(file_name, file_name.size - postfix.size); + if (match(file_name_post, postfix)){ + save_buffer(app, &buffer, buffer.file_name, buffer.file_name_len, 0); + } + } } } } +CUSTOM_COMMAND_SIG(save_all_dirty_buffers) +CUSTOM_DOC("Saves all buffers marked dirty (showing the '*' indicator).") +{ + String empty = {0}; + save_all_dirty_buffers_with_postfix(app, empty); +} + static void delete_file_base(Application_Links *app, String file_name, Buffer_ID buffer_id){ String path = path_of_directory(file_name); @@ -1462,20 +1474,31 @@ CUSTOM_DOC("Saves the current buffer.") exec_command(app, cmdid_save); } -CUSTOM_COMMAND_SIG(open_color_tweaker) -CUSTOM_DOC("Opens the 4coder colors and fonts selector menu.") -{ - // TODO(allen): TODO(allen): TODO(allen): TODO(allen): TODO(allen): TODO(allen): TODO(allen): - // TODO(allen): TODO(allen): TODO(allen): TODO(allen): TODO(allen): TODO(allen): - // TODO(allen): TODO(allen): TODO(allen): TODO(allen): TODO(allen): - // TODO(allen): TODO(allen): TODO(allen): TODO(allen): - // TODO(allen): TODO(allen): TODO(allen): - // TODO(allen): TODO(allen): - // TODO(allen): -} - //////////////////////////////// +CUSTOM_COMMAND_SIG(reload_themes) +CUSTOM_DOC("Loads all the theme files in the theme folder, replacing duplicates with the new theme data.") +{ + String fcoder_extension = make_lit_string(".4coder"); + save_all_dirty_buffers_with_postfix(app, fcoder_extension); + + Partition *scratch = &global_part; + Temp_Memory temp = begin_temp_memory(scratch); + load_folder_of_themes_into_live_set(app, scratch, "themes"); + String name = get_theme_name(app, scratch, 0); + int32_t theme_count = get_theme_count(app); + for (int32_t i = 1; i < theme_count; i += 1){ + Temp_Memory sub_temp = begin_temp_memory(scratch); + String style_name = get_theme_name(app, scratch, i); + if (match(name, style_name)){ + change_theme_by_index(app, i); + break; + } + end_temp_memory(sub_temp); + } + end_temp_memory(temp); +} + CUSTOM_COMMAND_SIG(open_in_other) CUSTOM_DOC("Interactively opens a file in the other panel.") { diff --git a/4coder_clipboard.cpp b/4coder_clipboard.cpp index 9c67e02a..009b99b8 100644 --- a/4coder_clipboard.cpp +++ b/4coder_clipboard.cpp @@ -50,10 +50,10 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.") int32_t count = clipboard_count(app, 0); if (count > 0){ View_Summary view = get_active_view(app, access); - - view_set_variable(app, &view, view_next_rewrite_loc, RewritePaste); + Dynamic_Scope scope = view_get_dynamic_scope(app, view.view_id); + managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste); int32_t paste_index = 0; - view_set_variable(app, &view, view_paste_index_loc, paste_index); + managed_variable_set(app, scope, view_paste_index_loc, paste_index); int32_t len = clipboard_index(app, 0, paste_index, 0, 0); char *str = 0; @@ -87,15 +87,16 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste int32_t count = clipboard_count(app, 0); if (count > 0){ View_Summary view = get_active_view(app, access); + Dynamic_Scope scope = view_get_dynamic_scope(app, view.view_id); uint64_t rewrite = 0; - view_get_variable(app, &view, view_rewrite_loc, &rewrite); + managed_variable_get(app, scope, view_rewrite_loc, &rewrite); if (rewrite == RewritePaste){ - view_set_variable(app, &view, view_next_rewrite_loc, RewritePaste); + managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste); uint64_t prev_paste_index = 0; - view_get_variable(app, &view, view_paste_index_loc, &prev_paste_index); + managed_variable_get(app, scope, view_paste_index_loc, &prev_paste_index); int32_t paste_index = (int32_t)prev_paste_index + 1; - view_set_variable(app, &view, view_paste_index_loc, paste_index); + managed_variable_set(app, scope, view_paste_index_loc, paste_index); int32_t len = clipboard_index(app, 0, paste_index, 0, 0); char *str = 0; diff --git a/4coder_config.cpp b/4coder_config.cpp index 00902f11..de514bcb 100644 --- a/4coder_config.cpp +++ b/4coder_config.cpp @@ -1681,9 +1681,10 @@ load_folder_of_themes_into_live_set(Application_Links *app, Partition *scratch, File_List list = get_file_list(app, path.str, path.size); for (uint32_t i = 0; i < list.count; ++i){ File_Info *info = &list.infos[i]; - if (info->folder) continue; + if (info->folder){ + continue; + } String info_file_name = make_string(info->filename, info->filename_len); - if (!match(file_extension(info_file_name), "4coder")) continue; char file_name_space[512]; String file_name = make_fixed_width_string(file_name_space); copy(&file_name, path); diff --git a/4coder_default_framework.cpp b/4coder_default_framework.cpp index 9fad4fa7..82cb94dd 100644 --- a/4coder_default_framework.cpp +++ b/4coder_default_framework.cpp @@ -56,13 +56,15 @@ new_view_settings(Application_Links *app, View_Summary *view){ static void view_set_passive(Application_Links *app, View_Summary *view, bool32 value){ - view_set_variable(app, view, view_is_passive_loc, (uint64_t)value); + Dynamic_Scope scope = view_get_dynamic_scope(app, view->view_id); + managed_variable_set(app, scope, view_is_passive_loc, (uint64_t)value); } static bool32 view_get_is_passive(Application_Links *app, View_Summary *view){ + Dynamic_Scope scope = view_get_dynamic_scope(app, view->view_id); uint64_t is_passive = 0; - view_get_variable(app, view, view_is_passive_loc, &is_passive); + managed_variable_get(app, scope, view_is_passive_loc, &is_passive); return(is_passive != 0); } @@ -245,10 +247,10 @@ default_4coder_initialize(Application_Links *app, int32_t override_font_size, bo load_folder_of_themes_into_live_set(app, &global_part, "themes"); load_config_and_apply(app, &global_part, &global_config, override_font_size, override_hinting); - view_rewrite_loc = create_view_variable(app, "DEFAULT.rewrite" , (uint64_t)0); - view_next_rewrite_loc = create_view_variable(app, "DEFAULT.next_rewrite", (uint64_t)0); - view_paste_index_loc = create_view_variable(app, "DEFAULT.paste_index" , (uint64_t)0); - view_is_passive_loc = create_view_variable(app, "DEFAULT.is_passive" , (uint64_t)false); + view_rewrite_loc = managed_variable_create_or_get_id(app, "DEFAULT.rewrite" , (uint64_t)0); + view_next_rewrite_loc = managed_variable_create_or_get_id(app, "DEFAULT.next_rewrite", (uint64_t)0); + view_paste_index_loc = managed_variable_create_or_get_id(app, "DEFAULT.paste_index" , (uint64_t)0); + view_is_passive_loc = managed_variable_create_or_get_id(app, "DEFAULT.is_passive" , (uint64_t)false); } static void diff --git a/4coder_default_framework.h b/4coder_default_framework.h index b542abf4..4e437230 100644 --- a/4coder_default_framework.h +++ b/4coder_default_framework.h @@ -23,11 +23,28 @@ enum Rewrite_Type{ //////////////////////////////// -struct ID_Based_Jump_Location{ - int32_t buffer_id; +struct ID_Line_Column_Jump_Location{ + Buffer_ID buffer_id; int32_t line; int32_t column; }; +typedef ID_Line_Column_Jump_Location ID_Based_Jump_Location; + +struct ID_Pos_Jump_Location{ + Buffer_ID buffer_id; + int32_t pos; +}; + +struct Name_Line_Column_Location{ + String file; + int32_t line; + int32_t column; +}; + +struct ID_Pos_Jump_Location_Array{ + struct ID_Pos_Jump_Location *jumps; + int32_t count; +}; //////////////////////////////// diff --git a/4coder_default_framework_variables.cpp b/4coder_default_framework_variables.cpp index 69b0665b..00191b4b 100644 --- a/4coder_default_framework_variables.cpp +++ b/4coder_default_framework_variables.cpp @@ -30,10 +30,10 @@ static String locked_buffer = make_fixed_width_string(locked_buffer_space); static View_ID build_footer_panel_view_id = 0; -static int32_t view_rewrite_loc = 0; -static int32_t view_next_rewrite_loc = 0; -static int32_t view_paste_index_loc = 0; -static int32_t view_is_passive_loc = 0; +static Managed_Variable_ID view_rewrite_loc = 0; +static Managed_Variable_ID view_next_rewrite_loc = 0; +static Managed_Variable_ID view_paste_index_loc = 0; +static Managed_Variable_ID view_is_passive_loc = 0; static char out_buffer_space[1024]; @@ -44,7 +44,7 @@ static char hot_directory_space[1024]; static bool32 suppressing_mouse = false; -static ID_Based_Jump_Location prev_location = {0}; +static ID_Line_Column_Jump_Location prev_location = {0}; static Config_Data global_config = {0}; diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index 90536c46..8e1d84ab 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -42,12 +42,13 @@ START_HOOK_SIG(default_start){ // also relies on this particular command caller hook. COMMAND_CALLER_HOOK(default_command_caller){ View_Summary view = get_active_view(app, AccessAll); + Dynamic_Scope scope = view_get_dynamic_scope(app, view.view_id); - view_set_variable(app, &view, view_next_rewrite_loc, 0); + managed_variable_set(app, scope, view_next_rewrite_loc, 0); exec_command(app, cmd); uint64_t next_rewrite = 0; - view_get_variable(app, &view, view_next_rewrite_loc, &next_rewrite); - view_set_variable(app, &view, view_rewrite_loc, next_rewrite); + managed_variable_get(app, scope, view_next_rewrite_loc, &next_rewrite); + managed_variable_set(app, scope, view_rewrite_loc, next_rewrite); return(0); } diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index cfbc3358..eecc7e62 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -30,7 +30,6 @@ #include "4coder_auto_indent.h" #include "4coder_search.h" #include "4coder_build_commands.h" -#include "4coder_jumping.h" #include "4coder_jump_sticky.h" #include "4coder_project_commands.h" #include "4coder_function_list.h" diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index 44ab436c..6a6faaec 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -25,6 +25,7 @@ struct Application_Links; #define BUFFER_REMOVE_MARKERS_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Marker_Handle marker) #define BUFFER_GET_SETTING_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out) #define BUFFER_SET_SETTING_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value) +#define BUFFER_GET_DYNAMIC_SCOPE_SIG(n) Dynamic_Scope n(Application_Links *app, Buffer_ID buffer_id) #define BUFFER_TOKEN_COUNT_SIG(n) int32_t n(Application_Links *app, Buffer_Summary *buffer) #define BUFFER_READ_TOKENS_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out) #define BUFFER_GET_TOKEN_INDEX_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result) @@ -41,6 +42,7 @@ struct Application_Links; #define SET_ACTIVE_VIEW_SIG(n) bool32 n(Application_Links *app, View_Summary *view) #define VIEW_GET_SETTING_SIG(n) bool32 n(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out) #define VIEW_SET_SETTING_SIG(n) bool32 n(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value) +#define VIEW_GET_DYNAMIC_SCOPE_SIG(n) Dynamic_Scope n(Application_Links *app, View_ID view_id) #define VIEW_SET_SPLIT_PROPORTION_SIG(n) bool32 n(Application_Links *app, View_Summary *view, float t) #define VIEW_COMPUTE_CURSOR_SIG(n) bool32 n(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out) #define VIEW_SET_CURSOR_SIG(n) bool32 n(Application_Links *app, View_Summary *view, Buffer_Seek seek, bool32 set_preferred_x) @@ -49,21 +51,28 @@ struct Application_Links; #define VIEW_SET_HIGHLIGHT_SIG(n) bool32 n(Application_Links *app, View_Summary *view, int32_t start, int32_t end, bool32 turn_on) #define VIEW_SET_BUFFER_SIG(n) bool32 n(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, Set_Buffer_Flag flags) #define VIEW_POST_FADE_SIG(n) bool32 n(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color) -#define CREATE_VIEW_VARIABLE_SIG(n) int32_t n(Application_Links *app, char *null_terminated_name, uint64_t default_value) -#define VIEW_SET_VARIABLE_SIG(n) bool32 n(Application_Links *app, View_Summary *view, int32_t location, uint64_t value) -#define VIEW_GET_VARIABLE_SIG(n) bool32 n(Application_Links *app, View_Summary *view, int32_t location, uint64_t *value_out) #define VIEW_START_UI_MODE_SIG(n) int32_t n(Application_Links *app, View_Summary *view) #define VIEW_END_UI_MODE_SIG(n) int32_t n(Application_Links *app, View_Summary *view) #define VIEW_SET_UI_SIG(n) bool32 n(Application_Links *app, View_Summary *view, UI_Control *control) #define VIEW_GET_UI_COPY_SIG(n) UI_Control n(Application_Links *app, View_Summary *view, struct Partition *part) +#define GET_GLOBAL_DYNAMIC_SCOPE_SIG(n) Dynamic_Scope n(Application_Links *app) +#define GET_INTERSECTED_DYNAMIC_SCOPE_SIG(n) Dynamic_Scope n(Application_Links *app, Dynamic_Scope *intersected_scopes, int32_t count) +#define MANAGED_VARIABLE_CREATE_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, uint64_t default_value) +#define MANAGED_VARIABLE_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name) +#define MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(n) int32_t n(Application_Links *app, char *null_terminated_name, uint64_t default_value) +#define MANAGED_VARIABLE_SET_SIG(n) bool32 n(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t value) +#define MANAGED_VARIABLE_GET_SIG(n) bool32 n(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t *value_out) #define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type) #define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app) #define GET_MOUSE_STATE_SIG(n) Mouse_State n(Application_Links *app) #define START_QUERY_BAR_SIG(n) bool32 n(Application_Links *app, Query_Bar *bar, uint32_t flags) #define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, uint32_t flags) #define PRINT_MESSAGE_SIG(n) void n(Application_Links *app, char *str, int32_t len) +#define GET_THEME_COUNT_SIG(n) int32_t n(Application_Links *app) +#define GET_THEME_NAME_SIG(n) String n(Application_Links *app, struct Partition *arena, int32_t index) #define CREATE_THEME_SIG(n) void n(Application_Links *app, Theme *theme, char *name, int32_t len) #define CHANGE_THEME_SIG(n) void n(Application_Links *app, char *name, int32_t len) +#define CHANGE_THEME_BY_INDEX_SIG(n) bool32 n(Application_Links *app, int32_t index) #define GET_LARGEST_FACE_ID_SIG(n) Face_ID n(Application_Links *app) #define SET_GLOBAL_FACE_SIG(n) bool32 n(Application_Links *app, Face_ID id, bool32 apply_to_all_buffers) #define BUFFER_SET_FACE_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Face_ID id) @@ -118,6 +127,7 @@ typedef BUFFER_GET_MARKERS_SIG(Buffer_Get_Markers_Function); typedef BUFFER_REMOVE_MARKERS_SIG(Buffer_Remove_Markers_Function); typedef BUFFER_GET_SETTING_SIG(Buffer_Get_Setting_Function); typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function); +typedef BUFFER_GET_DYNAMIC_SCOPE_SIG(Buffer_Get_Dynamic_Scope_Function); typedef BUFFER_TOKEN_COUNT_SIG(Buffer_Token_Count_Function); typedef BUFFER_READ_TOKENS_SIG(Buffer_Read_Tokens_Function); typedef BUFFER_GET_TOKEN_INDEX_SIG(Buffer_Get_Token_Index_Function); @@ -134,6 +144,7 @@ typedef CLOSE_VIEW_SIG(Close_View_Function); typedef SET_ACTIVE_VIEW_SIG(Set_Active_View_Function); typedef VIEW_GET_SETTING_SIG(View_Get_Setting_Function); typedef VIEW_SET_SETTING_SIG(View_Set_Setting_Function); +typedef VIEW_GET_DYNAMIC_SCOPE_SIG(View_Get_Dynamic_Scope_Function); typedef VIEW_SET_SPLIT_PROPORTION_SIG(View_Set_Split_Proportion_Function); typedef VIEW_COMPUTE_CURSOR_SIG(View_Compute_Cursor_Function); typedef VIEW_SET_CURSOR_SIG(View_Set_Cursor_Function); @@ -142,21 +153,28 @@ typedef VIEW_SET_MARK_SIG(View_Set_Mark_Function); typedef VIEW_SET_HIGHLIGHT_SIG(View_Set_Highlight_Function); typedef VIEW_SET_BUFFER_SIG(View_Set_Buffer_Function); typedef VIEW_POST_FADE_SIG(View_Post_Fade_Function); -typedef CREATE_VIEW_VARIABLE_SIG(Create_View_Variable_Function); -typedef VIEW_SET_VARIABLE_SIG(View_Set_Variable_Function); -typedef VIEW_GET_VARIABLE_SIG(View_Get_Variable_Function); typedef VIEW_START_UI_MODE_SIG(View_Start_UI_Mode_Function); typedef VIEW_END_UI_MODE_SIG(View_End_UI_Mode_Function); typedef VIEW_SET_UI_SIG(View_Set_UI_Function); typedef VIEW_GET_UI_COPY_SIG(View_Get_UI_Copy_Function); +typedef GET_GLOBAL_DYNAMIC_SCOPE_SIG(Get_Global_Dynamic_Scope_Function); +typedef GET_INTERSECTED_DYNAMIC_SCOPE_SIG(Get_Intersected_Dynamic_Scope_Function); +typedef MANAGED_VARIABLE_CREATE_SIG(Managed_Variable_Create_Function); +typedef MANAGED_VARIABLE_GET_ID_SIG(Managed_Variable_Get_ID_Function); +typedef MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(Managed_Variable_Create_Or_Get_ID_Function); +typedef MANAGED_VARIABLE_SET_SIG(Managed_Variable_Set_Function); +typedef MANAGED_VARIABLE_GET_SIG(Managed_Variable_Get_Function); typedef GET_USER_INPUT_SIG(Get_User_Input_Function); typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function); typedef GET_MOUSE_STATE_SIG(Get_Mouse_State_Function); typedef START_QUERY_BAR_SIG(Start_Query_Bar_Function); typedef END_QUERY_BAR_SIG(End_Query_Bar_Function); typedef PRINT_MESSAGE_SIG(Print_Message_Function); +typedef GET_THEME_COUNT_SIG(Get_Theme_Count_Function); +typedef GET_THEME_NAME_SIG(Get_Theme_Name_Function); typedef CREATE_THEME_SIG(Create_Theme_Function); typedef CHANGE_THEME_SIG(Change_Theme_Function); +typedef CHANGE_THEME_BY_INDEX_SIG(Change_Theme_By_Index_Function); typedef GET_LARGEST_FACE_ID_SIG(Get_Largest_Face_ID_Function); typedef SET_GLOBAL_FACE_SIG(Set_Global_Face_Function); typedef BUFFER_SET_FACE_SIG(Buffer_Set_Face_Function); @@ -213,6 +231,7 @@ Buffer_Get_Markers_Function *buffer_get_markers; Buffer_Remove_Markers_Function *buffer_remove_markers; Buffer_Get_Setting_Function *buffer_get_setting; Buffer_Set_Setting_Function *buffer_set_setting; +Buffer_Get_Dynamic_Scope_Function *buffer_get_dynamic_scope; Buffer_Token_Count_Function *buffer_token_count; Buffer_Read_Tokens_Function *buffer_read_tokens; Buffer_Get_Token_Index_Function *buffer_get_token_index; @@ -229,6 +248,7 @@ Close_View_Function *close_view; Set_Active_View_Function *set_active_view; View_Get_Setting_Function *view_get_setting; View_Set_Setting_Function *view_set_setting; +View_Get_Dynamic_Scope_Function *view_get_dynamic_scope; View_Set_Split_Proportion_Function *view_set_split_proportion; View_Compute_Cursor_Function *view_compute_cursor; View_Set_Cursor_Function *view_set_cursor; @@ -237,21 +257,28 @@ View_Set_Mark_Function *view_set_mark; View_Set_Highlight_Function *view_set_highlight; View_Set_Buffer_Function *view_set_buffer; View_Post_Fade_Function *view_post_fade; -Create_View_Variable_Function *create_view_variable; -View_Set_Variable_Function *view_set_variable; -View_Get_Variable_Function *view_get_variable; View_Start_UI_Mode_Function *view_start_ui_mode; View_End_UI_Mode_Function *view_end_ui_mode; View_Set_UI_Function *view_set_ui; View_Get_UI_Copy_Function *view_get_ui_copy; +Get_Global_Dynamic_Scope_Function *get_global_dynamic_scope; +Get_Intersected_Dynamic_Scope_Function *get_intersected_dynamic_scope; +Managed_Variable_Create_Function *managed_variable_create; +Managed_Variable_Get_ID_Function *managed_variable_get_id; +Managed_Variable_Create_Or_Get_ID_Function *managed_variable_create_or_get_id; +Managed_Variable_Set_Function *managed_variable_set; +Managed_Variable_Get_Function *managed_variable_get; Get_User_Input_Function *get_user_input; Get_Command_Input_Function *get_command_input; Get_Mouse_State_Function *get_mouse_state; Start_Query_Bar_Function *start_query_bar; End_Query_Bar_Function *end_query_bar; Print_Message_Function *print_message; +Get_Theme_Count_Function *get_theme_count; +Get_Theme_Name_Function *get_theme_name; Create_Theme_Function *create_theme; Change_Theme_Function *change_theme; +Change_Theme_By_Index_Function *change_theme_by_index; Get_Largest_Face_ID_Function *get_largest_face_id; Set_Global_Face_Function *set_global_face; Buffer_Set_Face_Function *buffer_set_face; @@ -307,6 +334,7 @@ Buffer_Get_Markers_Function *buffer_get_markers_; Buffer_Remove_Markers_Function *buffer_remove_markers_; Buffer_Get_Setting_Function *buffer_get_setting_; Buffer_Set_Setting_Function *buffer_set_setting_; +Buffer_Get_Dynamic_Scope_Function *buffer_get_dynamic_scope_; Buffer_Token_Count_Function *buffer_token_count_; Buffer_Read_Tokens_Function *buffer_read_tokens_; Buffer_Get_Token_Index_Function *buffer_get_token_index_; @@ -323,6 +351,7 @@ Close_View_Function *close_view_; Set_Active_View_Function *set_active_view_; View_Get_Setting_Function *view_get_setting_; View_Set_Setting_Function *view_set_setting_; +View_Get_Dynamic_Scope_Function *view_get_dynamic_scope_; View_Set_Split_Proportion_Function *view_set_split_proportion_; View_Compute_Cursor_Function *view_compute_cursor_; View_Set_Cursor_Function *view_set_cursor_; @@ -331,21 +360,28 @@ View_Set_Mark_Function *view_set_mark_; View_Set_Highlight_Function *view_set_highlight_; View_Set_Buffer_Function *view_set_buffer_; View_Post_Fade_Function *view_post_fade_; -Create_View_Variable_Function *create_view_variable_; -View_Set_Variable_Function *view_set_variable_; -View_Get_Variable_Function *view_get_variable_; View_Start_UI_Mode_Function *view_start_ui_mode_; View_End_UI_Mode_Function *view_end_ui_mode_; View_Set_UI_Function *view_set_ui_; View_Get_UI_Copy_Function *view_get_ui_copy_; +Get_Global_Dynamic_Scope_Function *get_global_dynamic_scope_; +Get_Intersected_Dynamic_Scope_Function *get_intersected_dynamic_scope_; +Managed_Variable_Create_Function *managed_variable_create_; +Managed_Variable_Get_ID_Function *managed_variable_get_id_; +Managed_Variable_Create_Or_Get_ID_Function *managed_variable_create_or_get_id_; +Managed_Variable_Set_Function *managed_variable_set_; +Managed_Variable_Get_Function *managed_variable_get_; Get_User_Input_Function *get_user_input_; Get_Command_Input_Function *get_command_input_; Get_Mouse_State_Function *get_mouse_state_; Start_Query_Bar_Function *start_query_bar_; End_Query_Bar_Function *end_query_bar_; Print_Message_Function *print_message_; +Get_Theme_Count_Function *get_theme_count_; +Get_Theme_Name_Function *get_theme_name_; Create_Theme_Function *create_theme_; Change_Theme_Function *change_theme_; +Change_Theme_By_Index_Function *change_theme_by_index_; Get_Largest_Face_ID_Function *get_largest_face_id_; Set_Global_Face_Function *set_global_face_; Buffer_Set_Face_Function *buffer_set_face_; @@ -409,6 +445,7 @@ app_links->buffer_get_markers_ = Buffer_Get_Markers;\ app_links->buffer_remove_markers_ = Buffer_Remove_Markers;\ app_links->buffer_get_setting_ = Buffer_Get_Setting;\ app_links->buffer_set_setting_ = Buffer_Set_Setting;\ +app_links->buffer_get_dynamic_scope_ = Buffer_Get_Dynamic_Scope;\ app_links->buffer_token_count_ = Buffer_Token_Count;\ app_links->buffer_read_tokens_ = Buffer_Read_Tokens;\ app_links->buffer_get_token_index_ = Buffer_Get_Token_Index;\ @@ -425,6 +462,7 @@ app_links->close_view_ = Close_View;\ app_links->set_active_view_ = Set_Active_View;\ app_links->view_get_setting_ = View_Get_Setting;\ app_links->view_set_setting_ = View_Set_Setting;\ +app_links->view_get_dynamic_scope_ = View_Get_Dynamic_Scope;\ app_links->view_set_split_proportion_ = View_Set_Split_Proportion;\ app_links->view_compute_cursor_ = View_Compute_Cursor;\ app_links->view_set_cursor_ = View_Set_Cursor;\ @@ -433,21 +471,28 @@ app_links->view_set_mark_ = View_Set_Mark;\ app_links->view_set_highlight_ = View_Set_Highlight;\ app_links->view_set_buffer_ = View_Set_Buffer;\ app_links->view_post_fade_ = View_Post_Fade;\ -app_links->create_view_variable_ = Create_View_Variable;\ -app_links->view_set_variable_ = View_Set_Variable;\ -app_links->view_get_variable_ = View_Get_Variable;\ app_links->view_start_ui_mode_ = View_Start_UI_Mode;\ app_links->view_end_ui_mode_ = View_End_UI_Mode;\ app_links->view_set_ui_ = View_Set_UI;\ app_links->view_get_ui_copy_ = View_Get_UI_Copy;\ +app_links->get_global_dynamic_scope_ = Get_Global_Dynamic_Scope;\ +app_links->get_intersected_dynamic_scope_ = Get_Intersected_Dynamic_Scope;\ +app_links->managed_variable_create_ = Managed_Variable_Create;\ +app_links->managed_variable_get_id_ = Managed_Variable_Get_ID;\ +app_links->managed_variable_create_or_get_id_ = Managed_Variable_Create_Or_Get_ID;\ +app_links->managed_variable_set_ = Managed_Variable_Set;\ +app_links->managed_variable_get_ = Managed_Variable_Get;\ app_links->get_user_input_ = Get_User_Input;\ app_links->get_command_input_ = Get_Command_Input;\ app_links->get_mouse_state_ = Get_Mouse_State;\ app_links->start_query_bar_ = Start_Query_Bar;\ app_links->end_query_bar_ = End_Query_Bar;\ app_links->print_message_ = Print_Message;\ +app_links->get_theme_count_ = Get_Theme_Count;\ +app_links->get_theme_name_ = Get_Theme_Name;\ app_links->create_theme_ = Create_Theme;\ app_links->change_theme_ = Change_Theme;\ +app_links->change_theme_by_index_ = Change_Theme_By_Index;\ app_links->get_largest_face_id_ = Get_Largest_Face_ID;\ app_links->set_global_face_ = Set_Global_Face;\ app_links->buffer_set_face_ = Buffer_Set_Face;\ @@ -503,6 +548,7 @@ static inline bool32 buffer_get_markers(Application_Links *app, Buffer_Summary * static inline bool32 buffer_remove_markers(Application_Links *app, Buffer_Summary *buffer, Marker_Handle marker){return(app->buffer_remove_markers(app, buffer, marker));} static inline bool32 buffer_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out){return(app->buffer_get_setting(app, buffer, setting, value_out));} static inline bool32 buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value){return(app->buffer_set_setting(app, buffer, setting, value));} +static inline Dynamic_Scope buffer_get_dynamic_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_dynamic_scope(app, buffer_id));} static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_token_count(app, buffer));} static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens(app, buffer, start_token, end_token, tokens_out));} static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index(app, buffer, pos, get_result));} @@ -519,6 +565,7 @@ static inline bool32 close_view(Application_Links *app, View_Summary *view){retu static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view(app, view));} static inline bool32 view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out){return(app->view_get_setting(app, view, setting, value_out));} static inline bool32 view_set_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value){return(app->view_set_setting(app, view, setting, value));} +static inline Dynamic_Scope view_get_dynamic_scope(Application_Links *app, View_ID view_id){return(app->view_get_dynamic_scope(app, view_id));} static inline bool32 view_set_split_proportion(Application_Links *app, View_Summary *view, float t){return(app->view_set_split_proportion(app, view, t));} static inline bool32 view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor(app, view, seek, cursor_out));} static inline bool32 view_set_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, bool32 set_preferred_x){return(app->view_set_cursor(app, view, seek, set_preferred_x));} @@ -527,21 +574,28 @@ static inline bool32 view_set_mark(Application_Links *app, View_Summary *view, B static inline bool32 view_set_highlight(Application_Links *app, View_Summary *view, int32_t start, int32_t end, bool32 turn_on){return(app->view_set_highlight(app, view, start, end, turn_on));} static inline bool32 view_set_buffer(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, Set_Buffer_Flag flags){return(app->view_set_buffer(app, view, buffer_id, flags));} static inline bool32 view_post_fade(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color){return(app->view_post_fade(app, view, seconds, start, end, color));} -static inline int32_t create_view_variable(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->create_view_variable(app, null_terminated_name, default_value));} -static inline bool32 view_set_variable(Application_Links *app, View_Summary *view, int32_t location, uint64_t value){return(app->view_set_variable(app, view, location, value));} -static inline bool32 view_get_variable(Application_Links *app, View_Summary *view, int32_t location, uint64_t *value_out){return(app->view_get_variable(app, view, location, value_out));} static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *view){return(app->view_start_ui_mode(app, view));} static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode(app, view));} static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui(app, view, control));} static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy(app, view, part));} +static inline Dynamic_Scope get_global_dynamic_scope(Application_Links *app){return(app->get_global_dynamic_scope(app));} +static inline Dynamic_Scope get_intersected_dynamic_scope(Application_Links *app, Dynamic_Scope *intersected_scopes, int32_t count){return(app->get_intersected_dynamic_scope(app, intersected_scopes, count));} +static inline Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create(app, null_terminated_name, default_value));} +static inline Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id(app, null_terminated_name));} +static inline int32_t managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id(app, null_terminated_name, default_value));} +static inline bool32 managed_variable_set(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t value){return(app->managed_variable_set(app, scope, location, value));} +static inline bool32 managed_variable_get(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get(app, scope, location, value_out));} static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input(app, get_type, abort_type));} static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input(app));} static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state(app));} static inline bool32 start_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){return(app->start_query_bar(app, bar, flags));} static inline void end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar(app, bar, flags));} static inline void print_message(Application_Links *app, char *str, int32_t len){(app->print_message(app, str, len));} +static inline int32_t get_theme_count(Application_Links *app){return(app->get_theme_count(app));} +static inline String get_theme_name(Application_Links *app, struct Partition *arena, int32_t index){return(app->get_theme_name(app, arena, index));} static inline void create_theme(Application_Links *app, Theme *theme, char *name, int32_t len){(app->create_theme(app, theme, name, len));} static inline void change_theme(Application_Links *app, char *name, int32_t len){(app->change_theme(app, name, len));} +static inline bool32 change_theme_by_index(Application_Links *app, int32_t index){return(app->change_theme_by_index(app, index));} static inline Face_ID get_largest_face_id(Application_Links *app){return(app->get_largest_face_id(app));} static inline bool32 set_global_face(Application_Links *app, Face_ID id, bool32 apply_to_all_buffers){return(app->set_global_face(app, id, apply_to_all_buffers));} static inline bool32 buffer_set_face(Application_Links *app, Buffer_Summary *buffer, Face_ID id){return(app->buffer_set_face(app, buffer, id));} @@ -597,6 +651,7 @@ static inline bool32 buffer_get_markers(Application_Links *app, Buffer_Summary * static inline bool32 buffer_remove_markers(Application_Links *app, Buffer_Summary *buffer, Marker_Handle marker){return(app->buffer_remove_markers_(app, buffer, marker));} static inline bool32 buffer_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out){return(app->buffer_get_setting_(app, buffer, setting, value_out));} static inline bool32 buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value){return(app->buffer_set_setting_(app, buffer, setting, value));} +static inline Dynamic_Scope buffer_get_dynamic_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_dynamic_scope_(app, buffer_id));} static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_token_count_(app, buffer));} static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens_(app, buffer, start_token, end_token, tokens_out));} static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index_(app, buffer, pos, get_result));} @@ -613,6 +668,7 @@ static inline bool32 close_view(Application_Links *app, View_Summary *view){retu static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view_(app, view));} static inline bool32 view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out){return(app->view_get_setting_(app, view, setting, value_out));} static inline bool32 view_set_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value){return(app->view_set_setting_(app, view, setting, value));} +static inline Dynamic_Scope view_get_dynamic_scope(Application_Links *app, View_ID view_id){return(app->view_get_dynamic_scope_(app, view_id));} static inline bool32 view_set_split_proportion(Application_Links *app, View_Summary *view, float t){return(app->view_set_split_proportion_(app, view, t));} static inline bool32 view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor_(app, view, seek, cursor_out));} static inline bool32 view_set_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, bool32 set_preferred_x){return(app->view_set_cursor_(app, view, seek, set_preferred_x));} @@ -621,21 +677,28 @@ static inline bool32 view_set_mark(Application_Links *app, View_Summary *view, B static inline bool32 view_set_highlight(Application_Links *app, View_Summary *view, int32_t start, int32_t end, bool32 turn_on){return(app->view_set_highlight_(app, view, start, end, turn_on));} static inline bool32 view_set_buffer(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, Set_Buffer_Flag flags){return(app->view_set_buffer_(app, view, buffer_id, flags));} static inline bool32 view_post_fade(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color){return(app->view_post_fade_(app, view, seconds, start, end, color));} -static inline int32_t create_view_variable(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->create_view_variable_(app, null_terminated_name, default_value));} -static inline bool32 view_set_variable(Application_Links *app, View_Summary *view, int32_t location, uint64_t value){return(app->view_set_variable_(app, view, location, value));} -static inline bool32 view_get_variable(Application_Links *app, View_Summary *view, int32_t location, uint64_t *value_out){return(app->view_get_variable_(app, view, location, value_out));} static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *view){return(app->view_start_ui_mode_(app, view));} static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode_(app, view));} static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui_(app, view, control));} static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy_(app, view, part));} +static inline Dynamic_Scope get_global_dynamic_scope(Application_Links *app){return(app->get_global_dynamic_scope_(app));} +static inline Dynamic_Scope get_intersected_dynamic_scope(Application_Links *app, Dynamic_Scope *intersected_scopes, int32_t count){return(app->get_intersected_dynamic_scope_(app, intersected_scopes, count));} +static inline Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_(app, null_terminated_name, default_value));} +static inline Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id_(app, null_terminated_name));} +static inline int32_t managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id_(app, null_terminated_name, default_value));} +static inline bool32 managed_variable_set(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t value){return(app->managed_variable_set_(app, scope, location, value));} +static inline bool32 managed_variable_get(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get_(app, scope, location, value_out));} static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input_(app, get_type, abort_type));} static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input_(app));} static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state_(app));} static inline bool32 start_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){return(app->start_query_bar_(app, bar, flags));} static inline void end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar_(app, bar, flags));} static inline void print_message(Application_Links *app, char *str, int32_t len){(app->print_message_(app, str, len));} +static inline int32_t get_theme_count(Application_Links *app){return(app->get_theme_count_(app));} +static inline String get_theme_name(Application_Links *app, struct Partition *arena, int32_t index){return(app->get_theme_name_(app, arena, index));} static inline void create_theme(Application_Links *app, Theme *theme, char *name, int32_t len){(app->create_theme_(app, theme, name, len));} static inline void change_theme(Application_Links *app, char *name, int32_t len){(app->change_theme_(app, name, len));} +static inline bool32 change_theme_by_index(Application_Links *app, int32_t index){return(app->change_theme_by_index_(app, index));} static inline Face_ID get_largest_face_id(Application_Links *app){return(app->get_largest_face_id_(app));} static inline bool32 set_global_face(Application_Links *app, Face_ID id, bool32 apply_to_all_buffers){return(app->set_global_face_(app, id, apply_to_all_buffers));} static inline bool32 buffer_set_face(Application_Links *app, Buffer_Summary *buffer, Face_ID id){return(app->buffer_set_face_(app, buffer, id));} diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index c6388db5..7fed164c 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -2,7 +2,7 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 201 +#define command_one_past_last_id 202 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -146,6 +146,7 @@ CUSTOM_COMMAND_SIG(query_replace); CUSTOM_COMMAND_SIG(query_replace_identifier); CUSTOM_COMMAND_SIG(query_replace_selection); CUSTOM_COMMAND_SIG(redo); +CUSTOM_COMMAND_SIG(reload_themes); CUSTOM_COMMAND_SIG(remap_interactive); CUSTOM_COMMAND_SIG(rename_file_query); CUSTOM_COMMAND_SIG(reopen); @@ -221,8 +222,8 @@ char *source_name; int32_t source_name_len; int32_t line_number; }; -static Command_Metadata fcoder_metacmd_table[201] = { -{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 191 }, +static Command_Metadata fcoder_metacmd_table[202] = { +{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 193 }, { PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 37, 722 }, { PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 37, 733 }, { PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 37, 712 }, @@ -232,8 +233,8 @@ static Command_Metadata fcoder_metacmd_table[201] = { { PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\4coder_build_commands.cpp", 40, 187 }, { PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\4coder_build_commands.cpp", 40, 155 }, { PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 120 }, -{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 133 }, -{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 143 }, +{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 135 }, +{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 145 }, { PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\4coder_build_commands.cpp", 40, 209 }, { PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 368 }, { PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 174 }, @@ -248,11 +249,11 @@ static Command_Metadata fcoder_metacmd_table[201] = { { PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 508 }, { PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 49 }, { PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 40, 487 }, -{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1012 }, -{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1262 }, +{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1024 }, +{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1274 }, { PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 107 }, { PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\4coder_seek.cpp", 30, 1253 }, -{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1240 }, +{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1252 }, { PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 561 }, { PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 569 }, { PROC_LINKS(execute_any_cli, 0), "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\\4coder_system_command.cpp", 40, 23 }, @@ -262,21 +263,21 @@ static Command_Metadata fcoder_metacmd_table[201] = { { PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 30, 1168 }, { PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 30, 1175 }, { PROC_LINKS(goto_first_jump_direct, 0), "goto_first_jump_direct", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 84 }, -{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 533 }, -{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 515 }, +{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 571 }, +{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 553 }, { PROC_LINKS(goto_jump_at_cursor_direct, 0), "goto_jump_at_cursor_direct", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 8 }, { PROC_LINKS(goto_jump_at_cursor_same_panel_direct, 0), "goto_jump_at_cursor_same_panel_direct", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list..", 168, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 29 }, -{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 365 }, -{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 337 }, +{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 399 }, +{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 371 }, { PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 585 }, { PROC_LINKS(goto_next_jump_direct, 0), "goto_next_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 48 }, { PROC_LINKS(goto_next_jump_no_skips_direct, 0), "goto_next_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 66 }, -{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 484 }, -{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 454 }, +{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 522 }, +{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 492 }, { PROC_LINKS(goto_prev_jump_direct, 0), "goto_prev_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 57 }, { PROC_LINKS(goto_prev_jump_no_skips_direct, 0), "goto_prev_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 75 }, -{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 500 }, -{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 470 }, +{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 538 }, +{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 508 }, { PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 471 }, { PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 457 }, { PROC_LINKS(highlight_next_scope_absolute, 0), "highlight_next_scope_absolute", 29, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 40, 363 }, @@ -285,12 +286,12 @@ static Command_Metadata fcoder_metacmd_table[201] = { { PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 82 }, { PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 519 }, { PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 497 }, -{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 31, 608 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 31, 710 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 31, 737 }, -{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 31, 677 }, -{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 31, 590 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1432 }, +{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 31, 647 }, +{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 31, 749 }, +{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 31, 776 }, +{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 31, 716 }, +{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 31, 629 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1444 }, { PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 135 }, { PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 39, 318 }, { PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 32, 741 }, @@ -321,53 +322,54 @@ static Command_Metadata fcoder_metacmd_table[201] = { { PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 31, 196 }, { PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 31, 256 }, { PROC_LINKS(load_project, 0), "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\\4coder_project_commands.cpp", 42, 1071 }, -{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1120 }, +{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1132 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 250 }, { PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 262 }, { PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 268 }, { PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 299 }, -{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1217 }, -{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1153 }, +{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1229 }, +{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1165 }, { PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 308 }, { PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 244 }, { PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 256 }, { PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 101 }, { PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 37, 116 }, -{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 571 }, -{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 556 }, +{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 609 }, +{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 594 }, { PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 42, 1055 }, { PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 42, 1062 }, -{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1465 }, -{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1339 }, -{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1479 }, +{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 31, 792 }, +{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1351 }, +{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1502 }, { PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 58 }, { PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 74 }, { PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 66 }, -{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1375 }, -{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 162 }, -{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 153 }, +{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1387 }, +{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 164 }, +{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 155 }, { PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 288 }, { PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 279 }, { PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 35, 46 }, -{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 35, 130 }, +{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 35, 131 }, { PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 35, 83 }, -{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 35, 137 }, +{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 35, 138 }, { PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 40, 481 }, { PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 42, 1078 }, { PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 42, 1103 }, { PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 912 }, { PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 932 }, { PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 950 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1447 }, -{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 211 }, -{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1078 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1453 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1459 }, +{ PROC_LINKS(reload_themes, 0), "reload_themes", 13, "Loads all the theme files in the theme folder, replacing duplicates with the new theme data.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1479 }, +{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 213 }, +{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1090 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1465 }, { PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 810 }, { PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 781 }, { PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 799 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1459 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 977 }, -{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a name and saves the contents of the current buffer, altering the buffer's name too.", 105, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1038 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1471 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 994 }, +{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a name and saves the contents of the current buffer, altering the buffer's name too.", 105, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1050 }, { PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 40, 738 }, { PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 774 }, { PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 788 }, @@ -402,18 +404,18 @@ static Command_Metadata fcoder_metacmd_table[201] = { { PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 450 }, { PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 30, 1259 }, { PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 30, 1265 }, -{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 185 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1399 }, +{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 187 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1411 }, { PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 348 }, { PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 328 }, { PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 478 }, -{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 203 }, +{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 205 }, { PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 487 }, -{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 197 }, +{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 199 }, { PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 554 }, { PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 543 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1441 }, -{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1389 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1453 }, +{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1401 }, { PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 32, 820 }, { PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 37, 745 }, { PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 106 }, @@ -561,68 +563,69 @@ static int32_t fcoder_metacmd_ID_query_replace = 133; static int32_t fcoder_metacmd_ID_query_replace_identifier = 134; static int32_t fcoder_metacmd_ID_query_replace_selection = 135; static int32_t fcoder_metacmd_ID_redo = 136; -static int32_t fcoder_metacmd_ID_remap_interactive = 137; -static int32_t fcoder_metacmd_ID_rename_file_query = 138; -static int32_t fcoder_metacmd_ID_reopen = 139; -static int32_t fcoder_metacmd_ID_replace_in_range = 140; -static int32_t fcoder_metacmd_ID_reverse_search = 141; -static int32_t fcoder_metacmd_ID_reverse_search_identifier = 142; -static int32_t fcoder_metacmd_ID_save = 143; -static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 144; -static int32_t fcoder_metacmd_ID_save_to_query = 145; -static int32_t fcoder_metacmd_ID_scope_absorb_down = 146; -static int32_t fcoder_metacmd_ID_search = 147; -static int32_t fcoder_metacmd_ID_search_identifier = 148; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 149; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 150; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 151; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 152; -static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 153; -static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 154; -static int32_t fcoder_metacmd_ID_seek_end_of_line = 155; -static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 156; -static int32_t fcoder_metacmd_ID_seek_token_left = 157; -static int32_t fcoder_metacmd_ID_seek_token_right = 158; -static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 159; -static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 160; -static int32_t fcoder_metacmd_ID_seek_whitespace_down = 161; -static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 162; -static int32_t fcoder_metacmd_ID_seek_whitespace_left = 163; -static int32_t fcoder_metacmd_ID_seek_whitespace_right = 164; -static int32_t fcoder_metacmd_ID_seek_whitespace_up = 165; -static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 166; -static int32_t fcoder_metacmd_ID_select_all = 167; -static int32_t fcoder_metacmd_ID_set_bindings_choose = 168; -static int32_t fcoder_metacmd_ID_set_bindings_default = 169; -static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 170; -static int32_t fcoder_metacmd_ID_set_mark = 171; -static int32_t fcoder_metacmd_ID_setup_build_bat = 172; -static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 173; -static int32_t fcoder_metacmd_ID_setup_build_sh = 174; -static int32_t fcoder_metacmd_ID_setup_new_project = 175; -static int32_t fcoder_metacmd_ID_show_filebar = 176; -static int32_t fcoder_metacmd_ID_show_scrollbar = 177; -static int32_t fcoder_metacmd_ID_snipe_token_or_word = 178; -static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 179; -static int32_t fcoder_metacmd_ID_suppress_mouse = 180; -static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 181; -static int32_t fcoder_metacmd_ID_to_lowercase = 182; -static int32_t fcoder_metacmd_ID_to_uppercase = 183; -static int32_t fcoder_metacmd_ID_toggle_filebar = 184; -static int32_t fcoder_metacmd_ID_toggle_fullscreen = 185; -static int32_t fcoder_metacmd_ID_toggle_line_wrap = 186; -static int32_t fcoder_metacmd_ID_toggle_mouse = 187; -static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 188; -static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 189; -static int32_t fcoder_metacmd_ID_undo = 190; -static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 191; -static int32_t fcoder_metacmd_ID_word_complete = 192; -static int32_t fcoder_metacmd_ID_write_and_auto_tab = 193; -static int32_t fcoder_metacmd_ID_write_block = 194; -static int32_t fcoder_metacmd_ID_write_character = 195; -static int32_t fcoder_metacmd_ID_write_hack = 196; -static int32_t fcoder_metacmd_ID_write_note = 197; -static int32_t fcoder_metacmd_ID_write_todo = 198; -static int32_t fcoder_metacmd_ID_write_underscore = 199; -static int32_t fcoder_metacmd_ID_write_zero_struct = 200; +static int32_t fcoder_metacmd_ID_reload_themes = 137; +static int32_t fcoder_metacmd_ID_remap_interactive = 138; +static int32_t fcoder_metacmd_ID_rename_file_query = 139; +static int32_t fcoder_metacmd_ID_reopen = 140; +static int32_t fcoder_metacmd_ID_replace_in_range = 141; +static int32_t fcoder_metacmd_ID_reverse_search = 142; +static int32_t fcoder_metacmd_ID_reverse_search_identifier = 143; +static int32_t fcoder_metacmd_ID_save = 144; +static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 145; +static int32_t fcoder_metacmd_ID_save_to_query = 146; +static int32_t fcoder_metacmd_ID_scope_absorb_down = 147; +static int32_t fcoder_metacmd_ID_search = 148; +static int32_t fcoder_metacmd_ID_search_identifier = 149; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 150; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 151; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 152; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 153; +static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 154; +static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 155; +static int32_t fcoder_metacmd_ID_seek_end_of_line = 156; +static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 157; +static int32_t fcoder_metacmd_ID_seek_token_left = 158; +static int32_t fcoder_metacmd_ID_seek_token_right = 159; +static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 160; +static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 161; +static int32_t fcoder_metacmd_ID_seek_whitespace_down = 162; +static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 163; +static int32_t fcoder_metacmd_ID_seek_whitespace_left = 164; +static int32_t fcoder_metacmd_ID_seek_whitespace_right = 165; +static int32_t fcoder_metacmd_ID_seek_whitespace_up = 166; +static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 167; +static int32_t fcoder_metacmd_ID_select_all = 168; +static int32_t fcoder_metacmd_ID_set_bindings_choose = 169; +static int32_t fcoder_metacmd_ID_set_bindings_default = 170; +static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 171; +static int32_t fcoder_metacmd_ID_set_mark = 172; +static int32_t fcoder_metacmd_ID_setup_build_bat = 173; +static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 174; +static int32_t fcoder_metacmd_ID_setup_build_sh = 175; +static int32_t fcoder_metacmd_ID_setup_new_project = 176; +static int32_t fcoder_metacmd_ID_show_filebar = 177; +static int32_t fcoder_metacmd_ID_show_scrollbar = 178; +static int32_t fcoder_metacmd_ID_snipe_token_or_word = 179; +static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 180; +static int32_t fcoder_metacmd_ID_suppress_mouse = 181; +static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 182; +static int32_t fcoder_metacmd_ID_to_lowercase = 183; +static int32_t fcoder_metacmd_ID_to_uppercase = 184; +static int32_t fcoder_metacmd_ID_toggle_filebar = 185; +static int32_t fcoder_metacmd_ID_toggle_fullscreen = 186; +static int32_t fcoder_metacmd_ID_toggle_line_wrap = 187; +static int32_t fcoder_metacmd_ID_toggle_mouse = 188; +static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 189; +static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 190; +static int32_t fcoder_metacmd_ID_undo = 191; +static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 192; +static int32_t fcoder_metacmd_ID_word_complete = 193; +static int32_t fcoder_metacmd_ID_write_and_auto_tab = 194; +static int32_t fcoder_metacmd_ID_write_block = 195; +static int32_t fcoder_metacmd_ID_write_character = 196; +static int32_t fcoder_metacmd_ID_write_hack = 197; +static int32_t fcoder_metacmd_ID_write_note = 198; +static int32_t fcoder_metacmd_ID_write_todo = 199; +static int32_t fcoder_metacmd_ID_write_underscore = 200; +static int32_t fcoder_metacmd_ID_write_zero_struct = 201; #endif diff --git a/4coder_helper.h b/4coder_helper.h index a348098f..31cda0bc 100644 --- a/4coder_helper.h +++ b/4coder_helper.h @@ -44,8 +44,10 @@ struct Bind_Buffer{ #endif #define PtrDif(a,b) ((uint8_t*)(a) - (uint8_t*)(b)) #define PtrAsInt(a) PtrDif(a,0) +#define HandleAsU64(a) (uint64_t)(PtrAsInt(a)) #define OffsetOfMember(S,m) PtrAsInt(&Member(S,m)) #define CastFromMember(S,m,ptr) (S*)( (uint8_t*)(ptr) - OffsetOfMember(S,m) ) +#define IntAsPtr(a) (void*)(((uint8_t*)0) + a) #if !defined(max_f32) inline float @@ -86,8 +88,8 @@ struct File_Name_Data{ struct File_Name_Path_Data{ String file_name; String path; -String data; - }; + String data; +}; //////////////////////////////// @@ -95,8 +97,8 @@ struct Buffer_Rect{ int32_t char0; int32_t line0; int32_t char1; -int32_t line1; - }; + int32_t line1; +}; //////////////////////////////// diff --git a/4coder_jump_direct.cpp b/4coder_jump_direct.cpp index 12325b45..e0978e48 100644 --- a/4coder_jump_direct.cpp +++ b/4coder_jump_direct.cpp @@ -11,7 +11,7 @@ CUSTOM_DOC("If the cursor is found to be on a jump location, parses the jump loc Temp_Memory temp = begin_temp_memory(&global_part); View_Summary view = get_active_view(app, AccessProtected); - Name_Based_Jump_Location location = {0}; + Name_Line_Column_Location location = {0}; if (parse_jump_from_buffer_line(app, &global_part, view.buffer_id, view.cursor.line, false, &location)){ change_active_panel(app); View_Summary target_view = get_active_view(app, AccessAll); @@ -32,7 +32,7 @@ CUSTOM_DOC("If the cursor is found to be on a jump location, parses the jump loc Temp_Memory temp = begin_temp_memory(&global_part); View_Summary view = get_active_view(app, AccessProtected); - Name_Based_Jump_Location location = {0}; + Name_Line_Column_Location location = {0}; if (parse_jump_from_buffer_line(app, &global_part, view.buffer_id, view.cursor.line, false, &location)){ View_Summary target_view = view; diff --git a/4coder_jump_sticky.cpp b/4coder_jump_sticky.cpp index 554e70d8..e63e6bd7 100644 --- a/4coder_jump_sticky.cpp +++ b/4coder_jump_sticky.cpp @@ -87,15 +87,148 @@ sticky_jump_markers_cleanup(Application_Links *app, Marker_Handle handle, void * } } -// TODO(allen): what to do when a push returns 0? +static Sticky_Jump_Array +parse_buffer_to_jump_array(Application_Links *app, Partition *arena, Buffer_Summary buffer){ + Sticky_Jump_Array result = {0}; + result.jumps = push_array(arena, Sticky_Jump, 0); + + for (int32_t line = 1;; line += 1){ + bool32 output_jump = false; + int32_t colon_index = 0; + bool32 is_sub_error = false; + Buffer_ID out_buffer_id = 0; + int32_t out_pos = 0; + + Temp_Memory temp = begin_temp_memory(arena); + String line_str = {0}; + if (read_line(app, arena, &buffer, line, &line_str)){ + Name_Line_Column_Location location = {0}; + if (parse_jump_location(line_str, &location, &colon_index, &is_sub_error)){ + Buffer_Summary jump_buffer = {0}; + if (open_file(app, &jump_buffer, location.file.str, location.file.size, false, true)){ + if (jump_buffer.exists){ + Partial_Cursor cursor = {0}; + if (buffer_compute_cursor(app, &jump_buffer, + seek_line_char(location.line, location.column), + &cursor)){ + out_buffer_id = jump_buffer.buffer_id; + out_pos = cursor.pos; + output_jump = true; + } + } + } + } + } + else{ + end_temp_memory(temp); + break; + } + end_temp_memory(temp); + + if (output_jump){ + Sticky_Jump *jump = push_array(arena, Sticky_Jump, 1); + jump->list_line = line; + jump->list_colon_index = colon_index; + jump->is_sub_error = is_sub_error; + jump->jump_buffer_id = out_buffer_id; + jump->jump_pos = out_pos; + } + } + + result.count = (int32_t)(push_array(arena, Sticky_Jump, 0) - result.jumps); + return(result); +} + +static Range_Array +jump_array_mark_buffer_ranges(Partition *arena, Sticky_Jump_Array jumps){ + Range_Array result = {0}; + result.ranges = push_array(arena, Range, 0); + int32_t start_i = 0; + for (int32_t i = 1; i <= jumps.count; i += 1){ + bool32 is_end = false; + if (i == jumps.count){ + is_end = true; + } + else if (jumps.jumps[i].jump_buffer_id != jumps.jumps[start_i].jump_buffer_id){ + is_end = true; + } + if (is_end){ + Range *new_range = push_array(arena, Range, 1); + new_range->first = start_i; + new_range->one_past_last = i; + start_i = i; + } + } + result.count = (int32_t)(push_array(arena, Range, 0) - result.ranges); + return(result); +} + +#if 1 static void -init_marker_list(Application_Links *app, Partition *part, General_Memory *general, int32_t buffer_id, +init_marker_list(Application_Links *app, Partition *part, General_Memory *general, Buffer_ID buffer_id, Marker_List *list){ Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); Temp_Memory temp = begin_temp_memory(part); - ID_Based_Jump_Location *location_list = (ID_Based_Jump_Location*)partition_current(part); - uint32_t location_count = 0; + Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, part, buffer); + Range_Array buffer_ranges = jump_array_mark_buffer_ranges(part, jumps); + + Dynamic_Scope scope_array[2]; + scope_array[0] = buffer_get_dynamic_scope(app, buffer_id); + + List_Node_Handle list_sentinel = managed_list_node_alloc(app, scope_array[0]); + + for (int32_t i = 0; i < buffer_ranges.count; i += 1){ + Range range = buffer_ranges.ranges[i]; + Buffer_ID target_buffer_id = jumps.jumps[range.first].jump_buffer_id; + int32_t jump_count = range.one_past_last - range.first; + + scope_array[1] = buffer_get_dynamic_scope(app, target_buffer_id); + Dynamic_Scope scope = get_intersected_dynamic_scope(app, scope_array, ArrayCount(scope_array)); + + Marker_Handle marker_handle = buffer_add_markers(app, target_buffer_id, jump_count, &scope); + Temp_Memory marker_temp = begin_temp_memory(part); + Marker *markers = push_array(part, Marker, jump_count); + for (int32_t j = 0; j < jump_count; j += 1){ + markers[j].pos = jumps.jumps[j + range.first].jump_pos; + markers[j].lean_right = false; + } + buffer_set_markers(app, handle, 0, jump_count, markers); + end_temp_memory(marker_temp); + + int32_t line_details_mem_size = sizeof(Sticky_Jump_Line_Details)*jump_count; + Memory_Handle memory = managed_memory_alloc(app, scope, line_details_mem_size); + Temp_Memory details_temp = begin_temp_memory(part); + Sticky_Jump_Line_Details *details = push_array(part, Sticky_Jump_Line_Details, jump_count); + for (int32_t j = 0; j < jump_count; j += 1){ + details[j].list_line = jumps.jumps[j + range.first].list_line; + details[j].list_colon_index = jumps.jumps[j + range.first].list_colon_index; + details[j].is_sub_error = jumps.jumps[j + range.first].is_sub_error; + } + managed_memory_set(app, memory, 0, details, line_details_mem_size); + end_temp_memory(details_temp); + + List_Node_Handle node_handle = managed_list_node_alloc(app, scope, sizeof(Sticky_Jump_Node_Header)); + managed_list_node_insert(app, list_sentinel, node_handle, ListInsert_Back); + Sticky_Jump_Node_Header node_header = {0}; + node_header.memory = memory; + node_header.markers = marker_handle; + node_handle.count = jump_count; + managed_memory_set(app, node_handle, 0, &node_header, sizeof(node_header)); + } + end_temp_memory(temp); +} + +#else + +static void +init_marker_list(Application_Links *app, Partition *part, General_Memory *general, Buffer_ID buffer_id, + Marker_List *list){ + Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); + + Temp_Memory temp = begin_temp_memory(part); + Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, part, buffer); + Range_Array buffer_ranges = jump_array_mark_buffer_ranges(part, jumps); list->dst_max = 64; list->dst = gen_array(general, Sticky_Jump_Destination_Array, list->dst_max); @@ -106,131 +239,48 @@ init_marker_list(Application_Links *app, Partition *part, General_Memory *genera list->previous_size = buffer.size; uint32_t prev_jump_count = 0; - for (int32_t this_jump_line = 1;; ++this_jump_line){ - bool32 output_jump = false; - Name_Based_Jump_Location location = {0}; - bool32 is_sub_error = false; - - Temp_Memory temp_name = begin_temp_memory(part); - String line_str = {0}; - if (read_line(app, part, &buffer, this_jump_line, &line_str)){ - int32_t colon_index = 0; - if (parse_jump_location(line_str, &location, &colon_index, &is_sub_error)){ - output_jump = true; - } - else{ - end_temp_memory(temp_name); - } - } - else{ - end_temp_memory(temp_name); - break; - } - - if (output_jump){ - Buffer_Summary jump_buffer = {0}; - if (open_file(app, &jump_buffer, location.file.str, location.file.size, false, true)){ - end_temp_memory(temp_name); - if (jump_buffer.buffer_id != 0){ - ID_Based_Jump_Location id_location = {0}; - id_location.buffer_id = jump_buffer.buffer_id; - id_location.line = location.line; - id_location.column = location.column; - - if (location_count > 0){ - ID_Based_Jump_Location *prev_parsed_loc = &location_list[location_count-1]; - if (prev_parsed_loc->buffer_id != id_location.buffer_id){ - Buffer_Summary location_buffer = get_buffer(app, prev_parsed_loc->buffer_id, AccessAll); - - if (location_buffer.exists){ - if (list->dst_count >= list->dst_max){ - double_dst_max(general, list); - } - - Marker_Handle new_handle = buffer_add_markers(app, &location_buffer, location_count, - sticky_jump_markers_cleanup, &list, sizeof(list)); - - list->dst[list->dst_count] = make_sticky_jump_destination_array(prev_jump_count, new_handle); - ++list->dst_count; - - prev_jump_count = list->jump_count; - - Marker *markers = push_array(part, Marker, location_count); - for (uint32_t i = 0; i < location_count; ++i){ - ID_Based_Jump_Location *write_loc = &location_list[i]; - Partial_Cursor cursor = {0}; - Buffer_Seek seek = seek_line_char(write_loc->line, write_loc->column); - if (buffer_compute_cursor(app, &location_buffer, seek, &cursor)){ - markers[i].pos = cursor.pos; - markers[i].lean_right = false; - } - } - - buffer_set_markers(app, &location_buffer, new_handle, 0, location_count, markers); - - location_count = 0; - reset_temp_memory(temp); - } - } - } - - ID_Based_Jump_Location *new_id_location = push_struct(part, ID_Based_Jump_Location); - *new_id_location = id_location; - ++location_count; - - if (list->jump_count >= list->jump_max){ - double_jump_max(general, list); - } - - uint32_t flags = 0; - if (is_sub_error){ - flags |= JumpFlag_IsSubJump; - } - - list->jumps[list->jump_count] = make_sticky_jump_source(this_jump_line, flags); - ++list->jump_count; - } - } - else{ - end_temp_memory(temp_name); - } - } - } - - if (location_count > 0){ - ID_Based_Jump_Location *prev_parsed_loc = &location_list[location_count-1]; - Buffer_Summary location_buffer = get_buffer(app, prev_parsed_loc->buffer_id, AccessAll); + for (int32_t i = 0; i < buffer_ranges.count; i += 1){ + Range range = buffer_ranges.ranges[i]; + Buffer_ID target_buffer_id = jumps.jumps[range.first].jump_buffer_id; + int32_t jump_count = range.one_past_last - range.first; if (list->dst_count >= list->dst_max){ double_dst_max(general, list); } - Marker_Handle new_handle = buffer_add_markers(app, &location_buffer, location_count, + Buffer_Summary location_buffer = get_buffer(app, target_buffer_id, AccessAll); + Marker_Handle new_handle = buffer_add_markers(app, &location_buffer, jump_count, sticky_jump_markers_cleanup, &list, sizeof(list)); + list->dst[list->dst_count] = make_sticky_jump_destination_array(prev_jump_count, new_handle); ++list->dst_count; prev_jump_count = list->jump_count; - Marker *markers = push_array(part, Marker, location_count); - for (uint32_t i = 0; i < location_count; ++i){ - ID_Based_Jump_Location *location = &location_list[i]; - Partial_Cursor cursor = {0}; - Buffer_Seek seek = seek_line_char(location->line, location->column); - if (buffer_compute_cursor(app, &location_buffer, seek, &cursor)){ - markers[i].pos = cursor.pos; - markers[i].lean_right = false; - } + Temp_Memory marker_temp = begin_temp_memory(part); + Marker *markers = push_array(part, Marker, jump_count); + for (int32_t j = 0; j < jump_count; j += 1){ + markers[j].pos = jumps.jumps[j + range.first].jump_pos; + markers[j].lean_right = false; } + buffer_set_markers(app, &location_buffer, new_handle, 0, jump_count, markers); + end_temp_memory(marker_temp); - buffer_set_markers(app, &location_buffer, new_handle, 0, location_count, markers); - - location_count = 0; - reset_temp_memory(temp); + for (int32_t j = range.first; j < range.one_past_last; j += 1){ + if (list->jump_count >= list->jump_max){ + double_jump_max(general, list); + } + uint32_t flags = 0; + if (jumps.jumps[j].is_sub_error){ + flags |= JumpFlag_IsSubJump; + } + list->jumps[list->jump_count] = make_sticky_jump_source(jumps.jumps[j].list_line, flags); + ++list->jump_count; + } } - end_temp_memory(temp); } +#endif static void free_marker_list(General_Memory *general, Marker_List list){ @@ -405,8 +455,12 @@ goto_jump_in_order(Application_Links *app, Marker_List *list, View_Summary *jump } static bool32 -jump_is_repeat(ID_Based_Jump_Location prev, ID_Pos_Jump_Location location){ +jump_is_repeat(ID_Line_Column_Jump_Location prev, ID_Pos_Jump_Location location){ bool32 skip = false; + // NOTE(allen): This looks wrong, but it is correct. The prev_location is a line column type + // because that is how the old-style direct jumps worked, and they are still supported. All code paths + // in the sticky jump system treat line as the field for pos and ignore column. When the time has + // passed and the direct jump legacy system is gone then this can be corrected. if (prev.buffer_id == location.buffer_id && prev.line == location.pos){ skip = true; } diff --git a/4coder_jump_sticky.h b/4coder_jump_sticky.h index 5c4a5f9e..013afad6 100644 --- a/4coder_jump_sticky.h +++ b/4coder_jump_sticky.h @@ -7,6 +7,32 @@ #if !defined(FCODER_JUMP_STICKY_H) #define FCODER_JUMP_STICKY_H +struct Sticky_Jump_Line_Details{ + int32_t list_line; + int32_t list_colon_index; + bool32 is_sub_error; +}; + +struct Sticky_Jump{ + int32_t list_line; + int32_t list_colon_index; + bool32 is_sub_error; + Buffer_ID jump_buffer_id; + int32_t jump_pos; +}; + +struct Sticky_Jump_Array{ + struct Sticky_Jump *jumps; + int32_t count; +}; + +struct Sticky_Jump_Node_Header{ + Memory_Handle memory; + Marker_Handle markers; + int32_t first_index; + int32_t count; +}; + enum Jump_Location_Flag{ JumpFlag_IsSubJump = 0x1, }; diff --git a/4coder_jumping.cpp b/4coder_jumping.cpp index cf694393..7b4a2c51 100644 --- a/4coder_jumping.cpp +++ b/4coder_jumping.cpp @@ -43,7 +43,7 @@ try_skip_rust_arrow(String line){ } static bool32 -parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *colon_char, bool32 *is_sub_error){ +parse_jump_location(String line, Name_Line_Column_Location *location, int32_t *colon_char, bool32 *is_sub_error){ bool32 result = false; *is_sub_error = (line.str[0] == ' '); @@ -161,7 +161,7 @@ parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *co } static bool32 -parse_jump_location(String line, bool32 skip_sub_error, Name_Based_Jump_Location *location, int32_t *colon_char){ +parse_jump_location(String line, bool32 skip_sub_error, Name_Line_Column_Location *location, int32_t *colon_char){ bool32 is_sub_error = false; bool32 result = parse_jump_location(line, location, colon_char, &is_sub_error); if (is_sub_error && skip_sub_error){ @@ -173,7 +173,7 @@ parse_jump_location(String line, bool32 skip_sub_error, Name_Based_Jump_Location static int32_t parse_jump_from_buffer_line(Application_Links *app, Partition *arena, int32_t buffer_id, int32_t line, - bool32 skip_sub_errors, Name_Based_Jump_Location *location){ + bool32 skip_sub_errors, Name_Line_Column_Location *location){ int32_t result = false; String line_str = {0}; Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); @@ -189,7 +189,7 @@ parse_jump_from_buffer_line(Application_Links *app, Partition *arena, //////////////////////////////// static bool32 -get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, Name_Based_Jump_Location *location){ +get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, Name_Line_Column_Location *location){ bool32 result = open_file(app, buffer, location->file.str, location->file.size, false, true); return(result); } @@ -223,7 +223,7 @@ set_view_to_location(Application_Links *app, View_Summary *view, Buffer_Summary } static void -jump_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, Name_Based_Jump_Location location){ +jump_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, Name_Line_Column_Location location){ set_active_view(app, view); set_view_to_location(app, view, buffer, seek_line_char(location.line, location.column)); if (auto_center_after_jumps){ @@ -246,7 +246,7 @@ static bool32 seek_next_jump_in_buffer(Application_Links *app, Partition *part, int32_t buffer_id, int32_t first_line, bool32 skip_sub_errors, int32_t direction, - int32_t *line_out, int32_t *colon_index_out, Name_Based_Jump_Location *location_out){ + int32_t *line_out, int32_t *colon_index_out, Name_Line_Column_Location *location_out){ Assert(direction == 1 || direction == -1); @@ -276,9 +276,9 @@ seek_next_jump_in_buffer(Application_Links *app, Partition *part, return(result); } -static ID_Based_Jump_Location -convert_name_based_to_id_based(Application_Links *app, Name_Based_Jump_Location loc){ - ID_Based_Jump_Location result = {0}; +static ID_Line_Column_Jump_Location +convert_name_based_to_id_based(Application_Links *app, Name_Line_Column_Location loc){ + ID_Line_Column_Jump_Location result = {0}; Buffer_Summary buffer = get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll); if (buffer.exists){ @@ -291,10 +291,10 @@ convert_name_based_to_id_based(Application_Links *app, Name_Based_Jump_Location } static int32_t -seek_next_jump_in_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_sub_errors, int32_t direction, int32_t *line_out, int32_t *colon_index_out, Name_Based_Jump_Location *location_out){ +seek_next_jump_in_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_sub_errors, int32_t direction, int32_t *line_out, int32_t *colon_index_out, Name_Line_Column_Location *location_out){ int32_t result = false; - Name_Based_Jump_Location location = {0}; + Name_Line_Column_Location location = {0}; int32_t line = view->cursor.line; int32_t colon_index = 0; if (seek_next_jump_in_buffer(app, part, view->buffer_id, line+direction, skip_sub_errors, direction, &line, &colon_index, &location)){ @@ -308,7 +308,7 @@ seek_next_jump_in_view(Application_Links *app, Partition *part, View_Summary *vi } static bool32 -skip_this_jump(ID_Based_Jump_Location prev, ID_Based_Jump_Location jump){ +skip_this_jump(ID_Line_Column_Jump_Location prev, ID_Line_Column_Jump_Location jump){ bool32 result = false; if (prev.buffer_id != 0 && prev.buffer_id == jump.buffer_id && prev.line == jump.line && prev.column <= jump.column){ result = true; @@ -317,12 +317,13 @@ skip_this_jump(ID_Based_Jump_Location prev, ID_Based_Jump_Location jump){ } static bool32 -advance_cursor_in_jump_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_repeats, int32_t skip_sub_error, int32_t direction, Name_Based_Jump_Location *location_out){ +advance_cursor_in_jump_view(Application_Links *app, Partition *part, View_Summary *view, int32_t skip_repeats, int32_t skip_sub_error, int32_t direction, Name_Line_Column_Location *location_out){ bool32 result = true; - Name_Based_Jump_Location location = {0}; - ID_Based_Jump_Location jump = {0}; - int32_t line = 0, colon_index = 0; + Name_Line_Column_Location location = {0}; + ID_Line_Column_Jump_Location jump = {0}; + int32_t line = 0; + int32_t colon_index = 0; do{ Temp_Memory temp = begin_temp_memory(part); @@ -340,7 +341,7 @@ advance_cursor_in_jump_view(Application_Links *app, Partition *part, View_Summar if (result){ *location_out = location; - view_set_cursor(app, view, seek_line_char(line, colon_index+1), true); + view_set_cursor(app, view, seek_line_char(line, colon_index + 1), true); } prev_location = jump; @@ -354,7 +355,7 @@ seek_jump(Application_Links *app, Partition *part, bool32 skip_repeats, bool32 s View_Summary view = get_view_for_locked_jump_buffer(app); if (view.exists){ - Name_Based_Jump_Location location = {0}; + Name_Line_Column_Location location = {0}; if (advance_cursor_in_jump_view(app, &global_part, &view, skip_repeats, skip_sub_errors, direction, &location)){ Buffer_Summary buffer = {0}; diff --git a/4coder_jumping.h b/4coder_jumping.h deleted file mode 100644 index d66462ea..00000000 --- a/4coder_jumping.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -4coder_jumping.h - Types used in jumping. -*/ - -// TOP - -#if !defined(FCODER_JUMPING_H) -#define FCODER_JUMPING_H - -struct ID_Pos_Jump_Location{ - Buffer_ID buffer_id; - int32_t pos; -}; - -struct Name_Based_Jump_Location{ - String file; - int32_t line; - int32_t column; -}; - -#endif - -// BOTTOM - diff --git a/4coder_lists.cpp b/4coder_lists.cpp index 432c0197..01c676e8 100644 --- a/4coder_lists.cpp +++ b/4coder_lists.cpp @@ -378,6 +378,45 @@ begin_integrated_lister__with_fixed_options(Application_Links *app, char *query_ view); } +static void +begin_integrated_lister__ui_list(Application_Links *app, char *query_string, + Lister_Handlers handlers, void *user_data, + Lister_UI_Option *options, int32_t option_count, + View_Summary *view){ + Partition *scratch = &global_part; + General_Memory *general = &global_general; + view_start_ui_mode(app, view); + view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map); + Lister_State *state = view_get_lister_state(view); + init_lister_state(state, general); + lister_first_init(&state->lister); + state->lister.theme_list = true; + for (int32_t i = 0; i < option_count; i += 1){ + lister_add_ui_item(&state->arena, &state->lister, + make_string_slowly(options[i].string), + options[i].index, + options[i].user_data, 0); + } + lister_set_query_string(&state->lister, query_string); + state->lister.handlers = handlers; + state->lister.handlers.refresh = 0; + state->lister.user_data = user_data; + lister_update_ui(app, scratch, view, state); +} + +static void +begin_integrated_lister__ui_list(Application_Links *app, char *query_string, + Lister_Activation_Function_Type *activate, void *user_data, + Lister_UI_Option *options, int32_t option_count, + View_Summary *view){ + Lister_Handlers handlers = lister_get_default_handlers(); + handlers.activate = activate; + begin_integrated_lister__ui_list(app, query_string, + handlers, user_data, + options, option_count, + view); +} + //////////////////////////////// static void @@ -394,7 +433,7 @@ generate_all_buffers_list(Application_Links *app, Partition *arena, Lister *list case DirtyState_UnsavedChanges: status = make_lit_string(" *"); break; case DirtyState_UnloadedChanges: status = make_lit_string(" !"); break; } - lister_add_item(arena, lister, buffer_name, status, (void*)buffer_id, 0); + lister_add_item(arena, lister, buffer_name, status, IntAsPtr(buffer_id), 0); } } @@ -491,9 +530,9 @@ enum{ static Lister_Activation_Code activate_confirm_kill(Application_Links *app, View_Summary *view, String text_field, void *user_data, bool32 clicked){ - int32_t behavior = (int32_t)user_data; + int32_t behavior = (int32_t)PtrAsInt(user_data); Lister_State *state = view_get_lister_state(view); - Buffer_ID buffer_id = (Buffer_ID)(state->lister.user_data); + Buffer_ID buffer_id = (Buffer_ID)(PtrAsInt(state->lister.user_data)); switch (behavior){ case SureToKill_No: {}break; @@ -525,13 +564,13 @@ activate_confirm_kill(Application_Links *app, View_Summary *view, String text_fi static void do_gui_sure_to_kill(Application_Links *app, Buffer_Summary *buffer, View_Summary *view){ Lister_Fixed_Option options[] = { - {"(N)o" , "", "Nn", (void*)SureToKill_No }, - {"(Y)es" , "", "Yy", (void*)SureToKill_Yes }, - {"(S)ave and Kill", "", "Ss", (void*)SureToKill_Save}, + {"(N)o" , "", "Nn", IntAsPtr(SureToKill_No) }, + {"(Y)es" , "", "Yy", IntAsPtr(SureToKill_Yes) }, + {"(S)ave and Kill", "", "Ss", IntAsPtr(SureToKill_Save)}, }; int32_t option_count = sizeof(options)/sizeof(options[0]); begin_integrated_lister__with_fixed_options(app, "There are unsaved changes, close anyway?", - activate_confirm_kill, (void*)buffer->buffer_id, + activate_confirm_kill, IntAsPtr(buffer->buffer_id), options, option_count, view); } @@ -539,7 +578,7 @@ do_gui_sure_to_kill(Application_Links *app, Buffer_Summary *buffer, View_Summary static Lister_Activation_Code activate_confirm_close_4coder(Application_Links *app, View_Summary *view, String text_field, void *user_data, bool32 clicked){ - int32_t behavior = (int32_t)user_data; + int32_t behavior = (int32_t)PtrAsInt(user_data); switch (behavior){ case SureToKill_No: {}break; @@ -581,7 +620,7 @@ static Lister_Activation_Code activate_switch_buffer(Application_Links *app, View_Summary *view, String text_field, void *user_data, bool32 activated_by_mouse){ if (user_data != 0){ - Buffer_ID buffer_id = (Buffer_ID)(user_data); + Buffer_ID buffer_id = (Buffer_ID)(PtrAsInt(user_data)); view_set_buffer(app, view, buffer_id, SetBuffer_KeepOriginalGUI); } return(ListerActivation_Finished); @@ -599,7 +638,7 @@ static Lister_Activation_Code activate_kill_buffer(Application_Links *app, View_Summary *view, String text_field, void *user_data, bool32 activated_by_mouse){ if (user_data != 0){ - Buffer_ID buffer_id = (Buffer_ID)(user_data); + Buffer_ID buffer_id = (Buffer_ID)(PtrAsInt(user_data)); kill_buffer(app, buffer_identifier(buffer_id), view->view_id, 0); } return(ListerActivation_Finished); @@ -742,5 +781,38 @@ CUSTOM_DOC("Interactively opens a file.") begin_integrated_lister__file_system_list(app, "Open: ", activate_open, 0, &view); } +static Lister_Activation_Code +activate_select_theme(Application_Links *app, View_Summary *view, String text_field, + void *user_data, bool32 clicked){ + Lister_Activation_Code result = ListerActivation_Finished; + change_theme_by_index(app, (int32_t)PtrAsInt(user_data)); + return(result); +} + +CUSTOM_COMMAND_SIG(open_color_tweaker) +CUSTOM_DOC("Opens the 4coder theme selector list.") +{ + Partition *scratch = &global_part; + Temp_Memory temp = begin_temp_memory(scratch); + + View_Summary view = get_active_view(app, AccessAll); + for (;view_end_ui_mode(app, &view);); + int32_t theme_count = get_theme_count(app); + Lister_UI_Option *options = push_array(scratch, Lister_UI_Option, theme_count); + for (int32_t i = 0; i < theme_count; i += 1){ + String name = get_theme_name(app, scratch, i); + options[i].string = name.str; + options[i].index = i; + options[i].user_data = IntAsPtr(i); + } + begin_integrated_lister__ui_list(app, + "Select a theme: ", + activate_select_theme, 0, + options, theme_count, + &view); + + end_temp_memory(temp); +} + // BOTTOM diff --git a/4coder_long_command_switch.cpp b/4coder_long_command_switch.cpp index 76e9e597..2ea5eb79 100644 --- a/4coder_long_command_switch.cpp +++ b/4coder_long_command_switch.cpp @@ -62,6 +62,9 @@ CUSTOM_DOC("Execute a 'long form' command.") else if (match(bar.string, make_lit_string("mkdir"))){ make_directory_query(app); } + else if (match(bar.string, make_lit_string("reload themes"))){ + reload_themes(app); + } else{ print_message(app, literal("unrecognized command\n")); } diff --git a/4coder_search.cpp b/4coder_search.cpp index 9a580df7..5fc0f76d 100644 --- a/4coder_search.cpp +++ b/4coder_search.cpp @@ -828,12 +828,14 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with if (buffer.exists){ int32_t do_init = false; + Dynamic_Scope scope = view_get_dynamic_scope(app, view.view_id); + uint64_t rewrite = 0; - view_get_variable(app, &view, view_rewrite_loc, &rewrite); + managed_variable_get(app, scope, view_rewrite_loc, &rewrite); if (rewrite != RewriteWordComplete){ do_init = true; } - view_set_variable(app, &view, view_next_rewrite_loc, RewriteWordComplete); + managed_variable_set(app, scope, view_next_rewrite_loc, RewriteWordComplete); if (!complete_state.initialized){ do_init = true; } diff --git a/4coder_ui_helper.cpp b/4coder_ui_helper.cpp index 2facee62..0abb3919 100644 --- a/4coder_ui_helper.cpp +++ b/4coder_ui_helper.cpp @@ -231,10 +231,18 @@ lister_get_clicked_item(Application_Links *app, View_Summary *view, Partition *s static void lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view, Lister_State *state){ + bool32 is_theme_list = state->lister.theme_list; + int32_t x0 = 0; int32_t x1 = view->view_region.x1 - view->view_region.x0; int32_t line_height = (int32_t)view->line_height; - int32_t block_height = line_height*2; + int32_t block_height = 0; + if (is_theme_list){ + block_height = line_height*3 + 6; + } + else{ + block_height = line_height*2; + } Temp_Memory full_temp = begin_temp_memory(scratch); @@ -266,11 +274,18 @@ lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view, y_pos = item_rect.y1; UI_Item item = {0}; - item.type = UIType_Option; + if (!is_theme_list){ + item.type = UIType_Option; + item.option.string = node->string; + item.option.status = node->status; + } + else{ + item.type = UIType_ColorTheme; + item.color_theme.string = node->string; + item.color_theme.index = node->index; + } item.activation_level = UIActivation_None; item.coordinates = UICoordinates_Scrolled; - item.option.string = node->string; - item.option.status = node->status; item.user_data = node->user_data; item.rectangle = item_rect; @@ -405,6 +420,31 @@ lister_add_item(Partition *arena, Lister *lister, user_data, extra_space)); } +static void* +lister_add_ui_item(Partition *arena, Lister *lister, + Lister_Prealloced_String string, int32_t index, + void *user_data, int32_t extra_space){ + Lister_Option_Node *node = push_array(arena, Lister_Option_Node, 1); + node->string = string.string; + node->index = index; + node->user_data = user_data; + zdll_push_back(lister->options.first, lister->options.last, node); + lister->options.count += 1; + void *result = push_array(arena, char, extra_space); + push_align(arena, 8); + return(result); +} + +static void* +lister_add_ui_item(Partition *arena, Lister *lister, + String string, int32_t index, + void *user_data, int32_t extra_space){ + return(lister_add_ui_item(arena, lister, + lister_prealloced(push_string_copy(arena, string)), + index, + user_data, extra_space)); +} + static void* lister_get_user_data(Lister *lister, int32_t index){ if (0 <= index && index < lister->options.count){ diff --git a/4coder_ui_helper.h b/4coder_ui_helper.h index 13dc3467..cbdd2f3a 100644 --- a/4coder_ui_helper.h +++ b/4coder_ui_helper.h @@ -23,7 +23,10 @@ struct Lister_Option_Node{ Lister_Option_Node *next; Lister_Option_Node *prev; String string; - String status; + union{ + String status; + int32_t index; + }; void *user_data; }; @@ -55,6 +58,7 @@ struct Lister{ char key_string_space[256]; String key_string; Lister_Option_List options; + bool32 theme_list; }; struct Lister_Prealloced_String{ @@ -81,6 +85,12 @@ struct Lister_Fixed_Option{ void *user_data; }; +struct Lister_UI_Option{ + char *string; + int32_t index; + void *user_data; +}; + #endif // BOTTOM diff --git a/4ed.cpp b/4ed.cpp index 372f80d9..682ace6b 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -192,7 +192,7 @@ do_feedback_message(System_Functions *system, Models *models, String value){ internal View* panel_make_empty(System_Functions *system, Models *models, Panel *panel){ Assert(panel->view == 0); - View_And_ID new_view = live_set_alloc_view(&models->mem.general, &models->live_set, panel); + View_And_ID new_view = live_set_alloc_view(&models->mem.general, &models->lifetime_allocator, &models->live_set, panel); view_set_file(system, models, new_view.view, models->scratch_buffer); return(new_view.view); } @@ -1072,16 +1072,15 @@ App_Init_Sig(app_init){ { setup_command_table(); - Assert(models->config_api.get_bindings != 0); i32 wanted_size = models->config_api.get_bindings(models->app_links.memory, models->app_links.memory_size); Assert(wanted_size <= models->app_links.memory_size); interpret_binding_buffer(models, models->app_links.memory, wanted_size); - memset(models->app_links.memory, 0, wanted_size); } - dynamic_variables_init(&models->view_variable_layout); + dynamic_variables_init(&models->variable_layout); + dynamic_variables_block_init(&models->mem.general, &models->dynamic_vars); // NOTE(allen): file setup working_set_init(&models->working_set, partition, &vars->models.mem.general); @@ -1134,7 +1133,7 @@ App_Init_Sig(app_init){ General_Memory *general = &models->mem.general; for (i32 i = 0; i < ArrayCount(init_files); ++i){ - Editing_File *file = working_set_alloc_always(&models->working_set, general); + Editing_File *file = working_set_alloc_always(&models->working_set, general, &models->lifetime_allocator); buffer_bind_name(models, general, partition, &models->working_set, file, init_files[i].name); if (init_files[i].read_only){ diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 726a28df..de2bc378 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -95,7 +95,6 @@ fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Live } } - inline void fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Command_Data *cmd){ fill_view_summary(system, view, vptr, &cmd->models->live_set, &cmd->models->working_set); @@ -104,7 +103,6 @@ fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Comm internal Editing_File* get_file_from_identifier(System_Functions *system, Working_Set *working_set, Buffer_Identifier buffer){ Editing_File *file = 0; - if (buffer.id){ file = working_set_get_active_file(working_set, buffer.id); } @@ -112,22 +110,25 @@ get_file_from_identifier(System_Functions *system, Working_Set *working_set, Buf String name = make_string(buffer.name, buffer.name_len); file = working_set_contains_name(working_set, name); } - + return(file); +} + +internal Editing_File* +imp_get_file(Command_Data *cmd, Buffer_ID buffer_id){ + Working_Set *working_set = &cmd->models->working_set; + Editing_File *file = working_set_get_active_file(working_set, buffer_id); + if (file != 0 && !file_is_ready(file)){ + file = 0; + } return(file); } internal Editing_File* imp_get_file(Command_Data *cmd, Buffer_Summary *buffer){ Editing_File *file = 0; - Working_Set *working_set = &cmd->models->working_set;; - if (buffer && buffer->exists){ - file = working_set_get_active_file(working_set, buffer->buffer_id); - if (file != 0 && !file_is_ready(file)){ - file = 0; - } + file = imp_get_file(cmd, buffer->buffer_id); } - return(file); } @@ -135,7 +136,6 @@ internal View* imp_get_view(Command_Data *cmd, View_ID view_id){ Live_Views *live_set = cmd->live_set; View *vptr = 0; - view_id = view_id - 1; if (view_id >= 0 && view_id < live_set->max){ vptr = live_set->views + view_id; @@ -143,18 +143,15 @@ imp_get_view(Command_Data *cmd, View_ID view_id){ vptr = 0; } } - return(vptr); } internal View* imp_get_view(Command_Data *cmd, View_Summary *view){ View *vptr = 0; - - if (view && view->exists){ + if (view != 0 && view->exists){ vptr = imp_get_view(cmd, view->view_id); } - return(vptr); } @@ -290,7 +287,7 @@ DOC_SEE(Command_Line_Interface_Flag) // NOTE(allen): If the buffer is specified by name but does not already exist, then create it. if (file == 0 && buffer_id.name != 0){ - file = working_set_alloc_always(working_set, general); + file = working_set_alloc_always(working_set, general, &models->lifetime_allocator); Assert(file != 0); String name = push_string(part, buffer_id.name, buffer_id.name_len); @@ -928,10 +925,10 @@ DOC_RETURN(returns non-zero on success) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; Editing_File *file = imp_get_file(cmd, buffer); - bool32 result = 0; + bool32 result = false; - if (file){ - result = 1; + if (file != 0){ + result = true; switch (setting){ case BufferSetting_Lex: { @@ -1198,6 +1195,19 @@ DOC_SEE(Buffer_Setting_ID) return(result); } +API_EXPORT Dynamic_Scope +Buffer_Get_Dynamic_Scope(Application_Links *app, Buffer_ID buffer_id) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Editing_File *file = imp_get_file(cmd, buffer_id); + Dynamic_Scope lifetime = {0}; + if (file != 0){ + lifetime.type = DynamicScopeType_Buffer; + lifetime.buffer_id = buffer_id; + } + return(lifetime); +} + API_EXPORT int32_t Buffer_Token_Count(Application_Links *app, Buffer_Summary *buffer) /* @@ -1207,13 +1217,12 @@ If the buffer does not exist or if it is not a lexed buffer, the return is zero. */{ Command_Data *cmd = (Command_Data*)app->cmd_context; Editing_File *file = imp_get_file(cmd, buffer); - int32_t count = 0; - - if (file && file->state.token_array.tokens && file->state.tokens_complete){ + if (file != 0 && + file->state.token_array.tokens && + file->state.tokens_complete){ count = file->state.token_array.count; } - return(count); } @@ -1357,7 +1366,7 @@ DOC_SEE(Buffer_Create_Flag) if (do_empty_buffer){ if ((flags & BufferCreate_NeverNew) == 0){ - file = working_set_alloc_always(working_set, general); + file = working_set_alloc_always(working_set, general, &models->lifetime_allocator); if (file != 0){ if (has_canon_name){ buffer_bind_file(system, general, working_set, file, canon.name); @@ -1383,7 +1392,7 @@ DOC_SEE(Buffer_Create_Flag) if (system->load_file(handle, buffer, size)){ system->load_close(handle); - file = working_set_alloc_always(working_set, general); + file = working_set_alloc_always(working_set, general, &models->lifetime_allocator); if (file != 0){ buffer_bind_file(system, general, working_set, file, canon.name); buffer_bind_name(models, general, part, working_set, file, front_of_directory(fname)); @@ -1495,7 +1504,7 @@ DOC_SEE(Buffer_Identifier) buffer_unbind_file(system, working_set, file); } file_free(system, &models->app_links, &models->mem.general, file); - working_set_free_file(&models->mem.general, working_set, file); + working_set_free_file(&models->mem.general, &models->lifetime_allocator, working_set, file); File_Node *used = &working_set->used_sentinel; File_Node *node = used->next; @@ -1740,7 +1749,7 @@ in the system, the call will fail.) if (vptr != 0 && models->layout.panel_count > 1){ Panel *panel = vptr->transient.panel; - live_set_free_view(&models->mem.general, &models->live_set, vptr); + live_set_free_view(&models->mem.general, &models->lifetime_allocator, &models->live_set, vptr); panel->view = 0; Divider_And_ID div = layout_get_divider(&models->layout, panel->parent); @@ -1809,7 +1818,6 @@ in the system, the call will fail.) layout_fix_all_panels(&models->layout); } - return(result); } @@ -1818,11 +1826,9 @@ Set_Active_View(Application_Links *app, View_Summary *view) /* DOC_PARAM(view, The view parameter specifies which view to make active.) DOC_RETURN(This call returns non-zero on success.) - DOC(If the given view is open, it is set as the active view, and takes subsequent commands and is returned from get_active_view.) - DOC_SEE(get_active_view) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; @@ -1933,6 +1939,19 @@ DOC_SEE(View_Setting_ID) return(result); } +API_EXPORT Dynamic_Scope +View_Get_Dynamic_Scope(Application_Links *app, View_ID view_id) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + View *view = imp_get_view(cmd, view_id); + Dynamic_Scope lifetime = {0}; + if (view != 0){ + lifetime.type = DynamicScopeType_View; + lifetime.view_id = view_id; + } + return(lifetime); +} + API_EXPORT bool32 View_Set_Split_Proportion(Application_Links *app, View_Summary *view, float t) /* @@ -2186,54 +2205,8 @@ DOC_SEE(int_color) } API_EXPORT int32_t -Create_View_Variable(Application_Links *app, char *null_terminated_name, uint64_t default_value){ - Command_Data *cmd = (Command_Data*)app->cmd_context; - Models *models = cmd->models; - String name = make_string_slowly(null_terminated_name); - return(dynamic_variables_lookup_or_create(&models->mem.general, - &models->view_variable_layout, name, default_value)); -} - -API_EXPORT bool32 -View_Set_Variable(Application_Links *app, View_Summary *view, int32_t location, uint64_t value){ - Command_Data *cmd = (Command_Data*)app->cmd_context; - View *vptr = imp_get_view(cmd, view); - bool32 result = false; - if (vptr != 0){ - Models *models = cmd->models; - u64 *ptr = 0; - if (dynamic_variables_get_ptr(&models->mem.general, - &models->view_variable_layout, - &vptr->transient.dynamic_vars, - location, &ptr)){ - result = true; - *ptr = value; - } - } - return(result); -} - -API_EXPORT bool32 -View_Get_Variable(Application_Links *app, View_Summary *view, int32_t location, uint64_t *value_out){ - Command_Data *cmd = (Command_Data*)app->cmd_context; - View *vptr = imp_get_view(cmd, view); - bool32 result = false; - if (vptr != 0){ - Models *models = cmd->models; - u64 *ptr = 0; - if (dynamic_variables_get_ptr(&models->mem.general, - &models->view_variable_layout, - &vptr->transient.dynamic_vars, - location, &ptr)){ - result = true; - *value_out = *ptr; - } - } - return(result); -} - -API_EXPORT int32_t -View_Start_UI_Mode(Application_Links *app, View_Summary *view){ +View_Start_UI_Mode(Application_Links *app, View_Summary *view) +{ Command_Data *cmd = (Command_Data*)app->cmd_context; View *vptr = imp_get_view(cmd, view); if (vptr != 0){ @@ -2247,7 +2220,8 @@ View_Start_UI_Mode(Application_Links *app, View_Summary *view){ } API_EXPORT int32_t -View_End_UI_Mode(Application_Links *app, View_Summary *view){ +View_End_UI_Mode(Application_Links *app, View_Summary *view) +{ Command_Data *cmd = (Command_Data*)app->cmd_context; View *vptr = imp_get_view(cmd, view); if (vptr != 0){ @@ -2266,11 +2240,12 @@ View_End_UI_Mode(Application_Links *app, View_Summary *view){ } API_EXPORT bool32 -View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control){ +View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control) +{ Command_Data *cmd = (Command_Data*)app->cmd_context; - View *vptr = imp_get_view(cmd, view); Models *models = cmd->models; General_Memory *general = &models->mem.general; + View *vptr = imp_get_view(cmd, view); if (vptr != 0){ if (vptr->transient.ui_control.items != 0){ general_memory_free(general, vptr->transient.ui_control.items); @@ -2293,6 +2268,11 @@ View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control){ string_size += item->text_field.query.size; string_size += item->text_field.string.size; }break; + + case UIType_ColorTheme: + { + string_size += item->color_theme.string.size; + }break; } } @@ -2307,20 +2287,30 @@ View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control){ for (UI_Item *item = new_items, *one_past_last = new_items + count; item < one_past_last; item += 1){ + String *fixup[2]; - i32 fixup_count = 0; + + int32_t fixup_count = 0; switch (item->type){ case UIType_Option: { fixup[0] = &item->option.string; fixup[1] = &item->option.status; + fixup_count = 2; }break; case UIType_TextField: { fixup[0] = &item->text_field.query; fixup[1] = &item->text_field.string; + fixup_count = 2; + }break; + case UIType_ColorTheme: + { + fixup[0] = &item->color_theme.string; + fixup_count = 1; }break; } + for (i32 i = 0; i < fixup_count; i += 1){ String old = *fixup[i]; char *new_str = push_array(&string_alloc, char, old.size); @@ -2345,7 +2335,8 @@ View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control){ } API_EXPORT UI_Control -View_Get_UI_Copy(Application_Links *app, View_Summary *view, struct Partition *part){ +View_Get_UI_Copy(Application_Links *app, View_Summary *view, struct Partition *part) +{ Command_Data *cmd = (Command_Data*)app->cmd_context; View *vptr = imp_get_view(cmd, view); UI_Control result = {0}; @@ -2365,6 +2356,188 @@ View_Get_UI_Copy(Application_Links *app, View_Summary *view, struct Partition *p return(result); } +API_EXPORT Dynamic_Scope +Get_Global_Dynamic_Scope(Application_Links *app) +{ + Dynamic_Scope scope = {0}; + scope.type = DynamicScopeType_Global; + return(scope); +} + +API_EXPORT Dynamic_Scope +Get_Intersected_Dynamic_Scope(Application_Links *app, Dynamic_Scope *intersected_scopes, int32_t count) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + Partition *scratch = &models->mem.part; + Dynamic_Scope result = {0}; + + Temp_Memory temp = begin_temp_memory(scratch); + + b32 filled_array = true; + Lifetime_Object **object_ptr_array = push_array(scratch, Lifetime_Object*, 0); + for (i32 i = 0; i < count; i += 1){ + Dynamic_Scope handle = intersected_scopes[i]; + + switch (handle.type){ + case DynamicScopeType_Global: + { + // NOTE(allen): (global_scope INTERSECT X) == X for all X, therefore we emit nothing when a global scope is in the key list. + }break; + + case DynamicScopeType_Intersected: + { + Lifetime_Key *key = (Lifetime_Key*)IntAsPtr(handle.intersected_opaque_handle); + i32 member_count = key->count; + Lifetime_Object **key_member_ptr = key->members; + for (i32 j = 0; j < member_count; j += 1, key_member_ptr += 1){ + Lifetime_Object **new_object_ptr = push_array(scratch, Lifetime_Object*, 1); + *new_object_ptr = *key_member_ptr; + } + }break; + + case DynamicScopeType_Buffer: + { + Editing_File *file = imp_get_file(cmd, handle.buffer_id); + if (file == 0){ + filled_array = false; + goto quit_loop; + } + Lifetime_Object **new_object_ptr = push_array(scratch, Lifetime_Object*, 1); + *new_object_ptr = file->lifetime_object; + }break; + + case DynamicScopeType_View: + { + View *vptr = imp_get_view(cmd, handle.view_id); + if (vptr == 0){ + filled_array = false; + goto quit_loop; + } + Lifetime_Object **new_object_ptr = push_array(scratch, Lifetime_Object*, 1); + *new_object_ptr = vptr->transient.lifetime_object; + }break; + } + } + quit_loop:; + + if (filled_array){ + i32 member_count = (i32)(push_array(scratch, Lifetime_Object*, 0) - object_ptr_array); + member_count = lifetime_sort_and_dedup_object_set(object_ptr_array, member_count); + + General_Memory *general = &models->mem.general; + Lifetime_Allocator *lifetime_allocator = &models->lifetime_allocator; + Lifetime_Key *key = lifetime_get_or_create_intersection_key(general, lifetime_allocator, object_ptr_array, member_count); + result.type = DynamicScopeType_Intersected; + result.intersected_opaque_handle = (u64)(PtrAsInt(key)); + } + + end_temp_memory(temp); + + return(result); +} + +API_EXPORT Managed_Variable_ID +Managed_Variable_Create(Application_Links *app, char *null_terminated_name, uint64_t default_value) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + String name = make_string_slowly(null_terminated_name); + General_Memory *general = &models->mem.general; + Dynamic_Variable_Layout *layout = &models->variable_layout; + return(dynamic_variables_create(general, layout, name, default_value)); +} + +API_EXPORT Managed_Variable_ID +Managed_Variable_Get_ID(Application_Links *app, char *null_terminated_name) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + String name = make_string_slowly(null_terminated_name); + Dynamic_Variable_Layout *layout = &models->variable_layout; + return(dynamic_variables_lookup(layout, name)); +} + +API_EXPORT int32_t +Managed_Variable_Create_Or_Get_ID(Application_Links *app, char *null_terminated_name, uint64_t default_value) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + String name = make_string_slowly(null_terminated_name); + General_Memory *general = &models->mem.general; + Dynamic_Variable_Layout *layout = &models->variable_layout; + return(dynamic_variables_lookup_or_create(general, layout, name, default_value)); +} + +internal bool32 +get_dynamic_variable(Command_Data *cmd, Dynamic_Scope handle, int32_t location, uint64_t **ptr_out){ + Models *models = cmd->models; + General_Memory *general = &models->mem.general; + Dynamic_Variable_Layout *layout = &models->variable_layout; + Dynamic_Variable_Block *block = 0; + + switch (handle.type){ + case DynamicScopeType_Global: + { + block = &models->dynamic_vars; + }break; + + case DynamicScopeType_Intersected: + { + Lifetime_Key *key = (Lifetime_Key*)IntAsPtr(handle.intersected_opaque_handle); + block = &key->dynamic_vars; + }break; + + case DynamicScopeType_Buffer: + { + Editing_File *file = imp_get_file(cmd, handle.buffer_id); + if (file != 0){ + block = &file->dynamic_vars; + } + }break; + + case DynamicScopeType_View: + { + View *vptr = imp_get_view(cmd, handle.view_id); + if (vptr != 0){ + block = &vptr->transient.dynamic_vars; + } + }break; + } + + bool32 result = false; + if (layout != 0 && block != 0){ + if (dynamic_variables_get_ptr(general, layout, block, location, ptr_out)){ + result = true; + } + } + return(result); +} + +API_EXPORT bool32 +Managed_Variable_Set(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t value) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + u64 *ptr = 0; + if (get_dynamic_variable(cmd, scope, location, &ptr)){ + *ptr = value; + return(true); + } + return(false); +} + +API_EXPORT bool32 +Managed_Variable_Get(Application_Links *app, Dynamic_Scope scope, Managed_Variable_ID location, uint64_t *value_out) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + u64 *ptr = 0; + if (get_dynamic_variable(cmd, scope, location, &ptr)){ + *value_out = *ptr; + return(true); + } + return(false); +} + API_EXPORT User_Input Get_User_Input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type) /* @@ -2426,23 +2599,6 @@ DOC_SEE(Mouse_State) return(mouse); } -/* -API_EXPORT Event_Message -Get_Event_Message (Application_Links *app){ -Event_Message message = {0}; -System_Functions *system = (System_Functions*)app->system_links; -Coroutine *coroutine = (Coroutine*)app->current_coroutine; - -if (app->type_coroutine == Co_View){ -Assert(coroutine); -system->yield_coroutine(coroutine); -message = *(Event_Message*)coroutine->in; -} - -return(message); -} -*/ - API_EXPORT bool32 Start_Query_Bar(Application_Links *app, Query_Bar *bar, uint32_t flags) /* @@ -2494,6 +2650,36 @@ DOC(This call posts a string to the *messages* buffer.) do_feedback_message(cmd->system, models, make_string(str, len)); } +API_EXPORT int32_t +Get_Theme_Count(Application_Links *app) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Style_Library *library = &cmd->models->styles; + return(library->count); +} + +API_EXPORT String +Get_Theme_Name(Application_Links *app, struct Partition *arena, int32_t index) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Style_Library *library = &cmd->models->styles; + + String str = {0}; + if (0 <= index && index < library->count){ + Style *style = &library->styles[index]; + char *mem = push_array(arena, char, style->name.size + 1); + if (mem != 0){ + str.str = mem; + str.size = style->name.size; + str.memory_size = str.size + 1; + memcpy(str.str, style->name.str, str.size); + str.str[str.size] = 0; + } + } + + return(str); +} + API_EXPORT void Create_Theme(Application_Links *app, Theme *theme, char *name, int32_t len) /* @@ -2508,10 +2694,11 @@ DOC(This call creates a new theme. If the given name is already the name of a s b32 hit_existing_theme = false; i32 count = library->count; - Style *style = library->styles; - for (i32 i = 0; i < count; ++i, ++style){ + Style *style = library->styles + 1; + for (i32 i = 1; i < count; ++i, ++style){ if (match(style->name, theme_name)){ style_set_colors(style, theme); + Print_Message(app, "DID THING\n", sizeof("DID THING\n") - 1); hit_existing_theme = true; break; } @@ -2538,15 +2725,28 @@ DOC(This call changes 4coder's color pallet to one of the built in themes.) String theme_name = make_string(name, len); i32 count = styles->count; - Style *s = styles->styles; - for (i32 i = 0; i < count; ++i, ++s){ - if (match_ss(s->name, theme_name)){ + Style *s = styles->styles + 1; + for (i32 i = 1; i < count; ++i, ++s){ + if (match(s->name, theme_name)){ style_copy(&styles->styles[0], s); break; } } } +API_EXPORT bool32 +Change_Theme_By_Index(Application_Links *app, int32_t index) +{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Style_Library *styles = &cmd->models->styles; + i32 count = styles->count; + if (0 <= index && index < count){ + style_copy(&styles->styles[0], &styles->styles[index]); + return(true); + } + return(false); +} + API_EXPORT Face_ID Get_Largest_Face_ID(Application_Links *app) /* diff --git a/4ed_app_models.h b/4ed_app_models.h index ceade1f6..de6a4e52 100644 --- a/4ed_app_models.h +++ b/4ed_app_models.h @@ -67,7 +67,9 @@ struct Models{ Live_Views live_set; Parse_Context_Memory parse_context_memory; - Dynamic_Variable_Layout view_variable_layout; + Dynamic_Variable_Layout variable_layout; + Dynamic_Variable_Block dynamic_vars; + Lifetime_Allocator lifetime_allocator; Editing_File *message_buffer; Editing_File *scratch_buffer; @@ -95,6 +97,12 @@ struct Models{ //////////////////////////////// +typedef i32 Lifetime_Object_Type; +enum{ + LifetimeObject_File = 0, + LifetimeObject_View = 1, +}; + enum App_State{ APP_STATE_EDIT, APP_STATE_RESIZING, diff --git a/4ed_app_target.cpp b/4ed_app_target.cpp index 23067148..a1462bfb 100644 --- a/4ed_app_target.cpp +++ b/4ed_app_target.cpp @@ -43,6 +43,7 @@ #include "4ed_linked_node_macros.h" #include "4ed_log.h" +#include "4ed_dynamic_variables.h" #include "4ed_buffer_model.h" #include "4ed_translation.h" @@ -59,10 +60,10 @@ #include "4ed_cli.h" #include "4ed_gui.h" #include "4ed_layout.h" -#include "4ed_dynamic_variables.h" #include "4ed_view.h" #include "4ed_app_models.h" +#include "4ed_dynamic_variables.cpp" #include "4ed_parse_context.cpp" #include "4ed_font.cpp" #include "4ed_translation.cpp" @@ -79,7 +80,6 @@ #include "4ed_hot_directory.cpp" #include "4ed_cli.cpp" #include "4ed_gui.cpp" -#include "4ed_dynamic_variables.cpp" #include "4ed_layout.cpp" #include "4coder_buffer_seek_constructors.cpp" #include "4ed_view.cpp" diff --git a/4ed_defines.h b/4ed_defines.h index 36425651..732f2a1c 100644 --- a/4ed_defines.h +++ b/4ed_defines.h @@ -71,6 +71,11 @@ typedef double f64; #if !defined(Member) # define Member(T, m) (((T*)0)->m) #endif +#define PtrDif(a,b) ((uint8_t*)(a) - (uint8_t*)(b)) +#define PtrAsInt(a) PtrDif(a,0) +#define OffsetOfMember(S,m) PtrAsInt(&Member(S,m)) +#define CastFromMember(S,m,ptr) (S*)( (uint8_t*)(ptr) - OffsetOfMember(S,m) ) +#define IntAsPtr(a) (void*)(((uint8_t*)0) + a) #define STR__(s) #s #define STR_(s) STR__(s) @@ -178,41 +183,77 @@ max_f32_proc(void){ #define max_f32 max_f32_proc() #endif -#define Bit_0 (1 << 0) -#define Bit_1 (1 << 1) -#define Bit_2 (1 << 2) -#define Bit_3 (1 << 3) -#define Bit_4 (1 << 4) -#define Bit_5 (1 << 5) -#define Bit_6 (1 << 6) -#define Bit_7 (1 << 7) +global_const u32 bit_0 = (((u32)1) << 0); +global_const u32 bit_1 = (((u32)1) << 1); +global_const u32 bit_2 = (((u32)1) << 2); +global_const u32 bit_3 = (((u32)1) << 3); +global_const u32 bit_4 = (((u32)1) << 4); +global_const u32 bit_5 = (((u32)1) << 5); +global_const u32 bit_6 = (((u32)1) << 6); +global_const u32 bit_7 = (((u32)1) << 7); -#define Bit_8 (1 << 8) -#define Bit_9 (1 << 9) -#define Bit_10 (1 << 10) -#define Bit_11 (1 << 11) -#define Bit_12 (1 << 12) -#define Bit_13 (1 << 13) -#define Bit_14 (1 << 14) -#define Bit_15 (1 << 15) +global_const u32 bit_8 = (((u32)1) << 8); +global_const u32 bit_9 = (((u32)1) << 9); +global_const u32 bit_10 = (((u32)1) << 10); +global_const u32 bit_11 = (((u32)1) << 11); +global_const u32 bit_12 = (((u32)1) << 12); +global_const u32 bit_13 = (((u32)1) << 13); +global_const u32 bit_14 = (((u32)1) << 14); +global_const u32 bit_15 = (((u32)1) << 15); -#define Bit_16 (1 << 16) -#define Bit_17 (1 << 17) -#define Bit_18 (1 << 18) -#define Bit_19 (1 << 19) -#define Bit_20 (1 << 20) -#define Bit_21 (1 << 21) -#define Bit_22 (1 << 22) -#define Bit_23 (1 << 23) +global_const u32 bit_16 = (((u32)1) << 16); +global_const u32 bit_17 = (((u32)1) << 17); +global_const u32 bit_18 = (((u32)1) << 18); +global_const u32 bit_19 = (((u32)1) << 19); +global_const u32 bit_20 = (((u32)1) << 20); +global_const u32 bit_21 = (((u32)1) << 21); +global_const u32 bit_22 = (((u32)1) << 22); +global_const u32 bit_23 = (((u32)1) << 23); -#define Bit_24 (1 << 24) -#define Bit_25 (1 << 25) -#define Bit_26 (1 << 26) -#define Bit_27 (1 << 27) -#define Bit_28 (1 << 28) -#define Bit_29 (1 << 29) -#define Bit_30 (1 << 30) -#define Bit_31 (1 << 31) +global_const u32 bit_24 = (((u32)1) << 24); +global_const u32 bit_25 = (((u32)1) << 25); +global_const u32 bit_26 = (((u32)1) << 26); +global_const u32 bit_27 = (((u32)1) << 27); +global_const u32 bit_28 = (((u32)1) << 28); +global_const u32 bit_29 = (((u32)1) << 29); +global_const u32 bit_30 = (((u32)1) << 30); +global_const u32 bit_31 = (((u32)1) << 31); + +global_const u64 bit_32 = (((u64)1) << (0 + 32)); +global_const u64 bit_33 = (((u64)1) << (1 + 32)); +global_const u64 bit_34 = (((u64)1) << (2 + 32)); +global_const u64 bit_35 = (((u64)1) << (3 + 32)); +global_const u64 bit_36 = (((u64)1) << (4 + 32)); +global_const u64 bit_37 = (((u64)1) << (5 + 32)); +global_const u64 bit_38 = (((u64)1) << (6 + 32)); +global_const u64 bit_39 = (((u64)1) << (7 + 32)); + +global_const u64 bit_40 = (((u64)1) << (8 + 32)); +global_const u64 bit_41 = (((u64)1) << (9 + 32)); +global_const u64 bit_42 = (((u64)1) << (10 + 32)); +global_const u64 bit_43 = (((u64)1) << (11 + 32)); +global_const u64 bit_44 = (((u64)1) << (12 + 32)); +global_const u64 bit_45 = (((u64)1) << (13 + 32)); +global_const u64 bit_46 = (((u64)1) << (14 + 32)); +global_const u64 bit_47 = (((u64)1) << (15 + 32)); + +global_const u64 bit_48 = (((u64)1) << (16 + 32)); +global_const u64 bit_49 = (((u64)1) << (17 + 32)); +global_const u64 bit_50 = (((u64)1) << (18 + 32)); +global_const u64 bit_51 = (((u64)1) << (19 + 32)); +global_const u64 bit_52 = (((u64)1) << (20 + 32)); +global_const u64 bit_53 = (((u64)1) << (21 + 32)); +global_const u64 bit_54 = (((u64)1) << (22 + 32)); +global_const u64 bit_55 = (((u64)1) << (23 + 32)); + +global_const u64 bit_56 = (((u64)1) << (24 + 32)); +global_const u64 bit_57 = (((u64)1) << (25 + 32)); +global_const u64 bit_58 = (((u64)1) << (26 + 32)); +global_const u64 bit_59 = (((u64)1) << (27 + 32)); +global_const u64 bit_60 = (((u64)1) << (28 + 32)); +global_const u64 bit_61 = (((u64)1) << (29 + 32)); +global_const u64 bit_62 = (((u64)1) << (30 + 32)); +global_const u64 bit_63 = (((u64)1) << (31 + 32)); #endif diff --git a/4ed_dynamic_variables.cpp b/4ed_dynamic_variables.cpp index c1166630..58475249 100644 --- a/4ed_dynamic_variables.cpp +++ b/4ed_dynamic_variables.cpp @@ -15,9 +15,8 @@ dynamic_variables_init(Dynamic_Variable_Layout *layout){ layout->location_counter = 1; } -internal i32 -dynamic_variables_lookup_or_create(General_Memory *general, Dynamic_Variable_Layout *layout, - String name, u64 default_value){ +internal Managed_Variable_ID +dynamic_variables_lookup(Dynamic_Variable_Layout *layout, String name){ for (Dynamic_Variable_Slot *slot = layout->sentinel.next; slot != &layout->sentinel; slot = slot->next){ @@ -25,6 +24,11 @@ dynamic_variables_lookup_or_create(General_Memory *general, Dynamic_Variable_Lay return(slot->location); } } + return(ManagedVariableIndex_ERROR); +} + +internal Managed_Variable_ID +dynamic_variables_create__always(General_Memory *general, Dynamic_Variable_Layout *layout, String name, u64 default_value){ int32_t alloc_size = name.size + 1 + sizeof(Dynamic_Variable_Slot); void *ptr = general_memory_allocate(general, alloc_size); if (ptr != 0){ @@ -39,7 +43,25 @@ dynamic_variables_lookup_or_create(General_Memory *general, Dynamic_Variable_Lay dll_insert_back(&layout->sentinel, new_slot); return(new_slot->location); } - return(0); + return(ManagedVariableIndex_ERROR); +} + +internal Managed_Variable_ID +dynamic_variables_lookup_or_create(General_Memory *general, Dynamic_Variable_Layout *layout, String name, u64 default_value){ + Managed_Variable_ID lookup_id = dynamic_variables_lookup(layout, name); + if (lookup_id != ManagedVariableIndex_ERROR){ + return(lookup_id); + } + return(dynamic_variables_create__always(general, layout, name, default_value)); +} + +internal i32 +dynamic_variables_create(General_Memory *general, Dynamic_Variable_Layout *layout, String name, u64 default_value){ + Managed_Variable_ID lookup_id = dynamic_variables_lookup(layout, name); + if (lookup_id == ManagedVariableIndex_ERROR){ + return(dynamic_variables_create__always(general, layout, name, default_value)); + } + return(ManagedVariableIndex_ERROR); } internal void @@ -98,5 +120,364 @@ dynamic_variables_get_ptr(General_Memory *general, return(result); } +//////////////////////////////// + +internal u64 +lifetime__key_hash(Lifetime_Object **object_ptr_array, i32 count){ + u64 hash = bit_1; + for (i32 i = 0; i < count; i += 1){ + u64 x = (u64)(PtrAsInt(object_ptr_array[i])); + x >>= 3; + hash = (hash + ((hash << 37) ^ (((x) >> (x&1))))); + } + return(hash | bit_63); +} + +internal Lifetime_Key* +lifetime__key_table_lookup(Lifetime_Key_Table *table, u64 hash, Lifetime_Object **object_ptr_array, i32 count){ + u32 max = table->max; + if (max > 0 && table->count > 0){ + u32 first_index = hash%max; + u32 index = first_index; + u64 *hashes = table->hashes; + umem set_size = count*sizeof(Lifetime_Object*); + for (;;){ + if (hashes[index] == hash){ + Lifetime_Key *key = table->keys[index]; + if (key->count == count && + memcmp(object_ptr_array, key->members, set_size) == 0){ + return(key); + } + } + else if (hashes[index] == LifetimeKeyHash_Empty){ + return(0); + } + index += 1; + if (index == max){ + index = 0; + } + if (index == first_index){ + return(0); + } + } + } + return(0); +} + +internal Lifetime_Key_Table +lifetime__key_table_copy(General_Memory *general, Lifetime_Key_Table table, u32 new_max); + +internal void +lifetime__key_table_insert(General_Memory *general, Lifetime_Key_Table *table, u64 hash, Lifetime_Key *key){ + { + u32 max = table->max; + u32 count = table->count; + if (max == 0 || (count + 1)*6 > max*5){ + Assert(general != 0); + Lifetime_Key_Table new_table = lifetime__key_table_copy(general, *table, max*2); + general_memory_free(general, table->mem_ptr); + *table = new_table; + } + } + + { + u32 max = table->max; + if (max > 0 && table->count > 0){ + u32 first_index = hash%max; + u32 index = first_index; + u64 *hashes = table->hashes; + for (;;){ + if (hashes[index] == LifetimeKeyHash_Empty || + hashes[index] == LifetimeKeyHash_Deleted){ + hashes[index] = hash; + table->keys[index] = key; + return; + } + index += 1; + if (index == max){ + index = 0; + } + if (index == first_index){ + return; + } + } + } + } +} + +internal void +lifetime__key_table_erase(Lifetime_Key_Table *table, Lifetime_Key *erase_key){ + u32 max = table->max; + if (max > 0 && table->count > 0){ + u64 hash = lifetime__key_hash(erase_key->members, erase_key->count); + u32 first_index = hash%max; + u32 index = first_index; + u64 *hashes = table->hashes; + for (;;){ + if (hashes[index] == hash){ + Lifetime_Key *key = table->keys[index]; + if (erase_key == key){ + hashes[index] = LifetimeKeyHash_Deleted; + table->keys[index] = 0; + } + } + else if (hashes[index] == LifetimeKeyHash_Empty){ + return; + } + index += 1; + if (index == max){ + index = 0; + } + if (index == first_index){ + return; + } + } + } +} + +internal Lifetime_Key_Table +lifetime__key_table_copy(General_Memory *general, Lifetime_Key_Table table, u32 new_max){ + Lifetime_Key_Table new_table = {0}; + new_table.max = clamp_bottom(table.max, new_max); + new_table.max = clamp_bottom(307, new_table.max); + i32 item_size = sizeof(*new_table.hashes) + sizeof(*new_table.keys); + new_table.mem_ptr = general_memory_allocate(general, item_size*new_table.max); + memset(new_table.mem_ptr, 0, item_size*new_table.max); + new_table.hashes = (u64*)(new_table.mem_ptr); + new_table.keys = (Lifetime_Key**)(new_table.hashes + new_table.max); + for (u32 i = 0; i < table.max; i += 1){ + if ((table.hashes[i]&bit_63) != 0){ + lifetime__key_table_insert(0, &new_table, table.hashes[i], table.keys[i]); + } + } + return(new_table); +} + +internal void +lifetime__free_key(General_Memory *general, Lifetime_Allocator *lifetime_allocator, + Lifetime_Key *key, Lifetime_Object *skip_object){ + // Deinit + dynamic_variables_block_free(general, &key->dynamic_vars); + + // Remove From Objects + i32 count = key->count; + Lifetime_Object **object_ptr = key->members; + for (i32 i = 0; i < count; i += 1, object_ptr += 1){ + if (*object_ptr == skip_object) continue; + + Lifetime_Key_Ref_Node *delete_point_node = 0; + i32 delete_point_i = 0; + + i32 key_i = 0; + Lifetime_Object *object = *object_ptr; + for (Lifetime_Key_Ref_Node *node = object->key_node_first; + node != 0; + node = node->next){ + i32 one_past_last = clamp_top(ArrayCount(node->keys), object->key_count - key_i); + for (i32 j = 0; j < one_past_last; j += 1){ + if (node->keys[j] == key){ + delete_point_node = node; + delete_point_i = j; + goto double_break; + } + } + key_i += one_past_last; + } + double_break:; + + Assert(delete_point_node != 0); + Lifetime_Key_Ref_Node *last_node = object->key_node_last; + Lifetime_Key *last_key = last_node->keys[object->key_count % lifetime_key_reference_per_node]; + delete_point_node->keys[delete_point_i] = last_key; + object->key_count -= 1; + + if ((object->key_count % lifetime_key_reference_per_node) == 0){ + zdll_remove(object->key_node_first, object->key_node_last, last_node); + zdll_push_back(lifetime_allocator->free_key_references.first, lifetime_allocator->free_key_references.last, last_node); + } + } + + // Free + lifetime__key_table_erase(&lifetime_allocator->key_table, key); + general_memory_free(general, key->members); + zdll_push_back(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, key); +} + +internal Lifetime_Key_Ref_Node* +lifetime__alloc_key_reference_node(General_Memory *general, Lifetime_Allocator *lifetime_allocator){ + Lifetime_Key_Ref_Node *result = lifetime_allocator->free_key_references.first; + if (result == 0){ + i32 new_node_count = 32; + Lifetime_Key_Ref_Node *new_nodes = (Lifetime_Key_Ref_Node*)general_memory_allocate(general, sizeof(Lifetime_Key_Ref_Node)*new_node_count); + Lifetime_Key_Ref_Node *new_node_ptr = new_nodes; + for (i32 i = 0; i < new_node_count; i += 1, new_node_ptr += 1){ + zdll_push_back(lifetime_allocator->free_key_references.first, + lifetime_allocator->free_key_references.last, + new_node_ptr); + } + lifetime_allocator->free_key_references.count += new_node_count; + result = lifetime_allocator->free_key_references.first; + } + zdll_remove(lifetime_allocator->free_key_references.first, lifetime_allocator->free_key_references.last, + result); + return(result); +} + +internal void +lifetime__object_add_key(General_Memory *general, Lifetime_Allocator *lifetime_allocator, + Lifetime_Object *object, Lifetime_Key *key){ + Lifetime_Key_Ref_Node *last_node = object->key_node_last; + b32 insert_on_new_node = false; + if (last_node == 0){ + insert_on_new_node = true; + } + else{ + i32 next_insert_slot = object->key_count%ArrayCount(last_node->keys); + if (next_insert_slot != 0){ + last_node->keys[next_insert_slot] = key; + } + else{ + insert_on_new_node = true; + } + } + if (insert_on_new_node){ + Lifetime_Key_Ref_Node *new_node = lifetime__alloc_key_reference_node(general, lifetime_allocator); + zdll_push_back(object->key_node_first, object->key_node_last, new_node); + memset(new_node->keys, 0, sizeof(new_node->keys)); + new_node->keys[0] = key; + object->key_count += 1; + } +} + +internal Lifetime_Object* +lifetime_alloc_object(General_Memory *general, Lifetime_Allocator *lifetime_allocator, i32 user_type, void *user_back_ptr){ + Lifetime_Object *object = lifetime_allocator->free_objects.first; + if (object == 0){ + i32 new_object_count = 256; + Lifetime_Object *new_objects = (Lifetime_Object*)general_memory_allocate(general, sizeof(Lifetime_Object)*new_object_count); + Lifetime_Object *new_object_ptr = new_objects; + for (i32 i = 0; i < new_object_count; i += 1, new_object_ptr += 1){ + zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, new_object_ptr); + } + lifetime_allocator->free_objects.count += new_object_count; + object = lifetime_allocator->free_objects.first; + } + + zdll_remove(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, object); + lifetime_allocator->free_objects.count -= 1; + + memset(object, 0, sizeof(*object)); + object->user_type = user_type; + object->user_back_ptr = user_back_ptr; + + return(object); +} + +internal void +lifetime_free_object(General_Memory *general, Lifetime_Allocator *lifetime_allocator, + Lifetime_Object *lifetime_object){ + i32 key_i = 0; + for (Lifetime_Key_Ref_Node *node = lifetime_object->key_node_first; + node != 0; + node = node->next){ + i32 one_past_last = clamp_top(ArrayCount(node->keys), lifetime_object->key_count - key_i); + for (i32 i = 0; i < one_past_last; i += 1){ + lifetime__free_key(general, lifetime_allocator, node->keys[i], lifetime_object); + } + key_i += one_past_last; + } + + if (lifetime_object->key_count > 0){ + lifetime_object->key_node_last->next = lifetime_allocator->free_key_references.first; + lifetime_allocator->free_key_references.first = lifetime_object->key_node_first; + i32 node_count = (lifetime_object->key_count + (lifetime_key_reference_per_node - 1))/lifetime_key_reference_per_node; + lifetime_allocator->free_key_references.count += node_count; + } + + zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, lifetime_object); +} + +internal i32 +lifetime_sort_object_set__part(Lifetime_Object **ptr_array, i32 first, i32 one_past_last){ + i32 pivot_index = one_past_last - 1; + Lifetime_Object *pivot = ptr_array[pivot_index]; + i32 j = first; + for (i32 i = first; i < pivot_index; i += 1){ + Lifetime_Object *object = ptr_array[i]; + if (object < pivot){ + Swap(Lifetime_Object*, ptr_array[i], ptr_array[j]); + j += 1; + } + } + Swap(Lifetime_Object*, ptr_array[j], ptr_array[pivot_index]); + return(j); +} + +internal void +lifetime_sort_object_set__quick(Lifetime_Object **ptr_array, i32 first, i32 one_past_last){ + if (first + 1 < one_past_last){ + i32 pivot = lifetime_sort_object_set__part(ptr_array, first, one_past_last); + lifetime_sort_object_set__quick(ptr_array, first, pivot); + lifetime_sort_object_set__quick(ptr_array, pivot + 1, one_past_last); + } +} + +internal i32 +lifetime_sort_and_dedup_object_set(Lifetime_Object **ptr_array, i32 count){ + lifetime_sort_object_set__quick(ptr_array, 0, count); + Lifetime_Object **ptr_write = ptr_array; + Lifetime_Object **ptr_read = ptr_array; + for (i32 i = 1; i < count; i += 1, ptr_read += 1){ + if (ptr_write[-1] < *ptr_read){ + ptr_write[0] = *ptr_read; + ptr_write += 1; + } + } + return((i32)(ptr_write - ptr_array)); +} + +internal Lifetime_Key* +lifetime_get_or_create_intersection_key(General_Memory *general, Lifetime_Allocator *lifetime_allocator, Lifetime_Object **object_ptr_array, i32 count){ + u64 hash = lifetime__key_hash(object_ptr_array, count); + + // Lookup + Lifetime_Key *existing_key = lifetime__key_table_lookup(&lifetime_allocator->key_table, hash, + object_ptr_array, count); + if (existing_key != 0){ + return(existing_key); + } + + // Allocate + Lifetime_Key *new_key = lifetime_allocator->free_keys.first; + if (new_key == 0){ + i32 new_key_count = 256; + Lifetime_Key *new_keys = (Lifetime_Key*)general_memory_allocate(general, sizeof(Lifetime_Key)*new_key_count); + Lifetime_Key *new_key_ptr = new_keys; + for (i32 i = 0; i < new_key_count; i += 1, new_key_ptr += 1){ + zdll_push_back(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, new_key_ptr); + } + lifetime_allocator->free_keys.count += new_key_count; + new_key = lifetime_allocator->free_keys.first; + } + zdll_remove(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, new_key); + + // Add to Objects + Lifetime_Object **object_ptr = object_ptr_array; + for (i32 i = 0; i < count; i += 1, object_ptr += 1){ + Lifetime_Object *object = *object_ptr; + lifetime__object_add_key(general, lifetime_allocator, object, new_key); + } + + // Initialize + new_key->members = (Lifetime_Object**)general_memory_allocate(general, sizeof(Lifetime_Object*)*count); + memcpy(new_key->members, object_ptr_array, sizeof(Lifetime_Object*)*count); + new_key->count = count; + dynamic_variables_block_init(general, &new_key->dynamic_vars); + + lifetime__key_table_insert(general, &lifetime_allocator->key_table, hash, new_key); + + return(new_key); +} + // BOTTOM diff --git a/4ed_dynamic_variables.h b/4ed_dynamic_variables.h index 3de8b14c..854b09da 100644 --- a/4ed_dynamic_variables.h +++ b/4ed_dynamic_variables.h @@ -31,6 +31,82 @@ struct Dynamic_Variable_Block{ i32 max; }; +//////////////////////////////// + +global_const i32 lifetime_key_reference_per_node = 32; + +struct Lifetime_Key_Ref_Node{ + Lifetime_Key_Ref_Node *next; + Lifetime_Key_Ref_Node *prev; + struct Lifetime_Key *keys[lifetime_key_reference_per_node]; +}; + +struct Lifetime_Object{ + union{ + struct{ + Lifetime_Object *next; + Lifetime_Object *prev; + }; + struct{ + Lifetime_Key_Ref_Node *key_node_first; + Lifetime_Key_Ref_Node *key_node_last; + i32 key_count; + i32 user_type; + void *user_back_ptr; + }; + }; +}; + +struct Lifetime_Key{ + union{ + struct{ + Lifetime_Key *next; + Lifetime_Key *prev; + }; + struct{ + struct Lifetime_Object **members; + i32 count; + Dynamic_Variable_Block dynamic_vars; + }; + }; +}; + +global_const u64 LifetimeKeyHash_Empty = 0&(~bit_63); +global_const u64 LifetimeKeyHash_Deleted = max_u64&(~bit_63); + +struct Lifetime_Key_Table{ + void *mem_ptr; + u64 *hashes; + Lifetime_Key **keys; + u32 count; + u32 max; +}; + +struct Lifetime_Key_Ref_Node_List{ + Lifetime_Key_Ref_Node *first; + Lifetime_Key_Ref_Node *last; + i32 count; +}; + +struct Lifetime_Object_List{ + Lifetime_Object *first; + Lifetime_Object *last; + i32 count; +}; + +struct Lifetime_Key_List{ + Lifetime_Key *first; + Lifetime_Key *last; + i32 count; +}; + +struct Lifetime_Allocator{ + Lifetime_Key_Ref_Node_List free_key_references; + Lifetime_Object_List free_objects; + Lifetime_Key_List free_keys; + Lifetime_Key_Table key_table; +}; + #endif // BOTTOM diff --git a/4ed_file.h b/4ed_file.h index 600b6a4b..14a7b6ef 100644 --- a/4ed_file.h +++ b/4ed_file.h @@ -131,6 +131,8 @@ struct Editing_File{ b32 is_loading; b32 is_dummy; Editing_File_State state; + Dynamic_Variable_Block dynamic_vars; + Lifetime_Object *lifetime_object; Editing_File_Markers markers; Editing_File_Name base_name; Editing_File_Name unique_name; diff --git a/4ed_linked_node_macros.h b/4ed_linked_node_macros.h index 74afc7b2..f38fe9c0 100644 --- a/4ed_linked_node_macros.h +++ b/4ed_linked_node_macros.h @@ -17,6 +17,13 @@ #define dll_insert_back(p,n) (n)->prev=(p)->prev,(n)->next=(p),(p)->prev=(n),(n)->prev->next=(n) #define dll_remove(n) (n)->next->prev=(n)->prev,(n)->prev->next=(n)->next +#define zdll_push_back_(f,l,n) if(f==0){n->next=n->prev=0;f=l=n;}else{n->prev=l;n->next=0;l->next=n;l=n;} +#define zdll_push_back(f,l,n) do{ zdll_push_back_((f),(l),(n)) }while(0) +#define zdll_remove_front_(f,l,n) if(f==l){f=l=0;}else{f=f->next;f->prev=0;} +#define zdll_remove_back_(f,l,n) if(f==l){f=l=0;}else{l=l->prev;l->next=0;} +#define zdll_remove_(f,l,n) if(f==n){zdll_remove_front_(f,l,n);}else if(l==n){zdll_remove_back_(f,l,n);}else{dll_remove(n);} +#define zdll_remove(f,l,n) do{ zdll_remove_((f),(l),(n)) }while(0) + #define sll_clear(f,l) (f)=(l)=0 #define sll_push(f,l,n) if((f)==0&&(l)==0){(f)=(l)=(n);}else{(l)->next=(n);(l)=(n);}(l)->next=0 #define sll_pop(f,l) if((f)!=(l)){(f)=(f)->next;}else{(f)=(l)=0;} diff --git a/4ed_style.h b/4ed_style.h index 1cdd1db0..5f7f7d84 100644 --- a/4ed_style.h +++ b/4ed_style.h @@ -40,7 +40,8 @@ style_set_name(Style *style, String name){ struct Style_Library{ Style styles[64]; - i32 count, max; + i32 count; + i32 max; }; #endif diff --git a/4ed_view.cpp b/4ed_view.cpp index df4267ef..2eff34f7 100644 --- a/4ed_view.cpp +++ b/4ed_view.cpp @@ -20,7 +20,7 @@ view_get_map(View *view){ } internal View_And_ID -live_set_alloc_view(General_Memory *general, Live_Views *live_set, Panel *panel){ +live_set_alloc_view(General_Memory *general, Lifetime_Allocator *lifetime_allocator, Live_Views *live_set, Panel *panel){ Assert(live_set->count < live_set->max); ++live_set->count; @@ -29,7 +29,6 @@ live_set_alloc_view(General_Memory *general, Live_Views *live_set, Panel *panel) result.id = (i32)(result.view - live_set->views); Assert(result.id == result.view->persistent.id); - //dll_remove(&result.view->transient)); result.view->transient.next->transient.prev = result.view->transient.prev; result.view->transient.prev->transient.next = result.view->transient.next; memset(&result.view->transient, 0, sizeof(result.view->transient)); @@ -41,12 +40,13 @@ live_set_alloc_view(General_Memory *general, Live_Views *live_set, Panel *panel) init_query_set(&result.view->transient.query_set); dynamic_variables_block_init(general, &result.view->transient.dynamic_vars); + result.view->transient.lifetime_object = lifetime_alloc_object(general, lifetime_allocator, LifetimeObject_View, result.view); return(result); } inline void -live_set_free_view(General_Memory *general, Live_Views *live_set, View *view){ +live_set_free_view(General_Memory *general, Lifetime_Allocator *lifetime_allocator, Live_Views *live_set, View *view){ Assert(live_set->count > 0); --live_set->count; @@ -54,7 +54,6 @@ live_set_free_view(General_Memory *general, Live_Views *live_set, View *view){ general_memory_free(general, view->transient.ui_control.items); } - //dll_insert(&live_set->free_sentinel, view); view->transient.next = live_set->free_sentinel.transient.next; view->transient.prev = &live_set->free_sentinel; live_set->free_sentinel.transient.next = view; @@ -62,6 +61,7 @@ live_set_free_view(General_Memory *general, Live_Views *live_set, View *view){ view->transient.in_use = false; dynamic_variables_block_free(general, &view->transient.dynamic_vars); + lifetime_free_object(general, lifetime_allocator, view->transient.lifetime_object); } //////////////////////////////// diff --git a/4ed_view.h b/4ed_view.h index 2f8a3693..bf65dc6b 100644 --- a/4ed_view.h +++ b/4ed_view.h @@ -15,7 +15,6 @@ struct View_Persistent{ i32 id; Coroutine_Head *coroutine; - Event_Message message_passing_slot; }; struct File_Viewing_Data{ @@ -38,6 +37,7 @@ struct View_Transient{ File_Viewing_Data file_data; Dynamic_Variable_Block dynamic_vars; + Lifetime_Object *lifetime_object; i32_Rect file_region_prev; i32_Rect file_region; diff --git a/4ed_view_ui.cpp b/4ed_view_ui.cpp index 225cfb5b..4a3900ae 100644 --- a/4ed_view_ui.cpp +++ b/4ed_view_ui.cpp @@ -241,6 +241,9 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc i32 line_height = view->transient.line_height; Style *style = &models->styles.styles[0]; Face_ID font_id = file->settings.font_id; + char font_name_space[256]; + String font_name = make_fixed_width_string(font_name_space); + font_name.size = system->font.get_name_by_id(font_id, font_name.str, font_name.memory_size); Font_Pointers font = system->font.get_pointers_by_id(font_id); if (!view->transient.hide_file_bar){ @@ -335,43 +338,47 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc draw_string(system, target, font_id, item->text_field.string, x, y, text1_color); }break; - case UIType_ThemePreview: + case UIType_ColorTheme: { - Style *preview_style = &models->styles.styles[item->theme_preview.theme_index]; - u32 back = preview_style->main.back_color; - u32 margin_color = style_get_margin_color(item->activation_level, preview_style); - u32 text_color = preview_style->main.default_color; - u32 keyword_color = preview_style->main.keyword_color; - u32 int_constant_color = preview_style->main.int_constant_color; - u32 comment_color = preview_style->main.comment_color; + Style *style_preview = &models->styles.styles[item->color_theme.index]; + u32 margin_color = style_get_margin_color(item->activation_level, style_preview); + u32 back = style_preview->main.back_color; + u32 text_color = style_preview->main.default_color; + u32 keyword_color = style_preview->main.keyword_color; + u32 int_constant_color = style_preview->main.int_constant_color; + u32 comment_color = style_preview->main.comment_color; + f32_Rect inner = get_inner_rect(item_rect, 3); - draw_rectangle(target, inner, back); + draw_margin(target, item_rect, inner, margin_color); - i32 start_y = (i32)inner.y0; - i32 start_x = (i32)inner.x0; - i32 end_y = (i32)inner.y1; - i32 y = start_y; - i32 x = start_x; - x = ceil32(draw_string(system, target, font_id, preview_style->name.str, x, y, text_color)); + draw_rectangle(target, inner, back); + + i32 y = (i32)inner.y0; + i32 x = (i32)inner.x0; + String str = item->color_theme.string; + if (str.str == 0){ + str = style_preview->name; + } + x = ceil32(draw_string(system, target, font_id, str, x, y, text_color)); + i32 font_x = (i32)(inner.x1 - font_string_width(system, target, font_id, font_name)); + if (font_x > x + 10){ + draw_string(system, target, font_id, font_name, font_x, y, text_color); + } i32 height = font.metrics->height; - x = start_x; + x = (i32)inner.x0; y += height; - if (y + height <= end_y){ - x = ceil32(draw_string(system, target, font_id, "if", x, y, keyword_color)); - x = ceil32(draw_string(system, target, font_id, "(x < ", x, y, text_color)); - x = ceil32(draw_string(system, target, font_id, "0", x, y, int_constant_color)); - x = ceil32(draw_string(system, target, font_id, ") { x = ", x, y, text_color)); - x = ceil32(draw_string(system, target, font_id, "0", x, y, int_constant_color)); - x = ceil32(draw_string(system, target, font_id, "; } ", x, y, text_color)); - x = ceil32(draw_string(system, target, font_id, "// comment", x, y, comment_color)); - - x = start_x; - y += height; - if (y + height <= end_y){ - draw_string(system, target, font_id, "[] () {}; * -> +-/ <>= ! && || % ^", x, y, text_color); - } - } + x = ceil32(draw_string(system, target, font_id, "if", x, y, keyword_color)); + x = ceil32(draw_string(system, target, font_id, "(x < ", x, y, text_color)); + x = ceil32(draw_string(system, target, font_id, "0", x, y, int_constant_color)); + x = ceil32(draw_string(system, target, font_id, ") { x = ", x, y, text_color)); + x = ceil32(draw_string(system, target, font_id, "0", x, y, int_constant_color)); + x = ceil32(draw_string(system, target, font_id, "; } ", x, y, text_color)); + x = ceil32(draw_string(system, target, font_id, "// comment", x, y, comment_color)); + + x = (i32)inner.x0; + y += height; + draw_string(system, target, font_id, "[] () {}; * -> +-/ <>= ! && || % ^", x, y, text_color); }break; } } diff --git a/4ed_working_set.cpp b/4ed_working_set.cpp index b8ffb63f..4571c45c 100644 --- a/4ed_working_set.cpp +++ b/4ed_working_set.cpp @@ -66,8 +66,13 @@ working_set_extend_memory(Working_Set *working_set, Editing_File *new_space, i16 } internal Editing_File* -working_set_alloc(Working_Set *working_set){ +working_set_alloc_always(Working_Set *working_set, General_Memory *general, Lifetime_Allocator *lifetime_allocator){ Editing_File *result = 0; + if (working_set->file_count == working_set->file_max && working_set->array_count < working_set->array_max){ + i16 new_count = (i16)clamp_top(working_set->file_max, max_i16); + Editing_File *new_chunk = gen_array(general, Editing_File, new_count); + working_set_extend_memory(working_set, new_chunk, new_count); + } if (working_set->file_count < working_set->file_max){ File_Node *node = working_set->free_sentinel.next; @@ -83,31 +88,24 @@ working_set_alloc(Working_Set *working_set){ result->settings.minimum_base_display_width = working_set->default_minimum_base_display_width; result->settings.wrap_indicator = WrapIndicator_Show_At_Wrap_Edge; init_file_markers_state(&result->markers); + dynamic_variables_block_init(general, &result->dynamic_vars); + result->lifetime_object = lifetime_alloc_object(general, lifetime_allocator, LifetimeObject_File, result); ++working_set->file_count; } return(result); } -internal Editing_File* -working_set_alloc_always(Working_Set *working_set, General_Memory *general){ - Editing_File *result = 0; - if (working_set->file_count == working_set->file_max && working_set->array_count < working_set->array_max){ - i16 new_count = (i16)clamp_top(working_set->file_max, max_i16); - Editing_File *new_chunk = gen_array(general, Editing_File, new_count); - working_set_extend_memory(working_set, new_chunk, new_count); - } - result = working_set_alloc(working_set); - return(result); -} - inline void -working_set_free_file(General_Memory *general, Working_Set *working_set, Editing_File *file){ +working_set_free_file(General_Memory *general, Lifetime_Allocator *lifetime_allocator, Working_Set *working_set, Editing_File *file){ if (working_set->sync_check_iter == &file->node){ working_set->sync_check_iter = working_set->sync_check_iter->next; } - file->is_dummy = 1; + dynamic_variables_block_free(general, &file->dynamic_vars); + lifetime_free_object(general, lifetime_allocator, file->lifetime_object); + + file->is_dummy = true; dll_remove(&file->node); dll_insert(&working_set->free_sentinel, &file->node); --working_set->file_count; @@ -581,7 +579,7 @@ open_file(System_Functions *system, Models *models, String filename){ General_Memory *general = &mem->general; Partition *part = &mem->part; - file = working_set_alloc_always(working_set, general); + file = working_set_alloc_always(working_set, general, &models->lifetime_allocator); buffer_bind_file(system, general, working_set, file, canon_name.name); buffer_bind_name(models, general, part, working_set, file, front_of_directory(filename)); diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index b4a1a05f..0cff1d45 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -930,8 +930,8 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ Control_Keys *controls = &win32vars.input_chunk.pers.controls; b8 *control_keys = win32vars.input_chunk.pers.control_keys; - b8 down = ((lParam & Bit_31)?(0):(1)); - b8 is_right = ((lParam & Bit_24)?(1):(0)); + b8 down = ((lParam & bit_31)?(0):(1)); + b8 is_right = ((lParam & bit_24)?(1):(0)); if (wParam != 255){ switch (wParam){ @@ -970,7 +970,7 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ default: { - b8 current_state = ((lParam & Bit_31)?(0):(1)); + b8 current_state = ((lParam & bit_31)?(0):(1)); if (current_state){ Key_Code key = keycode_lookup_table[(u8)wParam]; diff --git a/site/source_material/binding_list.txt b/site/source_material/binding_list.txt index 69a1bae7..e358d74b 100644 --- a/site/source_material/binding_list.txt +++ b/site/source_material/binding_list.txt @@ -33,13 +33,13 @@ The following bindings apply in all situations. \ITEM \STYLE{code} \END Change the currently active panel, moving to the panel with the next highest view_id. \ITEM \STYLE{code} \END Change the currently active panel, moving to the panel with the next lowest view_id. \ITEM \STYLE{code} \END Interactively creates a new file. -\ITEM \STYLE{code} \END Interactively opens or creates a new file. +\ITEM \STYLE{code} \END Interactively open a file out of the file system. \ITEM \STYLE{code} \END Interactively opens a file in the other panel. \ITEM \STYLE{code} \END Interactively kill an open buffer. \ITEM \STYLE{code} \END Interactively switch to an open buffer. \ITEM \STYLE{code} \END Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns. \ITEM \STYLE{code} \END Saves all buffers marked dirty (showing the '*' indicator). -\ITEM \STYLE{code} \END Opens the 4coder colors and fonts selector menu. +\ITEM \STYLE{code} \END Opens the 4coder theme selector list. \ITEM \STYLE{code} \END If the special build panel is open, makes the build panel the active panel. \ITEM \STYLE{code} \END If the special build panel is open, closes it. \ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations. @@ -185,12 +185,12 @@ The following commands only apply in files where the lexer (syntax highlighting) \SECTION{default-lister-ui-map} These commands apply in 'lister mode' such as when you open a file. \LIST -\ITEM \STYLE{code} \END A list mode command that inserts a new character to the text field. -\ITEM \STYLE{code} \END A list mode command that quits the list without executing any actions. -\ITEM \STYLE{code} \END A list mode command that activates the list's action on the highlighted item. -\ITEM \STYLE{code} \END A list mode command that activates the list's action on the highlighted item. -\ITEM \STYLE{code} \END A list mode command that backspaces one character from the text field. -\ITEM \STYLE{code} \END A list mode command that moves the highlighted item one up in the list. -\ITEM \STYLE{code} \END A list mode command that moves the highlighted item one up in the list. -\ITEM \STYLE{code} \END A list mode command that moves the highlighted item one down in the list. -\ITEM \STYLE{code} \END A list mode command that moves the highlighted item one down in the list. +\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's write character handler. +\ITEM \STYLE{code} \END A lister mode command that quits the list without executing any actions. +\ITEM \STYLE{code} \END A lister mode command that activates the list's action on the highlighted item. +\ITEM \STYLE{code} \END A lister mode command that activates the list's action on the highlighted item. +\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's backspace text field handler. +\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate up handler. +\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate up handler. +\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate down handler. +\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate down handler. diff --git a/themes/theme-sunlight.4coder b/themes/theme-sunlight.4coder new file mode 100644 index 00000000..0172ee94 --- /dev/null +++ b/themes/theme-sunlight.4coder @@ -0,0 +1,38 @@ +name = "sunlight"; + +Back = 0xFFDFD5D0; +Margin = 0xFFC7C7C7; +Margin_Hover = 0xFFBFBFBF; +Margin_Active = 0xFFB7B7B7; +List_Item = Margin; +List_Item_Hover = Margin_Hover; +List_Item_Active = Margin_Active; +Cursor = 0xFF222222; +At_Cursor = Back; +Mark = 0xFF797979; +Highlight = 0xFFFF9979; +At_Highlight = Back; +Default = 0xFF47474F; +Comment = 0xFF953FFF; +Keyword = 0xFF002255; +Str_Constant = Keyword; +Char_Constant = Str_Constant; +Int_Constant = Str_Constant; +Float_Constant = Str_Constant; +Bool_Constant = Str_Constant; +Include = Str_Constant; +Preproc = 0xFF000000; +Special_Character = 0xFFFF00FF; +Ghost_Character = 0xFF929292; + +Paste = 0xFFFF0000; +Undo = 0xFF00FF00; + +Highlight_Junk = 0xFFB7DFDF; +Highlight_White = 0xFFC7C7C7; + +Bar = 0xFF909090; +Bar_Active = 0xFFC1C1C1; +Base = 0xFFFFFFFF; +Pop1 = 0xFFFF4F2F; +Pop2 = 0xFF00C5FF;