Remove style struct, focus on enum and array
parent
59d70950d6
commit
180304dbe3
|
@ -16,7 +16,7 @@
|
|||
/* DOC(bool32 is an alias name to signal that an integer parameter or field is for true/false values.) */
|
||||
TYPEDEF int32_t bool32;
|
||||
|
||||
/* DOC(int_color is an alias name to signal that an integer parameter or field is for a color value, colors are specified as 32 bit integers (8 bit + 24 bit) with 3 channels: 0x**RRGGBB.) */
|
||||
/* DOC(int_color is an alias name to signal that an integer parameter or field is for a color value, colors are specified as 32 bit integers with 4 channels: 0xAARRGGBB. In some APIs if the alpha channel is zero, then the integer is a symbolic color with a special interpretation.) */
|
||||
TYPEDEF uint32_t int_color;
|
||||
|
||||
/* DOC(Parse_Context_ID identifies a parse context, which is a guiding rule for the parser. Each buffer sets which parse context to use when it is parsed.) */
|
||||
|
|
85
4ed.cpp
85
4ed.cpp
|
@ -559,51 +559,51 @@ setup_command_table(void){
|
|||
|
||||
internal void
|
||||
app_hardcode_default_style(Models *models){
|
||||
Interactive_Style file_info_style = {};
|
||||
Style *styles = models->styles.styles;
|
||||
Style *style = styles + 1;
|
||||
|
||||
/////////////////
|
||||
style_set_name(style, make_lit_string("4coder"));
|
||||
|
||||
style->main.back_color = 0xFF0C0C0C;
|
||||
style->main.margin_color = 0xFF181818;
|
||||
style->main.margin_hover_color = 0xFF252525;
|
||||
style->main.margin_active_color = 0xFF323232;
|
||||
style->main.list_item_color = style->main.margin_color;
|
||||
style->main.list_item_hover_color = style->main.margin_hover_color;
|
||||
style->main.list_item_active_color = style->main.margin_active_color;
|
||||
style->main.cursor_color = 0xFF00EE00;
|
||||
style->main.highlight_color = 0xFFDDEE00;
|
||||
style->main.mark_color = 0xFF494949;
|
||||
style->main.default_color = 0xFF90B080;
|
||||
style->main.at_cursor_color = style->main.back_color;
|
||||
style->main.highlight_cursor_line_color = 0xFF1E1E1E;
|
||||
style->main.at_highlight_color = 0xFFFF44DD;
|
||||
style->main.comment_color = 0xFF2090F0;
|
||||
style->main.keyword_color = 0xFFD08F20;
|
||||
style->main.str_constant_color = 0xFF50FF30;
|
||||
style->main.char_constant_color = style->main.str_constant_color;
|
||||
style->main.int_constant_color = style->main.str_constant_color;
|
||||
style->main.float_constant_color = style->main.str_constant_color;
|
||||
style->main.bool_constant_color = style->main.str_constant_color;
|
||||
style->main.include_color = style->main.str_constant_color;
|
||||
style->main.preproc_color = style->main.default_color;
|
||||
style->main.special_character_color = 0xFFFF0000;
|
||||
style->main.ghost_character_color = color_blend(style->main.default_color, 0.5f, style->main.back_color);
|
||||
style->theme.colors[Stag_Back] = 0xFF0C0C0C;
|
||||
style->theme.colors[Stag_Margin] = 0xFF181818;
|
||||
style->theme.colors[Stag_Margin_Hover] = 0xFF252525;
|
||||
style->theme.colors[Stag_Margin_Active] = 0xFF323232;
|
||||
style->theme.colors[Stag_List_Item] = style->theme.colors[Stag_Margin];
|
||||
style->theme.colors[Stag_List_Item_Hover] = style->theme.colors[Stag_Margin_Hover];
|
||||
style->theme.colors[Stag_List_Item_Active] = style->theme.colors[Stag_Margin_Active];
|
||||
style->theme.colors[Stag_Cursor] = 0xFF00EE00;
|
||||
style->theme.colors[Stag_Highlight] = 0xFFDDEE00;
|
||||
style->theme.colors[Stag_Mark] = 0xFF494949;
|
||||
style->theme.colors[Stag_Default] = 0xFF90B080;
|
||||
style->theme.colors[Stag_At_Cursor] = style->theme.colors[Stag_Back];
|
||||
style->theme.colors[Stag_Highlight_Cursor_Line] = 0xFF1E1E1E;
|
||||
style->theme.colors[Stag_At_Highlight] = 0xFFFF44DD;
|
||||
style->theme.colors[Stag_Comment] = 0xFF2090F0;
|
||||
style->theme.colors[Stag_Keyword] = 0xFFD08F20;
|
||||
style->theme.colors[Stag_Str_Constant] = 0xFF50FF30;
|
||||
style->theme.colors[Stag_Char_Constant] = style->theme.colors[Stag_Str_Constant];
|
||||
style->theme.colors[Stag_Int_Constant] = style->theme.colors[Stag_Str_Constant];
|
||||
style->theme.colors[Stag_Float_Constant] = style->theme.colors[Stag_Str_Constant];
|
||||
style->theme.colors[Stag_Bool_Constant] = style->theme.colors[Stag_Str_Constant];
|
||||
style->theme.colors[Stag_Include] = style->theme.colors[Stag_Str_Constant];
|
||||
style->theme.colors[Stag_Preproc] = style->theme.colors[Stag_Default];
|
||||
style->theme.colors[Stag_Special_Character] = 0xFFFF0000;
|
||||
style->theme.colors[Stag_Ghost_Character] = color_blend(style->theme.colors[Stag_Default],
|
||||
0.5f,
|
||||
style->theme.colors[Stag_Back]);
|
||||
|
||||
style->main.paste_color = 0xFFDDEE00;
|
||||
style->main.undo_color = 0xFF00DDEE;
|
||||
style->theme.colors[Stag_Paste] = 0xFFDDEE00;
|
||||
style->theme.colors[Stag_Undo] = 0xFF00DDEE;
|
||||
|
||||
style->main.highlight_junk_color = 0xff3a0000;
|
||||
style->main.highlight_white_color = 0xff003a3a;
|
||||
style->theme.colors[Stag_Highlight_Junk] = 0xff3a0000;
|
||||
style->theme.colors[Stag_Highlight_White] = 0xff003a3a;
|
||||
|
||||
file_info_style.bar_color = 0xFF888888;
|
||||
file_info_style.bar_active_color = 0xFF666666;
|
||||
file_info_style.base_color = 0xFF000000;
|
||||
file_info_style.pop1_color = 0xFF3C57DC;
|
||||
file_info_style.pop2_color = 0xFFFF0000;
|
||||
style->main.file_info_style = file_info_style;
|
||||
style->theme.colors[Stag_Bar] = 0xFF888888;
|
||||
style->theme.colors[Stag_Bar_Active] = 0xFF666666;
|
||||
style->theme.colors[Stag_Base] = 0xFF000000;
|
||||
style->theme.colors[Stag_Pop1] = 0xFF3C57DC;
|
||||
style->theme.colors[Stag_Pop2] = 0xFFFF0000;
|
||||
++style;
|
||||
|
||||
/////////////////
|
||||
|
@ -1587,23 +1587,22 @@ App_Step_Sig(app_step){
|
|||
View *view = panel->view;
|
||||
Style *style = &models->styles.styles[0];
|
||||
|
||||
b32 active = (panel == active_panel);
|
||||
u32 back_color = style->main.back_color;
|
||||
draw_rectangle(target, full, back_color);
|
||||
draw_rectangle(target, full, style->theme.colors[Stag_Back]);
|
||||
|
||||
GUI_Scroll_Vars *scroll_vars = &view->transient.edit_pos->scroll;
|
||||
|
||||
b32 active = (panel == active_panel);
|
||||
do_render_file_view(system, view, models, scroll_vars, active_view, panel->inner, active, target);
|
||||
|
||||
u32 margin_color;
|
||||
u32 margin_color = 0;
|
||||
if (active){
|
||||
margin_color = style->main.margin_active_color;
|
||||
margin_color = style->theme.colors[Stag_Margin_Active];
|
||||
}
|
||||
else if (panel == mouse_panel){
|
||||
margin_color = style->main.margin_hover_color;
|
||||
margin_color = style->theme.colors[Stag_Margin_Hover];
|
||||
}
|
||||
else{
|
||||
margin_color = style->main.margin_color;
|
||||
margin_color = style->theme.colors[Stag_Margin];
|
||||
}
|
||||
draw_rectangle(target, i32R( full.x0, full.y0, full.x1, inner.y0), margin_color);
|
||||
draw_rectangle(target, i32R( full.x0, inner.y1, full.x1, full.y1), margin_color);
|
||||
|
|
|
@ -3207,24 +3207,22 @@ DOC(This call creates a new theme. If the given name is already the name of a s
|
|||
Style_Library *library = &models->styles;
|
||||
String theme_name = make_string(name, len);
|
||||
|
||||
b32 hit_existing_theme = false;
|
||||
i32 count = library->count;
|
||||
Style *destination_style = 0;
|
||||
Style *style = library->styles + 1;
|
||||
for (i32 i = 1; i < count; ++i, ++style){
|
||||
if (match(style->name, theme_name)){
|
||||
style_set_colors(style, theme);
|
||||
hit_existing_theme = true;
|
||||
destination_style = style;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hit_existing_theme){
|
||||
if (library->count < library->max){
|
||||
Style *new_style = &library->styles[library->count++];
|
||||
style_set_colors(new_style, theme);
|
||||
style_set_name(new_style, make_string(name, len));
|
||||
}
|
||||
if (destination_style != 0 && library->count < library->max){
|
||||
destination_style = &library->styles[library->count++];
|
||||
style_set_name(destination_style, make_string(name, len));
|
||||
}
|
||||
|
||||
memcpy(&style->theme, theme, sizeof(*theme));
|
||||
}
|
||||
|
||||
API_EXPORT void
|
||||
|
@ -3557,7 +3555,7 @@ DOC_SEE(Theme_Color)
|
|||
Style *style = &models->styles.styles[0];
|
||||
Theme_Color *theme_color = colors;
|
||||
for (i32 i = 0; i < count; ++i, ++theme_color){
|
||||
int_color *color = style_index_by_tag(&style->main, theme_color->tag);
|
||||
int_color *color = &style->theme.colors[theme_color->tag];
|
||||
if (color != 0){
|
||||
*color = theme_color->color;
|
||||
}
|
||||
|
@ -3576,9 +3574,8 @@ DOC_SEE(Theme_Color)
|
|||
Style *style = &models->styles.styles[0];
|
||||
Theme_Color *theme_color = colors;
|
||||
for (i32 i = 0; i < count; ++i, ++theme_color){
|
||||
u32 *color = style_index_by_tag(&style->main, theme_color->tag);
|
||||
if (color != 0){
|
||||
theme_color->color = *color;
|
||||
if (theme_color->tag < Stag_COUNT){
|
||||
theme_color->color = style->theme.colors[theme_color->tag];
|
||||
}
|
||||
else{
|
||||
theme_color->color = 0xFF000000;
|
||||
|
|
|
@ -85,7 +85,6 @@ struct Mem_Options{
|
|||
#include "4ed_file.cpp"
|
||||
#include "4ed_code_wrap.cpp"
|
||||
#include "4ed_working_set.cpp"
|
||||
#include "4ed_style.cpp"
|
||||
#include "4ed_hot_directory.cpp"
|
||||
#include "4ed_cli.cpp"
|
||||
#include "4ed_gui.cpp"
|
||||
|
|
|
@ -492,7 +492,7 @@ edit_historical(System_Functions *system, Models *models, Editing_File *file, Vi
|
|||
view->transient.edit_pos->mark = view->transient.edit_pos->cursor.pos;
|
||||
|
||||
Style *style = &models->styles.styles[0];
|
||||
view_post_paste_effect(view, 0.333f, step.edit.start, step.edit.len, style->main.undo_color);
|
||||
view_post_paste_effect(view, 0.333f, step.edit.start, step.edit.len, style->theme.colors[Stag_Undo]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if 0
|
||||
struct Interactive_Style{
|
||||
u32 bar_color;
|
||||
u32 bar_active_color;
|
||||
|
@ -98,4 +99,5 @@ case Stag_Text_Cycle_4: result = &s->text_cycle_4_color; break;
|
|||
}
|
||||
return(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 25.03.2018
|
||||
*
|
||||
* Styles
|
||||
*
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
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 u32
|
||||
style_get_margin_color(i32 active_level, Style *style){
|
||||
u32 margin = 0xFFFFFFFF;
|
||||
switch (active_level){
|
||||
default:
|
||||
case UIActivation_None:
|
||||
{
|
||||
margin = style->main.list_item_color;
|
||||
}break;
|
||||
case UIActivation_Hover:
|
||||
{
|
||||
margin = style->main.list_item_hover_color;
|
||||
}break;
|
||||
case UIActivation_Active:
|
||||
{
|
||||
margin = style->main.list_item_active_color;
|
||||
}break;
|
||||
}
|
||||
return(margin);
|
||||
}
|
||||
|
||||
internal u32*
|
||||
style_get_color(Style *style, Cpp_Token token){
|
||||
u32 *result = 0;
|
||||
if ((token.flags & CPP_TFLAG_IS_KEYWORD) != 0){
|
||||
if (token.type == CPP_TOKEN_BOOLEAN_CONSTANT){
|
||||
result = &style->main.bool_constant_color;
|
||||
}
|
||||
else{
|
||||
result = &style->main.keyword_color;
|
||||
}
|
||||
}
|
||||
else if ((token.flags & CPP_TFLAG_PP_DIRECTIVE) != 0){
|
||||
result = &style->main.preproc_color;
|
||||
}
|
||||
else{
|
||||
switch (token.type){
|
||||
case CPP_TOKEN_COMMENT:
|
||||
{
|
||||
result = &style->main.comment_color;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_STRING_CONSTANT:
|
||||
{
|
||||
result = &style->main.str_constant_color;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_CHARACTER_CONSTANT:
|
||||
{
|
||||
result = &style->main.char_constant_color;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_INTEGER_CONSTANT:
|
||||
{
|
||||
result = &style->main.int_constant_color;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_FLOATING_CONSTANT:
|
||||
{
|
||||
result = &style->main.float_constant_color;
|
||||
}break;
|
||||
|
||||
case CPP_PP_INCLUDE_FILE:
|
||||
{
|
||||
result = &style->main.include_color;
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
result = &style->main.default_color;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
Assert(result != 0);
|
||||
return(result);
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
|
@ -21,7 +21,7 @@ struct Style_Font{
|
|||
struct Style{
|
||||
char name_[32];
|
||||
String name;
|
||||
Style_Main_Data main;
|
||||
Theme theme;
|
||||
};
|
||||
|
||||
internal void
|
||||
|
|
77
4ed_view.cpp
77
4ed_view.cpp
|
@ -492,7 +492,7 @@ release_font_and_update_files(System_Functions *system, Models *models, Face_ID
|
|||
internal void
|
||||
get_visual_markers(Partition *arena, Dynamic_Workspace *workspace,
|
||||
Range range, Buffer_ID buffer_id, i32 view_index,
|
||||
Style_Main_Data *style_data){
|
||||
Theme *theme_data){
|
||||
View_ID view_id = view_index + 1;
|
||||
for (Managed_Buffer_Markers_Header *node = workspace->buffer_markers_list.first;
|
||||
node != 0;
|
||||
|
@ -513,7 +513,7 @@ get_visual_markers(Partition *arena, Dynamic_Workspace *workspace,
|
|||
i32 priority = data->priority;
|
||||
|
||||
if ((color&SymbolicColor__StagColorFlag) && (color&0xFF000000) == 0){
|
||||
u32 *c = style_index_by_tag(style_data, color&0x007FFFFF);
|
||||
u32 *c = &theme_data->colors[color&0x007FFFFF];
|
||||
if (c != 0){
|
||||
color = *c;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ get_visual_markers(Partition *arena, Dynamic_Workspace *workspace,
|
|||
}
|
||||
|
||||
if ((text_color&SymbolicColor__StagColorFlag) && (text_color&0xFF000000) == 0){
|
||||
u32 *c = style_index_by_tag(style_data, text_color&0x007FFFFF);
|
||||
u32 *c = &theme_data->colors[color&0x007FFFFF];
|
||||
if (c != 0){
|
||||
text_color = *c;
|
||||
}
|
||||
|
@ -755,6 +755,55 @@ range_record_stack_get_insert_index(Render_Range_Record *records, i32 count, i32
|
|||
return(insert_pos);
|
||||
}
|
||||
|
||||
internal u32
|
||||
get_token_color(Style *style, Cpp_Token token){
|
||||
u32 result = 0;
|
||||
if ((token.flags & CPP_TFLAG_IS_KEYWORD) != 0){
|
||||
if (token.type == CPP_TOKEN_BOOLEAN_CONSTANT){
|
||||
result = style->theme.colors[Stag_Bool_Constant];
|
||||
}
|
||||
else{
|
||||
result = style->theme.colors[Stag_Keyword];
|
||||
}
|
||||
}
|
||||
else if ((token.flags & CPP_TFLAG_PP_DIRECTIVE) != 0){
|
||||
result = style->theme.colors[Stag_Preproc];
|
||||
}
|
||||
else{
|
||||
switch (token.type){
|
||||
case CPP_TOKEN_COMMENT:
|
||||
{
|
||||
result = style->theme.colors[Stag_Comment];
|
||||
}break;
|
||||
case CPP_TOKEN_STRING_CONSTANT:
|
||||
{
|
||||
result = style->theme.colors[Stag_Str_Constant];
|
||||
}break;
|
||||
case CPP_TOKEN_CHARACTER_CONSTANT:
|
||||
{
|
||||
result = style->theme.colors[Stag_Char_Constant];
|
||||
}break;
|
||||
case CPP_TOKEN_INTEGER_CONSTANT:
|
||||
{
|
||||
result = style->theme.colors[Stag_Int_Constant];
|
||||
}break;
|
||||
case CPP_TOKEN_FLOATING_CONSTANT:
|
||||
{
|
||||
result = style->theme.colors[Stag_Float_Constant];
|
||||
}break;
|
||||
case CPP_PP_INCLUDE_FILE:
|
||||
{
|
||||
result = style->theme.colors[Stag_Include];
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
result = style->theme.colors[Stag_Default];
|
||||
}break;
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *view,
|
||||
i32_Rect rect, Full_Cursor render_cursor, Range on_screen_range,
|
||||
|
@ -780,9 +829,9 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
|||
Lifetime_Object *lifetime_object = file->lifetime_object;
|
||||
Buffer_ID buffer_id = file->id.id;
|
||||
i32 view_index = view->persistent.id;
|
||||
Style_Main_Data *style_data = &style->main;
|
||||
Theme *theme_data = &style->theme;
|
||||
|
||||
get_visual_markers(part, &lifetime_object->workspace, on_screen_range, buffer_id, view_index, style_data);
|
||||
get_visual_markers(part, &lifetime_object->workspace, on_screen_range, buffer_id, view_index, theme_data);
|
||||
|
||||
i32 key_count = lifetime_object->key_count;
|
||||
i32 key_index = 0;
|
||||
|
@ -792,7 +841,7 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
|||
i32 local_count = clamp_top(lifetime_key_reference_per_node, key_count - key_index);
|
||||
for (i32 i = 0; i < local_count; i += 1){
|
||||
Lifetime_Key *key = node->keys[i];
|
||||
get_visual_markers(part, &key->dynamic_workspace, on_screen_range, buffer_id, view_index, style_data);
|
||||
get_visual_markers(part, &key->dynamic_workspace, on_screen_range, buffer_id, view_index, theme_data);
|
||||
}
|
||||
key_index += local_count;
|
||||
}
|
||||
|
@ -865,12 +914,12 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
|||
i32 visual_line_range_markers_scan_index = 0;
|
||||
|
||||
i32 token_i = 0;
|
||||
u32 main_color = style->main.default_color;
|
||||
u32 special_color = style->main.special_character_color;
|
||||
u32 ghost_color = style->main.ghost_character_color;
|
||||
u32 main_color = style->theme.colors[Stag_Default];
|
||||
u32 special_color = style->theme.colors[Stag_Special_Character];
|
||||
u32 ghost_color = style->theme.colors[Stag_Ghost_Character];
|
||||
if (tokens_use){
|
||||
Cpp_Get_Token_Result result = cpp_get_token(token_array, items->index);
|
||||
main_color = *style_get_color(style, token_array.tokens[result.token_index]);
|
||||
main_color = get_token_color(style, token_array.tokens[result.token_index]);
|
||||
token_i = result.token_index + 1;
|
||||
}
|
||||
|
||||
|
@ -927,17 +976,17 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
|||
if (token_i < token_array.count){
|
||||
if (ind >= token_array.tokens[token_i].start){
|
||||
for (;token_i < token_array.count && ind >= token_array.tokens[token_i].start; ++token_i){
|
||||
main_color = *style_get_color(style, token_array.tokens[token_i]);
|
||||
main_color = get_token_color(style, token_array.tokens[token_i]);
|
||||
current_token = token_array.tokens[token_i];
|
||||
}
|
||||
}
|
||||
else if (ind >= current_token.start + current_token.size){
|
||||
main_color = style->main.default_color;
|
||||
main_color = style->theme.colors[Stag_Default];
|
||||
}
|
||||
}
|
||||
|
||||
if (current_token.type == CPP_TOKEN_JUNK && ind >= current_token.start && ind < current_token.start + current_token.size){
|
||||
highlight_color = style->main.highlight_junk_color;
|
||||
highlight_color = style->theme.colors[Stag_Highlight_Junk];
|
||||
}
|
||||
else{
|
||||
highlight_color = 0;
|
||||
|
@ -955,7 +1004,7 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
|||
f32_Rect char_rect = f32R(item->x0, item->y0, item->x1, item->y1);
|
||||
|
||||
if (view->transient.file_data.show_whitespace && highlight_color == 0 && codepoint_is_whitespace(item->codepoint)){
|
||||
highlight_this_color = style->main.highlight_white_color;
|
||||
highlight_this_color = style->theme.colors[Stag_Highlight_White];
|
||||
}
|
||||
else{
|
||||
highlight_this_color = highlight_color;
|
||||
|
|
|
@ -134,16 +134,13 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
|||
|
||||
internal void
|
||||
draw_text_field(System_Functions *system, Render_Target *target, View *view, Models *models, Face_ID font_id, i32_Rect rect, String p, String t){
|
||||
if (target != 0){
|
||||
Style *style = &models->styles.styles[0];
|
||||
|
||||
u32 back_color = style->main.margin_color;
|
||||
u32 text1_color = style->main.default_color;
|
||||
u32 text2_color = style->main.file_info_style.pop1_color;
|
||||
|
||||
u32 back_color = style->theme.colors[Stag_Margin];
|
||||
u32 text1_color = style->theme.colors[Stag_Default];
|
||||
u32 text2_color = style->theme.colors[Stag_Pop1];
|
||||
i32 x = rect.x0;
|
||||
i32 y = rect.y0 + 2;
|
||||
|
||||
if (target){
|
||||
draw_rectangle(target, rect, back_color);
|
||||
x = ceil32(draw_string(system, target, font_id, p, x, y, text2_color));
|
||||
draw_string(system, target, font_id, t, x, y, text1_color);
|
||||
|
@ -160,12 +157,11 @@ internal void
|
|||
draw_file_bar(System_Functions *system, Render_Target *target, View *view, Models *models, Editing_File *file, i32_Rect rect){
|
||||
File_Bar bar;
|
||||
Style *style = &models->styles.styles[0];
|
||||
Interactive_Style bar_style = style->main.file_info_style;
|
||||
|
||||
u32 back_color = bar_style.bar_color;
|
||||
u32 base_color = bar_style.base_color;
|
||||
u32 pop1_color = bar_style.pop1_color;
|
||||
u32 pop2_color = bar_style.pop2_color;
|
||||
u32 back_color = style->theme.colors[Stag_Bar];
|
||||
u32 base_color = style->theme.colors[Stag_Base];
|
||||
u32 pop1_color = style->theme.colors[Stag_Pop1];
|
||||
u32 pop2_color = style->theme.colors[Stag_Pop2];
|
||||
|
||||
bar.rect = rect;
|
||||
|
||||
|
@ -225,6 +221,27 @@ draw_file_bar(System_Functions *system, Render_Target *target, View *view, Model
|
|||
}
|
||||
}
|
||||
|
||||
internal u32
|
||||
get_margin_color(Style *style, i32 level){
|
||||
u32 margin = 0xFFFFFFFF;
|
||||
switch (level){
|
||||
default:
|
||||
case UIActivation_None:
|
||||
{
|
||||
margin = style->theme.colors[Stag_List_Item];
|
||||
}break;
|
||||
case UIActivation_Hover:
|
||||
{
|
||||
margin = style->theme.colors[Stag_List_Item_Hover];
|
||||
}break;
|
||||
case UIActivation_Active:
|
||||
{
|
||||
margin = style->theme.colors[Stag_List_Item_Active];
|
||||
}break;
|
||||
}
|
||||
return(margin);
|
||||
}
|
||||
|
||||
internal void
|
||||
do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Scroll_Vars *scroll, View *active, i32_Rect rect, b32 is_active, Render_Target *target){
|
||||
|
||||
|
@ -259,9 +276,9 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
|
|||
query_bar_rect.x1 = rect.x1;
|
||||
query_bar_rect.y1 = rect.y0 + line_height + 2;
|
||||
rect.y0 = query_bar_rect.y1;
|
||||
u32 back_color = style->main.margin_color;
|
||||
u32 text1_color = style->main.default_color;
|
||||
u32 text2_color = style->main.file_info_style.pop1_color;
|
||||
u32 back_color = style->theme.colors[Stag_Back];
|
||||
u32 text1_color = style->theme.colors[Stag_Default];
|
||||
u32 text2_color = style->theme.colors[Stag_Pop1];
|
||||
i32 x = query_bar_rect.x0;
|
||||
i32 y = query_bar_rect.y0 + 2;
|
||||
draw_rectangle(target, query_bar_rect, back_color);
|
||||
|
@ -283,6 +300,7 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
|
|||
UI_Item *item = view->transient.ui_control.items;
|
||||
GUI_Scroll_Vars ui_scroll = view->transient.ui_scroll;
|
||||
for (i32 i = 0; i < item_count; ++i, item += 1){
|
||||
|
||||
f32_Rect item_rect = f32R(item->rectangle);
|
||||
switch (item->coordinates){
|
||||
case UICoordinates_Scrolled:
|
||||
|
@ -292,7 +310,6 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
|
|||
item_rect.x1 += rect_f32.x0 - ui_scroll.scroll_x;
|
||||
item_rect.y1 += rect_f32.y0 - ui_scroll.scroll_y;
|
||||
}break;
|
||||
|
||||
case UICoordinates_ViewRelative:
|
||||
{
|
||||
item_rect.x0 += rect_f32.x0;
|
||||
|
@ -306,10 +323,10 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
|
|||
switch (item->type){
|
||||
case UIType_Option:
|
||||
{
|
||||
u32 back = style->main.back_color;
|
||||
u32 margin_color = style_get_margin_color(item->activation_level, style);
|
||||
u32 text_color = style->main.default_color;
|
||||
u32 pop_color = style->main.file_info_style.pop2_color;
|
||||
u32 back = style->theme.colors[Stag_Back];
|
||||
u32 text_color = style->theme.colors[Stag_Default];
|
||||
u32 pop_color = style->theme.colors[Stag_Pop2];
|
||||
u32 margin_color = get_margin_color(style, item->activation_level);
|
||||
f32_Rect inner = get_inner_rect(item_rect, 3);
|
||||
draw_rectangle(target, inner, back);
|
||||
i32 x = (i32)inner.x0 + 3;
|
||||
|
@ -322,26 +339,26 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
|
|||
|
||||
case UIType_TextField:
|
||||
{
|
||||
u32 back_color = style->main.margin_color;
|
||||
u32 text1_color = style->main.default_color;
|
||||
u32 text2_color = style->main.file_info_style.pop1_color;
|
||||
draw_rectangle(target, item_rect, back_color);
|
||||
u32 back = style->theme.colors[Stag_Back];
|
||||
u32 text1 = style->theme.colors[Stag_Default];
|
||||
u32 text2 = style->theme.colors[Stag_Pop1];
|
||||
draw_rectangle(target, item_rect, back);
|
||||
i32 x = (i32)item_rect.x0;
|
||||
i32 y = (i32)item_rect.y0 + 2;
|
||||
x = ceil32(draw_string(system, target, font_id, item->text_field.query, x, y, text2_color));
|
||||
x = ceil32(draw_string(system, target, font_id, item->text_field.query, x, y, text2));
|
||||
x += (i32)font_string_width(system, target, font_id, " ");
|
||||
draw_string(system, target, font_id, item->text_field.string, x, y, text1_color);
|
||||
draw_string(system, target, font_id, item->text_field.string, x, y, text1);
|
||||
}break;
|
||||
|
||||
case UIType_ColorTheme:
|
||||
{
|
||||
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;
|
||||
u32 margin_color = get_margin_color(style_preview, item->activation_level);
|
||||
u32 back = style_preview->theme.colors[Stag_Back];
|
||||
u32 text_color = style_preview->theme.colors[Stag_Default];
|
||||
u32 keyword_color = style_preview->theme.colors[Stag_Keyword];
|
||||
u32 int_constant_color = style_preview->theme.colors[Stag_Int_Constant];
|
||||
u32 comment_color = style_preview->theme.colors[Stag_Comment];
|
||||
|
||||
f32_Rect inner = get_inner_rect(item_rect, 3);
|
||||
|
||||
|
|
|
@ -1254,7 +1254,7 @@ int main(int argc, char **argv){
|
|||
META_BEGIN();
|
||||
|
||||
fm_init_system();
|
||||
generate_style();
|
||||
//generate_style();
|
||||
generate_custom_headers();
|
||||
generate_remapping_code_and_data();
|
||||
|
||||
|
|
Loading…
Reference in New Issue