got the color theme file working, started replacing existing color themes with the new system
This commit is contained in:
parent
c9562439f4
commit
624e35f8d7
|
@ -54,6 +54,7 @@ struct Application_Links;
|
|||
#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 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_FONT_SIG(n) void n(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files)
|
||||
#define BUFFER_SET_FONT_SIG(n) void n(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len)
|
||||
|
@ -129,6 +130,7 @@ 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 CREATE_THEME_SIG(Create_Theme_Function);
|
||||
typedef CHANGE_THEME_SIG(Change_Theme_Function);
|
||||
typedef CHANGE_FONT_SIG(Change_Font_Function);
|
||||
typedef BUFFER_SET_FONT_SIG(Buffer_Set_Font_Function);
|
||||
|
@ -206,6 +208,7 @@ 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;
|
||||
Create_Theme_Function *create_theme;
|
||||
Change_Theme_Function *change_theme;
|
||||
Change_Font_Function *change_font;
|
||||
Buffer_Set_Font_Function *buffer_set_font;
|
||||
|
@ -282,6 +285,7 @@ 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_;
|
||||
Create_Theme_Function *create_theme_;
|
||||
Change_Theme_Function *change_theme_;
|
||||
Change_Font_Function *change_font_;
|
||||
Buffer_Set_Font_Function *buffer_set_font_;
|
||||
|
@ -366,6 +370,7 @@ 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->create_theme_ = Create_Theme;\
|
||||
app_links->change_theme_ = Change_Theme;\
|
||||
app_links->change_font_ = Change_Font;\
|
||||
app_links->buffer_set_font_ = Buffer_Set_Font;\
|
||||
|
@ -442,6 +447,7 @@ static inline Mouse_State get_mouse_state(Application_Links *app){return(app->ge
|
|||
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 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 void change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files){(app->change_font(app, name, len, apply_to_all_files));}
|
||||
static inline void buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){(app->buffer_set_font(app, buffer, name, len));}
|
||||
|
@ -518,6 +524,7 @@ static inline Mouse_State get_mouse_state(Application_Links *app){return(app->ge
|
|||
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 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 void change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files){(app->change_font_(app, name, len, apply_to_all_files));}
|
||||
static inline void buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){(app->buffer_set_font_(app, buffer, name, len));}
|
||||
|
|
|
@ -33,5 +33,42 @@ Stag_Highlight_White,
|
|||
Stag_Paste,
|
||||
Stag_Undo,
|
||||
Stag_Next_Undo,
|
||||
Stag_COUNT
|
||||
};
|
||||
|
||||
static char *style_tag_names[] = {
|
||||
"Bar",
|
||||
"Bar_Active",
|
||||
"Base",
|
||||
"Pop1",
|
||||
"Pop2",
|
||||
"Back",
|
||||
"Margin",
|
||||
"Margin_Hover",
|
||||
"Margin_Active",
|
||||
"List_Item",
|
||||
"List_Item_Hover",
|
||||
"List_Item_Active",
|
||||
"Cursor",
|
||||
"At_Cursor",
|
||||
"Highlight",
|
||||
"At_Highlight",
|
||||
"Mark",
|
||||
"Default",
|
||||
"Comment",
|
||||
"Keyword",
|
||||
"Str_Constant",
|
||||
"Char_Constant",
|
||||
"Int_Constant",
|
||||
"Float_Constant",
|
||||
"Bool_Constant",
|
||||
"Preproc",
|
||||
"Include",
|
||||
"Special_Character",
|
||||
"Ghost_Character",
|
||||
"Highlight_Junk",
|
||||
"Highlight_White",
|
||||
"Paste",
|
||||
"Undo",
|
||||
"Next_Undo",
|
||||
};
|
||||
|
|
|
@ -433,7 +433,7 @@ STRUCT File_Info{
|
|||
/* DOC(This field specifies the length of the filename string not counting the null terminator.) */
|
||||
int32_t filename_len;
|
||||
/* DOC(This field indicates that the description is for a folder not a file.) */
|
||||
int32_t folder;
|
||||
bool32 folder;
|
||||
};
|
||||
|
||||
/* DOC(File_List is a list of File_Info structs.)
|
||||
|
@ -453,10 +453,8 @@ STRUCT File_List{
|
|||
STRUCT Buffer_Identifier{
|
||||
/* DOC(This field is the name of the buffer; it need not be null terminated. If id is specified this pointer should be NULL.) */
|
||||
char *name;
|
||||
|
||||
/* DOC(This field specifies the length of the name string.) */
|
||||
int32_t name_len;
|
||||
|
||||
/* DOC(This field is the id of the buffer. If name is specified this should be 0.) */
|
||||
Buffer_ID id;
|
||||
};
|
||||
|
@ -722,6 +720,10 @@ STRUCT Theme_Color{
|
|||
int_color color;
|
||||
};
|
||||
|
||||
STRUCT Theme{
|
||||
int_color colors[Stag_COUNT];
|
||||
};
|
||||
|
||||
/* DOC(A Buffer_Batch_Edit_Type is a type of batch operation.) */
|
||||
ENUM(int32_t, Buffer_Batch_Edit_Type){
|
||||
/* DOC(The BatchEdit_Normal operation is always correct but does the most work if there are tokens to correct.) */
|
||||
|
|
|
@ -510,8 +510,8 @@ get_config_item(Config_Line line, char *mem, Cpp_Token_Array array){
|
|||
|
||||
static bool32
|
||||
config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_type, void *var_out){
|
||||
bool32 result = 0;
|
||||
bool32 subscript_succes = 1;
|
||||
bool32 result = false;
|
||||
bool32 subscript_success = true;
|
||||
if (item.line.val_token.type == token_type){
|
||||
if ((var_name == 0 && item.id.size == 0) || match(item.id, var_name)){
|
||||
if (subscript){
|
||||
|
@ -519,11 +519,11 @@ config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_
|
|||
*subscript = item.subscript_index;
|
||||
}
|
||||
else{
|
||||
subscript_succes = 0;
|
||||
subscript_success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (subscript_succes){
|
||||
if (subscript_success){
|
||||
if (var_out){
|
||||
switch (token_type){
|
||||
case CPP_TOKEN_BOOLEAN_CONSTANT:
|
||||
|
@ -533,8 +533,16 @@ config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_
|
|||
|
||||
case CPP_TOKEN_INTEGER_CONSTANT:
|
||||
{
|
||||
String val = make_string(item.mem + item.line.val_token.start, item.line.val_token.size);
|
||||
*(int32_t*)var_out = str_to_int(val);
|
||||
if (match(make_string(item.mem + item.line.val_token.start, 2), "0x")){
|
||||
// Hex Integer
|
||||
String val = make_string(item.mem + item.line.val_token.start + 2, item.line.val_token.size - 2);
|
||||
*(uint32_t*)var_out = hexstr_to_int(val);
|
||||
}
|
||||
else{
|
||||
// Integer
|
||||
String val = make_string(item.mem + item.line.val_token.start, item.line.val_token.size);
|
||||
*(int32_t*)var_out = str_to_int(val);
|
||||
}
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_STRING_CONSTANT:
|
||||
|
@ -543,6 +551,12 @@ config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_
|
|||
copy((String*)var_out, str);
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_IDENTIFIER:
|
||||
{
|
||||
String str = make_string(item.mem + item.line.val_token.start,item.line.val_token.size);
|
||||
copy((String*)var_out, str);
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_BRACE_OPEN:
|
||||
{
|
||||
Config_Array_Reader *array_reader = (Config_Array_Reader*)var_out;
|
||||
|
@ -554,7 +568,7 @@ config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_
|
|||
}break;
|
||||
}
|
||||
}
|
||||
result = 1;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -573,12 +587,24 @@ config_int_var(Config_Item item, char *var_name, int32_t *subscript, int32_t *va
|
|||
return(result);
|
||||
}
|
||||
|
||||
static bool32
|
||||
config_uint_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t *var_out){
|
||||
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_INTEGER_CONSTANT, var_out);
|
||||
return(result);
|
||||
}
|
||||
|
||||
static bool32
|
||||
config_string_var(Config_Item item, char *var_name, int32_t *subscript, String *var_out){
|
||||
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_STRING_CONSTANT, var_out);
|
||||
return(result);
|
||||
}
|
||||
|
||||
static bool32
|
||||
config_identifier_var(Config_Item item, char *var_name, int32_t *subscript, String *var_out){
|
||||
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_IDENTIFIER, var_out);
|
||||
return(result);
|
||||
}
|
||||
|
||||
static bool32
|
||||
config_array_var(Config_Item item, char *var_name, int32_t *subscript, Config_Array_Reader *array_reader){
|
||||
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_BRACE_OPEN, array_reader);
|
||||
|
@ -587,7 +613,7 @@ config_array_var(Config_Item item, char *var_name, int32_t *subscript, Config_Ar
|
|||
|
||||
static bool32
|
||||
config_array_next_item(Config_Array_Reader *array_reader, Config_Item *item){
|
||||
bool32 result = 0;
|
||||
bool32 result = false;
|
||||
|
||||
for (;array_reader->i < array_reader->val_array_end;
|
||||
++array_reader->i){
|
||||
|
@ -609,7 +635,7 @@ config_array_next_item(Config_Array_Reader *array_reader, Config_Item *item){
|
|||
line.val_token = array_token;
|
||||
line.read_success = 1;
|
||||
*item = get_config_item(line, array_reader->mem, array_reader->array);
|
||||
result = 1;
|
||||
result = true;
|
||||
++array_reader->i;
|
||||
goto doublebreak;
|
||||
}break;
|
||||
|
@ -823,6 +849,140 @@ process_config_file(Application_Links *app){
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Color Scheme
|
||||
//
|
||||
|
||||
static void
|
||||
process_color_scheme_file(Application_Links *app, char *file_name){
|
||||
Partition *part = &global_part;
|
||||
FILE *file = fopen(file_name, "rb");
|
||||
|
||||
if (!file){
|
||||
char space[256];
|
||||
int32_t size = get_4ed_path(app, space, sizeof(space));
|
||||
String str = make_string_cap(space, size, sizeof(space));
|
||||
append_sc(&str, "/");
|
||||
append_sc(&str, file_name);
|
||||
terminate_with_null(&str);
|
||||
file = fopen(str.str, "rb");
|
||||
}
|
||||
|
||||
if (file){
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
|
||||
char *mem = 0;
|
||||
int32_t size = 0;
|
||||
bool32 file_read_success = file_handle_dump(part, file, &mem, &size);
|
||||
fclose(file);
|
||||
bool32 success = false;
|
||||
|
||||
if (file_read_success){
|
||||
Cpp_Token_Array array;
|
||||
array.count = 0;
|
||||
array.max_count = (1 << 20)/sizeof(Cpp_Token);
|
||||
array.tokens = push_array(&global_part, Cpp_Token, array.max_count);
|
||||
|
||||
Cpp_Keyword_Table kw_table = {0};
|
||||
Cpp_Keyword_Table pp_table = {0};
|
||||
lexer_keywords_default_init(part, &kw_table, &pp_table);
|
||||
|
||||
Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table);
|
||||
Cpp_Lex_Result result = cpp_lex_step(&S, mem, size+1, HAS_NULL_TERM, &array, NO_OUT_LIMIT);
|
||||
|
||||
if (result == LexResult_Finished){
|
||||
success = true;
|
||||
|
||||
char name_space[512];
|
||||
String name_str = make_fixed_width_string(name_space);
|
||||
Theme theme;
|
||||
init_theme_zero(&theme);
|
||||
|
||||
for (int32_t i = 0; i < array.count; ++i){
|
||||
Config_Line config_line = read_config_line(array, &i);
|
||||
if (config_line.read_success){
|
||||
Config_Item item = get_config_item(config_line, mem, array);
|
||||
config_string_var(item, "name", 0, &name_str);
|
||||
|
||||
for (int32_t tag = 0; tag < ArrayCount(style_tag_names); ++tag){
|
||||
char *name = style_tag_names[tag];
|
||||
int_color color = 0;
|
||||
if (config_uint_var(item, name, 0, &color)){
|
||||
int_color *color_slot = &theme.colors[tag];
|
||||
*color_slot = color;
|
||||
}
|
||||
else{
|
||||
char var_space[512];
|
||||
String var_str = make_fixed_width_string(var_space);
|
||||
if (config_identifier_var(item, name, 0, &var_str)){
|
||||
for (int32_t eq_tag = 0; eq_tag < ArrayCount(style_tag_names); ++eq_tag){
|
||||
if (match(var_str, style_tag_names[eq_tag])){
|
||||
int_color *color_slot = &theme.colors[tag];
|
||||
*color_slot = theme.colors[eq_tag];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (name_str.size == 0){
|
||||
copy(&name_str, file_name);
|
||||
}
|
||||
|
||||
create_theme(app, &theme, name_str.str, name_str.size);
|
||||
}
|
||||
}
|
||||
end_temp_memory(temp);
|
||||
|
||||
if (!success){
|
||||
char space[256];
|
||||
String str = make_fixed_width_string(space);
|
||||
append_sc(&str, "Could not parse ");
|
||||
append_sc(&str, file_name);
|
||||
append_sc(&str, ", color scheme not loaded");
|
||||
print_message(app, str.str, str.size);
|
||||
}
|
||||
}
|
||||
else{
|
||||
char space[256];
|
||||
String str = make_fixed_width_string(space);
|
||||
append_sc(&str, "Did not find ");
|
||||
append_sc(&str, file_name);
|
||||
append_sc(&str, ", color scheme not loaded");
|
||||
print_message(app, str.str, str.size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
load_color_themes(Application_Links *app){
|
||||
char folder_name_space[512];
|
||||
String folder_name = make_fixed_width_string(folder_name_space);
|
||||
folder_name.size = get_4ed_path(app, folder_name_space, sizeof(folder_name_space));
|
||||
append(&folder_name, "themes");
|
||||
|
||||
if (folder_name.size < folder_name.memory_size){
|
||||
File_List list = get_file_list(app, folder_name.str, folder_name.size);
|
||||
for (uint32_t i = 0; i < list.count; ++i){
|
||||
File_Info *info = &list.infos[i];
|
||||
if (!info->folder){
|
||||
char file_name_space[512];
|
||||
String file_name = make_fixed_width_string(file_name_space);
|
||||
copy(&file_name, folder_name);
|
||||
append(&file_name, "/");
|
||||
append(&file_name, make_string(info->filename, info->filename_len));
|
||||
if (file_name.size < file_name.memory_size){
|
||||
terminate_with_null(&file_name);
|
||||
process_color_scheme_file(app, file_name.str);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_file_list(app, list);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Framework Init Functions
|
||||
//
|
||||
|
@ -843,6 +1003,7 @@ static void
|
|||
default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32 use_file_bars){
|
||||
init_memory(app);
|
||||
process_config_file(app);
|
||||
load_color_themes(app);
|
||||
|
||||
String theme = get_default_theme_name();
|
||||
String font = get_default_font_name();
|
||||
|
|
|
@ -143,6 +143,13 @@ query_user_number(Application_Links *app, Query_Bar *bar){
|
|||
return(success);
|
||||
}
|
||||
|
||||
static void
|
||||
init_theme_zero(Theme *theme){
|
||||
for (int32_t i = 0; i < Stag_COUNT; ++i){
|
||||
theme->colors[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static char
|
||||
buffer_get_char(Application_Links *app, Buffer_Summary *buffer, int32_t pos){
|
||||
char result = ' ';
|
||||
|
|
3
4ed.cpp
3
4ed.cpp
|
@ -632,6 +632,7 @@ app_hardcode_styles(Models *models){
|
|||
/////////////////
|
||||
style_set_name(style, make_lit_string("Handmade Hero"));
|
||||
|
||||
#if 0
|
||||
style->main.back_color = 0xFF161616;
|
||||
style->main.margin_color = 0xFF262626;
|
||||
style->main.margin_hover_color = 0xFF333333;
|
||||
|
@ -669,6 +670,8 @@ app_hardcode_styles(Models *models){
|
|||
file_info_style.pop1_color = 0xFF03CF0C;
|
||||
file_info_style.pop2_color = 0xFFFF0000;
|
||||
style->main.file_info_style = file_info_style;
|
||||
#endif
|
||||
|
||||
++style;
|
||||
|
||||
/////////////////
|
||||
|
|
|
@ -2190,7 +2190,33 @@ DOC(This call posts a string to the *messages* buffer.)
|
|||
do_feedback_message(cmd->system, models, make_string(str, len));
|
||||
}
|
||||
|
||||
// TODO(allen): List the names of built in themes and fonts.
|
||||
API_EXPORT void
|
||||
Create_Theme(Application_Links *app, Theme *theme, char *name, int32_t len)
|
||||
/*
|
||||
DOC_PARAM(theme, The color data of the new theme.)
|
||||
DOC_PARAM(name, The name of the new theme. This string need not be null terminated.)
|
||||
DOC_PARAM(len, The length of the name string.)
|
||||
DOC(This call creates a new theme. If the given name is already the name of a string, the old string will be replaced with the new one. This call does not set the current theme.)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Style_Library *styles = &cmd->models->styles;
|
||||
String theme_name = make_string(name, len);
|
||||
|
||||
b32 hit_existing_theme = false;
|
||||
i32 count = styles->count;
|
||||
Style *s = styles->styles;
|
||||
for (i32 i = 0; i < count; ++i, ++s){
|
||||
if (match_ss(s->name, theme_name)){
|
||||
style_set_colors(s, theme);
|
||||
hit_existing_theme = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hit_existing_theme){
|
||||
style_add(styles, theme, make_string(name, len));
|
||||
}
|
||||
}
|
||||
|
||||
API_EXPORT void
|
||||
Change_Theme(Application_Links *app, char *name, int32_t len)
|
||||
|
@ -2364,6 +2390,7 @@ Get_File_List(Application_Links *app, char *dir, int32_t len)
|
|||
DOC_PARAM(dir, This parameter specifies the directory whose files will be enumerated in the returned list; it need not be null terminated.)
|
||||
DOC_PARAM(len, This parameter the length of the dir string.)
|
||||
DOC_RETURN(This call returns a File_List struct containing pointers to the names of the files in the specified directory. The File_List returned should be passed to free_file_list when it is no longer in use.)
|
||||
DOC_SEE(File_List)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
System_Functions *system = cmd->system;
|
||||
|
@ -2381,6 +2408,7 @@ Free_File_List(Application_Links *app, File_List list)
|
|||
/*
|
||||
DOC_PARAM(list, This parameter provides the file list to be freed.)
|
||||
DOC(After this call the file list passed in should not be read or written to.)
|
||||
DOC_SEE(File_List)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
System_Functions *system = cmd->system;
|
||||
|
|
|
@ -38,5 +38,22 @@ struct Style_Library{
|
|||
i32 count, max;
|
||||
};
|
||||
|
||||
internal void
|
||||
style_set_colors(Style *style, Theme *theme){
|
||||
for (u32 i = 0; i < Stag_COUNT; ++i){
|
||||
u32 *color_ptr = style_index_by_tag(&style->main, i);
|
||||
*color_ptr = theme->colors[i];
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
style_add(Style_Library *library, Theme *theme, String name){
|
||||
if (library->count < library->max){
|
||||
Style *style = &library->styles[library->count++];
|
||||
style_set_colors(style, theme);
|
||||
style_set_name(style, name);
|
||||
}
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
||||
|
|
|
@ -194,8 +194,6 @@ static void
|
|||
generate_style(){
|
||||
char filename_4coder[] = STYLE_FILE;
|
||||
char filename_4ed[] = "4ed_style.h";
|
||||
char *tag = 0;
|
||||
int32_t count = 0, i = 0;
|
||||
|
||||
String out = make_out_string(10 << 20);
|
||||
Out_Context context = {0};
|
||||
|
@ -204,9 +202,9 @@ generate_style(){
|
|||
|
||||
enum_begin(&out, "Style_Tag");
|
||||
{
|
||||
count = ArrayCount(bar_style_fields);
|
||||
for (i = 0; i < count; ++i){
|
||||
tag = make_style_tag(bar_style_fields[i]);
|
||||
int32_t count = ArrayCount(bar_style_fields);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
char *tag = make_style_tag(bar_style_fields[i]);
|
||||
append_sc(&out, "Stag_");
|
||||
append_sc(&out, tag);
|
||||
append_sc(&out, ",\n");
|
||||
|
@ -214,16 +212,40 @@ generate_style(){
|
|||
}
|
||||
|
||||
count = ArrayCount(main_style_fields);
|
||||
for (i = 0; i < count; ++i){
|
||||
tag = make_style_tag(main_style_fields[i]);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
char *tag = make_style_tag(main_style_fields[i]);
|
||||
append_sc(&out, "Stag_");
|
||||
append_sc(&out, tag);
|
||||
append_sc(&out, ",\n");
|
||||
free(tag);
|
||||
}
|
||||
|
||||
append_sc(&out, "Stag_COUNT\n");
|
||||
}
|
||||
struct_end(&out);
|
||||
|
||||
append_sc(&out, "static char *style_tag_names[] = {\n");
|
||||
{
|
||||
int32_t count = ArrayCount(bar_style_fields);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
char *tag = make_style_tag(bar_style_fields[i]);
|
||||
append_sc(&out, "\"");
|
||||
append_sc(&out, tag);
|
||||
append_sc(&out, "\",\n");
|
||||
free(tag);
|
||||
}
|
||||
|
||||
count = ArrayCount(main_style_fields);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
char *tag = make_style_tag(main_style_fields[i]);
|
||||
append_sc(&out, "\"");
|
||||
append_sc(&out, tag);
|
||||
append_sc(&out, "\",\n");
|
||||
free(tag);
|
||||
}
|
||||
}
|
||||
append_sc(&out, "};\n");
|
||||
|
||||
end_file_out(context);
|
||||
}
|
||||
|
||||
|
@ -231,8 +253,8 @@ generate_style(){
|
|||
|
||||
struct_begin(&out, "Interactive_Style");
|
||||
{
|
||||
count = ArrayCount(bar_style_fields);
|
||||
for (i = 0; i < count; ++i){
|
||||
int32_t count = ArrayCount(bar_style_fields);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
append_sc(&out, "u32 ");
|
||||
append_sc(&out, bar_style_fields[i]);
|
||||
append_sc(&out, "_color;\n");
|
||||
|
@ -242,8 +264,8 @@ generate_style(){
|
|||
|
||||
struct_begin(&out, "Style_Main_Data");
|
||||
{
|
||||
count = ArrayCount(main_style_fields);
|
||||
for (i = 0; i < count; ++i){
|
||||
int32_t count = ArrayCount(main_style_fields);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
append_sc(&out, "u32 ");
|
||||
append_sc(&out, main_style_fields[i]);
|
||||
append_sc(&out, "_color;\n");
|
||||
|
@ -259,9 +281,9 @@ generate_style(){
|
|||
"u32 *result = 0;\n"
|
||||
"switch (tag){\n");
|
||||
|
||||
count = ArrayCount(bar_style_fields);
|
||||
for (i = 0; i < count; ++i){
|
||||
tag = make_style_tag(bar_style_fields[i]);
|
||||
int32_t count = ArrayCount(bar_style_fields);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
char *tag = make_style_tag(bar_style_fields[i]);
|
||||
append_sc(&out, "case Stag_");
|
||||
append_sc(&out, tag);
|
||||
append_sc(&out, ": result = &s->file_info_style.");
|
||||
|
@ -271,8 +293,8 @@ generate_style(){
|
|||
}
|
||||
|
||||
count = ArrayCount(main_style_fields);
|
||||
for (i = 0; i < count; ++i){
|
||||
tag = make_style_tag(main_style_fields[i]);
|
||||
for (int32_t i = 0; i < count; ++i){
|
||||
char *tag = make_style_tag(main_style_fields[i]);
|
||||
append_sc(&out, "case Stag_");
|
||||
append_sc(&out, tag);
|
||||
append_sc(&out, ": result = &s->");
|
||||
|
|
|
@ -479,6 +479,17 @@ build_main(char *cdir, u32 flags){
|
|||
build(OPTS | INCLUDES | LIBS | ICON | flags, cdir, PLAT_LAYER, dir, "4ed", 0);
|
||||
END_TIME_SECTION("build 4ed");
|
||||
}
|
||||
|
||||
{
|
||||
BEGIN_TIME_SECTION();
|
||||
DECL_STR(themes_folder, "../build/themes");
|
||||
|
||||
DECL_STR(source_themes_folder, "themes");
|
||||
clear_folder(themes_folder);
|
||||
make_folder_if_missing(themes_folder, 0);
|
||||
copy_all(source_themes_folder, "*", themes_folder);
|
||||
END_TIME_SECTION("move files");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
name = "4coder";
|
||||
|
||||
Back = 0xFF0C0C0C;
|
||||
Margin = 0xFF181818;
|
||||
Margin_Hover = 0xFF252525;
|
||||
Margin_Active = 0xFF323232;
|
||||
List_Item = Margin;
|
||||
List_Item_Hover = Margin_Hover;
|
||||
List_Item_Active = Margin_Active;
|
||||
Cursor = 0xFF00EE00;
|
||||
Highlight = 0xFFDDEE00;
|
||||
Mark = 0xFF494949;
|
||||
Default = 0xFF90B080;
|
||||
At_Cursor = Back;
|
||||
At_Highlight = 0xFFFF44DD;
|
||||
Comment = 0xFF2090F0;
|
||||
Keyword = 0xFFD08F20;
|
||||
Str_Constant = 0xFF50FF30;
|
||||
Char_Constant = Str_Constant;
|
||||
Int_Constant = Str_Constant;
|
||||
Float_Constant = Str_Constant;
|
||||
Bool_Constant = Str_Constant;
|
||||
Include = Str_Constant;
|
||||
Preproc = Default;
|
||||
Special_Character = 0xFFFF0000;
|
||||
Ghost_Character = 0xFF4E5E46;
|
||||
|
||||
Paste = 0xFFDDEE00;
|
||||
|
||||
Undo = 0xFF00DDEE;
|
||||
|
||||
Highlight_Junk = 0xff3a0000;
|
||||
Highlight_White = 0xff003a3a;
|
||||
|
||||
Bar = 0xFF888888;
|
||||
Bar_Active = 0xFF666666;
|
||||
Base = 0xFF000000;
|
||||
Pop1 = 0xFF3C57DC;
|
||||
Pop2 = 0xFFFF0000;
|
|
@ -0,0 +1,39 @@
|
|||
name = "Handmade Hero";
|
||||
|
||||
Back = 0xFF161616;
|
||||
Margin = 0xFF262626;
|
||||
Margin_Hover = 0xFF333333;
|
||||
Margin_Active = 0xFF404040;
|
||||
List_Item = Margin;
|
||||
List_Item_Hover = Margin_Hover;
|
||||
List_Item_Active = Margin_Active;
|
||||
Cursor = 0xFF40FF40;
|
||||
Highlight = 0xFF703419;
|
||||
Mark = 0xFF808080;
|
||||
Default = 0xFFA08563;
|
||||
At_Cursor = Back;
|
||||
At_Highlight = 0xFFCDAA7D;
|
||||
Comment = 0xFF7D7D7D;
|
||||
Keyword = 0xFFCD950C;
|
||||
Str_Constant = 0xFF6B8E23;
|
||||
Char_Constant = Str_Constant;
|
||||
Int_Constant = Str_Constant;
|
||||
Float_Constant = Str_Constant;
|
||||
Bool_Constant = Str_Constant;
|
||||
Include = Str_Constant;
|
||||
Preproc = 0xFFDAB98F;
|
||||
Special_Character = 0xFFFF0000;
|
||||
Ghost_Character = 0xFF5B4D3C;
|
||||
|
||||
Paste = 0xFFFFBB00;
|
||||
|
||||
Undo = 0xFF80005D;
|
||||
|
||||
Highlight_Junk = 0xFF3A0000;
|
||||
Highlight_White = 0xFF003A3A;
|
||||
|
||||
Bar = 0xFFCACACA;
|
||||
Bar_Active = FFA8A8A8;
|
||||
Base = 0xFF000000;
|
||||
Pop1 = 0xFF03CF0C;
|
||||
Pop2 = 0xFFFF0000;
|
Loading…
Reference in New Issue