Project printing, scroll bars and file bars in config, indentation in config

This commit is contained in:
Allen Webster 2018-05-27 22:30:31 -07:00
parent 59e2a62f37
commit 4783c9598f
10 changed files with 222 additions and 126 deletions

View File

@ -4,14 +4,6 @@
// TOP
#if !defined(DEFAULT_INDENT_FLAGS)
# define DEFAULT_INDENT_FLAGS false
#endif
#if !defined(DEF_TAB_WIDTH)
# define DEF_TAB_WIDTH 4
#endif
static Hard_Start_Result
buffer_find_hard_start(Application_Links *app, Buffer_Summary *buffer, int32_t line_start, int32_t tab_width){
tab_width -= 1;
@ -709,6 +701,14 @@ buffer_auto_indent(Application_Links *app, Buffer_Summary *buffer, int32_t start
// Commands
//
#if !defined(DEFAULT_INDENT_FLAGS)
# define DEFAULT_INDENT_FLAGS ((global_config.indent_with_tabs)?(AutoIndent_UseTab):(0))
#endif
#if !defined(DEF_TAB_WIDTH)
# define DEF_TAB_WIDTH global_config.indent_width
#endif
CUSTOM_COMMAND_SIG(auto_tab_whole_file)
CUSTOM_DOC("Audo-indents the entire current buffer.")
{

View File

@ -997,15 +997,27 @@ text_data_to_parsed_data(Partition *arena, String file_name, String data){
static void
config_init_default(Config_Data *config){
config->default_wrap_width = 672;
config->default_min_base_width = 550;
config->user_name = make_fixed_width_string(config->user_name_space);
copy(&config->user_name, "");
memset(&config->code_exts, 0, sizeof(config->code_exts));
config->current_mapping = make_fixed_width_string(config->current_mapping_space);
copy(&config->current_mapping, "");
config->use_scroll_bars = false;
config->use_file_bars = true;
config->enable_code_wrapping = true;
config->automatically_adjust_wrapping = true;
config->automatically_indent_text_on_save = true;
config->automatically_save_changes_on_build = true;
config->automatically_load_project = false;
config->lalt_lctrl_is_altgr = false;
config->indent_with_tabs = false;
config->indent_width = 4;
config->default_wrap_width = 672;
config->default_min_base_width = 550;
config->default_theme_name = make_fixed_width_string(config->default_theme_name_space);
copy(&config->default_theme_name, "4coder");
@ -1013,9 +1025,6 @@ config_init_default(Config_Data *config){
config->default_font_name = make_fixed_width_string(config->default_font_name_space);
copy(&config->default_font_name, "");
config->user_name = make_fixed_width_string(config->user_name_space);
copy(&config->user_name, "");
config->default_compiler_bat = make_fixed_width_string(config->default_compiler_bat_space);
copy(&config->default_compiler_bat, "cl");
@ -1028,10 +1037,7 @@ config_init_default(Config_Data *config){
config->default_flags_sh = make_fixed_width_string(config->default_flags_sh_space);
copy(&config->default_flags_sh, "");
config->current_mapping = make_fixed_width_string(config->current_mapping_space);
copy(&config->current_mapping, "");
memset(&config->code_exts, 0, sizeof(config->code_exts));
config->lalt_lctrl_is_altgr = false;
}
static Config*
@ -1044,10 +1050,27 @@ config_parse__data(Partition *arena, String file_name, String data, Config_Data
if (parsed != 0){
success = true;
config_fixed_string_var(parsed, "user_name", 0,
&config->user_name, config->user_name_space);
String str;
if (config_string_var(parsed, "treat_as_code", 0, &str)){
parse_extension_line_to_extension_list(str, &config->code_exts);
}
config_fixed_string_var(parsed, "mapping", 0,
&config->current_mapping, config->current_mapping_space);
config_bool_var(parsed, "use_scroll_bars", 0, &config->use_scroll_bars);
config_bool_var(parsed, "use_file_bars", 0, &config->use_file_bars);
config_bool_var(parsed, "enable_code_wrapping", 0, &config->enable_code_wrapping);
config_bool_var(parsed, "automatically_adjust_wrapping", 0, &config->automatically_adjust_wrapping);
config_bool_var(parsed, "automatically_indent_text_on_save", 0, &config->automatically_indent_text_on_save);
config_bool_var(parsed, "automatically_save_changes_on_build", 0, &config->automatically_save_changes_on_build);
config_bool_var(parsed, "automatically_load_project", 0, &config->automatically_load_project);
config_bool_var(parsed, "indent_with_tabs", 0, &config->indent_with_tabs);
config_int_var(parsed, "indent_width", 0, &config->indent_width);
config_int_var(parsed, "default_wrap_width", 0, &config->default_wrap_width);
config_int_var(parsed, "default_min_base_width", 0, &config->default_min_base_width);
@ -1056,8 +1079,6 @@ config_parse__data(Partition *arena, String file_name, String data, Config_Data
&config->default_theme_name, config->default_theme_name_space);
config_fixed_string_var(parsed, "default_font_name", 0,
&config->default_font_name, config->default_font_name_space);
config_fixed_string_var(parsed, "user_name", 0,
&config->user_name, config->user_name_space);
config_fixed_string_var(parsed, "default_compiler_bat", 0,
&config->default_compiler_bat, config->default_compiler_bat_space);
@ -1068,15 +1089,6 @@ config_parse__data(Partition *arena, String file_name, String data, Config_Data
config_fixed_string_var(parsed, "default_flags_sh", 0,
&config->default_flags_sh, config->default_flags_sh_space);
config_fixed_string_var(parsed, "mapping", 0,
&config->current_mapping, config->current_mapping_space);
String str;
if (config_string_var(parsed, "treat_as_code", 0, &str)){
parse_extension_line_to_extension_list(str, &config->code_exts);
}
config_bool_var(parsed, "automatically_load_project", 0, &config->automatically_load_project);
config_bool_var(parsed, "lalt_lctrl_is_altgr", 0, &config->lalt_lctrl_is_altgr);
}
@ -1248,28 +1260,36 @@ load_config_and_apply(Application_Links *app, Partition *scratch, Config_Data *c
// Values
Temp_Memory temp2 = begin_temp_memory(scratch);
String space = push_string(scratch, partition_remaining(scratch));
config_feedback_string(&space, "user_name", config->user_name);
config_feedback_extension_list(&space, "treat_as_code", &config->code_exts);
config_feedback_string(&space, "current_mapping", config->current_mapping);
config_feedback_bool(&space, "enable_code_wrapping", config->enable_code_wrapping);
config_feedback_bool(&space, "automatically_indent_text_on_save", config->automatically_indent_text_on_save);
config_feedback_bool(&space, "automatically_save_changes_on_build", config->automatically_save_changes_on_build);
config_feedback_bool(&space, "automatically_adjust_wrapping", config->automatically_adjust_wrapping);
config_feedback_bool(&space, "automatically_load_project", config->automatically_load_project);
config_feedback_int(&space, "default_wrap_width", config->default_wrap_width);
config_feedback_int(&space, "default_min_base_width", config->default_min_base_width);
config_feedback_string(&space, "default_theme_name", config->default_theme_name);
config_feedback_string(&space, "default_font_name", config->default_font_name);
config_feedback_string(&space, "default_compiler_bat", config->default_compiler_bat);
config_feedback_string(&space, "default_flags_bat", config->default_flags_bat);
config_feedback_string(&space, "default_compiler_sh", config->default_compiler_sh);
config_feedback_string(&space, "default_flags_sh", config->default_flags_sh);
config_feedback_bool(&space, "lalt_lctrl_is_altgr", config->lalt_lctrl_is_altgr);
{
config_feedback_string(&space, "user_name", config->user_name);
config_feedback_extension_list(&space, "treat_as_code", &config->code_exts);
config_feedback_string(&space, "current_mapping", config->current_mapping);
config_feedback_bool(&space, "use_scroll_bars", config->use_scroll_bars);
config_feedback_bool(&space, "use_file_bars", config->use_file_bars);
config_feedback_bool(&space, "enable_code_wrapping", config->enable_code_wrapping);
config_feedback_bool(&space, "automatically_indent_text_on_save", config->automatically_indent_text_on_save);
config_feedback_bool(&space, "automatically_save_changes_on_build", config->automatically_save_changes_on_build);
config_feedback_bool(&space, "automatically_adjust_wrapping", config->automatically_adjust_wrapping);
config_feedback_bool(&space, "automatically_load_project", config->automatically_load_project);
config_feedback_bool(&space, "indent_with_tabs", config->indent_with_tabs);
config_feedback_int(&space, "indent_width", config->indent_width);
config_feedback_int(&space, "default_wrap_width", config->default_wrap_width);
config_feedback_int(&space, "default_min_base_width", config->default_min_base_width);
config_feedback_string(&space, "default_theme_name", config->default_theme_name);
config_feedback_string(&space, "default_font_name", config->default_font_name);
config_feedback_string(&space, "default_compiler_bat", config->default_compiler_bat);
config_feedback_string(&space, "default_flags_bat", config->default_flags_bat);
config_feedback_string(&space, "default_compiler_sh", config->default_compiler_sh);
config_feedback_string(&space, "default_flags_sh", config->default_flags_sh);
config_feedback_bool(&space, "lalt_lctrl_is_altgr", config->lalt_lctrl_is_altgr);
}
append(&space, "\n");
print_message(app, space.str, space.size);

View File

@ -154,12 +154,17 @@ struct Config_Data{
char current_mapping_space[256];
String current_mapping;
bool32 use_scroll_bars;
bool32 use_file_bars;
bool32 enable_code_wrapping;
bool32 automatically_indent_text_on_save;
bool32 automatically_save_changes_on_build;
bool32 automatically_adjust_wrapping;
bool32 automatically_load_project;
bool32 indent_with_tabs;
int32_t indent_width;
int32_t default_wrap_width;
int32_t default_min_base_width;

View File

@ -20,10 +20,6 @@ static String locked_buffer = make_fixed_width_string(locked_buffer_space);
static View_ID special_note_view_id = 0;
static bool32 default_use_scrollbars = false;
static bool32 default_use_file_bars = true;
View_Paste_Index view_paste_index_[16];
View_Paste_Index *view_paste_index = view_paste_index_ - 1;
@ -79,10 +75,10 @@ get_view_for_locked_jump_buffer(Application_Links *app){
static void
new_view_settings(Application_Links *app, View_Summary *view){
if (!default_use_scrollbars){
if (!global_config.use_scroll_bars){
view_set_setting(app, view, ViewSetting_ShowScrollbar, false);
}
if (!default_use_file_bars){
if (!global_config.use_file_bars){
view_set_setting(app, view, ViewSetting_ShowFileBar, false);
}
}
@ -419,7 +415,7 @@ init_memory(Application_Links *app){
}
static void
default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32 use_file_bars){
default_4coder_initialize(Application_Links *app){
init_memory(app);
static const char message[] = ""
@ -427,6 +423,7 @@ default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32
"If you're new to 4coder there are some tutorials at http://4coder.net/tutorials.html\n"
"Direct bug reports to editor@4coder.net for maximum reply speed\n"
"Questions or requests can go to editor@4coder.net or to 4coder.handmade.network\n"
"The change log can be found in CHANGES.txt\n"
"\n";
String msg = make_lit_string(message);
print_message(app, msg.str, msg.size);
@ -439,14 +436,13 @@ default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32
change_theme(app, theme.str, theme.size);
change_font(app, font.str, font.size, true);
default_use_scrollbars = use_scrollbars;
default_use_file_bars = use_file_bars;
}
static void
default_4coder_initialize(Application_Links *app){
default_4coder_initialize(app, false, true);
default_4coder_initialize(Application_Links *app, bool32 use_scroll_bars, bool32 use_file_bars){
default_4coder_initialize(app);
global_config.use_scroll_bars = use_scroll_bars;
global_config.use_file_bars = use_file_bars;
}
static void

View File

@ -8,7 +8,6 @@ the default 4coder behavior.
static Named_Mapping *named_maps = 0;
static int32_t named_map_count = 0;
static char *default_extensions[] = {
"cpp",
"hpp",

View File

@ -213,7 +213,7 @@ int32_t source_name_len;
int32_t line_number;
};
static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 203 },
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 199 },
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 722 },
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 733 },
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 712 },
@ -223,13 +223,13 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ 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, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 189 },
{ 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, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 155 },
{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 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, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 145 },
{ 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, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 155 },
{ 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, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 141 },
{ 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, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 151 },
{ 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, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 211 },
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 368 },
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 174 },
{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 187 },
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 879 },
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 975 },
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 205 },
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 441 },
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 26 },
@ -295,7 +295,7 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 800 },
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 747 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 759 },
{ 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 902 },
{ 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 998 },
{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1101 },
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "C:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 45, 110 },
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "C:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 45, 383 },
@ -317,8 +317,8 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ 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, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 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, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 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, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 556 },
{ 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 886 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 893 },
{ 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 982 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 989 },
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1457 },
{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1320 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Switches to the next active panel and begins an open file dialogue.", 67, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1465 },
@ -326,8 +326,8 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ 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, "C:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 55, 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, "C:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 55, 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1356 },
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 174 },
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 165 },
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 170 },
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 161 },
{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 279 },
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 46 },
@ -335,13 +335,13 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ 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, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 84 },
{ 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, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 135 },
{ 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, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 909 },
{ 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 934 },
{ 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 1005 },
{ 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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 1030 },
{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 893 },
{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 913 },
{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 931 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1403 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 223 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 219 },
{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1059 },
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "C:\\work\\4ed\\code\\4coder_experiments.cpp", 43, 385 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1439 },
@ -378,19 +378,19 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 61 },
{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 75 },
{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 86 },
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 982 },
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 1078 },
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 464 },
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 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, "C:\\work\\4ed\\code\\4coder_seek.cpp", 36, 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, "C:\\work\\4ed\\code\\4coder_seek.cpp", 36, 1265 },
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 197 },
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 193 },
{ 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1380 },
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 328 },
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 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, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 215 },
{ 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, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 211 },
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 487 },
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 209 },
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "C:\\work\\4ed\\code\\4coder_default_framework.cpp", 49, 205 },
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 554 },
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 543 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1397 },

