eliminate defaults for overridden properties, e.g. per-tab font size; just pull value from hierarchy

This commit is contained in:
Ryan Fleury
2025-05-06 16:25:04 -07:00
parent de5ae9746d
commit 6b4c1997e1
4 changed files with 33 additions and 37 deletions
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -434,7 +434,7 @@ RD_VocabTable:
@row_commands(@file copy_tab_full_path, @file show_file_in_explorer, duplicate_tab, close_tab) @row_commands(@file copy_tab_full_path, @file show_file_in_explorer, duplicate_tab, close_tab)
x: x:
{ {
@default(11) @display_name('Tab Font Size') @description("Controls the tab's font size.") @override @display_name('Tab Font Size') @description("Controls the tab's font size.")
'font_size': @range[6, 72] u64, 'font_size': @range[6, 72] u64,
} }
``` ```
@@ -446,7 +446,7 @@ RD_VocabTable:
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@default(3.f) @display_name('Tab Row Height') @description("Controls the tab's row height, in multiples of the font size.") @override @display_name('Tab Row Height') @description("Controls the tab's row height, in multiples of the font size.")
'row_height': @range[1.75f, 5.f] f32, 'row_height': @range[1.75f, 5.f] f32,
'label': code_string, 'label': code_string,
@description("The root expression which is evaluated to produce the watch window.") @description("The root expression which is evaluated to produce the watch window.")
+28 -32
View File
@@ -1851,49 +1851,45 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
{ {
read_data = cfg->first->string; read_data = cfg->first->string;
} }
else if(str8_match(child_type_name, str8_lit("bool"), 0)) else
{ {
String8 value_string = cfg->first->string; String8 value_string = cfg->first->string;
if(value_string.size == 0) if(value_string.size == 0)
{ {
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string; value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string;
} }
String8 value_string_casted = push_str8f(scratch.arena, "(bool)(%S)", value_string); if(value_string.size == 0 && !md_node_is_nil(md_tag_from_string(child_schema, str8_lit("override"), 0)))
B32 value = !!e_value_from_string(value_string_casted).u64;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
}
else if(str8_match(child_type_name, str8_lit("u64"), 0))
{
String8 value_string = cfg->first->string;
if(value_string.size == 0)
{ {
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string; for(RD_Cfg *parent = root_cfg->parent; parent != &rd_nil_cfg; parent = parent->parent)
{
RD_Cfg *parent_child_w_key = rd_cfg_child_from_string(parent, child_key);
if(parent_child_w_key != &rd_nil_cfg)
{
value_string = parent_child_w_key->first->string;
break;
}
}
} }
String8 value_string_casted = push_str8f(scratch.arena, "(uint64)(%S)", value_string); if(str8_match(child_type_name, str8_lit("bool"), 0))
U64 value = e_value_from_string(value_string_casted).u64;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
}
else if(str8_match(child_type_name, str8_lit("u32"), 0))
{
String8 value_string = cfg->first->string;
if(value_string.size == 0)
{ {
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string; B32 value = !!e_value_from_stringf("(bool)(%S)", value_string).u64;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
} }
String8 value_string_casted = push_str8f(scratch.arena, "(uint32)(%S)", value_string); else if(str8_match(child_type_name, str8_lit("u64"), 0))
U64 value = e_value_from_string(value_string_casted).u64;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
}
else if(str8_match(child_type_name, str8_lit("f32"), 0))
{
String8 value_string = cfg->first->string;
if(value_string.size == 0)
{ {
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string; U64 value = e_value_from_stringf("(uint64)(%S)", value_string).u64;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
}
else if(str8_match(child_type_name, str8_lit("u32"), 0))
{
U64 value = e_value_from_stringf("(uint32)(%S)", value_string).u64;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
}
else if(str8_match(child_type_name, str8_lit("f32"), 0))
{
F32 value = e_value_from_stringf("(float32)(%S)", value_string).f32;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
} }
String8 value_string_casted = push_str8f(scratch.arena, "(float32)(%S)", value_string);
F32 value = e_value_from_string(value_string_casted).f32;
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
} }
} }
@@ -4867,7 +4863,7 @@ rd_view_ui(Rng2F32 rect)
} }
// rjf: apply expander (or substitute space) // rjf: apply expander (or substitute space)
if(!ewv->text_editing || !cell_selected) if(!ewv->text_editing || !cell_selected || row_depth > 0)
{ {
if(row_is_expandable && cell == row_info->cells.first) if(row_is_expandable && cell == row_info->cells.first)
{ {
+1 -1
View File
@@ -213,7 +213,6 @@
//////////////////////////////// ////////////////////////////////
//~ rjf: 0.9.16 TODO notes //~ rjf: 0.9.16 TODO notes
// //
// [ ] evaluate `foo.bar` symbol names???
// [ ] maybe add extra caching layer to process memory querying? we pay a pretty // [ ] maybe add extra caching layer to process memory querying? we pay a pretty
// heavy cost even to just read 8 bytes... // heavy cost even to just read 8 bytes...
@@ -307,6 +306,7 @@
// [ ] audio waveform views // [ ] audio waveform views
// //
//- eval improvements //- eval improvements
// [ ] evaluate `foo.bar` symbol names without escape hatch?
// [ ] serializing eval view maps (?) // [ ] serializing eval view maps (?)
// [ ] EVAL LOOKUP RULES -> currently going 0 -> rdis_count, but we need // [ ] EVAL LOOKUP RULES -> currently going 0 -> rdis_count, but we need
// to prioritize the primary rdi // to prioritize the primary rdi