A few visual style options in config.4coder

master
Allen Webster 2020-05-01 21:21:14 -07:00
parent ca7240f349
commit 88af8b02fb
7 changed files with 965 additions and 924 deletions

View File

@ -1243,6 +1243,10 @@ config_init_default(Config_Data *config){
config->automatically_save_changes_on_build = true;
config->automatically_load_project = false;
config->cursor_roundness = .45f;
config->mark_thickness = 2.f;
config->lister_roundness = .45f;
config->virtual_whitespace_regular_indent = 4;
config->indent_with_tabs = false;
@ -1312,6 +1316,19 @@ config_parse__data(Application_Links *app, Arena *arena, String_Const_u8 file_na
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);
{
i32 x = 0;
if (config_int_var(parsed, "cursor_roundness", 0, &x)){
config->cursor_roundness = ((f32)x)*0.01f;
}
if (config_int_var(parsed, "mark_thickness", 0, &x)){
config->mark_thickness = (f32)x;
}
if (config_int_var(parsed, "lister_roundness", 0, &x)){
config->lister_roundness = ((f32)x)*0.01f;
}
}
config_int_var(parsed, "virtual_whitespace_regular_indent", 0, &config->virtual_whitespace_regular_indent);
config_bool_var(parsed, "indent_with_tabs", 0, &config->indent_with_tabs);
@ -1558,6 +1575,10 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
config_feedback_bool(scratch, &list, "show_line_number_margins", config->show_line_number_margins);
config_feedback_bool(scratch, &list, "enable_output_wrapping", config->enable_output_wrapping);
config_feedback_int(scratch, &list, "cursor_roundness", (i32)(config->cursor_roundness*100.f));
config_feedback_int(scratch, &list, "mark_thickness", (i32)(config->mark_thickness));
config_feedback_int(scratch, &list, "lister_roundness", (i32)(config->lister_roundness*100.f));
config_feedback_bool(scratch, &list, "enable_virtual_whitespace", config->enable_virtual_whitespace);
config_feedback_int(scratch, &list, "virtual_whitespace_regular_indent", config->virtual_whitespace_regular_indent);
config_feedback_bool(scratch, &list, "enable_code_wrapping", config->enable_code_wrapping);

View File

@ -210,6 +210,10 @@ struct Config_Data{
b8 automatically_save_changes_on_build;
b8 automatically_load_project;
f32 cursor_roundness;
f32 mark_thickness;
f32 lister_roundness;
i32 virtual_whitespace_regular_indent;
i32 indent_width;

View File

@ -290,8 +290,8 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
// NOTE(allen): Cursor shape
Face_Metrics metrics = get_face_metrics(app, face_id);
f32 cursor_roundness = (metrics.normal_advance*0.5f)*0.9f;
f32 mark_thickness = 2.f;
f32 cursor_roundness = metrics.normal_advance*global_config.cursor_roundness;
f32 mark_thickness = (f32)global_config.mark_thickness;
// NOTE(allen): Token colorizing
Token_Array token_array = get_token_array_from_buffer(app, buffer);

View File

@ -304,8 +304,9 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){
highlight = UIHighlight_Hover;
}
draw_rectangle_fcolor(app, item_rect, 6.f, get_item_margin_color(highlight));
draw_rectangle_fcolor(app, item_inner, 6.f, get_item_margin_color(highlight, 1));
f32 roundness = block_height*global_config.lister_roundness;
draw_rectangle_fcolor(app, item_rect, roundness, get_item_margin_color(highlight));
draw_rectangle_fcolor(app, item_inner, roundness, get_item_margin_color(highlight, 1));
Fancy_Line line = {};
push_fancy_string(scratch, &line, fcolor_id(defcolor_text_default), node->string);

View File

@ -363,7 +363,7 @@ static Command_Metadata fcoder_metacmd_table[244] = {
{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 171 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 183 },
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 864 },
{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "w:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1633 },
{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "w:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1654 },
{ PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 457 },
{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 469 },
{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1451 },

View File

@ -6,6 +6,7 @@
+ 'clean_trailing_whitespace' leaves blank lines
+ In config.4coder "enable_output_wrapping" determine whether to wrap buffers like *compilation*, *search*, etc.
+ In config.4coder "default_tab_width" determines the width of a tab character in number of spaces
+ In config.4coder "cursor_roundness" "lister_roundness" "mark_thickness"
+ Fix: when generated/metadata* files are missing buildsuper still succeeds
+ Fix: mac does not hang opening multiple files
+ Fix: line number margin performance

View File

@ -22,6 +22,20 @@ lister_whole_word_backspace_when_modified = false;
show_line_number_margins = false;
enable_output_wrapping = false;
// cursor_roundess is a value [0,50] setting the radius of
// the cursor and mark's roundness as a percentage of their width
// (At 50 the left and right corners will be so round they form a semi-circle,
// hence 50 is the max)
cursor_roundness = 45;
// mark_thickness is a pixel count value setting the
// thickness of the mark wire box in original mode
mark_thickness = 2;
// lister_roundess is a value [0,50] setting the radius of
// the lister items' roundness as a percentage of their height
lister_roundness = 20;
// Code Wrapping
treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m.mm";
enable_virtual_whitespace = true;