From 21b253a87076de8f0169acbae49cd8b720fa3b33 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Wed, 18 May 2022 17:24:26 +0300 Subject: Define some Theme data structures with using for readability --- scene/resources/theme.cpp | 68 +++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'scene/resources/theme.cpp') diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index e14f5f224e..e65763ba2e 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -129,42 +129,42 @@ void Theme::_get_property_list(List *p_list) const { } // Icons. - for (const KeyValue>> &E : icon_map) { + for (const KeyValue &E : icon_map) { for (const KeyValue> &F : E.value) { list.push_back(PropertyInfo(Variant::OBJECT, String() + E.key + "/icons/" + F.key, PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NULL)); } } // Styles. - for (const KeyValue>> &E : style_map) { + for (const KeyValue &E : style_map) { for (const KeyValue> &F : E.value) { list.push_back(PropertyInfo(Variant::OBJECT, String() + E.key + "/styles/" + F.key, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NULL)); } } // Fonts. - for (const KeyValue>> &E : font_map) { + for (const KeyValue &E : font_map) { for (const KeyValue> &F : E.value) { list.push_back(PropertyInfo(Variant::OBJECT, String() + E.key + "/fonts/" + F.key, PROPERTY_HINT_RESOURCE_TYPE, "Font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NULL)); } } // Font sizes. - for (const KeyValue> &E : font_size_map) { + for (const KeyValue &E : font_size_map) { for (const KeyValue &F : E.value) { list.push_back(PropertyInfo(Variant::INT, String() + E.key + "/font_sizes/" + F.key, PROPERTY_HINT_RANGE, "0,256,1,or_greater")); } } // Colors. - for (const KeyValue> &E : color_map) { + for (const KeyValue &E : color_map) { for (const KeyValue &F : E.value) { - list.push_back(PropertyInfo(Variant::INT, String() + E.key + "/colors/" + F.key)); + list.push_back(PropertyInfo(Variant::COLOR, String() + E.key + "/colors/" + F.key)); } } // Constants. - for (const KeyValue> &E : constant_map) { + for (const KeyValue &E : constant_map) { for (const KeyValue &F : E.value) { list.push_back(PropertyInfo(Variant::INT, String() + E.key + "/constants/" + F.key)); } @@ -407,7 +407,7 @@ void Theme::add_icon_type(const StringName &p_theme_type) { if (icon_map.has(p_theme_type)) { return; } - icon_map[p_theme_type] = HashMap>(); + icon_map[p_theme_type] = ThemeIconMap(); } void Theme::remove_icon_type(const StringName &p_theme_type) { @@ -432,7 +432,7 @@ void Theme::remove_icon_type(const StringName &p_theme_type) { void Theme::get_icon_type_list(List *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue>> &E : icon_map) { + for (const KeyValue &E : icon_map) { p_list->push_back(E.key); } } @@ -517,7 +517,7 @@ void Theme::add_stylebox_type(const StringName &p_theme_type) { if (style_map.has(p_theme_type)) { return; } - style_map[p_theme_type] = HashMap>(); + style_map[p_theme_type] = ThemeStyleMap(); } void Theme::remove_stylebox_type(const StringName &p_theme_type) { @@ -542,7 +542,7 @@ void Theme::remove_stylebox_type(const StringName &p_theme_type) { void Theme::get_stylebox_type_list(List *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue>> &E : style_map) { + for (const KeyValue &E : style_map) { p_list->push_back(E.key); } } @@ -629,7 +629,7 @@ void Theme::add_font_type(const StringName &p_theme_type) { if (font_map.has(p_theme_type)) { return; } - font_map[p_theme_type] = HashMap>(); + font_map[p_theme_type] = ThemeFontMap(); } void Theme::remove_font_type(const StringName &p_theme_type) { @@ -654,7 +654,7 @@ void Theme::remove_font_type(const StringName &p_theme_type) { void Theme::get_font_type_list(List *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue>> &E : font_map) { + for (const KeyValue &E : font_map) { p_list->push_back(E.key); } } @@ -728,7 +728,7 @@ void Theme::add_font_size_type(const StringName &p_theme_type) { if (font_size_map.has(p_theme_type)) { return; } - font_size_map[p_theme_type] = HashMap(); + font_size_map[p_theme_type] = ThemeFontSizeMap(); } void Theme::remove_font_size_type(const StringName &p_theme_type) { @@ -742,7 +742,7 @@ void Theme::remove_font_size_type(const StringName &p_theme_type) { void Theme::get_font_size_type_list(List *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue> &E : font_size_map) { + for (const KeyValue &E : font_size_map) { p_list->push_back(E.key); } } @@ -814,7 +814,7 @@ void Theme::add_color_type(const StringName &p_theme_type) { if (color_map.has(p_theme_type)) { return; } - color_map[p_theme_type] = HashMap(); + color_map[p_theme_type] = ThemeColorMap(); } void Theme::remove_color_type(const StringName &p_theme_type) { @@ -828,7 +828,7 @@ void Theme::remove_color_type(const StringName &p_theme_type) { void Theme::get_color_type_list(List *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue> &E : color_map) { + for (const KeyValue &E : color_map) { p_list->push_back(E.key); } } @@ -900,7 +900,7 @@ void Theme::add_constant_type(const StringName &p_theme_type) { if (constant_map.has(p_theme_type)) { return; } - constant_map[p_theme_type] = HashMap(); + constant_map[p_theme_type] = ThemeConstantMap(); } void Theme::remove_constant_type(const StringName &p_theme_type) { @@ -914,7 +914,7 @@ void Theme::remove_constant_type(const StringName &p_theme_type) { void Theme::get_constant_type_list(List *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue> &E : constant_map) { + for (const KeyValue &E : constant_map) { p_list->push_back(E.key); } } @@ -1278,32 +1278,32 @@ void Theme::get_type_list(List *p_list) const { RBSet types; // Icons. - for (const KeyValue>> &E : icon_map) { + for (const KeyValue &E : icon_map) { types.insert(E.key); } // Styles. - for (const KeyValue>> &E : style_map) { + for (const KeyValue &E : style_map) { types.insert(E.key); } // Fonts. - for (const KeyValue>> &E : font_map) { + for (const KeyValue &E : font_map) { types.insert(E.key); } // Font sizes. - for (const KeyValue> &E : font_size_map) { + for (const KeyValue &E : font_size_map) { types.insert(E.key); } // Colors. - for (const KeyValue> &E : color_map) { + for (const KeyValue &E : color_map) { types.insert(E.key); } // Constants. - for (const KeyValue> &E : constant_map) { + for (const KeyValue &E : constant_map) { types.insert(E.key); } @@ -1620,7 +1620,7 @@ void Theme::merge_with(const Ref &p_other) { // Colors. { - for (const KeyValue> &E : p_other->color_map) { + for (const KeyValue &E : p_other->color_map) { for (const KeyValue &F : E.value) { set_color(F.key, E.key, F.value); } @@ -1629,7 +1629,7 @@ void Theme::merge_with(const Ref &p_other) { // Constants. { - for (const KeyValue> &E : p_other->constant_map) { + for (const KeyValue &E : p_other->constant_map) { for (const KeyValue &F : E.value) { set_constant(F.key, E.key, F.value); } @@ -1638,7 +1638,7 @@ void Theme::merge_with(const Ref &p_other) { // Fonts. { - for (const KeyValue>> &E : p_other->font_map) { + for (const KeyValue &E : p_other->font_map) { for (const KeyValue> &F : E.value) { set_font(F.key, E.key, F.value); } @@ -1647,7 +1647,7 @@ void Theme::merge_with(const Ref &p_other) { // Font sizes. { - for (const KeyValue> &E : p_other->font_size_map) { + for (const KeyValue &E : p_other->font_size_map) { for (const KeyValue &F : E.value) { set_font_size(F.key, E.key, F.value); } @@ -1656,7 +1656,7 @@ void Theme::merge_with(const Ref &p_other) { // Icons. { - for (const KeyValue>> &E : p_other->icon_map) { + for (const KeyValue &E : p_other->icon_map) { for (const KeyValue> &F : E.value) { set_icon(F.key, E.key, F.value); } @@ -1665,7 +1665,7 @@ void Theme::merge_with(const Ref &p_other) { // Styleboxes. { - for (const KeyValue>> &E : p_other->style_map) { + for (const KeyValue &E : p_other->style_map) { for (const KeyValue> &F : E.value) { set_stylebox(F.key, E.key, F.value); } @@ -1685,7 +1685,7 @@ void Theme::merge_with(const Ref &p_other) { void Theme::clear() { // These items need disconnecting. { - for (const KeyValue>> &E : icon_map) { + for (const KeyValue &E : icon_map) { for (const KeyValue> &F : E.value) { if (F.value.is_valid()) { Ref icon = F.value; @@ -1696,7 +1696,7 @@ void Theme::clear() { } { - for (const KeyValue>> &E : style_map) { + for (const KeyValue &E : style_map) { for (const KeyValue> &F : E.value) { if (F.value.is_valid()) { Ref style = F.value; @@ -1707,7 +1707,7 @@ void Theme::clear() { } { - for (const KeyValue>> &E : font_map) { + for (const KeyValue &E : font_map) { for (const KeyValue> &F : E.value) { if (F.value.is_valid()) { Ref font = F.value; -- cgit v1.2.3