work on tag-based styling

This commit is contained in:
Ryan Fleury
2025-02-18 18:08:18 -08:00
parent 6c9f7018f1
commit 1b8e39c635
13 changed files with 501 additions and 439 deletions
+27 -20
View File
@@ -242,7 +242,7 @@ str8_cstring_capped_reverse(void *raw_start, void *raw_cap)
for(; ptr > start; )
{
ptr -= 1;
if (*ptr == '\0')
{
break;
@@ -619,7 +619,7 @@ internal String8
str8_from_memory_size(Arena *arena, U64 size)
{
String8 result;
if(size < KB(1))
{
result = push_str8f(arena, "%llu Bytes", size);
@@ -640,7 +640,7 @@ str8_from_memory_size(Arena *arena, U64 size)
{
result = push_str8f(arena, "%llu.%02llu TiB", size / TB(1), ((size * 100) / TB(1)) % 100);
}
return result;
}
@@ -648,7 +648,7 @@ internal String8
str8_from_count(Arena *arena, U64 count)
{
String8 result;
if(count < 1 * 1000)
{
result = push_str8f(arena, "%llu", count);
@@ -689,7 +689,7 @@ str8_from_count(Arena *arena, U64 count)
result = push_str8f(arena, "%lluB", count / 1000000000, frac);
}
}
return result;
}
@@ -1114,6 +1114,13 @@ str8_list_from_flags(Arena *arena, String8List *list,
////////////////////////////////
//~ rjf; String Arrays
internal String8Array
str8_array_zero(void)
{
String8Array result = {0};
return result;
}
internal String8Array
str8_array_from_list(Arena *arena, String8List *list)
{
@@ -1827,10 +1834,10 @@ try_guid_from_string(String8 string, Guid *guid_out)
String8 data4_hi_str = list.first->next->next->next->string;
String8 data4_lo_str = list.first->next->next->next->next->string;
if(str8_is_integer(data1_str, 16) &&
str8_is_integer(data2_str, 16) &&
str8_is_integer(data3_str, 16) &&
str8_is_integer(data4_hi_str, 16) &&
str8_is_integer(data4_lo_str, 16))
str8_is_integer(data2_str, 16) &&
str8_is_integer(data3_str, 16) &&
str8_is_integer(data4_hi_str, 16) &&
str8_is_integer(data4_lo_str, 16))
{
U64 data1 = u64_from_str8(data1_str, 16);
U64 data2 = u64_from_str8(data2_str, 16);
@@ -1838,10 +1845,10 @@ try_guid_from_string(String8 string, Guid *guid_out)
U64 data4_hi = u64_from_str8(data4_hi_str, 16);
U64 data4_lo = u64_from_str8(data4_lo_str, 16);
if(data1 <= max_U32 &&
data2 <= max_U16 &&
data3 <= max_U16 &&
data4_hi <= max_U16 &&
data4_lo <= 0xffffffffffff)
data2 <= max_U16 &&
data3 <= max_U16 &&
data4_hi <= max_U16 &&
data4_lo <= 0xffffffffffff)
{
guid_out->data1 = (U32)data1;
guid_out->data2 = (U16)data2;
@@ -2381,18 +2388,18 @@ str8_deserial_read_uleb128(String8 string, U64 off, U64 *value_out)
{
U8 byte = 0;
U64 bytes_read = str8_deserial_read_struct(string, cursor, &byte);
if(bytes_read != sizeof(byte))
{
break;
}
U8 val = byte & 0x7fu;
value |= ((U64)val) << shift;
cursor += bytes_read;
shift += 7u;
if((byte & 0x80u) == 0)
{
break;
@@ -2420,13 +2427,13 @@ str8_deserial_read_sleb128(String8 string, U64 off, S64 *value_out)
{
break;
}
U8 val = byte & 0x7fu;
value |= ((U64)val) << shift;
cursor += bytes_read;
shift += 7u;
if((byte & 0x80u) == 0)
{
if(shift < sizeof(value) * 8 && (byte & 0x40u) != 0)
+1
View File
@@ -284,6 +284,7 @@ internal void str8_list_from_flags(Arena *arena, String8List *list, U32
////////////////////////////////
//~ rjf; String Arrays
internal String8Array str8_array_zero(void);
internal String8Array str8_array_from_list(Arena *arena, String8List *list);
internal String8Array str8_array_reserve(Arena *arena, U64 count);
+1 -1
View File
@@ -809,7 +809,7 @@ str8_lit_comp("far_manager"),
String8 rd_theme_preset_cfg_string_table[9] =
{
str8_lit_comp("theme:\n{\n background: 0x1b1b1bff,\n alt: background: 0x222222ff,\n good: background: 0x222222ff,\n bad: background: 0x222222ff,\n pop: background: 0x222222ff,\n border: 0x404040ff,\n text: 0xe5e5e5ff,\n weak: text: 0xe5e5e5ff,\n hover: 0xffffffff,\n focus: 0xfda200ff,\n cursor: 0x8aff00ff,\n selection: 0x99ccffff,\n\n menu_bar:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n\n good:\n {\n background: 0x2c5b36ff,\n border: 0x3f3f3fff,\n }\n\n bad:\n {\n background: 0x803425ff,\n border: 0xe88774ff,\n }\n\n pop:\n {\n background: 0x355b6eff,\n border: 0x355b6eff,\n }\n\n scroll_bar:\n {\n background: 0x2b2b2bff,\n border: 0x3f3f3fff,\n }\n\n tab:\n {\n background: 0x6f5135ff,\n border: 0x8a6e54ff,\n inactive:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n }\n\n drop_site:\n {\n background: 0xffffffff,\n border: 0xffffffff,\n }\n\n code:\n {\n default: text: 0xcbcbcbff,\n symbol: text: 0x42a2cfff,\n type: text: 0xfec746ff,\n local: text: 0x98bc80ff,\n register: text: 0xb7afd5ff,\n keyword: text: 0xb38d4cff,\n delimiter_or_operator: text: 0x767676ff,\n numeric: text: 0x98abb1ff,\n numeric_alt_digit_group: text: 0x738287ff,\n string: text: 0x98abb1ff,\n meta: text: 0xd96759ff,\n comment: text: 0x717171ff,\n line_info_0: background: 0x99503dff,\n line_info_1: background: 0xfe8249ff,\n line_info_2: background: 0xffba17ff,\n line_info_3: background: 0xcefd69ff,\n line_info_4: background: 0x99503dff,\n line_info_5: background: 0xfe8249ff,\n line_info_6: background: 0xcefd69ff,\n line_info_7: background: 0x99503dff,\n }\n\n debug_state:\n {\n thread_0: 0xffcb7fff,\n thread_1: 0xb2ff65ff,\n thread_2: 0xff99e5ff,\n thread_3: 0x6598ffff,\n thread_4: 0x65ffcbff,\n thread_5: 0xff9819ff,\n thread_6: 0x9932ffff,\n thread_7: 0x65ff4cff,\n thread_unwound: 0xb2ccd8ff,\n thread_error: 0xb23219ff,\n breakpoint: 0xa72911ff,\n }\n}\n"),
str8_lit_comp("theme:\n{\n background: 0x1b1b1bff,\n alt: background: 0x222222ff,\n good_pop: background: 0x2c5b36ff,\n bad_pop: background: 0x803425ff,\n good: text: 0x32a852ff,\n bad: text: 0xcf5242ff,\n pop: background: 0x355b6eff,\n border: 0x404040ff,\n text: 0xe5e5e5ff,\n weak: text: 0xe5e5e5ff,\n hover: 0xffffffff,\n focus: 0xfda200ff,\n cursor: 0x8aff00ff,\n selection: 0x99ccffff,\n inactive: background: 0x0000002f,\n drop_shadow: 0x0000007f,\n\n code_default: 0xcbcbcbff,\n code_symbol: 0x42a2cfff,\n code_type: 0xfec746ff,\n code_local: 0x98bc80ff,\n code_register: 0xb7afd5ff,\n code_keyword: 0xb38d4cff,\n code_delimiter_or_operator: 0x767676ff,\n code_numeric: 0x98abb1ff,\n code_numeric_alt_digit_group: 0x738287ff,\n code_string: 0x98abb1ff,\n code_meta: 0xd96759ff,\n code_comment: 0x717171ff,\n line_info_0: 0x99503dff,\n line_info_1: 0xfe8249ff,\n line_info_2: 0xffba17ff,\n line_info_3: 0xcefd69ff,\n line_info_4: 0x99503dff,\n line_info_5: 0xfe8249ff,\n line_info_6: 0xcefd69ff,\n line_info_7: 0x99503dff,\n thread_0: 0xffcb7fff,\n thread_1: 0xb2ff65ff,\n thread_2: 0xff99e5ff,\n thread_3: 0x6598ffff,\n thread_4: 0x65ffcbff,\n thread_5: 0xff9819ff,\n thread_6: 0x9932ffff,\n thread_7: 0x65ff4cff,\n thread_unwound: 0xb2ccd8ff,\n thread_error: 0xb23219ff,\n breakpoint: 0xa72911ff,\n\n floating:\n {\n background: 0x2222225f,\n background: alt: 0x2222225f,\n border: 0xbfbfbf1f,\n }\n\n menu_bar:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n\n good:\n {\n background: 0x2c5b36ff,\n border: 0x3f3f3fff,\n }\n\n bad:\n {\n background: 0x803425ff,\n border: 0xe88774ff,\n }\n\n pop:\n {\n background: 0x355b6eff,\n border: 0x355b6eff,\n }\n\n scroll_bar:\n {\n background: 0x2b2b2bff,\n border: 0x3f3f3fff,\n }\n\n implicit:\n {\n background: 0x00000000,\n border: 0x00000000,\n }\n\n hollow:\n {\n background: 0x00000000,\n border: 0xffffff1f,\n }\n\n tab:\n {\n background: 0x6f5135ff,\n border: 0x8a6e54ff,\n inactive:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n }\n\n drop_site:\n {\n background: 0xffffff05,\n border: 0xffffff0f,\n }\n}\n"),
str8_lit_comp(""),
str8_lit_comp(""),
str8_lit_comp(""),
+60 -44
View File
@@ -989,9 +989,11 @@ RD_ThemePresetTable:
{
background: 0x1b1b1bff,
alt: background: 0x222222ff,
good: background: 0x222222ff,
bad: background: 0x222222ff,
pop: background: 0x222222ff,
good_pop: background: 0x2c5b36ff,
bad_pop: background: 0x803425ff,
good: text: 0x32a852ff,
bad: text: 0xcf5242ff,
pop: background: 0x355b6eff,
border: 0x404040ff,
text: 0xe5e5e5ff,
weak: text: 0xe5e5e5ff,
@@ -999,6 +1001,47 @@ RD_ThemePresetTable:
focus: 0xfda200ff,
cursor: 0x8aff00ff,
selection: 0x99ccffff,
inactive: background: 0x0000002f,
drop_shadow: 0x0000007f,
code_default: 0xcbcbcbff,
code_symbol: 0x42a2cfff,
code_type: 0xfec746ff,
code_local: 0x98bc80ff,
code_register: 0xb7afd5ff,
code_keyword: 0xb38d4cff,
code_delimiter_or_operator: 0x767676ff,
code_numeric: 0x98abb1ff,
code_numeric_alt_digit_group: 0x738287ff,
code_string: 0x98abb1ff,
code_meta: 0xd96759ff,
code_comment: 0x717171ff,
line_info_0: 0x99503dff,
line_info_1: 0xfe8249ff,
line_info_2: 0xffba17ff,
line_info_3: 0xcefd69ff,
line_info_4: 0x99503dff,
line_info_5: 0xfe8249ff,
line_info_6: 0xcefd69ff,
line_info_7: 0x99503dff,
thread_0: 0xffcb7fff,
thread_1: 0xb2ff65ff,
thread_2: 0xff99e5ff,
thread_3: 0x6598ffff,
thread_4: 0x65ffcbff,
thread_5: 0xff9819ff,
thread_6: 0x9932ffff,
thread_7: 0x65ff4cff,
thread_unwound: 0xb2ccd8ff,
thread_error: 0xb23219ff,
breakpoint: 0xa72911ff,
floating:
{
background: 0x2222225f,
background: alt: 0x2222225f,
border: 0xbfbfbf1f,
}
menu_bar:
{
@@ -1030,6 +1073,18 @@ RD_ThemePresetTable:
border: 0x3f3f3fff,
}
implicit:
{
background: 0x00000000,
border: 0x00000000,
}
hollow:
{
background: 0x00000000,
border: 0xffffff1f,
}
tab:
{
background: 0x6f5135ff,
@@ -1043,47 +1098,8 @@ RD_ThemePresetTable:
drop_site:
{
background: 0xffffffff,
border: 0xffffffff,
}
code:
{
default: text: 0xcbcbcbff,
symbol: text: 0x42a2cfff,
type: text: 0xfec746ff,
local: text: 0x98bc80ff,
register: text: 0xb7afd5ff,
keyword: text: 0xb38d4cff,
delimiter_or_operator: text: 0x767676ff,
numeric: text: 0x98abb1ff,
numeric_alt_digit_group: text: 0x738287ff,
string: text: 0x98abb1ff,
meta: text: 0xd96759ff,
comment: text: 0x717171ff,
line_info_0: background: 0x99503dff,
line_info_1: background: 0xfe8249ff,
line_info_2: background: 0xffba17ff,
line_info_3: background: 0xcefd69ff,
line_info_4: background: 0x99503dff,
line_info_5: background: 0xfe8249ff,
line_info_6: background: 0xcefd69ff,
line_info_7: background: 0x99503dff,
}
debug_state:
{
thread_0: 0xffcb7fff,
thread_1: 0xb2ff65ff,
thread_2: 0xff99e5ff,
thread_3: 0x6598ffff,
thread_4: 0x65ffcbff,
thread_5: 0xff9819ff,
thread_6: 0x9932ffff,
thread_7: 0x65ff4cff,
thread_unwound: 0xb2ccd8ff,
thread_error: 0xb23219ff,
breakpoint: 0xa72911ff,
background: 0xffffff05,
border: 0xffffff0f,
}
}
```
+249 -265
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -999,7 +999,7 @@ internal RD_KeyMapNodePtrList rd_key_map_node_ptr_list_from_name(Arena *arena, S
internal RD_KeyMapNodePtrList rd_key_map_node_ptr_list_from_binding(Arena *arena, RD_Binding binding);
internal Vec4F32 rd_hsva_from_cfg(RD_Cfg *cfg);
internal Vec4F32 rd_rgba_from_cfg(RD_Cfg *cfg);
internal Vec4F32 rd_color_from_cfg(RD_Cfg *cfg);
internal B32 rd_disabled_from_cfg(RD_Cfg *cfg);
internal RD_Location rd_location_from_cfg(RD_Cfg *cfg);
@@ -1026,7 +1026,7 @@ internal E_Expr *rd_tag_from_cfg(Arena *arena, RD_Cfg *cfg);
////////////////////////////////
//~ rjf: Control Entity Info Extraction
internal Vec4F32 rd_rgba_from_ctrl_entity(CTRL_Entity *entity);
internal Vec4F32 rd_color_from_ctrl_entity(CTRL_Entity *entity);
internal String8 rd_name_from_ctrl_entity(Arena *arena, CTRL_Entity *entity);
internal DR_FStrList rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_extras);
@@ -1164,7 +1164,7 @@ internal String8 rd_push_search_string(Arena *arena);
//~ rjf: Colors, Fonts, Config
//- rjf: colors
internal Vec4F32 rd_color_from_tags(String8Array tags);
internal Vec4F32 rd_color_from_tags(String8Array tags, String8 name);
internal Vec4F32 rd_rgba_from_theme_color(RD_ThemeColor color);
internal RD_ThemeColor rd_theme_color_from_txt_token_kind(TXT_TokenKind kind);
internal RD_ThemeColor rd_theme_color_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string);
+22 -24
View File
@@ -2750,11 +2750,13 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
{
if(row_is_fresh)
{
row_flags |= UI_BoxFlag_DrawPop;
ui_set_next_tag(str8_lit("pop"));
row_flags |= UI_BoxFlag_DrawBackground;
}
if(global_row_idx & 1)
else if(global_row_idx & 1)
{
row_flags |= UI_BoxFlag_DrawAlt;
ui_set_next_tag(str8_lit("alt"));
row_flags |= UI_BoxFlag_DrawBackground;
}
if(!row_matches_last_row_topology)
{
@@ -2852,7 +2854,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
rd_state->hover_regs_slot == RD_RegSlot_Cfg)
{
RD_Cfg *cfg = cell_info.cfg;
Vec4F32 rgba = linear_from_srgba(rd_rgba_from_cfg(cfg));
Vec4F32 rgba = linear_from_srgba(rd_color_from_cfg(cfg));
if(rgba.w == 0)
{
rgba = ui_top_palette()->background_pop;
@@ -2866,7 +2868,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
rd_state->hover_regs_slot == RD_RegSlot_CtrlEntity)
{
CTRL_Entity *entity = cell_info.entity;
Vec4F32 rgba = linear_from_srgba(rd_rgba_from_ctrl_entity(entity));
Vec4F32 rgba = rd_color_from_ctrl_entity(entity);
if(rgba.w == 0)
{
rgba = ui_top_palette()->background_pop;;
@@ -2894,7 +2896,6 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
UI_FocusHot(cell_selected ? UI_FocusKind_On : UI_FocusKind_Off)
UI_FocusActive((cell_selected && ewv->text_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
RD_Font(RD_FontSlot_Code)
UI_FlagsAdd(row_depth > 0 ? UI_BoxFlag_DrawTextWeak : 0)
{
// rjf: cell has errors? -> build error box
if(cell_info.flags & RD_WatchCellFlag_IsErrored) RD_Font(RD_FontSlot_Main)
@@ -2960,7 +2961,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
{
RD_Font(RD_FontSlot_Icons)
UI_Flags(UI_BoxFlag_DisableTextTrunc)
UI_Palette(ui_build_palette(ui_top_palette(), .text = rd_rgba_from_ctrl_entity(row_info->callstack_thread)))
UI_Palette(ui_build_palette(ui_top_palette(), .text = rd_color_from_ctrl_entity(row_info->callstack_thread)))
ui_label(rd_icon_kind_text_table[RD_IconKind_RightArrow]);
}
}
@@ -3181,16 +3182,16 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, parse.exprs.last);
E_OpList oplist = e_oplist_from_irtree(scratch.arena, irtree.root);
String8 bytecode = e_bytecode_from_oplist(scratch.arena, &oplist);
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Text:");
ui_labelf("Text:");
ui_label(string);
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Tokens:");
ui_labelf("Tokens:");
for(U64 idx = 0; idx < tokens.count; idx += 1)
{
ui_labelf("%S: '%S'", e_token_kind_strings[tokens.v[idx].kind], str8_substr(string, tokens.v[idx].range));
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Expression:");
ui_labelf("Expression:");
{
typedef struct Task Task;
struct Task
@@ -3243,7 +3244,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
}
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("IR Tree:");
ui_labelf("IR Tree:");
{
typedef struct Task Task;
struct Task
@@ -3280,7 +3281,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
}
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Op List:");
ui_labelf("Op List:");
{
for(E_Op *op = oplist.first; op != 0; op = op->next)
{
@@ -3307,7 +3308,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
}
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Bytecode:");
ui_labelf("Bytecode:");
{
for(U64 idx = 0; idx < bytecode.size; idx += 1)
{
@@ -3526,7 +3527,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
UI_Row
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_text_dim(10, 1))
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_TagF("weak")
{
if(file_is_out_of_date)
{
@@ -3773,7 +3774,7 @@ RD_VIEW_UI_FUNCTION_DEF(disasm)
UI_Row
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_text_dim(10, 1))
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_TagF("weak")
RD_Font(RD_FontSlot_Code)
{
U64 cursor_vaddr = (1 <= rd_regs()->cursor.line && rd_regs()->cursor.line <= dasm_info.lines.count) ? (range.min+dasm_info.lines.v[rd_regs()->cursor.line-1].code_off) : 0;
@@ -4141,7 +4142,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
annotation->name_string = thread->string.size ? thread->string : push_str8f(scratch.arena, "TID: %I64u", thread->id);
annotation->kind_string = str8_lit("Stack");
annotation->color = rd_rgba_from_ctrl_entity(thread);
annotation->color = rd_color_from_ctrl_entity(thread);
annotation->vaddr_range = stack_vaddr_range;
for(U64 vaddr = stack_vaddr_range_in_viz.min; vaddr < stack_vaddr_range_in_viz.max; vaddr += 1)
{
@@ -4220,7 +4221,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
UI_Parent(header_box)
RD_Font(RD_FontSlot_Code)
UI_FontSize(font_size)
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_TagF("weak")
{
UI_PrefWidth(ui_px(big_glyph_advance*20.f, 1.f)) ui_labelf("Address");
UI_PrefWidth(ui_px(cell_width_px, 1.f))
@@ -4229,10 +4230,6 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
Rng1U64 col_selection_rng = r1u64(cursor%num_columns, mark%num_columns);
for(U64 row_off = 0; row_off < num_columns*bytes_per_cell; row_off += bytes_per_cell)
{
if(!(col_selection_rng.min <= row_off && row_off <= col_selection_rng.max))
{
ui_set_next_flags(UI_BoxFlag_DrawTextWeak);
}
ui_labelf("%I64X", row_off);
}
}
@@ -4401,7 +4398,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
{
if(!(selection.max >= row_range_bytes.min && selection.min < row_range_bytes.max))
{
ui_set_next_flags(UI_BoxFlag_DrawTextWeak);
ui_set_next_tag(str8_lit("weak"));
}
ui_labelf("0x%016I64X", row_range_bytes.min);
}
@@ -4573,7 +4570,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
footer_box = ui_build_box_from_stringf(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawDropShadow, "footer");
UI_Parent(footer_box) RD_Font(RD_FontSlot_Code) UI_FontSize(font_size)
{
UI_PrefWidth(ui_em(7.5f, 1.f)) UI_HeightFill UI_Column UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_PrefWidth(ui_em(7.5f, 1.f)) UI_HeightFill UI_Column UI_TagF("weak")
UI_PrefHeight(ui_px(row_height_px, 0.f))
{
ui_labelf("Address:");
@@ -5049,7 +5046,8 @@ RD_VIEW_UI_FUNCTION_DEF(color_rgba)
{
UI_Signal h_sig = ui_hue_pickerf(&hsva.x, hsva.y, hsva.z, "hue_picker");
}
UI_PrefWidth(ui_children_sum(1)) UI_Column UI_PrefWidth(ui_text_dim(10, 1)) UI_PrefHeight(ui_em(2.f, 0.f)) RD_Font(RD_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_PrefWidth(ui_children_sum(1)) UI_Column UI_PrefWidth(ui_text_dim(10, 1)) UI_PrefHeight(ui_em(2.f, 0.f)) RD_Font(RD_FontSlot_Code)
UI_TagF("weak")
{
ui_labelf("Hex");
ui_labelf("R");
+27 -24
View File
@@ -292,7 +292,7 @@ rd_cmd_spec_button(String8 name)
RD_Font(RD_FontSlot_Icons)
UI_PrefWidth(ui_em(2.f, 1.f))
UI_TextAlignment(UI_TextAlign_Center)
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_TagF("weak")
{
ui_label(rd_icon_kind_text_table[canonical_icon]);
}
@@ -308,7 +308,7 @@ rd_cmd_spec_button(String8 name)
UI_PrefWidth(ui_children_sum(1))
UI_FontSize(ui_top_font_size()*0.95f) UI_HeightFill
UI_NamedRow(str8_lit("###bindings"))
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_TagF("weak")
UI_FastpathCodepoint(0)
{
rd_cmd_binding_buttons(name);
@@ -365,7 +365,8 @@ rd_icon_button(RD_IconKind kind, FuzzyMatchRangeList *matches, String8 string)
RD_Font(RD_FontSlot_Icons)
UI_PrefWidth(ui_em(2.f, 1.f))
UI_PrefHeight(ui_pct(1, 0))
UI_FlagsAdd(UI_BoxFlag_DisableTextTrunc|UI_BoxFlag_DrawTextWeak)
UI_FlagsAdd(UI_BoxFlag_DisableTextTrunc)
UI_TagF("weak")
ui_label(rd_icon_kind_text_table[kind]);
if(display_string.size != 0)
{
@@ -481,12 +482,14 @@ internal UI_BOX_CUSTOM_DRAW(rd_thread_box_draw_extensions)
if(u->is_frozen)
{
F32 lock_icon_off = ui_top_font_size()*0.2f;
Vec4F32 lock_icon_color = ui_top_palette()->background_bad;
String8 tags[] = {str8_lit("bad")};
String8Array tags_array = {tags, ArrayCount(tags)};
Vec4F32 color = rd_color_from_tags(tags_array, str8_lit("text"));
dr_text(rd_font_from_slot(RD_FontSlot_Icons),
box->font_size, 0, 0, FNT_RasterFlag_Smooth,
v2f32((box->rect.x0 + box->rect.x1)/2 + lock_icon_off/2,
box->rect.y0 + lock_icon_off/2),
lock_icon_color,
color,
rd_icon_kind_text_table[RD_IconKind_Locked]);
}
}
@@ -590,10 +593,10 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
B32 ctrlified = (os_get_modifiers() & OS_Modifier_Ctrl);
Vec4F32 code_line_bgs[] =
{
rd_rgba_from_theme_color(RD_ThemeColor_LineInfoBackground0),
rd_rgba_from_theme_color(RD_ThemeColor_LineInfoBackground1),
rd_rgba_from_theme_color(RD_ThemeColor_LineInfoBackground2),
rd_rgba_from_theme_color(RD_ThemeColor_LineInfoBackground3),
rd_color_from_tags(str8_array_zero(), str8_lit("line_info_0")),
rd_color_from_tags(str8_array_zero(), str8_lit("line_info_1")),
rd_color_from_tags(str8_array_zero(), str8_lit("line_info_2")),
rd_color_from_tags(str8_array_zero(), str8_lit("line_info_3")),
};
F32 line_num_padding_px = ui_top_font_size()*1.f;
F32 entity_alive_t_rate = (1 - pow_f32(2, (-30.f * rd_state->frame_dt)));
@@ -671,7 +674,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
CTRL_EntityList line_ips = params->line_ips[line_idx];
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable*!!(params->flags & RD_CodeSliceFlag_Clickable)|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable*!!(params->flags & RD_CodeSliceFlag_Clickable)|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);
UI_Parent(line_margin_box)
{
//- rjf: build margin thread ip ui
@@ -691,7 +694,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
// rjf: thread info => color
Vec4F32 color = linear_from_srgba(rd_rgba_from_ctrl_entity(thread));
Vec4F32 color = rd_color_from_ctrl_entity(thread);
{
if(color.w == 0)
{
@@ -801,6 +804,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
//
UI_Box *catchall_margin_container_box = &ui_nil_box;
if(params->flags & RD_CodeSliceFlag_CatchallMargin) UI_Focus(UI_FocusKind_Off) UI_Parent(top_container_box) ProfScope("build catchall margins")
UI_TagF("implicit")
{
if(params->margin_float_off_px != 0)
{
@@ -844,7 +848,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
// rjf: thread info => color
Vec4F32 color = linear_from_srgba(rd_rgba_from_ctrl_entity(thread));
Vec4F32 color = rd_color_from_ctrl_entity(thread);
{
if(color.w == 0)
{
@@ -952,7 +956,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
for(RD_CfgNode *n = line_bps.first; n != 0; n = n->next)
{
RD_Cfg *bp = n->v;
Vec4F32 bp_rgba = rd_rgba_from_cfg(bp);
Vec4F32 bp_rgba = rd_color_from_cfg(bp);
if(bp_rgba.w == 0)
{
bp_rgba = rd_rgba_from_theme_color(RD_ThemeColor_Breakpoint);
@@ -1045,7 +1049,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
for(RD_CfgNode *n = line_pins.first; n != 0; n = n->next)
{
RD_Cfg *pin = n->v;
Vec4F32 color = rd_rgba_from_cfg(pin);
Vec4F32 color = rd_color_from_cfg(pin);
if(color.w == 0)
{
color = rd_rgba_from_theme_color(RD_ThemeColor_CodeDefault);
@@ -1115,6 +1119,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
//- rjf: build line numbers
//
if(params->flags & RD_CodeSliceFlag_LineNums) UI_Parent(top_container_box) ProfScope("build line numbers") UI_Focus(UI_FocusKind_Off)
UI_TagF("implicit")
{
TxtRng select_rng = txt_rng(*cursor, *mark);
Vec4F32 active_color = rd_rgba_from_theme_color(RD_ThemeColor_CodeLineNumbersSelected);
@@ -1173,7 +1178,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
//- rjf: build background for line numbers & margins
//
{
UI_Parent(top_container_box)
UI_Parent(top_container_box) UI_TagF("floating")
{
ui_set_next_pref_width(ui_px(params->priority_margin_width_px + params->catchall_margin_width_px + params->line_num_width_px, 1));
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
@@ -1293,7 +1298,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
UI_BoxFlag_DrawBorder, pin_box_key);
UI_Parent(pin_box) UI_PrefWidth(ui_text_dim(10, 1))
{
Vec4F32 pin_color = rd_rgba_from_cfg(pin);
Vec4F32 pin_color = rd_color_from_cfg(pin);
if(pin_color.w == 0)
{
pin_color = rd_rgba_from_theme_color(RD_ThemeColor_CodeDefault);
@@ -1485,7 +1490,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
line_drag_drop = 1;
line_drag_cfg = cfg;
line_drag_drop_color = linear_from_srgba(rd_rgba_from_cfg(cfg));
line_drag_drop_color = linear_from_srgba(rd_color_from_cfg(cfg));
if(line_drag_drop_color.w == 0)
{
line_drag_drop_color = ui_top_palette()->background_pop;
@@ -1495,7 +1500,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
line_drag_drop = 1;
line_drag_ctrl_entity = thread;
line_drag_drop_color = linear_from_srgba(rd_rgba_from_ctrl_entity(thread));
line_drag_drop_color = rd_color_from_ctrl_entity(thread);
if(line_drag_drop_color.w == 0)
{
line_drag_drop_color = ui_top_palette()->background_pop;
@@ -2215,8 +2220,7 @@ rd_error_label(String8 string)
ui_set_next_font(rd_font_from_slot(RD_FontSlot_Icons));
ui_set_next_text_raster_flags(FNT_RasterFlag_Smooth);
ui_set_next_text_alignment(UI_TextAlign_Center);
ui_set_next_flags(UI_BoxFlag_DrawTextWeak);
UI_PrefWidth(ui_em(2.25f, 1.f)) ui_label(rd_icon_kind_text_table[RD_IconKind_WarningBig]);
UI_TagF("weak") UI_PrefWidth(ui_em(2.25f, 1.f)) ui_label(rd_icon_kind_text_table[RD_IconKind_WarningBig]);
UI_PrefWidth(ui_text_dim(10, 0)) rd_label(string);
}
return sig;
@@ -2500,7 +2504,7 @@ rd_line_edit(RD_LineEditParams *params, String8 string)
//- rjf: build expander placeholder
else if(params->flags & RD_LineEditFlag_ExpanderPlaceholder) UI_Parent(box) UI_PrefWidth(ui_px(expander_size_px, 1.f)) UI_Focus(UI_FocusKind_Off)
{
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
UI_TagF("weak")
UI_Flags(UI_BoxFlag_DrawSideLeft)
RD_Font(RD_FontSlot_Icons)
UI_TextAlignment(UI_TextAlign_Center)
@@ -2696,9 +2700,8 @@ rd_line_edit(RD_LineEditParams *params, String8 string)
ui_box_equip_fuzzy_match_ranges(box, params->fuzzy_matches);
}
}
else
else UI_TagF("weak")
{
ui_set_next_flags(UI_BoxFlag_DrawTextWeak);
UI_Box *box = ui_label(display_string).box;
if(params->fuzzy_matches != 0)
{
@@ -2715,7 +2718,7 @@ rd_line_edit(RD_LineEditParams *params, String8 string)
}
else
{
ui_set_next_flags(UI_BoxFlag_DrawTextWeak);
ui_set_next_tag(str8_lit("weak"));
}
UI_Box *box = ui_label(display_string).box;
if(params->fuzzy_matches != 0)
+6 -5
View File
@@ -14,6 +14,7 @@
#define UI_PrefHeight(v) DeferLoop(ui_push_pref_height(v), ui_pop_pref_height())
#define UI_PermissionFlags(v) DeferLoop(ui_push_permission_flags(v), ui_pop_permission_flags())
#define UI_Flags(v) DeferLoop(ui_push_flags(v), ui_pop_flags())
#define UI_OmitFlags(v) DeferLoop(ui_push_omit_flags(v), ui_pop_omit_flags())
#define UI_FocusHot(v) DeferLoop(ui_push_focus_hot(v), ui_pop_focus_hot())
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
@@ -45,13 +46,13 @@ internal UI_Size ui_top_pref_width(void) { UI_StackTopImpl(ui_state, PrefWidth,
internal UI_Size ui_top_pref_height(void) { UI_StackTopImpl(ui_state, PrefHeight, pref_height) }
internal UI_PermissionFlags ui_top_permission_flags(void) { UI_StackTopImpl(ui_state, PermissionFlags, permission_flags) }
internal UI_BoxFlags ui_top_flags(void) { UI_StackTopImpl(ui_state, Flags, flags) }
internal UI_BoxFlags ui_top_omit_flags(void) { UI_StackTopImpl(ui_state, OmitFlags, omit_flags) }
internal UI_FocusKind ui_top_focus_hot(void) { UI_StackTopImpl(ui_state, FocusHot, focus_hot) }
internal UI_FocusKind ui_top_focus_active(void) { UI_StackTopImpl(ui_state, FocusActive, focus_active) }
internal U32 ui_top_fastpath_codepoint(void) { UI_StackTopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
internal UI_Key ui_top_group_key(void) { UI_StackTopImpl(ui_state, GroupKey, group_key) }
internal F32 ui_top_transparency(void) { UI_StackTopImpl(ui_state, Transparency, transparency) }
internal UI_Palette* ui_top_palette(void) { UI_StackTopImpl(ui_state, Palette, palette) }
internal String8 ui_top_tag(void) { UI_StackTopImpl(ui_state, Tag, tag) }
internal F32 ui_top_squish(void) { UI_StackTopImpl(ui_state, Squish, squish) }
internal OS_Cursor ui_top_hover_cursor(void) { UI_StackTopImpl(ui_state, HoverCursor, hover_cursor) }
internal FNT_Tag ui_top_font(void) { UI_StackTopImpl(ui_state, Font, font) }
@@ -75,13 +76,13 @@ internal UI_Size ui_bottom_pref_width(void) { UI_StackBottomImpl(ui_state, PrefW
internal UI_Size ui_bottom_pref_height(void) { UI_StackBottomImpl(ui_state, PrefHeight, pref_height) }
internal UI_PermissionFlags ui_bottom_permission_flags(void) { UI_StackBottomImpl(ui_state, PermissionFlags, permission_flags) }
internal UI_BoxFlags ui_bottom_flags(void) { UI_StackBottomImpl(ui_state, Flags, flags) }
internal UI_BoxFlags ui_bottom_omit_flags(void) { UI_StackBottomImpl(ui_state, OmitFlags, omit_flags) }
internal UI_FocusKind ui_bottom_focus_hot(void) { UI_StackBottomImpl(ui_state, FocusHot, focus_hot) }
internal UI_FocusKind ui_bottom_focus_active(void) { UI_StackBottomImpl(ui_state, FocusActive, focus_active) }
internal U32 ui_bottom_fastpath_codepoint(void) { UI_StackBottomImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
internal UI_Key ui_bottom_group_key(void) { UI_StackBottomImpl(ui_state, GroupKey, group_key) }
internal F32 ui_bottom_transparency(void) { UI_StackBottomImpl(ui_state, Transparency, transparency) }
internal UI_Palette* ui_bottom_palette(void) { UI_StackBottomImpl(ui_state, Palette, palette) }
internal String8 ui_bottom_tag(void) { UI_StackBottomImpl(ui_state, Tag, tag) }
internal F32 ui_bottom_squish(void) { UI_StackBottomImpl(ui_state, Squish, squish) }
internal OS_Cursor ui_bottom_hover_cursor(void) { UI_StackBottomImpl(ui_state, HoverCursor, hover_cursor) }
internal FNT_Tag ui_bottom_font(void) { UI_StackBottomImpl(ui_state, Font, font) }
@@ -105,13 +106,13 @@ internal UI_Size ui_push_pref_width(UI_Size v) { UI_StackPushImpl(ui_state, Pref
internal UI_Size ui_push_pref_height(UI_Size v) { UI_StackPushImpl(ui_state, PrefHeight, pref_height, UI_Size, v) }
internal UI_PermissionFlags ui_push_permission_flags(UI_PermissionFlags v) { UI_StackPushImpl(ui_state, PermissionFlags, permission_flags, UI_PermissionFlags, v) }
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v) { UI_StackPushImpl(ui_state, Flags, flags, UI_BoxFlags, v) }
internal UI_BoxFlags ui_push_omit_flags(UI_BoxFlags v) { UI_StackPushImpl(ui_state, OmitFlags, omit_flags, UI_BoxFlags, v) }
internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v) { UI_StackPushImpl(ui_state, FocusHot, focus_hot, UI_FocusKind, v) }
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v) { UI_StackPushImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
internal U32 ui_push_fastpath_codepoint(U32 v) { UI_StackPushImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
internal UI_Key ui_push_group_key(UI_Key v) { UI_StackPushImpl(ui_state, GroupKey, group_key, UI_Key, v) }
internal F32 ui_push_transparency(F32 v) { UI_StackPushImpl(ui_state, Transparency, transparency, F32, v) }
internal UI_Palette* ui_push_palette(UI_Palette* v) { UI_StackPushImpl(ui_state, Palette, palette, UI_Palette* , v) }
internal String8 ui_push_tag(String8 v) { UI_StackPushImpl(ui_state, Tag, tag, String8, v) }
internal F32 ui_push_squish(F32 v) { UI_StackPushImpl(ui_state, Squish, squish, F32, v) }
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v) { UI_StackPushImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
internal FNT_Tag ui_push_font(FNT_Tag v) { UI_StackPushImpl(ui_state, Font, font, FNT_Tag, v) }
@@ -135,13 +136,13 @@ internal UI_Size ui_pop_pref_width(void) { UI_StackPopImpl(ui_state, PrefWidth,
internal UI_Size ui_pop_pref_height(void) { UI_StackPopImpl(ui_state, PrefHeight, pref_height) }
internal UI_PermissionFlags ui_pop_permission_flags(void) { UI_StackPopImpl(ui_state, PermissionFlags, permission_flags) }
internal UI_BoxFlags ui_pop_flags(void) { UI_StackPopImpl(ui_state, Flags, flags) }
internal UI_BoxFlags ui_pop_omit_flags(void) { UI_StackPopImpl(ui_state, OmitFlags, omit_flags) }
internal UI_FocusKind ui_pop_focus_hot(void) { UI_StackPopImpl(ui_state, FocusHot, focus_hot) }
internal UI_FocusKind ui_pop_focus_active(void) { UI_StackPopImpl(ui_state, FocusActive, focus_active) }
internal U32 ui_pop_fastpath_codepoint(void) { UI_StackPopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
internal UI_Key ui_pop_group_key(void) { UI_StackPopImpl(ui_state, GroupKey, group_key) }
internal F32 ui_pop_transparency(void) { UI_StackPopImpl(ui_state, Transparency, transparency) }
internal UI_Palette* ui_pop_palette(void) { UI_StackPopImpl(ui_state, Palette, palette) }
internal String8 ui_pop_tag(void) { UI_StackPopImpl(ui_state, Tag, tag) }
internal F32 ui_pop_squish(void) { UI_StackPopImpl(ui_state, Squish, squish) }
internal OS_Cursor ui_pop_hover_cursor(void) { UI_StackPopImpl(ui_state, HoverCursor, hover_cursor) }
internal FNT_Tag ui_pop_font(void) { UI_StackPopImpl(ui_state, Font, font) }
@@ -165,13 +166,13 @@ internal UI_Size ui_set_next_pref_width(UI_Size v) { UI_StackSetNextImpl(ui_stat
internal UI_Size ui_set_next_pref_height(UI_Size v) { UI_StackSetNextImpl(ui_state, PrefHeight, pref_height, UI_Size, v) }
internal UI_PermissionFlags ui_set_next_permission_flags(UI_PermissionFlags v) { UI_StackSetNextImpl(ui_state, PermissionFlags, permission_flags, UI_PermissionFlags, v) }
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v) { UI_StackSetNextImpl(ui_state, Flags, flags, UI_BoxFlags, v) }
internal UI_BoxFlags ui_set_next_omit_flags(UI_BoxFlags v) { UI_StackSetNextImpl(ui_state, OmitFlags, omit_flags, UI_BoxFlags, v) }
internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v) { UI_StackSetNextImpl(ui_state, FocusHot, focus_hot, UI_FocusKind, v) }
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v) { UI_StackSetNextImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
internal U32 ui_set_next_fastpath_codepoint(U32 v) { UI_StackSetNextImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
internal UI_Key ui_set_next_group_key(UI_Key v) { UI_StackSetNextImpl(ui_state, GroupKey, group_key, UI_Key, v) }
internal F32 ui_set_next_transparency(F32 v) { UI_StackSetNextImpl(ui_state, Transparency, transparency, F32, v) }
internal UI_Palette* ui_set_next_palette(UI_Palette* v) { UI_StackSetNextImpl(ui_state, Palette, palette, UI_Palette* , v) }
internal String8 ui_set_next_tag(String8 v) { UI_StackSetNextImpl(ui_state, Tag, tag, String8, v) }
internal F32 ui_set_next_squish(F32 v) { UI_StackSetNextImpl(ui_state, Squish, squish, F32, v) }
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v) { UI_StackSetNextImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
internal FNT_Tag ui_set_next_font(FNT_Tag v) { UI_StackSetNextImpl(ui_state, Font, font, FNT_Tag, v) }
+11
View File
@@ -16,6 +16,7 @@ typedef struct UI_PrefWidthNode UI_PrefWidthNode; struct UI_PrefWidthNode{UI_Pre
typedef struct UI_PrefHeightNode UI_PrefHeightNode; struct UI_PrefHeightNode{UI_PrefHeightNode *next; UI_Size v;};
typedef struct UI_PermissionFlagsNode UI_PermissionFlagsNode; struct UI_PermissionFlagsNode{UI_PermissionFlagsNode *next; UI_PermissionFlags v;};
typedef struct UI_FlagsNode UI_FlagsNode; struct UI_FlagsNode{UI_FlagsNode *next; UI_BoxFlags v;};
typedef struct UI_OmitFlagsNode UI_OmitFlagsNode; struct UI_OmitFlagsNode{UI_OmitFlagsNode *next; UI_BoxFlags v;};
typedef struct UI_FocusHotNode UI_FocusHotNode; struct UI_FocusHotNode{UI_FocusHotNode *next; UI_FocusKind v;};
typedef struct UI_FocusActiveNode UI_FocusActiveNode; struct UI_FocusActiveNode{UI_FocusActiveNode *next; UI_FocusKind v;};
typedef struct UI_FastpathCodepointNode UI_FastpathCodepointNode; struct UI_FastpathCodepointNode{UI_FastpathCodepointNode *next; U32 v;};
@@ -49,6 +50,7 @@ UI_PrefWidthNode pref_width_nil_stack_top;\
UI_PrefHeightNode pref_height_nil_stack_top;\
UI_PermissionFlagsNode permission_flags_nil_stack_top;\
UI_FlagsNode flags_nil_stack_top;\
UI_OmitFlagsNode omit_flags_nil_stack_top;\
UI_FocusHotNode focus_hot_nil_stack_top;\
UI_FocusActiveNode focus_active_nil_stack_top;\
UI_FastpathCodepointNode fastpath_codepoint_nil_stack_top;\
@@ -81,6 +83,7 @@ state->pref_width_nil_stack_top.v = ui_px(250.f, 1.f);\
state->pref_height_nil_stack_top.v = ui_px(30.f, 1.f);\
state->permission_flags_nil_stack_top.v = UI_PermissionFlag_All;\
state->flags_nil_stack_top.v = 0;\
state->omit_flags_nil_stack_top.v = 0;\
state->focus_hot_nil_stack_top.v = UI_FocusKind_Null;\
state->focus_active_nil_stack_top.v = UI_FocusKind_Null;\
state->fastpath_codepoint_nil_stack_top.v = 0;\
@@ -115,6 +118,7 @@ struct { UI_PrefWidthNode *top; UI_Size bottom_val; UI_PrefWidthNode *free; U64
struct { UI_PrefHeightNode *top; UI_Size bottom_val; UI_PrefHeightNode *free; U64 gen; B32 auto_pop; } pref_height_stack;\
struct { UI_PermissionFlagsNode *top; UI_PermissionFlags bottom_val; UI_PermissionFlagsNode *free; U64 gen; B32 auto_pop; } permission_flags_stack;\
struct { UI_FlagsNode *top; UI_BoxFlags bottom_val; UI_FlagsNode *free; U64 gen; B32 auto_pop; } flags_stack;\
struct { UI_OmitFlagsNode *top; UI_BoxFlags bottom_val; UI_OmitFlagsNode *free; U64 gen; B32 auto_pop; } omit_flags_stack;\
struct { UI_FocusHotNode *top; UI_FocusKind bottom_val; UI_FocusHotNode *free; U64 gen; B32 auto_pop; } focus_hot_stack;\
struct { UI_FocusActiveNode *top; UI_FocusKind bottom_val; UI_FocusActiveNode *free; U64 gen; B32 auto_pop; } focus_active_stack;\
struct { UI_FastpathCodepointNode *top; U32 bottom_val; UI_FastpathCodepointNode *free; U64 gen; B32 auto_pop; } fastpath_codepoint_stack;\
@@ -147,6 +151,7 @@ state->pref_width_stack.top = &state->pref_width_nil_stack_top; state->pref_widt
state->pref_height_stack.top = &state->pref_height_nil_stack_top; state->pref_height_stack.bottom_val = ui_px(30.f, 1.f); state->pref_height_stack.free = 0; state->pref_height_stack.auto_pop = 0;\
state->permission_flags_stack.top = &state->permission_flags_nil_stack_top; state->permission_flags_stack.bottom_val = UI_PermissionFlag_All; state->permission_flags_stack.free = 0; state->permission_flags_stack.auto_pop = 0;\
state->flags_stack.top = &state->flags_nil_stack_top; state->flags_stack.bottom_val = 0; state->flags_stack.free = 0; state->flags_stack.auto_pop = 0;\
state->omit_flags_stack.top = &state->omit_flags_nil_stack_top; state->omit_flags_stack.bottom_val = 0; state->omit_flags_stack.free = 0; state->omit_flags_stack.auto_pop = 0;\
state->focus_hot_stack.top = &state->focus_hot_nil_stack_top; state->focus_hot_stack.bottom_val = UI_FocusKind_Null; state->focus_hot_stack.free = 0; state->focus_hot_stack.auto_pop = 0;\
state->focus_active_stack.top = &state->focus_active_nil_stack_top; state->focus_active_stack.bottom_val = UI_FocusKind_Null; state->focus_active_stack.free = 0; state->focus_active_stack.auto_pop = 0;\
state->fastpath_codepoint_stack.top = &state->fastpath_codepoint_nil_stack_top; state->fastpath_codepoint_stack.bottom_val = 0; state->fastpath_codepoint_stack.free = 0; state->fastpath_codepoint_stack.auto_pop = 0;\
@@ -179,6 +184,7 @@ if(state->pref_width_stack.auto_pop) { ui_pop_pref_width(); state->pref_width_st
if(state->pref_height_stack.auto_pop) { ui_pop_pref_height(); state->pref_height_stack.auto_pop = 0; }\
if(state->permission_flags_stack.auto_pop) { ui_pop_permission_flags(); state->permission_flags_stack.auto_pop = 0; }\
if(state->flags_stack.auto_pop) { ui_pop_flags(); state->flags_stack.auto_pop = 0; }\
if(state->omit_flags_stack.auto_pop) { ui_pop_omit_flags(); state->omit_flags_stack.auto_pop = 0; }\
if(state->focus_hot_stack.auto_pop) { ui_pop_focus_hot(); state->focus_hot_stack.auto_pop = 0; }\
if(state->focus_active_stack.auto_pop) { ui_pop_focus_active(); state->focus_active_stack.auto_pop = 0; }\
if(state->fastpath_codepoint_stack.auto_pop) { ui_pop_fastpath_codepoint(); state->fastpath_codepoint_stack.auto_pop = 0; }\
@@ -210,6 +216,7 @@ internal UI_Size ui_top_pref_width(void);
internal UI_Size ui_top_pref_height(void);
internal UI_PermissionFlags ui_top_permission_flags(void);
internal UI_BoxFlags ui_top_flags(void);
internal UI_BoxFlags ui_top_omit_flags(void);
internal UI_FocusKind ui_top_focus_hot(void);
internal UI_FocusKind ui_top_focus_active(void);
internal U32 ui_top_fastpath_codepoint(void);
@@ -240,6 +247,7 @@ internal UI_Size ui_bottom_pref_width(void);
internal UI_Size ui_bottom_pref_height(void);
internal UI_PermissionFlags ui_bottom_permission_flags(void);
internal UI_BoxFlags ui_bottom_flags(void);
internal UI_BoxFlags ui_bottom_omit_flags(void);
internal UI_FocusKind ui_bottom_focus_hot(void);
internal UI_FocusKind ui_bottom_focus_active(void);
internal U32 ui_bottom_fastpath_codepoint(void);
@@ -270,6 +278,7 @@ internal UI_Size ui_push_pref_width(UI_Size v);
internal UI_Size ui_push_pref_height(UI_Size v);
internal UI_PermissionFlags ui_push_permission_flags(UI_PermissionFlags v);
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v);
internal UI_BoxFlags ui_push_omit_flags(UI_BoxFlags v);
internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v);
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v);
internal U32 ui_push_fastpath_codepoint(U32 v);
@@ -300,6 +309,7 @@ internal UI_Size ui_pop_pref_width(void);
internal UI_Size ui_pop_pref_height(void);
internal UI_PermissionFlags ui_pop_permission_flags(void);
internal UI_BoxFlags ui_pop_flags(void);
internal UI_BoxFlags ui_pop_omit_flags(void);
internal UI_FocusKind ui_pop_focus_hot(void);
internal UI_FocusKind ui_pop_focus_active(void);
internal U32 ui_pop_fastpath_codepoint(void);
@@ -330,6 +340,7 @@ internal UI_Size ui_set_next_pref_width(UI_Size v);
internal UI_Size ui_set_next_pref_height(UI_Size v);
internal UI_PermissionFlags ui_set_next_permission_flags(UI_PermissionFlags v);
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v);
internal UI_BoxFlags ui_set_next_omit_flags(UI_BoxFlags v);
internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v);
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v);
internal U32 ui_set_next_fastpath_codepoint(U32 v);
+9 -8
View File
@@ -3,11 +3,11 @@
//- rjf: stack table
@table(name, name_lower, type, default)
@table(name, name_lower, type, default, manual_impl)
UI_StackTable:
{
//- rjf: parents
{ Parent parent `UI_Box *` `&ui_nil_box` }
{ Parent parent `UI_Box *` `&ui_nil_box` }
//- rjf: layout params
{ ChildLayoutAxis child_layout_axis Axis2 `Axis2_X` }
@@ -23,6 +23,7 @@ UI_StackTable:
//- rjf: flags
{ PermissionFlags permission_flags UI_PermissionFlags UI_PermissionFlag_All }
{ Flags flags UI_BoxFlags 0 }
{ OmitFlags omit_flags UI_BoxFlags 0 }
//- rjf: interaction
{ FocusHot focus_hot UI_FocusKind UI_FocusKind_Null }
@@ -33,7 +34,7 @@ UI_StackTable:
//- rjf: colors
{ Transparency transparency F32 0 }
{ Palette palette `UI_Palette* ` `&ui_g_nil_palette` }
{ Tag tag String8 `str8_lit("")` }
{ Tag tag String8 `str8_lit("")` 1 }
//- rjf: squish
{ Squish squish F32 0 }
@@ -149,13 +150,13 @@ UI_StackTable:
@gen @c_file
{
@expand(UI_StackTable a)
`internal $(a.type) ui_top_$(a.name_lower)(void) { UI_StackTopImpl(ui_state, $(a.name), $(a.name_lower)) }`;
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_top_" .. a.name_lower .. "(void) { UI_StackTopImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ") }")`;
@expand(UI_StackTable a)
`internal $(a.type) ui_bottom_$(a.name_lower)(void) { UI_StackBottomImpl(ui_state, $(a.name), $(a.name_lower)) }`;
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_bottom_" .. a.name_lower .. "(void) { UI_StackBottomImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ") }")`;
@expand(UI_StackTable a)
`internal $(a.type) ui_push_$(a.name_lower)($(a.type) v) { UI_StackPushImpl(ui_state, $(a.name), $(a.name_lower), $(a.type), v) }`;
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_push_" .. a.name_lower .. "(" .. a.type .. " v) { UI_StackPushImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ", " .. a.type .. ", v) }")`;
@expand(UI_StackTable a)
`internal $(a.type) ui_pop_$(a.name_lower)(void) { UI_StackPopImpl(ui_state, $(a.name), $(a.name_lower)) }`;
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_pop_" .. a.name_lower .. "(void) { UI_StackPopImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ") }")`;
@expand(UI_StackTable a)
`internal $(a.type) ui_set_next_$(a.name_lower)($(a.type) v) { UI_StackSetNextImpl(ui_state, $(a.name), $(a.name_lower), $(a.type), v) }`;
`$(a.manual_impl == "" -> "internal " .. a.type .. " ui_set_next_" .. a.name_lower .. "(" .. a.type .. " v) { UI_StackSetNextImpl(ui_state, " .. a.name .. ", " .. a.name_lower .. ", " .. a.type .. ", v) }")`;
}
+76 -45
View File
@@ -1918,11 +1918,13 @@ ui_tooltip_begin_base(void)
ui_push_flags(0);
ui_push_text_raster_flags(ui_bottom_text_raster_flags());
ui_push_palette(ui_bottom_palette());
ui_push_tag(str8_lit("."));
}
internal void
ui_tooltip_end_base(void)
{
ui_pop_tag();
ui_pop_palette();
ui_pop_text_raster_flags();
ui_pop_flags();
@@ -2005,6 +2007,7 @@ ui_begin_ctx_menu(UI_Key key)
ui_push_focus_hot(UI_FocusKind_Root);
ui_push_focus_active(UI_FocusKind_Root);
ui_push_palette(ui_state->widget_palette_info.ctx_menu_palette);
ui_push_tag(str8_lit("."));
B32 is_open = ui_key_match(key, ui_state->ctx_menu_key) && ui_state->ctx_menu_open;
if(is_open != 0)
{
@@ -2033,6 +2036,7 @@ ui_end_ctx_menu(void)
ui_state->is_in_open_ctx_menu = 0;
ui_spacer(ui_em(1.f, 1.f));
}
ui_pop_tag();
ui_pop_palette();
ui_pop_focus_active();
ui_pop_focus_hot();
@@ -2262,7 +2266,7 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
//- rjf: fill box
{
box->key = key;
box->flags = flags|ui_state->flags_stack.top->v;
box->flags = (flags | ui_state->flags_stack.top->v) & ~ui_state->omit_flags_stack.top->v;
box->fastpath_codepoint = ui_state->fastpath_codepoint_stack.top->v;
box->group_key = ui_state->group_key_stack.top->v;
@@ -2357,7 +2361,14 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
String8List tags = {0};
for(UI_TagNode *n = ui_state->tag_stack.top; n != 0; n = n->next)
{
str8_list_push(ui_build_arena(), &tags, push_str8_copy(ui_build_arena(), n->v));
if(n->v.size == 1 && n->v.str[0] == '.')
{
break;
}
if(n->v.size != 0)
{
str8_list_push(ui_build_arena(), &tags, push_str8_copy(ui_build_arena(), n->v));
}
}
ui_state->current_gen_tags = str8_array_from_list(ui_build_arena(), &tags);
scratch_end(scratch);
@@ -3054,6 +3065,57 @@ ui_anim_(UI_Key key, UI_AnimParams *params)
////////////////////////////////
//~ rjf: Stacks
#define UI_StackTopImpl(state, name_upper, name_lower) \
return state->name_lower##_stack.top->v;
#define UI_StackBottomImpl(state, name_upper, name_lower) \
return state->name_lower##_stack.bottom_val;
#define UI_StackPushImpl(state, name_upper, name_lower, type, new_value) \
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
type old_value = state->name_lower##_stack.top->v;\
node->v = new_value;\
SLLStackPush(state->name_lower##_stack.top, node);\
if(node->next == &state->name_lower##_nil_stack_top)\
{\
state->name_lower##_stack.bottom_val = (new_value);\
}\
state->name_lower##_stack.auto_pop = 0;\
state->name_lower##_stack.gen += 1;\
return old_value;
#define UI_StackPopImpl(state, name_upper, name_lower) \
UI_##name_upper##Node *popped = state->name_lower##_stack.top;\
if(popped != &state->name_lower##_nil_stack_top)\
{\
SLLStackPop(state->name_lower##_stack.top);\
SLLStackPush(state->name_lower##_stack.free, popped);\
state->name_lower##_stack.auto_pop = 0;\
state->name_lower##_stack.gen += 1;\
}\
return popped->v;\
#define UI_StackSetNextImpl(state, name_upper, name_lower, type, new_value) \
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
type old_value = state->name_lower##_stack.top->v;\
node->v = new_value;\
SLLStackPush(state->name_lower##_stack.top, node);\
state->name_lower##_stack.auto_pop = 1;\
state->name_lower##_stack.gen += 1;\
return old_value;
//- rjf: manual implementations
internal String8 ui_top_tag(void) { UI_StackTopImpl(ui_state, Tag, tag) }
internal String8 ui_bottom_tag(void) { UI_StackBottomImpl(ui_state, Tag, tag) }
internal String8 ui_push_tag(String8 v) { UI_StackPushImpl(ui_state, Tag, tag, String8, push_str8_copy(ui_build_arena(), v)) }
internal String8 ui_pop_tag(void) { UI_StackPopImpl(ui_state, Tag, tag) }
internal String8 ui_set_next_tag(String8 v) { UI_StackSetNextImpl(ui_state, Tag, tag, String8, push_str8_copy(ui_build_arena(), v)) }
//- rjf: helpers
internal Rng2F32
@@ -3139,50 +3201,19 @@ ui_pop_corner_radius(void)
ui_pop_corner_radius_11();
}
internal void
ui_push_tagf(char *fmt, ...)
{
Temp scratch = scratch_begin(0, 0);
va_list args;
va_start(args, fmt);
String8 string = push_str8fv(scratch.arena, fmt, args);
ui_push_tag(string);
va_end(args);
scratch_end(scratch);
}
////////////////////////////////
//~ rjf: Generated Code
#define UI_StackTopImpl(state, name_upper, name_lower) \
return state->name_lower##_stack.top->v;
#define UI_StackBottomImpl(state, name_upper, name_lower) \
return state->name_lower##_stack.bottom_val;
#define UI_StackPushImpl(state, name_upper, name_lower, type, new_value) \
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
type old_value = state->name_lower##_stack.top->v;\
node->v = new_value;\
SLLStackPush(state->name_lower##_stack.top, node);\
if(node->next == &state->name_lower##_nil_stack_top)\
{\
state->name_lower##_stack.bottom_val = (new_value);\
}\
state->name_lower##_stack.auto_pop = 0;\
state->name_lower##_stack.gen += 1;\
return old_value;
#define UI_StackPopImpl(state, name_upper, name_lower) \
UI_##name_upper##Node *popped = state->name_lower##_stack.top;\
if(popped != &state->name_lower##_nil_stack_top)\
{\
SLLStackPop(state->name_lower##_stack.top);\
SLLStackPush(state->name_lower##_stack.free, popped);\
state->name_lower##_stack.auto_pop = 0;\
state->name_lower##_stack.gen += 1;\
}\
return popped->v;\
#define UI_StackSetNextImpl(state, name_upper, name_lower, type, new_value) \
UI_##name_upper##Node *node = state->name_lower##_stack.free;\
if(node != 0) {SLLStackPop(state->name_lower##_stack.free);}\
else {node = push_array(ui_build_arena(), UI_##name_upper##Node, 1);}\
type old_value = state->name_lower##_stack.top->v;\
node->v = new_value;\
SLLStackPush(state->name_lower##_stack.top, node);\
state->name_lower##_stack.auto_pop = 1;\
state->name_lower##_stack.gen += 1;\
return old_value;
#include "generated/ui.meta.c"
+9
View File
@@ -948,6 +948,7 @@ internal U32 ui_top_fastpath_codepoint(void);
internal UI_Key ui_top_group_key(void);
internal F32 ui_top_transparency(void);
internal UI_Palette* ui_top_palette(void);
internal String8 ui_top_tag(void);
internal F32 ui_top_squish(void);
internal OS_Cursor ui_top_hover_cursor(void);
internal FNT_Tag ui_top_font(void);
@@ -977,6 +978,7 @@ internal U32 ui_bottom_fastpath_codepoint(void);
internal UI_Key ui_bottom_group_key(void);
internal F32 ui_bottom_transparency(void);
internal UI_Palette* ui_bottom_palette(void);
internal String8 ui_bottom_tag(void);
internal F32 ui_bottom_squish(void);
internal OS_Cursor ui_bottom_hover_cursor(void);
internal FNT_Tag ui_bottom_font(void);
@@ -1006,6 +1008,7 @@ internal U32 ui_push_fastpath_codepoint(U32 v);
internal UI_Key ui_push_group_key(UI_Key v);
internal F32 ui_push_transparency(F32 v);
internal UI_Palette* ui_push_palette(UI_Palette* v);
internal String8 ui_push_tag(String8 v);
internal F32 ui_push_squish(F32 v);
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
internal FNT_Tag ui_push_font(FNT_Tag v);
@@ -1035,6 +1038,7 @@ internal U32 ui_pop_fastpath_codepoint(void);
internal UI_Key ui_pop_group_key(void);
internal F32 ui_pop_transparency(void);
internal UI_Palette* ui_pop_palette(void);
internal String8 ui_pop_tag(void);
internal F32 ui_pop_squish(void);
internal OS_Cursor ui_pop_hover_cursor(void);
internal FNT_Tag ui_pop_font(void);
@@ -1064,6 +1068,7 @@ internal U32 ui_set_next_fastpath_codepoint(U32 v);
internal UI_Key ui_set_next_group_key(UI_Key v);
internal F32 ui_set_next_transparency(F32 v);
internal UI_Palette* ui_set_next_palette(UI_Palette* v);
internal String8 ui_set_next_tag(String8 v);
internal F32 ui_set_next_squish(F32 v);
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
internal FNT_Tag ui_set_next_font(FNT_Tag v);
@@ -1087,6 +1092,7 @@ internal UI_Size ui_pop_pref_size(Axis2 axis);
internal UI_Size ui_set_next_pref_size(Axis2 axis, UI_Size v);
internal void ui_push_corner_radius(F32 v);
internal void ui_pop_corner_radius(void);
internal void ui_push_tagf(char *fmt, ...);
////////////////////////////////
//~ rjf: Macro Loop Wrappers
@@ -1102,12 +1108,14 @@ internal void ui_pop_corner_radius(void);
#define UI_PrefHeight(v) DeferLoop(ui_push_pref_height(v), ui_pop_pref_height())
#define UI_PermissionFlags(v) DeferLoop(ui_push_permission_flags(v), ui_pop_permission_flags())
#define UI_Flags(v) DeferLoop(ui_push_flags(v), ui_pop_flags())
#define UI_OmitFlags(v) DeferLoop(ui_push_omit_flags(v), ui_pop_omit_flags())
#define UI_FocusHot(v) DeferLoop(ui_push_focus_hot(v), ui_pop_focus_hot())
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
#define UI_GroupKey(v) DeferLoop(ui_push_group_key(v), ui_pop_group_key())
#define UI_Transparency(v) DeferLoop(ui_push_transparency(v), ui_pop_transparency())
#define UI_Palette(v) DeferLoop(ui_push_palette(v), ui_pop_palette())
#define UI_Tag(v) DeferLoop(ui_push_tag(v), ui_pop_tag())
#define UI_Squish(v) DeferLoop(ui_push_squish(v), ui_pop_squish())
#define UI_HoverCursor(v) DeferLoop(ui_push_hover_cursor(v), ui_pop_hover_cursor())
#define UI_Font(v) DeferLoop(ui_push_font(v), ui_pop_font())
@@ -1132,6 +1140,7 @@ internal void ui_pop_corner_radius(void);
#define UI_CornerRadius(v) DeferLoop(ui_push_corner_radius(v), ui_pop_corner_radius())
#define UI_Focus(kind) DeferLoop((ui_push_focus_hot(kind), ui_push_focus_active(kind)), (ui_pop_focus_hot(), ui_pop_focus_active()))
#define UI_FlagsAdd(v) DeferLoop(ui_push_flags(ui_top_flags()|(v)), ui_pop_flags())
#define UI_TagF(...) DeferLoop(ui_push_tagf(__VA_ARGS__), ui_pop_tag())
//- rjf: tooltip
#define UI_TooltipBase DeferLoop(ui_tooltip_begin_base(), ui_tooltip_end_base())