Merge pull request #10899 from toger5/theme_fixes_from_light

Theme fixes from light
This commit is contained in:
Rémi Verschelde 2017-09-04 23:14:18 +02:00 committed by GitHub
commit 431de234e4
3 changed files with 32 additions and 14 deletions

View file

@ -283,13 +283,22 @@ void EditorNode::_notification(int p_what) {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
Ref<Theme> theme = create_editor_theme(theme_base->get_theme());
theme_base->set_theme(theme);
gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
scene_tabs->add_style_override("tab_fg", gui_base->get_stylebox("SceneTabFG", "EditorStyles"));
scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles"));
file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
if (bool(EDITOR_DEF("interface/scene_tabs/resize_if_many_tabs", true))) {
scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
} else {
@ -4841,9 +4850,10 @@ EditorNode::EditorNode() {
}
file_menu = memnew(MenuButton);
file_menu->set_flat(false);
file_menu->set_text(TTR("Scene"));
left_menu_hb->add_child(file_menu);
file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(file_menu);
prev_scene = memnew(ToolButton);
prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons"));
@ -4931,6 +4941,7 @@ EditorNode::EditorNode() {
p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
project_menu = memnew(MenuButton);
project_menu->set_flat(false);
project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
project_menu->set_text(TTR("Project"));
project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
@ -4964,9 +4975,11 @@ EditorNode::EditorNode() {
menu_hb->add_child(editor_region);
debug_menu = memnew(MenuButton);
debug_menu->set_flat(false);
debug_menu->set_text(TTR("Debug"));
debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(debug_menu);
p = debug_menu->get_popup();
p->set_hide_on_item_selection(false);
p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
@ -4988,9 +5001,10 @@ EditorNode::EditorNode() {
menu_hb->add_spacer();
settings_menu = memnew(MenuButton);
left_menu_hb->add_child(settings_menu);
settings_menu->set_flat(false);
settings_menu->set_text(TTR("Editor"));
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(settings_menu);
p = settings_menu->get_popup();
p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
@ -5005,10 +5019,12 @@ EditorNode::EditorNode() {
p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
// Help Menu
MenuButton *help_menu = memnew(MenuButton);
left_menu_hb->add_child(help_menu);
help_menu = memnew(MenuButton);
help_menu->set_flat(false);
help_menu->set_text(TTR("Help"));
help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(help_menu);
p = help_menu->get_popup();
p->connect("id_pressed", this, "_menu_option");
p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES);

View file

@ -236,11 +236,12 @@ private:
MenuButton *file_menu;
MenuButton *project_menu;
MenuButton *debug_menu;
MenuButton *settings_menu;
MenuButton *help_menu;
PopupMenu *tool_menu;
ToolButton *export_button;
ToolButton *prev_scene;
MenuButton *object_menu;
MenuButton *settings_menu;
ToolButton *play_button;
MenuButton *native_play_button;
ToolButton *pause_button;

View file

@ -237,8 +237,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 1.5);
Color dark_color_3 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 2);
Color contrast_color_1 = base_color.linear_interpolate((dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)), 0.3);
Color contrast_color_2 = base_color.linear_interpolate((dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)), 0.5);
Color contrast_color_1 = base_color.linear_interpolate((dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)), MAX(contrast, default_contrast));
Color contrast_color_2 = base_color.linear_interpolate((dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)), MAX(contrast * 1.5, default_contrast * 1.5));
Color font_color = dark_theme ? Color(1, 1, 1) : Color(0, 0, 0);
Color font_color_disabled = dark_theme ? Color(0.6, 0.6, 0.6) : Color(0.45, 0.45, 0.45);
@ -303,12 +303,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_menu_hover_bg = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
style_menu_hover_border->set_draw_center(false);
style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width);
style_menu_hover_border->set_border_width(MARGIN_BOTTOM, 2 * EDSCALE);
style_menu_hover_border->set_border_color_all(highlight_color);
style_menu_hover_border->set_expand_margin_size(MARGIN_BOTTOM, border_width);
theme->set_stylebox("normal", "MenuButton", style_menu);
theme->set_stylebox("hover", "MenuButton", style_menu_hover_border);
theme->set_stylebox("hover", "MenuButton", style_menu);
theme->set_stylebox("pressed", "MenuButton", style_menu);
theme->set_stylebox("focus", "MenuButton", style_menu);
theme->set_stylebox("disabled", "MenuButton", style_menu);
@ -358,6 +357,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("pressed", "Button", change_border_color(style_button_type, highlight_color));
theme->set_stylebox("focus", "Button", change_border_color(style_button_type, highlight_color));
theme->set_stylebox("disabled", "Button", style_button_type_disabled);
theme->set_color("font_color", "Button", button_font_color);
theme->set_color("font_color_hover", "Button", HIGHLIGHT_COLOR_FONT);
theme->set_color("font_color_pressed", "Button", highlight_color);
@ -367,13 +367,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("icon_color_pressed", "Button", Color(highlight_color.r * 1.15, highlight_color.g * 1.15, highlight_color.b * 1.15, highlight_color.a));
// OptionButton
Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
style_option_button->set_border_width_all(border_width);
theme->set_stylebox("normal", "OptionButton", style_button_type);
theme->set_stylebox("hover", "OptionButton", change_border_color(style_button_type, contrast_color_1));
theme->set_stylebox("pressed", "OptionButton", change_border_color(style_button_type, HIGHLIGHT_COLOR_FONT));
theme->set_stylebox("focus", "OptionButton", change_border_color(style_button_type, highlight_color));
theme->set_stylebox("disabled", "OptionButton", style_button_type_disabled);
theme->set_stylebox("normal", "OptionButton", style_button_type);
theme->set_color("font_color", "OptionButton", button_font_color);
theme->set_color("font_color_hover", "OptionButton", HIGHLIGHT_COLOR_FONT);
theme->set_color("font_color_pressed", "OptionButton", highlight_color);
@ -386,6 +385,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// CheckButton
theme->set_icon("on", "CheckButton", theme->get_icon("GuiToggleOn", "EditorIcons"));
theme->set_icon("off", "CheckButton", theme->get_icon("GuiToggleOff", "EditorIcons"));
theme->set_color("font_color", "CheckButton", button_font_color);
theme->set_color("font_color_hover", "CheckButton", HIGHLIGHT_COLOR_FONT);
theme->set_color("font_color_pressed", "CheckButton", highlight_color);
@ -436,7 +436,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("custom_button_pressed", "Tree", make_empty_stylebox());
theme->set_stylebox("custom_button_hover", "Tree", style_button_type);
theme->set_color("custom_button_font_highlight", "Tree", HIGHLIGHT_COLOR_FONT);
theme->set_color("font_color", "Tree", font_color_disabled);
theme->set_color("font_color", "Tree", font_color);
theme->set_color("font_color_selected", "Tree", font_color);
Ref<StyleBox> style_tree_btn = make_flat_stylebox(contrast_color_1, 2, 4, 2, 4);
@ -526,6 +526,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// LineEdit
Ref<StyleBoxFlat> style_line_edit = make_flat_stylebox(dark_color_1, 6, 4, 6, 4);
style_line_edit->set_border_width_all(border_width);
style_line_edit = change_border_color(style_line_edit, contrast_color_1);
Ref<StyleBoxFlat> style_line_edit_disabled = change_border_color(style_line_edit, dark_color_1);
style_line_edit_disabled->set_bg_color(Color(0, 0, 0, .1));