diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-09-21 10:25:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-21 10:25:40 +0200 |
commit | 34c4c8046cb0d74878af879a9737d6878a75a464 (patch) | |
tree | 2847b83ed8329d6bf1c6ae9e7c84c8ac0e691031 /editor | |
parent | 5c76e638ab52b695ea6ec9fbdc5d1b66c5298995 (diff) | |
parent | 8f460bb73db00216f3b24a528d80314b5d632a16 (diff) |
Merge pull request #11221 from toger5/editor_spacing
added editor spacing
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_settings.cpp | 2 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 27 |
2 files changed, 20 insertions, 9 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index eb72fdf64b..59f0ce302e 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -584,6 +584,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("interface/theme/border_size", 1); set("interface/theme/use_graph_node_headers", false); hints["interface/theme/border_size"] = PropertyInfo(Variant::INT, "interface/theme/border_size", PROPERTY_HINT_RANGE, "0,2,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/theme/additional_spacing", 0); + hints["interface/theme/additional_spacing"] = PropertyInfo(Variant::REAL, "interface/theme/additional_spacing", PROPERTY_HINT_RANGE, "0,5,0.1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); set("interface/theme/custom_theme", ""); hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 4aa1ccaa81..a4f2368794 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -345,11 +345,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { style_default->set_draw_center(true); // Button and widgets - Ref<StyleBoxFlat> style_widget = style_default->duplicate(); + const float extra_spacing = EDITOR_DEF("interface/theme/additional_spacing", 0.0); + Ref<StyleBoxFlat> style_widget = style_default->duplicate(); + style_widget->set_default_margin(MARGIN_LEFT, (extra_spacing + 6) * EDSCALE); + style_widget->set_default_margin(MARGIN_TOP, (extra_spacing + default_margin_size) * EDSCALE); + style_widget->set_default_margin(MARGIN_RIGHT, (extra_spacing + 6) * EDSCALE); + style_widget->set_default_margin(MARGIN_BOTTOM, (extra_spacing + default_margin_size) * EDSCALE); style_widget->set_bg_color(dark_color_1); - style_widget->set_default_margin(MARGIN_LEFT, 6 * EDSCALE); - style_widget->set_default_margin(MARGIN_RIGHT, 6 * EDSCALE); style_widget->set_border_color_all(dark_color_2); Ref<StyleBoxFlat> style_widget_disabled = style_widget->duplicate(); @@ -381,7 +384,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Tabs const int tab_default_margin_side = 10 * EDSCALE; - Ref<StyleBoxFlat> style_tab_selected = style_default->duplicate(); + Ref<StyleBoxFlat> style_tab_selected = style_widget->duplicate(); style_tab_selected->set_border_width_all(border_width); style_tab_selected->set_border_width(MARGIN_BOTTOM, 0); style_tab_selected->set_border_color_all(dark_color_3); @@ -404,7 +407,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("Focus", "EditorStyles", style_focus); // Menu - Ref<StyleBoxEmpty> style_menu = style_empty; + Ref<StyleBoxFlat> style_menu = style_widget->duplicate(); + style_menu->set_draw_center(false); + style_menu->set_border_width_all(0); theme->set_stylebox("panel", "PanelContainer", style_menu); theme->set_stylebox("MenuPanel", "EditorStyles", style_menu); @@ -416,13 +421,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty); //make_stylebox(theme->get_icon("GuiPlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4)); //MenuButton - Ref<StyleBoxFlat> style_menu_hover_border = style_default->duplicate(); + Ref<StyleBoxFlat> style_menu_hover_border = style_widget->duplicate(); style_menu_hover_border->set_draw_center(false); style_menu_hover_border->set_border_width_all(0); style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width); style_menu_hover_border->set_border_color_all(accent_color); - Ref<StyleBoxFlat> style_menu_hover_bg = style_default->duplicate(); + Ref<StyleBoxFlat> style_menu_hover_bg = style_widget->duplicate(); style_menu_hover_bg->set_border_width_all(0); style_menu_hover_bg->set_bg_color(dark_color_1); @@ -517,7 +522,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons")); theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); - + theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size) * EDSCALE); // Tree & ItemList background Ref<StyleBoxFlat> style_tree_bg = style_default->duplicate(); style_tree_bg->set_bg_color(dark_color_1); @@ -537,6 +542,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("custom_button_font_highlight", "Tree", font_color_hl); theme->set_color("font_color", "Tree", font_color); theme->set_color("font_color_selected", "Tree", font_color); + theme->set_constant("vseparation", "Tree", (extra_spacing + default_margin_size) * EDSCALE); Ref<StyleBoxFlat> style_tree_btn = style_default->duplicate(); style_tree_btn->set_bg_color(contrast_color_1); @@ -592,7 +598,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("selected", "ItemList", style_tree_selected); theme->set_stylebox("bg_focus", "ItemList", style_focus); theme->set_stylebox("bg", "ItemList", style_itemlist_bg); - theme->set_constant("vseparation", "ItemList", 5 * EDSCALE); + theme->set_constant("vseparation", "ItemList", (extra_spacing + default_margin_size) * EDSCALE); theme->set_color("font_color", "ItemList", font_color); // Tabs & TabContainer @@ -840,6 +846,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_icon("resizer", "GraphNode", theme->get_icon("GuiResizer", "EditorIcons")); theme->set_icon("port", "GraphNode", theme->get_icon("GuiGraphNodePort", "EditorIcons")); + // GridContainer + theme->set_constant("vseperation", "GridContainer", (extra_spacing + default_margin_size) * EDSCALE); + // FileDialog theme->set_color("files_disabled", "FileDialog", font_color_disabled); |