Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further separate icon from text of buttons in both editor and default themes #80285

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/classes/Button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<theme_item name="icon_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Icon modulate [Color] used when the [Button] is being pressed.
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="2">
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The horizontal space between [Button]'s icon and text. Negative values will be treated as [code]0[/code] when used.
</theme_item>
<theme_item name="icon_max_width" data_type="constant" type="int" default="0">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/ColorPickerButton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(0.8, 0.8, 0.8, 1)">
Text [Color] used when the [ColorPickerButton] is being pressed.
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="2">
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The horizontal space between [ColorPickerButton]'s icon and text.
</theme_item>
<theme_item name="outline_size" data_type="constant" type="int" default="0">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/MenuButton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [MenuButton] is being pressed.
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="3">
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The horizontal space between [MenuButton]'s icon and text. Negative values will be treated as [code]0[/code] when used.
</theme_item>
<theme_item name="outline_size" data_type="constant" type="int" default="0">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/OptionButton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
<theme_item name="arrow_margin" data_type="constant" type="int" default="4">
The horizontal space between the arrow icon and the right edge of the button.
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="2">
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The horizontal space between [OptionButton]'s icon and text. Negative values will be treated as [code]0[/code] when used.
</theme_item>
<theme_item name="modulate_arrow" data_type="constant" type="int" default="0">
Expand Down
1 change: 0 additions & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
5 changes: 1 addition & 4 deletions editor/editor_themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> 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;
Expand Down Expand Up @@ -1478,9 +1478,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> 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<StyleBoxFlat> 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);
Expand Down
1 change: 0 additions & 1 deletion editor/plugins/debugger_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions scene/resources/default_theme/default_theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &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
Expand Down Expand Up @@ -259,7 +259,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &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);
Expand All @@ -282,7 +282,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &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
Expand Down Expand Up @@ -788,7 +788,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &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);
Expand All @@ -803,9 +803,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &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<Font>());
Expand Down Expand Up @@ -1005,7 +1005,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &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
Expand Down
Loading