editor: update helps and script panel on theme could change.

This commit is contained in:
toger5 2017-07-26 16:02:53 +02:00
parent 2bff914512
commit 3b2a4cc52a
4 changed files with 75 additions and 51 deletions

View File

@ -1621,12 +1621,18 @@ void EditorHelp::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
//forward->set_icon(get_icon("Forward","EditorIcons")); //forward->set_icon(get_icon("Forward","EditorIcons"));
//back->set_icon(get_icon("Back","EditorIcons")); //back->set_icon(get_icon("Back","EditorIcons"));
_update_doc(); _update_doc();
} break; } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
style->set_bg_color(EditorSettings::get_singleton()->get("text_editor/highlighting/background_color"));
background_panel->add_style_override("panel", style);
} break;
default: break;
} }
} }
@ -1695,14 +1701,14 @@ EditorHelp::EditorHelp() {
//class_list->set_selection_enabled(true); //class_list->set_selection_enabled(true);
{ {
Panel *pc = memnew(Panel); background_panel = memnew(Panel);
Ref<StyleBoxFlat> style(memnew(StyleBoxFlat)); Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
style->set_bg_color(EditorSettings::get_singleton()->get("text_editor/highlighting/background_color")); style->set_bg_color(EditorSettings::get_singleton()->get("text_editor/highlighting/background_color"));
pc->set_v_size_flags(SIZE_EXPAND_FILL); background_panel->set_v_size_flags(SIZE_EXPAND_FILL);
pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit")); background_panel->add_style_override("panel", style); //get_stylebox("normal","TextEdit"));
vbc->add_child(pc); vbc->add_child(background_panel);
class_desc = memnew(RichTextLabel); class_desc = memnew(RichTextLabel);
pc->add_child(class_desc); background_panel->add_child(class_desc);
class_desc->set_area_as_parent_rect(8); class_desc->set_area_as_parent_rect(8);
class_desc->connect("meta_clicked", this, "_class_desc_select"); class_desc->connect("meta_clicked", this, "_class_desc_select");
class_desc->connect("gui_input", this, "_class_desc_input"); class_desc->connect("gui_input", this, "_class_desc_input");

View File

@ -129,6 +129,7 @@ class EditorHelp : public VBoxContainer {
HSplitContainer *h_split; HSplitContainer *h_split;
static DocData *doc; static DocData *doc;
Panel *background_panel;
ConfirmationDialog *search_dialog; ConfirmationDialog *search_dialog;
LineEdit *search; LineEdit *search;

View File

@ -143,7 +143,7 @@ Ref<Theme> create_editor_theme() {
Color light_color_1 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast); Color light_color_1 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast);
Color light_color_2 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast * 1.5); Color light_color_2 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast * 1.5);
const int border_width = MIN(border_size, 3) * EDSCALE; const int border_width = CLAMP(border_size, 0, 3) * EDSCALE;
Color title_color_hl = base_color; Color title_color_hl = base_color;
if (highlight_tabs) if (highlight_tabs)

View File

@ -211,9 +211,11 @@ void ScriptEditorQuickOpen::_confirmed() {
void ScriptEditorQuickOpen::_notification(int p_what) { void ScriptEditorQuickOpen::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
connect("confirmed", this, "_confirmed"); connect("confirmed", this, "_confirmed");
} break;
} }
} }
@ -1064,7 +1066,9 @@ void ScriptEditor::_tab_changed(int p_which) {
void ScriptEditor::_notification(int p_what) { void ScriptEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
editor->connect("play_pressed", this, "_editor_play"); editor->connect("play_pressed", this, "_editor_play");
editor->connect("pause_pressed", this, "_editor_pause"); editor->connect("pause_pressed", this, "_editor_pause");
@ -1092,30 +1096,43 @@ void ScriptEditor::_notification(int p_what) {
script_forward->set_icon(get_icon("Forward", "EditorIcons")); script_forward->set_icon(get_icon("Forward", "EditorIcons"));
script_back->set_icon(get_icon("Back", "EditorIcons")); script_back->set_icon(get_icon("Back", "EditorIcons"));
} } break;
if (p_what == NOTIFICATION_READY) { case NOTIFICATION_READY: {
get_tree()->connect("tree_changed", this, "_tree_changed"); get_tree()->connect("tree_changed", this, "_tree_changed");
editor->connect("request_help", this, "_request_help"); editor->connect("request_help", this, "_request_help");
editor->connect("request_help_search", this, "_help_search"); editor->connect("request_help_search", this, "_help_search");
editor->connect("request_help_index", this, "_help_index"); editor->connect("request_help_index", this, "_help_index");
} } break;
if (p_what == NOTIFICATION_EXIT_TREE) { case NOTIFICATION_EXIT_TREE: {
editor->disconnect("play_pressed", this, "_editor_play"); editor->disconnect("play_pressed", this, "_editor_play");
editor->disconnect("pause_pressed", this, "_editor_pause"); editor->disconnect("pause_pressed", this, "_editor_pause");
editor->disconnect("stop_pressed", this, "_editor_stop"); editor->disconnect("stop_pressed", this, "_editor_stop");
} } break;
if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) { case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
_test_script_times_on_disk(); _test_script_times_on_disk();
_update_modified_scripts_for_external_editor(); _update_modified_scripts_for_external_editor();
} } break;
if (p_what == NOTIFICATION_PROCESS) { case NOTIFICATION_PROCESS: {
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
tab_container->add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
Ref<StyleBox> sb = editor->get_gui_base()->get_stylebox("panel", "TabContainer")->duplicate();
sb->set_default_margin(MARGIN_TOP, 0);
add_style_override("panel", sb);
} break;
default:
break;
} }
} }