From 5748fcd4bdcfd17e022da3de730578e3fb63f9df Mon Sep 17 00:00:00 2001 From: volzhs Date: Wed, 6 Jun 2018 06:18:11 +0900 Subject: [PATCH] Show opened script or help name --- editor/plugins/script_editor_plugin.cpp | 17 +++++++++++------ editor/plugins/script_editor_plugin.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d4e8bced9f67..431b0604b0ea 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1542,18 +1542,18 @@ void ScriptEditor::_update_members_overview_visibility() { ScriptEditorBase *se = _get_current_editor(); if (!se) { - members_overview_buttons_hbox->set_visible(false); + members_overview_alphabeta_sort_button->set_visible(false); members_overview->set_visible(false); overview_vbox->set_visible(false); return; } if (members_overview_enabled && se->show_members_overview()) { - members_overview_buttons_hbox->set_visible(true); + members_overview_alphabeta_sort_button->set_visible(true); members_overview->set_visible(true); overview_vbox->set_visible(true); } else { - members_overview_buttons_hbox->set_visible(false); + members_overview_alphabeta_sort_button->set_visible(false); members_overview->set_visible(false); overview_vbox->set_visible(false); } @@ -1582,7 +1582,7 @@ void ScriptEditor::_update_members_overview() { members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1); } - String path = se->get_edited_resource()->get_path(); + String path = se->get_edited_script()->get_path(); bool built_in = !path.is_resource_file(); String name = built_in ? path.get_file() : se->get_name(); filename->set_text(name); @@ -1604,9 +1604,8 @@ void ScriptEditor::_update_help_overview_visibility() { } if (help_overview_enabled) { - members_overview_buttons_hbox->set_visible(false); + members_overview_alphabeta_sort_button->set_visible(false); help_overview->set_visible(true); - overview_vbox->set_visible(true); filename->set_text(se->get_name()); } else { help_overview->set_visible(false); @@ -2946,6 +2945,12 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { members_overview_buttons_hbox = memnew(HBoxContainer); members_overview_vbox->add_child(members_overview_buttons_hbox); + filename = memnew(Label); + filename->set_clip_text(true); + filename->set_h_size_flags(SIZE_EXPAND_FILL); + filename->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit")); + members_overview_buttons_hbox->add_child(filename); + members_overview_alphabeta_sort_button = memnew(ToolButton); members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list.")); members_overview_alphabeta_sort_button->set_toggle_mode(true); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 990fb8296248..5adb73e798c3 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -207,6 +207,7 @@ class ScriptEditor : public PanelContainer { ItemList *members_overview; VBoxContainer *members_overview_vbox; HBoxContainer *members_overview_buttons_hbox; + Label *filename; ToolButton *members_overview_alphabeta_sort_button; bool members_overview_enabled; ItemList *help_overview;