mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-23 16:07:50 +00:00
color scheme -> palette; fix eval/watch views after cleanup; make more progress on new palette system
This commit is contained in:
+19
-30
@@ -1442,7 +1442,7 @@ ui_end_build(void)
|
||||
Min(text_pos.x+drawn_text_dim.x, rect.x1),
|
||||
rect.y1),
|
||||
ui_state->mouse);
|
||||
if(text_is_truncated && mouse_is_hovering)
|
||||
if(text_is_truncated && mouse_is_hovering && !(b->flags & UI_BoxFlag_DisableTruncatedHover))
|
||||
{
|
||||
if(!str8_match(box_display_string, ui_state->string_hover_string, 0))
|
||||
{
|
||||
@@ -1890,7 +1890,7 @@ ui_begin_ctx_menu(UI_Key key)
|
||||
ui_state->ctx_menu_root->flags |= UI_BoxFlag_Clip;
|
||||
ui_state->ctx_menu_root->flags |= UI_BoxFlag_Clickable;
|
||||
ui_state->ctx_menu_root->corner_radii[Corner_00] = ui_state->ctx_menu_root->corner_radii[Corner_01] = ui_state->ctx_menu_root->corner_radii[Corner_10] = ui_state->ctx_menu_root->corner_radii[Corner_11] = ui_top_font_size()*0.25f;
|
||||
ui_state->ctx_menu_root->scheme = ui_top_scheme();
|
||||
ui_state->ctx_menu_root->palette = ui_top_palette();
|
||||
ui_state->ctx_menu_root->blur_size = ui_top_blur_size();
|
||||
}
|
||||
ui_push_pref_width(ui_bottom_pref_width());
|
||||
@@ -2036,21 +2036,16 @@ ui_set_auto_focus_hot_key(UI_Key key)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: color scheme forming
|
||||
//- rjf: palette forming
|
||||
|
||||
internal UI_ColorScheme *
|
||||
ui_push_color_scheme_(UI_ColorScheme *params)
|
||||
internal UI_Palette *
|
||||
ui_build_palette_(UI_Palette *base, UI_Palette *overrides)
|
||||
{
|
||||
UI_ColorScheme *scheme = push_array(ui_build_arena(), UI_ColorScheme, 1);
|
||||
MemoryCopyStruct(scheme, params);
|
||||
return scheme;
|
||||
}
|
||||
|
||||
internal UI_ColorScheme *
|
||||
ui_fork_color_scheme_(UI_ColorScheme *scheme, UI_ColorScheme *overrides)
|
||||
{
|
||||
UI_ColorScheme *fork = push_array(ui_build_arena(), UI_ColorScheme, 1);
|
||||
MemoryCopyStruct(fork, scheme);
|
||||
UI_Palette *palette = push_array(ui_build_arena(), UI_Palette, 1);
|
||||
if(base != 0)
|
||||
{
|
||||
MemoryCopyStruct(palette, base);
|
||||
}
|
||||
for(EachEnumVal(UI_ColorCode, code))
|
||||
{
|
||||
if(overrides->colors[code].x != 0 ||
|
||||
@@ -2058,17 +2053,10 @@ ui_fork_color_scheme_(UI_ColorScheme *scheme, UI_ColorScheme *overrides)
|
||||
overrides->colors[code].z != 0 ||
|
||||
overrides->colors[code].w != 0)
|
||||
{
|
||||
fork->colors[code] = overrides->colors[code];
|
||||
palette->colors[code] = overrides->colors[code];
|
||||
}
|
||||
}
|
||||
return fork;
|
||||
}
|
||||
|
||||
internal UI_ColorScheme *
|
||||
ui_fork_top_color_scheme_(UI_ColorScheme *params)
|
||||
{
|
||||
UI_ColorScheme *scheme = ui_fork_color_scheme_(ui_top_scheme(), params);
|
||||
return scheme;
|
||||
return palette;
|
||||
}
|
||||
|
||||
//- rjf: box node construction
|
||||
@@ -2215,7 +2203,7 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
|
||||
box->text_align = ui_state->text_alignment_stack.top->v;
|
||||
box->child_layout_axis = ui_state->child_layout_axis_stack.top->v;
|
||||
box->scheme = ui_state->scheme_stack.top->v;
|
||||
box->palette = ui_state->palette_stack.top->v;
|
||||
box->font = ui_state->font_stack.top->v;
|
||||
box->font_size = ui_state->font_size_stack.top->v;
|
||||
box->tab_size = ui_state->tab_size_stack.top->v;
|
||||
@@ -2302,10 +2290,11 @@ ui_box_equip_display_string(UI_Box *box, String8 string)
|
||||
ProfBeginFunction();
|
||||
box->string = push_str8_copy(ui_build_arena(), string);
|
||||
box->flags |= UI_BoxFlag_HasDisplayString;
|
||||
UI_ColorCode text_color_code = (box->flags & UI_BoxFlag_DrawTextWeak ? UI_ColorCode_TextWeak : UI_ColorCode_Text);
|
||||
if(box->flags & UI_BoxFlag_DrawText && (box->fastpath_codepoint == 0 || !(box->flags & UI_BoxFlag_DrawTextFastpathCodepoint)))
|
||||
{
|
||||
String8 display_string = ui_box_display_string(box);
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->palette->colors[text_color_code], box->font_size, 0, 0}};
|
||||
D_FancyStringList fancy_strings = {&fancy_string_n, &fancy_string_n, 1};
|
||||
box->display_string_runs = d_fancy_run_list_from_fancy_string_list(ui_build_arena(), box->tab_size, &fancy_strings);
|
||||
}
|
||||
@@ -2318,15 +2307,15 @@ ui_box_equip_display_string(UI_Box *box, String8 string)
|
||||
U64 fpcp_pos = str8_find_needle(display_string, 0, fpcp, StringMatchFlag_CaseInsensitive);
|
||||
if(fpcp_pos < display_string.size)
|
||||
{
|
||||
D_FancyStringNode pst_fancy_string_n = {0, {box->font, str8_skip(display_string, fpcp_pos+fpcp.size), box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringNode cdp_fancy_string_n = {&pst_fancy_string_n, {box->font, str8_substr(display_string, r1u64(fpcp_pos, fpcp_pos+fpcp.size)), box->scheme->colors[UI_ColorCode_Text], box->font_size, 4.f, 0}};
|
||||
D_FancyStringNode pre_fancy_string_n = {&cdp_fancy_string_n, {box->font, str8_prefix(display_string, fpcp_pos), box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringNode pst_fancy_string_n = {0, {box->font, str8_skip(display_string, fpcp_pos+fpcp.size), box->palette->colors[text_color_code], box->font_size, 0, 0}};
|
||||
D_FancyStringNode cdp_fancy_string_n = {&pst_fancy_string_n, {box->font, str8_substr(display_string, r1u64(fpcp_pos, fpcp_pos+fpcp.size)), box->palette->colors[text_color_code], box->font_size, 4.f, 0}};
|
||||
D_FancyStringNode pre_fancy_string_n = {&cdp_fancy_string_n, {box->font, str8_prefix(display_string, fpcp_pos), box->palette->colors[text_color_code], box->font_size, 0, 0}};
|
||||
D_FancyStringList fancy_strings = {&pre_fancy_string_n, &pst_fancy_string_n, 3};
|
||||
box->display_string_runs = d_fancy_run_list_from_fancy_string_list(ui_build_arena(), box->tab_size, &fancy_strings);
|
||||
}
|
||||
else
|
||||
{
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->palette->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringList fancy_strings = {&fancy_string_n, &fancy_string_n, 1};
|
||||
box->display_string_runs = d_fancy_run_list_from_fancy_string_list(ui_build_arena(), box->tab_size, &fancy_strings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user