mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-10 12:47:51 +08:00
fix(xml): find constants in styles in the global scope
This commit is contained in:
committed by
Felipe Neves
parent
8599e9be77
commit
84acb67dca
@@ -124,13 +124,31 @@ lv_result_t lv_xml_style_register(lv_xml_component_scope_t * scope, const char *
|
||||
|
||||
if(value[0] == '#') {
|
||||
const char * value_clean = &value[1];
|
||||
bool const_found = false;
|
||||
lv_xml_const_t * c;
|
||||
LV_LL_READ(&scope->const_ll, c) {
|
||||
if(lv_streq(c->name, value_clean)) {
|
||||
value = c->value;
|
||||
const_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!const_found) {
|
||||
lv_xml_component_scope_t * global_scope = lv_xml_component_get_scope("globals");
|
||||
if(global_scope) {
|
||||
LV_LL_READ(&global_scope->const_ll, c) {
|
||||
if(lv_streq(c->name, value_clean)) {
|
||||
value = c->value;
|
||||
const_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!const_found) {
|
||||
LV_LOG_WARN("Constant `%s` is not found", value_clean);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(lv_streq(value, "remove")) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<style name="blue" text_color="#dark_blue" text_font="lv_montserrat_30"/>
|
||||
<style name="scale_main" bg_opa="50%" pad_all="32" radius="8"/>
|
||||
<style name="scale_indic" length="20" />
|
||||
<style name="scale_sectoion_indic" text_color="#00ff00" line_width="6"/>
|
||||
<style name="scale_sectoion_indic" text_color="0x00ff00" line_width="6"/>
|
||||
</styles>
|
||||
|
||||
<view width="700" height="470" style_bg_color="#light_blue" flex_flow="column_wrap">
|
||||
|
||||
Reference in New Issue
Block a user