mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
checkpoint on final pre-release pass over 'fancy rows' (combined line edit, toggler, slider, etc. widget), plug autocompletion in for theme selection lister
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -388,7 +388,6 @@ RD_CodeColorSlot_COUNT,
|
||||
|
||||
typedef enum RD_ThemePreset
|
||||
{
|
||||
RD_ThemePreset_None,
|
||||
RD_ThemePreset_DefaultDark,
|
||||
RD_ThemePreset_DefaultLight,
|
||||
RD_ThemePreset_VSDark,
|
||||
@@ -568,9 +567,9 @@ extern String8 rd_binding_version_remap_old_name_table[8];
|
||||
extern String8 rd_binding_version_remap_new_name_table[8];
|
||||
extern String8 rd_icon_kind_text_table[75];
|
||||
extern String8 rd_code_color_slot_name_table[14];
|
||||
extern String8 rd_theme_preset_display_string_table[11];
|
||||
extern String8 rd_theme_preset_code_string_table[11];
|
||||
extern String8 rd_theme_preset_cfg_string_table[11];
|
||||
extern String8 rd_theme_preset_display_string_table[10];
|
||||
extern String8 rd_theme_preset_code_string_table[10];
|
||||
extern String8 rd_theme_preset_cfg_string_table[10];
|
||||
read_only global U8 rd_icon_font_bytes__data[] =
|
||||
{
|
||||
0x00,0x01,0x00,0x00,0x00,0x0f,0x00,0x80,0x00,0x03,0x00,0x70,0x47,0x53,0x55,0x42,0x20,0x8b,0x25,0x7a,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x54,0x4f,0x53,0x2f,0x32,0x56,0x43,0x62,0x25,0x00,0x00,0x01,0x50,0x00,0x00,0x00,0x60,0x63,0x6d,0x61,0x70,0xa3,0x60,0xa4,0x23,0x00,0x00,0x01,0xb0,0x00,0x00,0x06,0x12,0x63,0x76,0x74,0x20,
|
||||
|
||||
@@ -237,8 +237,10 @@ RD_VocabTable:
|
||||
'code_font': string,
|
||||
|
||||
//- rjf: theme
|
||||
@display_name('User Theme') 'theme': string,
|
||||
@no_expand @display_name('User Theme') @description("The user's theme, which describes all colors used throughout the UI.")
|
||||
@default("Default (Dark)") @display_name('User Theme')
|
||||
@description("The user's theme, which describes all colors used throughout the UI.")
|
||||
'theme': string,
|
||||
@no_expand @display_name('User Theme')
|
||||
'theme_colors': query,
|
||||
|
||||
//- rjf: autocompletion
|
||||
@@ -294,7 +296,8 @@ RD_VocabTable:
|
||||
@default(1) use_default_ue_type_views: bool,
|
||||
|
||||
//- rjf: theme
|
||||
@display_name('Project Theme') 'theme': string,
|
||||
@default("None") @display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.")
|
||||
'theme': string,
|
||||
@no_expand @display_name('Project Theme') @description("The project's theme, which describes all colors used throughout the UI, and can override the user's theme.")
|
||||
'theme_colors': query,
|
||||
|
||||
@@ -1365,9 +1368,6 @@ RD_IconTable:
|
||||
@table(name_upper name_lower display_string cfg)
|
||||
RD_ThemePresetTable:
|
||||
{
|
||||
//- rjf: stub
|
||||
{None none "None" ""}
|
||||
|
||||
//- rjf: default dark theme
|
||||
{
|
||||
DefaultDark default_dark "Default (Dark)",
|
||||
|
||||
@@ -4837,6 +4837,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
}
|
||||
|
||||
// rjf: form cell build parameters
|
||||
UI_Key line_edit_key = {0};
|
||||
RD_CellParams cell_params = {0};
|
||||
ProfScope("form cell build parameters")
|
||||
{
|
||||
@@ -4851,6 +4852,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
cell_params.edit_buffer = cell_edit_state->input_buffer;
|
||||
cell_params.edit_buffer_size = sizeof(cell_edit_state->input_buffer);
|
||||
cell_params.edit_string_size_out = &cell_edit_state->input_size;
|
||||
cell_params.line_edit_key_out = &line_edit_key;
|
||||
cell_params.expanded_out = &next_row_expanded;
|
||||
cell_params.search_needle = needle;
|
||||
cell_params.meta_fstrs = cell_info.expr_fstrs;
|
||||
@@ -4968,7 +4970,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
{
|
||||
list_expr = cursor_info.list_expr;
|
||||
}
|
||||
rd_set_autocomp_regs(.ui_key = sig.box->key,
|
||||
rd_set_autocomp_regs(.ui_key = line_edit_key,
|
||||
.string = cursor_info.filter,
|
||||
.expr = list_expr);
|
||||
}
|
||||
@@ -5801,7 +5803,7 @@ rd_window_frame(void)
|
||||
if(rd_setting_b32_from_name(str8_lit("use_project_theme")))
|
||||
{
|
||||
theme_cfg = theme_cfgs[0];
|
||||
if(theme_cfg == &rd_nil_cfg || str8_match(theme_cfg->first->string, rd_theme_preset_display_string_table[RD_ThemePreset_None], 0))
|
||||
if(theme_cfg == &rd_nil_cfg)
|
||||
{
|
||||
theme_cfg = theme_cfgs[1];
|
||||
}
|
||||
@@ -5814,7 +5816,7 @@ rd_window_frame(void)
|
||||
String8 theme_name = theme_cfg->first->string;
|
||||
if(theme_name.size != 0)
|
||||
{
|
||||
for EachNonZeroEnumVal(RD_ThemePreset, p)
|
||||
for EachEnumVal(RD_ThemePreset, p)
|
||||
{
|
||||
if(str8_match(theme_name, rd_theme_preset_display_string_table[p], 0))
|
||||
{
|
||||
@@ -9642,10 +9644,17 @@ rd_autocomp_primary_list_expr_from_dst_eval(Arena *arena, E_Eval dst_eval)
|
||||
{
|
||||
String8 result = str8_lit("query:locals, query:globals, query:thread_locals, query:procedures, query:types");
|
||||
{
|
||||
E_TypeKey maybe_enum_type = e_type_key_unwrap(dst_eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative & ~E_TypeUnwrapFlag_Enums);
|
||||
if(dst_eval.space.kind == RD_EvalSpaceKind_MetaCfg && str8_match(e_string_from_id(dst_eval.space.u64s[1]), str8_lit("theme"), 0))
|
||||
{
|
||||
result = str8_lit("query:themes");
|
||||
}
|
||||
#if 0
|
||||
else if(e_type_kind_from_key(maybe_enum_type) == E_TypeKind_Enum)
|
||||
{
|
||||
result = e_type_string_from_key(arena, maybe_enum_type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -968,6 +968,7 @@ internal void rd_set_autocomp_regs_(RD_Regs *regs);
|
||||
//~ rjf: Colors, Fonts, Config
|
||||
|
||||
//- rjf: colors
|
||||
internal UI_Theme *rd_ui_theme_from_tree(MD_Node *tree);
|
||||
internal Vec4F32 rd_rgba_from_code_color_slot(RD_CodeColorSlot slot);
|
||||
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind(TXT_TokenKind kind);
|
||||
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string);
|
||||
|
||||
@@ -1851,6 +1851,25 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, name);
|
||||
result.expr_fstrs = fstrs;
|
||||
}break;
|
||||
|
||||
//- rjf: unattached processes
|
||||
case RD_EvalSpaceKind_MetaTheme:
|
||||
{
|
||||
String8 name = e_string_from_id(cell->eval.value.u64);
|
||||
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_color_from_name(str8_lit("text")), ui_top_font_size()};
|
||||
DR_FStrList fstrs = {0};
|
||||
UI_TagF("weak")
|
||||
{
|
||||
dr_fstrs_push_new(arena, &fstrs, ¶ms,
|
||||
rd_icon_kind_text_table[RD_IconKind_Palette],
|
||||
.font = rd_font_from_slot(RD_FontSlot_Icons),
|
||||
.raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons),
|
||||
.color = ui_color_from_name(str8_lit("text")));
|
||||
}
|
||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" "));
|
||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, name);
|
||||
result.eval_fstrs = fstrs;
|
||||
}break;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
|
||||
+109
-12
@@ -3211,6 +3211,7 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
B32 build_slider = !!(params->flags & RD_CellFlag_Slider) && !is_focus_active;
|
||||
B32 build_bindings = !!(params->flags & RD_CellFlag_Bindings) && !is_focus_active;
|
||||
B32 build_lhs_name_desc = (params->meta_fstrs.node_count != 0 || params->description.size != 0);
|
||||
B32 build_line_edit = (params->pre_edit_value.size != 0 || params->value_fstrs.node_count != 0);
|
||||
DR_FStrList lhs_name_fstrs = params->meta_fstrs;
|
||||
DR_FStrList value_name_fstrs = params->value_fstrs;
|
||||
|
||||
@@ -3237,6 +3238,7 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
ui_set_next_hover_cursor(OS_Cursor_IBar);
|
||||
}
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_MouseClickable|
|
||||
(!!build_lhs_name_desc*UI_BoxFlag_DisableFocusBorder)|
|
||||
(!!(params->flags & RD_CellFlag_KeyboardClickable)*UI_BoxFlag_KeyboardClickable)|
|
||||
UI_BoxFlag_ClickToFocus|
|
||||
(!!(params->flags & RD_CellFlag_Button)*UI_BoxFlag_DrawHotEffects)|
|
||||
@@ -3297,6 +3299,10 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
{
|
||||
UI_Parent(box) UI_WidthFill UI_ChildLayoutAxis(Axis2_Y)
|
||||
{
|
||||
if(ui_top_text_alignment() == UI_TextAlign_Left && (params->flags & (RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder)) == 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
lhs_box = ui_build_box_from_stringf(0, "lhs_box");
|
||||
}
|
||||
}
|
||||
@@ -3313,10 +3319,6 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
}
|
||||
UI_Row
|
||||
{
|
||||
if(ui_top_text_alignment() == UI_TextAlign_Left && (params->flags & (RD_CellFlag_Expander|RD_CellFlag_ExpanderSpace|RD_CellFlag_ExpanderPlaceholder)) == 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
UI_Box *name_box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fstrs(name_box, &lhs_name_fstrs);
|
||||
ui_box_equip_fuzzy_match_ranges(name_box, &fuzzy_matches);
|
||||
@@ -3325,7 +3327,6 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
{
|
||||
UI_Row
|
||||
{
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
UI_Box *desc_box = ui_label(params->description).box;
|
||||
FuzzyMatchRangeList desc_fuzzy_matches = fuzzy_match_find(scratch.arena, params->search_needle, params->description);
|
||||
ui_box_equip_fuzzy_match_ranges(desc_box, &desc_fuzzy_matches);
|
||||
@@ -3333,21 +3334,115 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build reset-to-default, if line edit is embedded & it is marked
|
||||
//
|
||||
#if 0
|
||||
if(!is_focus_active && !is_focus_active_disabled)
|
||||
{
|
||||
UI_TagF(".")
|
||||
UI_TagF("weak")
|
||||
UI_TagF("implicit")
|
||||
UI_Parent(box)
|
||||
UI_PrefWidth(ui_em(2.f, 1.f))
|
||||
{
|
||||
UI_Column
|
||||
UI_Padding(ui_pct(1, 0))
|
||||
UI_PrefHeight(ui_em(2.f, 1.f))
|
||||
UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
UI_HoverCursor(OS_Cursor_HandPoint)
|
||||
RD_Font(RD_FontSlot_Icons)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
UI_Box *edit_start_box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|
|
||||
UI_BoxFlag_DrawHotEffects|
|
||||
UI_BoxFlag_DrawBorder|
|
||||
UI_BoxFlag_DrawBackground|
|
||||
UI_BoxFlag_DisableFocusOverlay|
|
||||
UI_BoxFlag_DisableFocusBorder|
|
||||
UI_BoxFlag_Clickable,
|
||||
"%S##undo", rd_icon_kind_text_table[RD_IconKind_Undo]);
|
||||
UI_Signal sig = ui_signal_from_box(edit_start_box);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build line edit container box
|
||||
//
|
||||
UI_Box *edit_box = &ui_nil_box;
|
||||
UI_Parent(box) if((is_focus_active || is_focus_active_disabled) ||
|
||||
params->pre_edit_value.size != 0 ||
|
||||
params->value_fstrs.node_count != 0)
|
||||
if((is_focus_active || is_focus_active_disabled) || build_line_edit)
|
||||
UI_Parent(box)
|
||||
{
|
||||
B32 is_editing = (is_focus_active || is_focus_active_disabled);
|
||||
UI_Size edit_box_size = ui_pct(1, 0);
|
||||
if(build_lhs_name_desc)
|
||||
{
|
||||
edit_box_size = ui_children_sum(1);
|
||||
F32 px_size = is_editing ? (floor_f32(dim_2f32(box->rect).x*0.5f)) : floor_f32(dr_dim_from_fstrs(&value_name_fstrs).x + ui_top_font_size()*1.5f);
|
||||
edit_box_size = ui_px(px_size, 1.f);
|
||||
}
|
||||
UI_PrefWidth(edit_box_size)
|
||||
edit_box = ui_build_box_from_stringf(0, "edit_box");
|
||||
{
|
||||
if(ui_top_px_height() > ui_top_font_size()*3.f)
|
||||
{
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
UI_Column UI_Padding(ui_em(1, 0)) UI_Focus(UI_FocusKind_On)
|
||||
{
|
||||
UI_PrefHeight(ui_em(3.f, 1.f)) UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
edit_box = ui_build_box_from_stringf((!!is_editing*UI_BoxFlag_DrawBorder)|
|
||||
UI_BoxFlag_Clickable|
|
||||
UI_BoxFlag_DisableFocusOverlay,
|
||||
"edit_box");
|
||||
if(params->line_edit_key_out)
|
||||
{
|
||||
params->line_edit_key_out[0] = edit_box->key;
|
||||
}
|
||||
}
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
else
|
||||
{
|
||||
edit_box = ui_build_box_from_stringf(0, "edit_box");
|
||||
if(params->line_edit_key_out)
|
||||
{
|
||||
params->line_edit_key_out[0] = edit_box->key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build edit-button, if line edit is embedded, and has no string
|
||||
//
|
||||
if(!is_focus_active && !is_focus_active_disabled && build_lhs_name_desc && build_line_edit && value_name_fstrs.total_size == 0)
|
||||
{
|
||||
UI_TagF(".")
|
||||
UI_TagF("weak")
|
||||
UI_TagF("implicit")
|
||||
UI_Parent(box)
|
||||
UI_PrefWidth(ui_em(2.f, 1.f))
|
||||
{
|
||||
UI_Column
|
||||
UI_Padding(ui_pct(1, 0))
|
||||
UI_PrefHeight(ui_em(2.f, 1.f))
|
||||
UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
UI_HoverCursor(OS_Cursor_HandPoint)
|
||||
RD_Font(RD_FontSlot_Icons)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
UI_Box *edit_start_box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|
|
||||
UI_BoxFlag_DrawHotEffects|
|
||||
UI_BoxFlag_DrawBorder|
|
||||
UI_BoxFlag_DrawBackground|
|
||||
UI_BoxFlag_DisableFocusOverlay|
|
||||
UI_BoxFlag_DisableFocusBorder|
|
||||
UI_BoxFlag_Clickable,
|
||||
"%S##edit", rd_icon_kind_text_table[RD_IconKind_Pencil]);
|
||||
UI_Signal sig = ui_signal_from_box(edit_start_box);
|
||||
}
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -3374,7 +3469,7 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
UI_PrefWidth(ui_children_sum(1.f))
|
||||
UI_HeightFill
|
||||
UI_Column UI_Padding(ui_px(padding_px, 1.f))
|
||||
UI_Row UI_Padding(ui_px(padding_px, 1.f))
|
||||
UI_Row
|
||||
UI_PrefWidth(ui_em(3.5f, 1.f))
|
||||
UI_PrefHeight(ui_px(height_px, 1.f))
|
||||
UI_CornerRadius(floor_f32(height_px/2.f - 1.f))
|
||||
@@ -3410,6 +3505,7 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
params->toggled_out[0] ^= 1;
|
||||
}
|
||||
}
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -3422,7 +3518,7 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
UI_PrefWidth(ui_children_sum(1.f))
|
||||
UI_HeightFill
|
||||
UI_Column UI_Padding(ui_px(padding_px, 1.f))
|
||||
UI_Row UI_Padding(ui_px(padding_px, 1.f))
|
||||
UI_Row
|
||||
UI_PrefWidth(ui_pct(0.5f - 0.2f*(!!build_lhs_name_desc), 0.f))
|
||||
UI_PrefHeight(ui_px(height_px, 1.f))
|
||||
UI_CornerRadius(floor_f32(height_px/2.f - 1.f))
|
||||
@@ -3469,6 +3565,7 @@ rd_cell(RD_CellParams *params, String8 string)
|
||||
ui_spacer(ui_pct(1-Clamp(0, params->slider_value_out[0], 1), 0.f));
|
||||
}
|
||||
}
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
@@ -68,6 +68,7 @@ struct RD_CellParams
|
||||
U8 *edit_buffer;
|
||||
U64 edit_buffer_size;
|
||||
U64 *edit_string_size_out;
|
||||
UI_Key *line_edit_key_out;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user