Skip to content

Commit

Permalink
Merge pull request #91953 from AThousandShips/use_normal_sname
Browse files Browse the repository at this point in the history
Use `CoreStringNames::normal` in more places
  • Loading branch information
akien-mga committed May 31, 2024
2 parents b201c08 + cade5b8 commit 9c87e8c
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 69 deletions.
4 changes: 2 additions & 2 deletions editor/connections_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,10 @@ void ConnectDialog::_notification(int p_what) {
type_list->set_item_icon(i, get_editor_theme_icon(type_name));
}

Ref<StyleBox> style = get_theme_stylebox("normal", "LineEdit")->duplicate();
Ref<StyleBox> 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"));
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_audio_buses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Control>(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);

Expand Down
2 changes: 1 addition & 1 deletion editor/editor_feature_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
// Add some spacing above the help label.
Ref<StyleBoxEmpty> 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);
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void EditorHelp::_class_desc_resized(bool p_force_update_theme) {
Ref<StyleBox> 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);
}
}
Expand Down Expand Up @@ -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<StyleBox> style = content->get_theme_stylebox("normal");
const Ref<StyleBox> 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);
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ void EditorNode::_update_theme(bool p_skip_creation) {
scene_root_parent->add_theme_style_override(SceneStringName(panel), theme->get_stylebox(SNAME("Content"), EditorStringName(EditorStyles)));
bottom_panel->add_theme_style_override(SceneStringName(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)));
Expand Down
2 changes: 1 addition & 1 deletion editor/gui/editor_spin_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion editor/gui/editor_zoom_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ EditorZoomWidget::EditorZoomWidget() {
zoom_reset->set_flat(true);

Ref<StyleBoxEmpty> 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);
Expand Down
2 changes: 1 addition & 1 deletion editor/import/3d/scene_import_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions editor/import_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/animation_player_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/asset_library_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/bit_map_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ BitMapEditor::BitMapEditor() {
Ref<StyleBoxEmpty> 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);
}

///////////////////////
Expand Down
10 changes: 5 additions & 5 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3044,15 +3044,15 @@ 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)));
view_menu->add_theme_style_override("disabled", gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles)));
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)));
Expand All @@ -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(SceneStringName(panel), gui_base->get_theme_stylebox(SNAME("Information3dViewport"), EditorStringName(EditorStyles)));
// Set a minimum width to prevent the width from changing all the time
Expand All @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/tiles/tile_set_atlas_source_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions editor/plugins/visual_shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down
Loading

0 comments on commit 9c87e8c

Please sign in to comment.