Skip to content

Commit

Permalink
Merge pull request #80285 from YeldhamDev/just_a_little_bit
Browse files Browse the repository at this point in the history
Further separate icon from text of buttons in both editor and default themes
  • Loading branch information
akien-mga committed Aug 9, 2023
2 parents 75c979e + 98bdb56 commit f6b9d44
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
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 @@ -7856,7 +7856,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 @@ -1479,9 +1479,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

0 comments on commit f6b9d44

Please sign in to comment.