View File

@ -714,9 +714,76 @@ project_deep_copy(Partition *arena, Project *project){
return(result);
}
static void
config_feedback_file_pattern_array(String *space, char *name, Project_File_Pattern_Array *array){
append(space, name);
append(space, " = {\n");
Project_File_Pattern *pattern = array->patterns;
for (int32_t i = 0; i < array->count; ++i, ++pattern){
append(space, "\"");
String *absolute = pattern->absolutes.a;
for (int32_t j = 0; j < pattern->absolutes.count; ++j, ++absolute){
if (j != 0){
append(space, "*");
}
append(space, *absolute);
}
append(space, "\",\n");
}
append(space, "};\n");
}
static void
config_feedback_file_load_path_array(String *space, char *name, Project_File_Load_Path_Array *array){
append(space, name);
append(space, " = {\n");
Project_File_Load_Path *path = array->paths;
for (int32_t i = 0; i < array->count; ++i, ++path){
append(space, "{ ");
append(space, ".path = \"");
append(space, path->path);
append(space, "\", ");
append(space, ".recursive = ");
append(space, path->recursive?"true":"false");
append(space, ", ");
append(space, ".relative = ");
append(space, path->relative?"true":"false");
append(space, ", ");
append(space, "},\n");
}
append(space, "};\n");
}
static void
config_feedback_command_array(String *space, char *name, Project_Command_Array *array){
append(space, name);
append(space, " = {\n");
Project_Command *command = array->commands;
for (int32_t i = 0; i < array->count; ++i, ++command){
append(space, "{ ");
append(space, ".name = \"");
append(space, command->name);
append(space, "\", ");
append(space, ".cmd = \"");
append(space, command->cmd);
append(space, "\", ");
append(space, ".out = \"");
append(space, command->out);
append(space, "\", ");
append(space, ".footer_panel = ");
append(space, command->footer_panel?"true":"false");
append(space, ", ");
append(space, ".save_dirty_files = ");
append(space, command->save_dirty_files?"true":"false");
append(space, ", ");
append(space, "},\n");
}
append(space, "};\n");
}
static void
set_current_project(Application_Links *app, Partition *scratch, Project *project, Config *parsed){
bool32 print_errors = false;
bool32 print_feedback = false;
if (parsed != 0 && project != 0){
if (current_project_arena.base == 0){
@ -731,7 +798,7 @@ set_current_project(Application_Links *app, Partition *scratch, Project *project
if (new_project.loaded){
current_project = new_project;
print_errors = true;
print_feedback = true;
// Open all project files
for (int32_t i = 0; i < current_project.load_path_array.count; ++i){
@ -789,13 +856,42 @@ set_current_project(Application_Links *app, Partition *scratch, Project *project
}
}
else if (parsed != 0){
print_errors = true;
print_feedback = true;
}
if (print_errors){
if (print_feedback){
Temp_Memory temp = begin_temp_memory(scratch);
// Top
print_message(app, literal("Loaded project file:\n"));
// Errors
String error_text = config_stringize_errors(scratch, parsed);
print_message(app, error_text.str, error_text.size);
// Values
if (project == 0){
print_message(app, literal("Could not instantiate project\n"));
}
else{
Temp_Memory temp2 = begin_temp_memory(scratch);
String space = push_string(scratch, partition_remaining(scratch));
{
config_feedback_string(&space, "'root_directory'", project->dir);
config_feedback_string(&space, "project_name", project->name);
config_feedback_file_pattern_array(&space, "patterns", &project->pattern_array);
config_feedback_file_pattern_array(&space, "blacklist_patterns", &project->blacklist_pattern_array);
config_feedback_file_load_path_array(&space, "load_paths", &project->load_path_array);
config_feedback_command_array(&space, "command_list", &project->command_array);
}
append(&space, "\n");
print_message(app, space.str, space.size);
end_temp_memory(temp2);
}
end_temp_memory(temp);
}
}

View File

@ -24,16 +24,12 @@ enum{
///////////////////////////////
struct Project_Command{
String name;
String cmd;
String out;
bool32 footer_panel;
bool32 save_dirty_files;
struct Project_File_Pattern{
Absolutes absolutes;
};
struct Project_Command_Array{
Project_Command *commands;
struct Project_File_Pattern_Array{
Project_File_Pattern *patterns;
int32_t count;
};
@ -48,12 +44,16 @@ struct Project_File_Load_Path_Array{
int32_t count;
};
struct Project_File_Pattern{
Absolutes absolutes;
struct Project_Command{
String name;
String cmd;
String out;
bool32 footer_panel;
bool32 save_dirty_files;
};
struct Project_File_Pattern_Array{
Project_File_Pattern *patterns;
struct Project_Command_Array{
Project_Command *commands;
int32_t count;
};

View File

@ -1,28 +0,0 @@
/*
New File
*/
#include "4coder_default_include.cpp"
extern "C" int32_t
get_bindings(void *data, int32_t size){
Bind_Helper context_ = begin_bind_helper(data, size);
Bind_Helper *context = &context_;
set_all_default_hooks(context);
default_keys(context);
begin_map(context, mapid_global);
bind(context, 'M', MDFR_ALT, goto_prev_jump_no_skips_sticky);
bind(context, 'N', MDFR_ALT, goto_first_jump_sticky);
end_map(context);
begin_map(context, mapid_file);
end_map(context);
begin_map(context, default_code_map);
end_map(context);
int32_t result = end_bind_helper(context);
return(result);
}

View File

@ -6,6 +6,10 @@
// <my-own-string> - If you use the custom layer to make a named mapping you can use that here too.
mapping = "";
// UI
use_scroll_bars = false;
use_file_bars = true;
// Code Wrapping
enable_code_wrapping = true;
automatically_adjust_wrapping = true;
@ -19,6 +23,13 @@ automatically_indent_text_on_save = true;
// When set to true, all unsaved changes will be saved on a build.
automatically_save_changes_on_build = true;
// Load project on startup
automatically_load_project = false;
// Indentation
indent_with_tabs = false;
indent_width = 4;
// Theme
default_theme_name = "4coder";
default_font_name = "Liberation Mono";
@ -29,9 +40,6 @@ user_name = "NAME";
// Extensions
treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m";
// Load project on startup
automatically_load_project = false;
// Keyboard AltGr setting
lalt_lctrl_is_altgr = false;