From cade5b88d9c4b01c57115a355743460047c0ca50 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Tue, 14 May 2024 14:41:39 +0200 Subject: [PATCH] Use `CoreStringNames::normal` in more places --- editor/connections_dialog.cpp | 4 +- editor/editor_audio_buses.cpp | 2 +- editor/editor_feature_profile.cpp | 2 +- editor/editor_help.cpp | 4 +- editor/editor_node.cpp | 2 +- editor/gui/editor_spin_slider.cpp | 2 +- editor/gui/editor_zoom_widget.cpp | 2 +- editor/import/3d/scene_import_settings.cpp | 2 +- editor/import_dock.cpp | 4 +- .../animation_player_editor_plugin.cpp | 4 +- .../plugins/asset_library_editor_plugin.cpp | 2 +- editor/plugins/bit_map_editor_plugin.cpp | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 10 ++-- editor/plugins/script_editor_plugin.cpp | 4 +- .../tiles/tile_set_atlas_source_editor.cpp | 2 +- .../plugins/visual_shader_editor_plugin.cpp | 6 +-- editor/project_manager.cpp | 2 +- editor/themes/editor_theme_manager.cpp | 50 +++++++++---------- scene/theme/default_theme.cpp | 32 ++++++------ 19 files changed, 69 insertions(+), 69 deletions(-) diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index cb775a67e7f..7042cbec339 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -465,10 +465,10 @@ void ConnectDialog::_notification(int p_what) { type_list->set_item_icon(i, get_editor_theme_icon(type_name)); } - Ref style = get_theme_stylebox("normal", "LineEdit")->duplicate(); + Ref style = get_theme_stylebox(CoreStringName(normal), "LineEdit")->duplicate(); if (style.is_valid()) { style->set_content_margin(SIDE_TOP, style->get_content_margin(SIDE_TOP) + 1.0); - from_signal->add_theme_style_override("normal", style); + from_signal->add_theme_style_override(CoreStringName(normal), style); } method_search->set_right_icon(get_editor_theme_icon("Search")); open_method_tree->set_icon(get_editor_theme_icon("Edit")); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 0b5122fce2f..4c2cee91065 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -837,7 +837,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { for (int i = 0; i < hbc->get_child_count(); i++) { Control *child = Object::cast_to(hbc->get_child(i)); child->begin_bulk_theme_override(); - child->add_theme_style_override("normal", sbempty); + child->add_theme_style_override(CoreStringName(normal), sbempty); child->add_theme_style_override("hover", sbempty); child->add_theme_style_override("focus", sbempty); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 020706c7147..ba04f36abe5 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -1010,7 +1010,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { // Add some spacing above the help label. Ref sb = memnew(StyleBoxEmpty); sb->set_content_margin(SIDE_TOP, 20 * EDSCALE); - no_profile_selected_help->add_theme_style_override("normal", sb); + no_profile_selected_help->add_theme_style_override(CoreStringName(normal), sb); no_profile_selected_help->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); no_profile_selected_help->set_v_size_flags(Control::SIZE_EXPAND_FILL); h_split->add_child(no_profile_selected_help); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index fa5cdd185fd..ec064a92d74 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -345,7 +345,7 @@ void EditorHelp::_class_desc_resized(bool p_force_update_theme) { Ref class_desc_stylebox = theme_cache.background_style->duplicate(); class_desc_stylebox->set_content_margin(SIDE_LEFT, display_margin); class_desc_stylebox->set_content_margin(SIDE_RIGHT, display_margin); - class_desc->add_theme_style_override("normal", class_desc_stylebox); + class_desc->add_theme_style_override(CoreStringName(normal), class_desc_stylebox); class_desc->add_theme_style_override("focused", class_desc_stylebox); } } @@ -3723,7 +3723,7 @@ void EditorHelpBit::set_content_height_limits(float p_min, float p_max) { void EditorHelpBit::update_content_height() { float content_height = content->get_content_height(); - const Ref style = content->get_theme_stylebox("normal"); + const Ref style = content->get_theme_stylebox(CoreStringName(normal)); if (style.is_valid()) { content_height += style->get_content_margin(SIDE_TOP) + style->get_content_margin(SIDE_BOTTOM); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index af06ccb8857..fc70a93e9b4 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -521,7 +521,7 @@ void EditorNode::_update_theme(bool p_skip_creation) { scene_root_parent->add_theme_style_override("panel", theme->get_stylebox(SNAME("Content"), EditorStringName(EditorStyles))); bottom_panel->add_theme_style_override("panel", theme->get_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles))); distraction_free->set_icon(theme->get_icon(SNAME("DistractionFree"), EditorStringName(EditorIcons))); - distraction_free->add_theme_style_override(SceneStringName(pressed), theme->get_stylebox("normal", "FlatMenuButton")); + distraction_free->add_theme_style_override(SceneStringName(pressed), theme->get_stylebox(CoreStringName(normal), "FlatMenuButton")); help_menu->set_item_icon(help_menu->get_item_index(HELP_SEARCH), theme->get_icon(SNAME("HelpSearch"), EditorStringName(EditorIcons))); help_menu->set_item_icon(help_menu->get_item_index(HELP_COPY_SYSTEM_INFO), theme->get_icon(SNAME("ActionCopy"), EditorStringName(EditorIcons))); diff --git a/editor/gui/editor_spin_slider.cpp b/editor/gui/editor_spin_slider.cpp index bf487a57696..a838299288b 100644 --- a/editor/gui/editor_spin_slider.cpp +++ b/editor/gui/editor_spin_slider.cpp @@ -300,7 +300,7 @@ void EditorSpinSlider::_update_value_input_stylebox() { stylebox->set_content_margin(SIDE_LEFT, (!get_label().is_empty() ? 23 : 16) * EDSCALE); } - value_input->add_theme_style_override("normal", stylebox); + value_input->add_theme_style_override(CoreStringName(normal), stylebox); } void EditorSpinSlider::_draw_spin_slider() { diff --git a/editor/gui/editor_zoom_widget.cpp b/editor/gui/editor_zoom_widget.cpp index e3d8d4b224f..73afbc3ab5d 100644 --- a/editor/gui/editor_zoom_widget.cpp +++ b/editor/gui/editor_zoom_widget.cpp @@ -205,7 +205,7 @@ EditorZoomWidget::EditorZoomWidget() { zoom_reset->set_flat(true); Ref empty_stylebox = memnew(StyleBoxEmpty); - zoom_reset->add_theme_style_override("normal", empty_stylebox); + zoom_reset->add_theme_style_override(CoreStringName(normal), empty_stylebox); zoom_reset->add_theme_style_override("hover", empty_stylebox); zoom_reset->add_theme_style_override("focus", empty_stylebox); zoom_reset->add_theme_style_override(SceneStringName(pressed), empty_stylebox); diff --git a/editor/import/3d/scene_import_settings.cpp b/editor/import/3d/scene_import_settings.cpp index 4c78c620c1f..61e988ae2d6 100644 --- a/editor/import/3d/scene_import_settings.cpp +++ b/editor/import/3d/scene_import_settings.cpp @@ -1261,7 +1261,7 @@ void SceneImportSettingsDialog::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { action_menu->begin_bulk_theme_override(); - action_menu->add_theme_style_override("normal", get_theme_stylebox("normal", "Button")); + action_menu->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), "Button")); action_menu->add_theme_style_override("hover", get_theme_stylebox("hover", "Button")); action_menu->add_theme_style_override(SceneStringName(pressed), get_theme_stylebox(SceneStringName(pressed), "Button")); action_menu->end_bulk_theme_override(); diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 2d87e6592fc..3c06c684144 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -718,7 +718,7 @@ void ImportDock::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (EditorThemeManager::is_generated_theme_outdated()) { - imported->add_theme_style_override("normal", get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"))); + imported->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"))); } } break; @@ -775,7 +775,7 @@ ImportDock::ImportDock() { content->hide(); imported = memnew(Label); - imported->add_theme_style_override("normal", EditorNode::get_singleton()->get_editor_theme()->get_stylebox(CoreStringName(normal), SNAME("LineEdit"))); + imported->add_theme_style_override(CoreStringName(normal), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(CoreStringName(normal), SNAME("LineEdit"))); imported->set_clip_text(true); content->add_child(imported); HBoxContainer *hb = memnew(HBoxContainer); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 1cf11f2a431..1e7c43c64af 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -172,8 +172,8 @@ void AnimationPlayerEditor::_notification(int p_what) { pin->set_icon(get_editor_theme_icon(SNAME("Pin"))); - tool_anim->add_theme_style_override("normal", get_theme_stylebox(CoreStringName(normal), SNAME("Button"))); - track_editor->get_edit_menu()->add_theme_style_override("normal", get_theme_stylebox(CoreStringName(normal), SNAME("Button"))); + tool_anim->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), SNAME("Button"))); + track_editor->get_edit_menu()->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), SNAME("Button"))); #define ITEM_ICON(m_item, m_icon) tool_anim->get_popup()->set_item_icon(tool_anim->get_popup()->get_item_index(m_item), get_editor_theme_icon(SNAME(m_icon))) diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 99c7ab63e9c..832b916e3bf 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -181,7 +181,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) { label_margin->set_content_margin_all(0); price = memnew(Label); - price->add_theme_style_override("normal", label_margin); + price->add_theme_style_override(CoreStringName(normal), label_margin); price->set_tooltip_text(TTR("License")); price->set_mouse_filter(MOUSE_FILTER_PASS); diff --git a/editor/plugins/bit_map_editor_plugin.cpp b/editor/plugins/bit_map_editor_plugin.cpp index f1d86de5377..668ea04d698 100644 --- a/editor/plugins/bit_map_editor_plugin.cpp +++ b/editor/plugins/bit_map_editor_plugin.cpp @@ -55,7 +55,7 @@ BitMapEditor::BitMapEditor() { Ref stylebox; stylebox.instantiate(); stylebox->set_content_margin(SIDE_RIGHT, 4 * EDSCALE); - size_label->add_theme_style_override("normal", stylebox); + size_label->add_theme_style_override(CoreStringName(normal), stylebox); } /////////////////////// diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 69b66cd7b24..21906cead4e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -3044,7 +3044,7 @@ void Node3DEditorViewport::_notification(int p_what) { Control *gui_base = EditorNode::get_singleton()->get_gui_base(); view_menu->begin_bulk_theme_override(); - view_menu->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + view_menu->add_theme_style_override(CoreStringName(normal), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); view_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); view_menu->add_theme_style_override(SceneStringName(pressed), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); view_menu->add_theme_style_override("focus", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); @@ -3052,7 +3052,7 @@ void Node3DEditorViewport::_notification(int p_what) { view_menu->end_bulk_theme_override(); preview_camera->begin_bulk_theme_override(); - preview_camera->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + preview_camera->add_theme_style_override(CoreStringName(normal), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); preview_camera->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); preview_camera->add_theme_style_override(SceneStringName(pressed), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); preview_camera->add_theme_style_override("focus", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); @@ -3063,7 +3063,7 @@ void Node3DEditorViewport::_notification(int p_what) { frame_time_gradient->set_color(1, get_theme_color(SNAME("warning_color"), EditorStringName(Editor))); frame_time_gradient->set_color(2, get_theme_color(SNAME("error_color"), EditorStringName(Editor))); - info_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + info_label->add_theme_style_override(CoreStringName(normal), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); frame_time_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); // Set a minimum width to prevent the width from changing all the time @@ -3073,8 +3073,8 @@ void Node3DEditorViewport::_notification(int p_what) { frame_time_panel->set_custom_minimum_size(Size2(min_width, 0) * EDSCALE); frame_time_vbox->add_theme_constant_override("separation", Math::round(-1 * EDSCALE)); - cinema_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); - locked_label->add_theme_style_override("normal", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + cinema_label->add_theme_style_override(CoreStringName(normal), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); + locked_label->add_theme_style_override(CoreStringName(normal), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles))); } break; case NOTIFICATION_DRAG_END: { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 4812c623c97..f28ee1f6150 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1737,7 +1737,7 @@ void ScriptEditor::_notification(int p_what) { filter_scripts->set_right_icon(get_editor_theme_icon(SNAME("Search"))); filter_methods->set_right_icon(get_editor_theme_icon(SNAME("Search"))); - filename->add_theme_style_override("normal", get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"))); + filename->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"))); recent_scripts->reset_size(); @@ -4052,7 +4052,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { filename = memnew(Label); filename->set_clip_text(true); filename->set_h_size_flags(SIZE_EXPAND_FILL); - filename->add_theme_style_override("normal", EditorNode::get_singleton()->get_editor_theme()->get_stylebox(CoreStringName(normal), SNAME("LineEdit"))); + filename->add_theme_style_override(CoreStringName(normal), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(CoreStringName(normal), SNAME("LineEdit"))); buttons_hbox->add_child(filename); members_overview_alphabeta_sort_button = memnew(Button); diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 03070bc6b5a..600e01bf2c4 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -997,7 +997,7 @@ void TileSetAtlasSourceEditor::_update_atlas_view() { Button *button = memnew(Button); button->set_flat(true); button->set_icon(get_editor_theme_icon(SNAME("Add"))); - button->add_theme_style_override("normal", memnew(StyleBoxEmpty)); + button->add_theme_style_override(CoreStringName(normal), memnew(StyleBoxEmpty)); button->add_theme_style_override("hover", memnew(StyleBoxEmpty)); button->add_theme_style_override("focus", memnew(StyleBoxEmpty)); button->add_theme_style_override(SceneStringName(pressed), memnew(StyleBoxEmpty)); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 438d7981200..d8e0d68587a 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1138,14 +1138,14 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool Label *label = memnew(Label); label->set_auto_translate_mode(Node::AUTO_TRANSLATE_MODE_DISABLED); // TODO: Implement proper translation switch. label->set_text(name_left); - label->add_theme_style_override("normal", editor->get_theme_stylebox(SNAME("label_style"), SNAME("VShaderEditor"))); //more compact + label->add_theme_style_override(CoreStringName(normal), editor->get_theme_stylebox(SNAME("label_style"), SNAME("VShaderEditor"))); //more compact hb->add_child(label); if (vsnode->is_input_port_default(j, mode) && !port_left_used) { Label *hint_label = memnew(Label); hint_label->set_text(TTR("[default]")); hint_label->add_theme_color_override("font_color", editor->get_theme_color(SNAME("font_readonly_color"), SNAME("TextEdit"))); - hint_label->add_theme_style_override("normal", editor->get_theme_stylebox(SNAME("label_style"), SNAME("VShaderEditor"))); + hint_label->add_theme_style_override(CoreStringName(normal), editor->get_theme_stylebox(SNAME("label_style"), SNAME("VShaderEditor"))); hb->add_child(hint_label); } } @@ -1188,7 +1188,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool Label *label = memnew(Label); label->set_auto_translate_mode(Node::AUTO_TRANSLATE_MODE_DISABLED); // TODO: Implement proper translation switch. label->set_text(name_right); - label->add_theme_style_override("normal", editor->get_theme_stylebox(SNAME("label_style"), SNAME("VShaderEditor"))); //more compact + label->add_theme_style_override(CoreStringName(normal), editor->get_theme_stylebox(SNAME("label_style"), SNAME("VShaderEditor"))); //more compact hb->add_child(label); } } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 00aa78f3421..04a6ff3db36 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1297,7 +1297,7 @@ ProjectManager::ProjectManager() { empty_list_message->set_use_bbcode(true); empty_list_message->set_fit_content(true); empty_list_message->set_h_size_flags(SIZE_EXPAND_FILL); - empty_list_message->add_theme_style_override("normal", memnew(StyleBoxEmpty)); + empty_list_message->add_theme_style_override(CoreStringName(normal), memnew(StyleBoxEmpty)); const String line1 = TTR("You don't have any projects yet."); const String line2 = TTR("Get started by creating a new one,\nimporting one that exists, or by downloading a project template from the Asset Library!"); diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index d56094b0f37..f7ff11c2c0f 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -704,7 +704,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the { // Button. - p_theme->set_stylebox("normal", "Button", p_config.button_style); + p_theme->set_stylebox(CoreStringName(normal), "Button", p_config.button_style); p_theme->set_stylebox("hover", "Button", p_config.button_style_hover); p_theme->set_stylebox(SceneStringName(pressed), "Button", p_config.button_style_pressed); p_theme->set_stylebox("focus", "Button", p_config.button_style_focus); @@ -730,7 +730,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // MenuButton. - p_theme->set_stylebox("normal", "MenuButton", p_config.panel_container_style); + p_theme->set_stylebox(CoreStringName(normal), "MenuButton", p_config.panel_container_style); p_theme->set_stylebox("hover", "MenuButton", p_config.button_style_hover); p_theme->set_stylebox(SceneStringName(pressed), "MenuButton", p_config.panel_container_style); p_theme->set_stylebox("focus", "MenuButton", p_config.panel_container_style); @@ -746,7 +746,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // MenuBar. - p_theme->set_stylebox("normal", "MenuBar", p_config.button_style); + p_theme->set_stylebox(CoreStringName(normal), "MenuBar", p_config.button_style); p_theme->set_stylebox("hover", "MenuBar", p_config.button_style_hover); p_theme->set_stylebox(SceneStringName(pressed), "MenuBar", p_config.button_style_pressed); p_theme->set_stylebox("disabled", "MenuBar", p_config.button_style_disabled); @@ -783,7 +783,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the option_button_disabled_style->set_content_margin(SIDE_RIGHT, 4 * EDSCALE); p_theme->set_stylebox("focus", "OptionButton", option_button_focus_style); - p_theme->set_stylebox("normal", "OptionButton", p_config.button_style); + p_theme->set_stylebox(CoreStringName(normal), "OptionButton", p_config.button_style); p_theme->set_stylebox("hover", "OptionButton", p_config.button_style_hover); p_theme->set_stylebox(SceneStringName(pressed), "OptionButton", p_config.button_style_pressed); p_theme->set_stylebox("disabled", "OptionButton", p_config.button_style_disabled); @@ -816,7 +816,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // CheckButton. - p_theme->set_stylebox("normal", "CheckButton", p_config.panel_container_style); + p_theme->set_stylebox(CoreStringName(normal), "CheckButton", p_config.panel_container_style); p_theme->set_stylebox(SceneStringName(pressed), "CheckButton", p_config.panel_container_style); p_theme->set_stylebox("disabled", "CheckButton", p_config.panel_container_style); p_theme->set_stylebox("hover", "CheckButton", p_config.panel_container_style); @@ -855,7 +855,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the Ref checkbox_style = p_config.panel_container_style->duplicate(); checkbox_style->set_content_margin_all(p_config.base_margin * EDSCALE); - p_theme->set_stylebox("normal", "CheckBox", checkbox_style); + p_theme->set_stylebox(CoreStringName(normal), "CheckBox", checkbox_style); p_theme->set_stylebox(SceneStringName(pressed), "CheckBox", checkbox_style); p_theme->set_stylebox("disabled", "CheckBox", checkbox_style); p_theme->set_stylebox("hover", "CheckBox", checkbox_style); @@ -1177,7 +1177,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // LineEdit. - p_theme->set_stylebox("normal", "LineEdit", text_editor_style); + p_theme->set_stylebox(CoreStringName(normal), "LineEdit", text_editor_style); p_theme->set_stylebox("focus", "LineEdit", p_config.button_style_focus); p_theme->set_stylebox("read_only", "LineEdit", text_editor_disabled_style); @@ -1199,7 +1199,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // TextEdit. - p_theme->set_stylebox("normal", "TextEdit", text_editor_style); + p_theme->set_stylebox(CoreStringName(normal), "TextEdit", text_editor_style); p_theme->set_stylebox("focus", "TextEdit", p_config.button_style_focus); p_theme->set_stylebox("read_only", "TextEdit", text_editor_disabled_style); @@ -1430,7 +1430,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the { // RichTextLabel. - p_theme->set_stylebox("normal", "RichTextLabel", p_config.tree_panel_style); + p_theme->set_stylebox(CoreStringName(normal), "RichTextLabel", p_config.tree_panel_style); p_theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); p_theme->set_color("default_color", "RichTextLabel", p_config.font_color); @@ -1445,7 +1445,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // Label. - p_theme->set_stylebox("normal", "Label", p_config.base_empty_style); + p_theme->set_stylebox(CoreStringName(normal), "Label", p_config.base_empty_style); p_theme->set_color("font_color", "Label", p_config.font_color); p_theme->set_color("font_shadow_color", "Label", Color(0, 0, 0, 0)); @@ -1620,7 +1620,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // GraphNode's title Label. p_theme->set_type_variation("GraphNodeTitleLabel", "Label"); - p_theme->set_stylebox("normal", "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0)); + p_theme->set_stylebox(CoreStringName(normal), "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0)); p_theme->set_color("font_color", "GraphNodeTitleLabel", p_config.dark_theme ? p_config.font_color : Color(1, 1, 1)); // Also use a bright font color for light themes. p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", Color(0, 0, 0, 0.35)); p_theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", 4); @@ -1652,7 +1652,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // GraphFrame's title Label. p_theme->set_type_variation("GraphFrameTitleLabel", "Label"); - p_theme->set_stylebox("normal", "GraphFrameTitleLabel", memnew(StyleBoxEmpty)); + p_theme->set_stylebox(CoreStringName(normal), "GraphFrameTitleLabel", memnew(StyleBoxEmpty)); p_theme->set_font_size("font_size", "GraphFrameTitleLabel", 22); p_theme->set_color("font_color", "GraphFrameTitleLabel", Color(1, 1, 1)); p_theme->set_color("font_shadow_color", "GraphFrameTitleLabel", Color(0, 0, 0, 0)); @@ -1730,7 +1730,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0); tag->set_corner_radius(CORNER_TOP_RIGHT, 4); tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4); - p_theme->set_stylebox("normal", "ProjectTag", tag); + p_theme->set_stylebox(CoreStringName(normal), "ProjectTag", tag); tag = p_config.button_style_hover->duplicate(); tag->set_corner_radius(CORNER_TOP_LEFT, 0); @@ -1809,13 +1809,13 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme menu_transparent_style->set_content_margin((Side)i, p_config.button_style->get_content_margin((Side)i)); main_screen_button_hover->set_content_margin((Side)i, p_config.button_style_hover->get_content_margin((Side)i)); } - p_theme->set_stylebox("normal", "MainScreenButton", menu_transparent_style); + p_theme->set_stylebox(CoreStringName(normal), "MainScreenButton", menu_transparent_style); p_theme->set_stylebox(SceneStringName(pressed), "MainScreenButton", menu_transparent_style); p_theme->set_stylebox("hover", "MainScreenButton", main_screen_button_hover); p_theme->set_stylebox("hover_pressed", "MainScreenButton", main_screen_button_hover); p_theme->set_type_variation("MainMenuBar", "FlatMenuButton"); - p_theme->set_stylebox("normal", "MainMenuBar", menu_transparent_style); + p_theme->set_stylebox(CoreStringName(normal), "MainMenuBar", menu_transparent_style); p_theme->set_stylebox(SceneStringName(pressed), "MainMenuBar", main_screen_button_hover); p_theme->set_stylebox("hover", "MainMenuBar", main_screen_button_hover); p_theme->set_stylebox("hover_pressed", "MainMenuBar", main_screen_button_hover); @@ -1830,7 +1830,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme style_bottom_panel->set_corner_radius_all(p_config.corner_radius * EDSCALE); p_theme->set_stylebox("BottomPanel", EditorStringName(EditorStyles), style_bottom_panel); p_theme->set_type_variation("BottomPanelButton", "FlatMenuButton"); - p_theme->set_stylebox("normal", "BottomPanelButton", menu_transparent_style); + p_theme->set_stylebox(CoreStringName(normal), "BottomPanelButton", menu_transparent_style); p_theme->set_stylebox(SceneStringName(pressed), "BottomPanelButton", menu_transparent_style); p_theme->set_stylebox("hover_pressed", "BottomPanelButton", main_screen_button_hover); p_theme->set_stylebox("hover", "BottomPanelButton", main_screen_button_hover); @@ -1900,12 +1900,12 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme } style_flat_button_pressed->set_bg_color(flat_pressed_color); - p_theme->set_stylebox("normal", "FlatButton", style_flat_button); + p_theme->set_stylebox(CoreStringName(normal), "FlatButton", style_flat_button); p_theme->set_stylebox("hover", "FlatButton", style_flat_button_hover); p_theme->set_stylebox(SceneStringName(pressed), "FlatButton", style_flat_button_pressed); p_theme->set_stylebox("disabled", "FlatButton", style_flat_button); - p_theme->set_stylebox("normal", "FlatMenuButton", style_flat_button); + p_theme->set_stylebox(CoreStringName(normal), "FlatMenuButton", style_flat_button); p_theme->set_stylebox("hover", "FlatMenuButton", style_flat_button_hover); p_theme->set_stylebox(SceneStringName(pressed), "FlatMenuButton", style_flat_button_pressed); p_theme->set_stylebox("disabled", "FlatMenuButton", style_flat_button); @@ -1930,7 +1930,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme if (!p_config.dark_theme) { editor_log_button_pressed->set_bg_color(flat_pressed_color.lightened(0.5)); } - p_theme->set_stylebox("normal", "EditorLogFilterButton", style_flat_button); + p_theme->set_stylebox(CoreStringName(normal), "EditorLogFilterButton", style_flat_button); p_theme->set_stylebox("hover", "EditorLogFilterButton", style_flat_button_hover); p_theme->set_stylebox(SceneStringName(pressed), "EditorLogFilterButton", editor_log_button_pressed); } @@ -1951,7 +1951,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme Ref panel_button_style_disabled = p_config.button_style_disabled->duplicate(); panel_button_style_disabled->set_bg_color(p_config.disabled_bg_color); - p_theme->set_stylebox("normal", "PanelBackgroundButton", panel_button_style); + p_theme->set_stylebox(CoreStringName(normal), "PanelBackgroundButton", panel_button_style); p_theme->set_stylebox("hover", "PanelBackgroundButton", panel_button_style_hover); p_theme->set_stylebox(SceneStringName(pressed), "PanelBackgroundButton", panel_button_style_pressed); p_theme->set_stylebox("disabled", "PanelBackgroundButton", panel_button_style_disabled); @@ -1986,7 +1986,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme Ref style_inspector_action = p_config.button_style->duplicate(); style_inspector_action->set_bg_color(color_inspector_action); style_inspector_action->set_content_margin(SIDE_RIGHT, action_extra_margin); - p_theme->set_stylebox("normal", "InspectorActionButton", style_inspector_action); + p_theme->set_stylebox(CoreStringName(normal), "InspectorActionButton", style_inspector_action); style_inspector_action = p_config.button_style_hover->duplicate(); style_inspector_action->set_content_margin(SIDE_RIGHT, action_extra_margin); @@ -2016,7 +2016,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme // Unpressed icon is dim, so use a dim highlight. p_theme->set_color("icon_hover_color", "PreviewLightButton", dim_light_highlighted_color); - p_theme->set_stylebox("normal", "PreviewLightButton", sb_empty_borderless); + p_theme->set_stylebox(CoreStringName(normal), "PreviewLightButton", sb_empty_borderless); p_theme->set_stylebox("hover", "PreviewLightButton", sb_empty_borderless); p_theme->set_stylebox("focus", "PreviewLightButton", sb_empty_borderless); p_theme->set_stylebox(SceneStringName(pressed), "PreviewLightButton", sb_empty_borderless); @@ -2232,7 +2232,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme style->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); p_theme->set_type_variation("EditorHelpBitTitle", "RichTextLabel"); - p_theme->set_stylebox("normal", "EditorHelpBitTitle", style); + p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitTitle", style); } // EditorHelpBitContent. @@ -2242,7 +2242,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme style->set_corner_radius(CORNER_TOP_RIGHT, 0); p_theme->set_type_variation("EditorHelpBitContent", "RichTextLabel"); - p_theme->set_stylebox("normal", "EditorHelpBitContent", style); + p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitContent", style); } // Asset Library. @@ -2486,7 +2486,7 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref &p_ const Color background_color = EDITOR_GET("text_editor/theme/highlighting/background_color"); Ref code_edit_stylebox = make_flat_stylebox(background_color, p_config.widget_margin.x, p_config.widget_margin.y, p_config.widget_margin.x, p_config.widget_margin.y, p_config.corner_radius); - p_theme->set_stylebox("normal", "CodeEdit", code_edit_stylebox); + p_theme->set_stylebox(CoreStringName(normal), "CodeEdit", code_edit_stylebox); p_theme->set_stylebox("read_only", "CodeEdit", code_edit_stylebox); p_theme->set_stylebox("focus", "CodeEdit", memnew(StyleBoxEmpty)); diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cpp index aa4d6692386..d2d99a8391d 100644 --- a/scene/theme/default_theme.cpp +++ b/scene/theme/default_theme.cpp @@ -159,7 +159,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // Make the focus outline appear to be flush with the buttons it's focusing. focus->set_expand_margin_all(Math::round(2 * scale)); - theme->set_stylebox("normal", "Button", button_normal); + theme->set_stylebox(CoreStringName(normal), "Button", button_normal); theme->set_stylebox("hover", "Button", button_hover); theme->set_stylebox(SceneStringName(pressed), "Button", button_pressed); theme->set_stylebox("disabled", "Button", button_disabled); @@ -188,7 +188,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_constant("icon_max_width", "Button", 0); // MenuBar - theme->set_stylebox("normal", "MenuBar", button_normal); + theme->set_stylebox(CoreStringName(normal), "MenuBar", button_normal); theme->set_stylebox("hover", "MenuBar", button_hover); theme->set_stylebox(SceneStringName(pressed), "MenuBar", button_pressed); theme->set_stylebox("disabled", "MenuBar", button_disabled); @@ -231,7 +231,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const Ref sb_optbutton_pressed = make_flat_stylebox(style_pressed_color, 2 * default_margin, default_margin, 2 * default_margin, default_margin); Ref sb_optbutton_disabled = make_flat_stylebox(style_disabled_color, 2 * default_margin, default_margin, 2 * default_margin, default_margin); - theme->set_stylebox("normal", "OptionButton", sb_optbutton_normal); + theme->set_stylebox(CoreStringName(normal), "OptionButton", sb_optbutton_normal); theme->set_stylebox("hover", "OptionButton", sb_optbutton_hover); theme->set_stylebox(SceneStringName(pressed), "OptionButton", sb_optbutton_pressed); theme->set_stylebox("disabled", "OptionButton", sb_optbutton_disabled); @@ -266,7 +266,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // MenuButton - theme->set_stylebox("normal", "MenuButton", button_normal); + theme->set_stylebox(CoreStringName(normal), "MenuButton", button_normal); theme->set_stylebox(SceneStringName(pressed), "MenuButton", button_pressed); theme->set_stylebox("hover", "MenuButton", button_hover); theme->set_stylebox("disabled", "MenuButton", button_disabled); @@ -292,7 +292,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const Ref cbx_focus = focus; cbx_focus->set_content_margin_all(Math::round(4 * scale)); - theme->set_stylebox("normal", "CheckBox", cbx_empty); + theme->set_stylebox(CoreStringName(normal), "CheckBox", cbx_empty); theme->set_stylebox(SceneStringName(pressed), "CheckBox", cbx_empty); theme->set_stylebox("disabled", "CheckBox", cbx_empty); theme->set_stylebox("hover", "CheckBox", cbx_empty); @@ -328,7 +328,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const Ref cb_empty = memnew(StyleBoxEmpty); cb_empty->set_content_margin_individual(Math::round(6 * scale), Math::round(4 * scale), Math::round(6 * scale), Math::round(4 * scale)); - theme->set_stylebox("normal", "CheckButton", cb_empty); + theme->set_stylebox(CoreStringName(normal), "CheckButton", cb_empty); theme->set_stylebox(SceneStringName(pressed), "CheckButton", cb_empty); theme->set_stylebox("disabled", "CheckButton", cb_empty); theme->set_stylebox("hover", "CheckButton", cb_empty); @@ -372,19 +372,19 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const Ref flat_button_pressed = button_pressed->duplicate(); flat_button_pressed->set_bg_color(style_pressed_color * Color(1, 1, 1, 0.85)); - theme->set_stylebox("normal", "FlatButton", flat_button_normal); + theme->set_stylebox(CoreStringName(normal), "FlatButton", flat_button_normal); theme->set_stylebox("hover", "FlatButton", flat_button_normal); theme->set_stylebox(SceneStringName(pressed), "FlatButton", flat_button_pressed); theme->set_stylebox("disabled", "FlatButton", flat_button_normal); - theme->set_stylebox("normal", "FlatMenuButton", flat_button_normal); + theme->set_stylebox(CoreStringName(normal), "FlatMenuButton", flat_button_normal); theme->set_stylebox("hover", "FlatMenuButton", flat_button_normal); theme->set_stylebox(SceneStringName(pressed), "FlatMenuButton", flat_button_pressed); theme->set_stylebox("disabled", "FlatMenuButton", flat_button_normal); // Label - theme->set_stylebox("normal", "Label", memnew(StyleBoxEmpty)); + theme->set_stylebox(CoreStringName(normal), "Label", memnew(StyleBoxEmpty)); theme->set_font("font", "Label", Ref()); theme->set_font_size("font_size", "Label", -1); @@ -413,7 +413,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // Add a line at the bottom to make LineEdits distinguishable from Buttons. style_line_edit->set_border_width(SIDE_BOTTOM, 2); style_line_edit->set_border_color(style_pressed_color); - theme->set_stylebox("normal", "LineEdit", style_line_edit); + theme->set_stylebox(CoreStringName(normal), "LineEdit", style_line_edit); theme->set_stylebox("focus", "LineEdit", focus); @@ -457,7 +457,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // TextEdit - theme->set_stylebox("normal", "TextEdit", style_line_edit); + theme->set_stylebox(CoreStringName(normal), "TextEdit", style_line_edit); theme->set_stylebox("focus", "TextEdit", focus); theme->set_stylebox("read_only", "TextEdit", style_line_edit_read_only); @@ -487,7 +487,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // CodeEdit - theme->set_stylebox("normal", "CodeEdit", style_line_edit); + theme->set_stylebox(CoreStringName(normal), "CodeEdit", style_line_edit); theme->set_stylebox("focus", "CodeEdit", focus); theme->set_stylebox("read_only", "CodeEdit", style_line_edit_read_only); theme->set_stylebox("completion", "CodeEdit", make_flat_stylebox(style_normal_color, 0, 0, 0, 0)); @@ -746,7 +746,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_type_variation("GraphNodeTitleLabel", "Label"); - theme->set_stylebox("normal", "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0)); + theme->set_stylebox(CoreStringName(normal), "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0)); theme->set_font("font", "GraphNodeTitleLabel", Ref()); theme->set_font_size("font_size", "GraphNodeTitleLabel", -1); theme->set_color("font_color", "GraphNodeTitleLabel", control_font_color); @@ -777,7 +777,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_type_variation("GraphFrameTitleLabel", "Label"); - theme->set_stylebox("normal", "GraphFrameTitleLabel", memnew(StyleBoxEmpty)); + theme->set_stylebox(CoreStringName(normal), "GraphFrameTitleLabel", memnew(StyleBoxEmpty)); theme->set_font_size("font_size", "GraphFrameTitleLabel", 22); theme->set_color("font_color", "GraphFrameTitleLabel", Color(1, 1, 1)); theme->set_color("font_shadow_color", "GraphFrameTitleLabel", Color(0, 0, 0, 0)); @@ -1050,7 +1050,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // ColorPickerButton theme->set_icon("bg", "ColorPickerButton", icons["mini_checkerboard"]); - theme->set_stylebox("normal", "ColorPickerButton", button_normal); + theme->set_stylebox(CoreStringName(normal), "ColorPickerButton", button_normal); theme->set_stylebox(SceneStringName(pressed), "ColorPickerButton", button_pressed); theme->set_stylebox("hover", "ColorPickerButton", button_hover); theme->set_stylebox("disabled", "ColorPickerButton", button_disabled); @@ -1101,7 +1101,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // RichTextLabel theme->set_stylebox("focus", "RichTextLabel", focus); - theme->set_stylebox("normal", "RichTextLabel", make_empty_stylebox(0, 0, 0, 0)); + theme->set_stylebox(CoreStringName(normal), "RichTextLabel", make_empty_stylebox(0, 0, 0, 0)); theme->set_font("normal_font", "RichTextLabel", Ref()); theme->set_font("bold_font", "RichTextLabel", bold_font);