From 98bdb56815fe6cdf6d75b0a65b8858501cc39c9b Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Sat, 5 Aug 2023 01:13:48 -0300 Subject: [PATCH] Further separate icon from text of buttons in both editor and default themes --- doc/classes/Button.xml | 2 +- doc/classes/ColorPickerButton.xml | 2 +- doc/classes/MenuButton.xml | 2 +- doc/classes/OptionButton.xml | 2 +- editor/editor_node.cpp | 1 - editor/editor_themes.cpp | 5 +---- editor/plugins/debugger_editor_plugin.cpp | 1 - scene/resources/default_theme/default_theme.cpp | 16 ++++++++-------- 8 files changed, 13 insertions(+), 18 deletions(-) diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index 6faefcbe0dd..25c71deb1fb 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -115,7 +115,7 @@ Icon modulate [Color] used when the [Button] is being pressed. - + The horizontal space between [Button]'s icon and text. Negative values will be treated as [code]0[/code] when used. diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 32ec27868a2..f6af188998c 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -74,7 +74,7 @@ Text [Color] used when the [ColorPickerButton] is being pressed. - + The horizontal space between [ColorPickerButton]'s icon and text. diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml index 8af233427c7..e3a707ba729 100644 --- a/doc/classes/MenuButton.xml +++ b/doc/classes/MenuButton.xml @@ -69,7 +69,7 @@ Text [Color] used when the [MenuButton] is being pressed. - + The horizontal space between [MenuButton]'s icon and text. Negative values will be treated as [code]0[/code] when used. diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 659f08d49ad..7737754fc68 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -262,7 +262,7 @@ The horizontal space between the arrow icon and the right edge of the button. - + The horizontal space between [OptionButton]'s icon and text. Negative values will be treated as [code]0[/code] when used. diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 10512abf6e3..dc8ad8e5d9f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -7853,7 +7853,6 @@ EditorNode::EditorNode() { log = memnew(EditorLog); Button *output_button = add_bottom_panel_item(TTR("Output"), log); - output_button->set_theme_type_variation("BottomPanelButton"); log->set_tool_button(output_button); center_split->connect("resized", callable_mp(this, &EditorNode::_vp_resized)); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 80cefecee29..910e154248a 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -914,7 +914,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("icon_pressed_color", "Button", icon_pressed_color); theme->set_color("icon_disabled_color", "Button", icon_disabled_color); - theme->set_constant("h_separation", "Button", 2 * EDSCALE); + theme->set_constant("h_separation", "Button", 4 * EDSCALE); theme->set_constant("outline_size", "Button", 0); const float ACTION_BUTTON_EXTRA_MARGIN = 32 * EDSCALE; @@ -1478,9 +1478,6 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("panel", "TabContainer", style_content_panel); // Bottom panel. - theme->set_type_variation("BottomPanelButton", "Button"); - // Add separation for the warning/error icon. - theme->set_constant("h_separation", "BottomPanelButton", 6 * EDSCALE); Ref style_bottom_panel = style_content_panel->duplicate(); style_bottom_panel->set_corner_radius_all(corner_radius * EDSCALE); theme->set_stylebox("BottomPanel", "EditorStyles", style_bottom_panel); diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp index 3c9bc991d3f..15829a55de6 100644 --- a/editor/plugins/debugger_editor_plugin.cpp +++ b/editor/plugins/debugger_editor_plugin.cpp @@ -54,7 +54,6 @@ DebuggerEditorPlugin::DebuggerEditorPlugin(PopupMenu *p_debug_menu) { EditorDebuggerNode *debugger = memnew(EditorDebuggerNode); Button *db = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Debugger"), debugger); - db->set_theme_type_variation("BottomPanelButton"); debugger->set_tool_button(db); // Main editor debug menu. diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index b6a1737acb4..d6b0fe797f2 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -183,7 +183,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("icon_focus_color", "Button", Color(1, 1, 1, 1)); theme->set_color("icon_disabled_color", "Button", Color(1, 1, 1, 0.4)); - theme->set_constant("h_separation", "Button", Math::round(2 * scale)); + theme->set_constant("h_separation", "Button", Math::round(4 * scale)); theme->set_constant("icon_max_width", "Button", 0); // MenuBar @@ -259,7 +259,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("font_disabled_color", "OptionButton", control_font_disabled_color); theme->set_color("font_outline_color", "OptionButton", Color(1, 1, 1)); - theme->set_constant("h_separation", "OptionButton", Math::round(2 * scale)); + theme->set_constant("h_separation", "OptionButton", Math::round(4 * scale)); theme->set_constant("arrow_margin", "OptionButton", Math::round(4 * scale)); theme->set_constant("outline_size", "OptionButton", 0); theme->set_constant("modulate_arrow", "OptionButton", false); @@ -282,7 +282,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("font_disabled_color", "MenuButton", Color(1, 1, 1, 0.3)); theme->set_color("font_outline_color", "MenuButton", Color(1, 1, 1)); - theme->set_constant("h_separation", "MenuButton", Math::round(3 * scale)); + theme->set_constant("h_separation", "MenuButton", Math::round(4 * scale)); theme->set_constant("outline_size", "MenuButton", 0); // CheckBox @@ -788,7 +788,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_constant("children_hl_line_width", "Tree", 1); theme->set_constant("parent_hl_line_margin", "Tree", 0); theme->set_constant("draw_guides", "Tree", 1); - theme->set_constant("scroll_border", "Tree", 4); + theme->set_constant("scroll_border", "Tree", Math::round(4 * scale)); theme->set_constant("scroll_speed", "Tree", 12); theme->set_constant("outline_size", "Tree", 0); theme->set_constant("icon_max_width", "Tree", 0); @@ -803,9 +803,9 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_stylebox("panel", "ItemList", make_flat_stylebox(style_normal_color)); theme->set_stylebox("focus", "ItemList", focus); - theme->set_constant("h_separation", "ItemList", 4); - theme->set_constant("v_separation", "ItemList", 2); - theme->set_constant("icon_margin", "ItemList", 4); + theme->set_constant("h_separation", "ItemList", Math::round(4 * scale)); + theme->set_constant("v_separation", "ItemList", Math::round(2 * scale)); + theme->set_constant("icon_margin", "ItemList", Math::round(4 * scale)); theme->set_constant("line_separation", "ItemList", Math::round(2 * scale)); theme->set_font("font", "ItemList", Ref()); @@ -1005,7 +1005,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("font_disabled_color", "ColorPickerButton", Color(0.9, 0.9, 0.9, 0.3)); theme->set_color("font_outline_color", "ColorPickerButton", Color(1, 1, 1)); - theme->set_constant("h_separation", "ColorPickerButton", Math::round(2 * scale)); + theme->set_constant("h_separation", "ColorPickerButton", Math::round(4 * scale)); theme->set_constant("outline_size", "ColorPickerButton", 0); // ColorPresetButton