summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-03 23:00:45 +0200
committerGitHub <noreply@github.com>2019-05-03 23:00:45 +0200
commit84401e8cdf4f41fc0e804bf5410622e75a08c0f5 (patch)
treec71a1a1144d344c3d078793a3eb0a11fc3e827a8
parenta5dfb3ae5dccfb5874d4ac4d952fee7612817594 (diff)
parent52651509f0fa3db5b514606742ec015e7c6de43f (diff)
Merge pull request #28629 from YeldhamDev/findfiles_always_available
Make "Find in Files" always available in the script editor
-rw-r--r--editor/plugins/script_editor_plugin.cpp22
-rw-r--r--editor/plugins/script_editor_plugin.h1
2 files changed, 19 insertions, 4 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 0982da784f..92579e5cef 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -603,6 +603,8 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
idx = history[history_pos].control->get_index();
}
tab_container->set_current_tab(idx);
+ } else {
+ _update_selected_editor_menu();
}
_update_history_arrows();
@@ -1002,6 +1004,9 @@ void ScriptEditor::_menu_option(int p_option) {
save_all_scripts();
} break;
+ case SEARCH_IN_FILES: {
+ _on_find_in_files_requested("");
+ } break;
case SEARCH_HELP: {
help_search_dialog->popup_dialog();
@@ -2694,10 +2699,22 @@ void ScriptEditor::_update_selected_editor_menu() {
}
EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_current_tab_control());
+ script_search_menu->get_popup()->clear();
if (eh) {
+
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
+ script_search_menu->get_popup()->add_separator();
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES);
script_search_menu->show();
} else {
- script_search_menu->hide();
+
+ if (tab_container->get_child_count() == 0) {
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES);
+ script_search_menu->show();
+ } else {
+ script_search_menu->hide();
+ }
}
}
@@ -3109,10 +3126,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_search_menu->set_text(TTR("Search"));
script_search_menu->set_switch_on_hover(true);
script_search_menu->get_popup()->set_hide_on_window_lose_focus(true);
- script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
- script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
script_search_menu->get_popup()->connect("id_pressed", this, "_menu_option");
- script_search_menu->hide();
debug_menu = memnew(MenuButton);
menu_hb->add_child(debug_menu);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index a17fed1e06..683fa881f8 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -157,6 +157,7 @@ class ScriptEditor : public PanelContainer {
DEBUG_SHOW,
DEBUG_SHOW_KEEP_OPEN,
DEBUG_WITH_EXTERNAL_EDITOR,
+ SEARCH_IN_FILES,
SEARCH_HELP,
SEARCH_WEBSITE,
REQUEST_DOCS,