Show opened script or help name

This commit is contained in:
volzhs 2018-06-06 06:18:11 +09:00
parent 255d6470ee
commit 69ac6a1f3d
2 changed files with 17 additions and 4 deletions

View file

@ -1404,16 +1404,16 @@ 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);
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);
} else {
members_overview_buttons_hbox->set_visible(false);
members_overview_alphabeta_sort_button->set_visible(false);
members_overview->set_visible(false);
}
}
@ -1440,6 +1440,11 @@ void ScriptEditor::_update_members_overview() {
members_overview->add_item(functions[i].get_slice(":", 0));
members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1);
}
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);
}
void ScriptEditor::_update_help_overview_visibility() {
@ -1458,8 +1463,9 @@ 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);
filename->set_text(se->get_name());
} else {
help_overview->set_visible(false);
}
@ -2681,6 +2687,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);

View file

@ -201,6 +201,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;