From 57fff67580981397420ab8be2b3121ca951f36b8 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Fri, 8 Sep 2017 15:39:41 -0500 Subject: [PATCH] Fixed some inconsistent styles, plus some cleanup --- editor/editor_help.cpp | 10 ++++++---- editor/editor_help.h | 1 - editor/editor_log.cpp | 25 +++++-------------------- editor/editor_log.h | 3 --- editor/editor_themes.cpp | 12 +++++++++--- 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 7fa2c53275e..696eda25364 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1709,6 +1709,10 @@ void EditorHelp::_notification(int p_what) { //forward->set_icon(get_icon("Forward","EditorIcons")); //back->set_icon(get_icon("Back","EditorIcons")); _update_doc(); + + class_desc->add_style_override("normal", class_desc->get_stylebox("code_normal", "RichTextLabel")); + class_desc->add_style_override("focus", class_desc->get_stylebox("code_focus", "RichTextLabel")); + } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { @@ -1784,12 +1788,10 @@ EditorHelp::EditorHelp() { //class_list->set_selection_enabled(true); { - background_panel = memnew(Panel); - background_panel->set_v_size_flags(SIZE_EXPAND_FILL); - vbc->add_child(background_panel); class_desc = memnew(RichTextLabel); - background_panel->add_child(class_desc); + vbc->add_child(class_desc); class_desc->set_area_as_parent_rect(); + class_desc->set_v_size_flags(SIZE_EXPAND_FILL); class_desc->add_color_override("selection_color", EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1))); class_desc->connect("meta_clicked", this, "_class_desc_select"); class_desc->connect("gui_input", this, "_class_desc_input"); diff --git a/editor/editor_help.h b/editor/editor_help.h index 30a535a5356..f937e4a7235 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -130,7 +130,6 @@ class EditorHelp : public VBoxContainer { HSplitContainer *h_split; static DocData *doc; - Panel *background_panel; ConfirmationDialog *search_dialog; LineEdit *search; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 35291f8f9ef..035819f5039 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -61,9 +61,6 @@ void EditorLog::_notification(int p_what) { //button->set_icon(get_icon("Console","EditorIcons")); } - if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - _override_logger_styles(); - } /*if (p_what==NOTIFICATION_DRAW) { @@ -129,7 +126,6 @@ void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) { void EditorLog::_bind_methods() { ClassDB::bind_method(D_METHOD("_clear_request"), &EditorLog::_clear_request); - ClassDB::bind_method("_override_logger_styles", &EditorLog::_override_logger_styles); //ClassDB::bind_method(D_METHOD("_dragged"),&EditorLog::_dragged ); ADD_SIGNAL(MethodInfo("clear_request")); } @@ -151,21 +147,15 @@ EditorLog::EditorLog() { clearbutton->set_text(TTR("Clear")); clearbutton->connect("pressed", this, "_clear_request"); - ec = memnew(Control); - vb->add_child(ec); - ec->set_custom_minimum_size(Size2(0, 180) * EDSCALE); - ec->set_v_size_flags(SIZE_EXPAND_FILL); - - pc = memnew(PanelContainer); - ec->add_child(pc); - pc->set_area_as_parent_rect(); - pc->connect("tree_entered", this, "_override_logger_styles"); - log = memnew(RichTextLabel); log->set_scroll_follow(true); log->set_selection_enabled(true); log->set_focus_mode(FOCUS_CLICK); - pc->add_child(log); + log->set_custom_minimum_size(Size2(0, 180) * EDSCALE); + log->set_area_as_parent_rect(); + log->set_v_size_flags(SIZE_EXPAND_FILL); + log->set_h_size_flags(SIZE_EXPAND_FILL); + vb->add_child(log); add_message(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur."); //log->add_text("Initialization Complete.\n"); //because it looks cool. @@ -183,10 +173,5 @@ void EditorLog::deinit() { remove_error_handler(&eh); } -void EditorLog::_override_logger_styles() { - - pc->add_style_override("panel", get_stylebox("normal", "TextEdit")); -} - EditorLog::~EditorLog() { } diff --git a/editor/editor_log.h b/editor/editor_log.h index fd919fd692a..e5516231409 100644 --- a/editor/editor_log.h +++ b/editor/editor_log.h @@ -50,8 +50,6 @@ class EditorLog : public VBoxContainer { RichTextLabel *log; HBoxContainer *title_hb; //PaneDrag *pd; - Control *ec; - PanelContainer *pc; static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type); @@ -66,7 +64,6 @@ class EditorLog : public VBoxContainer { protected: static void _bind_methods(); void _notification(int p_what); - void _override_logger_styles(); public: void add_message(const String &p_msg, bool p_error = false); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index bdfecfff10d..1903514ea64 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -698,6 +698,12 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("default_color", "RichTextLabel", rtl_font_color); theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); theme->set_stylebox("normal", "RichTextLabel", style_tree_bg); + Ref style_code = style_tree_bg->duplicate(); + style_code->set_bg_color(rtl_combined_bg_color); + theme->set_stylebox("code_normal", "RichTextLabel", style_code); + Ref style_code_focus = style_tree_focus->duplicate(); + style_code_focus->set_bg_color(rtl_combined_bg_color); + theme->set_stylebox("code_focus", "RichTextLabel", style_code_focus); // Panel theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4)); @@ -725,9 +731,9 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("font_color", "ProgressBar", font_color); // GraphEdit - theme->set_stylebox("bg", "GraphEdit", make_flat_stylebox(dark_color_2, 4, 4, 4, 4)); - theme->set_color("grid_major", "GraphEdit", Color(font_color.r, font_color.g, font_color.b, 0.2)); - theme->set_color("grid_minor", "GraphEdit", Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.2)); + theme->set_stylebox("bg", "GraphEdit", style_tree_bg); + theme->set_color("grid_major", "GraphEdit", Color(font_color.r, font_color.g, font_color.b, 0.1)); + theme->set_color("grid_minor", "GraphEdit", Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.05)); theme->set_icon("minus", "GraphEdit", theme->get_icon("ZoomLess", "EditorIcons")); theme->set_icon("more", "GraphEdit", theme->get_icon("ZoomMore", "EditorIcons")); theme->set_icon("reset", "GraphEdit", theme->get_icon("ZoomReset", "EditorIcons"));