diff options
author | groud <gilles.roudiere@gmail.com> | 2018-11-03 18:36:59 +0100 |
---|---|---|
committer | groud <gilles.roudiere@gmail.com> | 2018-11-03 18:37:57 +0100 |
commit | a821de2275088ce6d4f91551459ce5bc36e21146 (patch) | |
tree | d5d379e2f084214963d2af2d09947a8cf1c7eb62 | |
parent | 121cead38e5ea84ec22139df02eee56d822290b7 (diff) |
Hide some RMB options in the filesystem dock when files are searched
-rw-r--r-- | editor/filesystem_dock.cpp | 15 | ||||
-rw-r--r-- | editor/filesystem_dock.h | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 22910074f2..bab51202dc 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1968,7 +1968,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori return; } -void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths) { +void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) { // Add options for files and folders ERR_FAIL_COND(p_paths.empty()) @@ -2055,9 +2055,11 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str if (p_paths.size() == 1) { p_popup->add_separator(); - p_popup->add_item(TTR("New Folder..."), FILE_NEW_FOLDER); - p_popup->add_item(TTR("New Script..."), FILE_NEW_SCRIPT); - p_popup->add_item(TTR("New Resource..."), FILE_NEW_RESOURCE); + if (p_display_path_dependent_options) { + p_popup->add_item(TTR("New Folder..."), FILE_NEW_FOLDER); + p_popup->add_item(TTR("New Script..."), FILE_NEW_SCRIPT); + p_popup->add_item(TTR("New Resource..."), FILE_NEW_RESOURCE); + } String fpath = p_paths[0]; String item_text = fpath.ends_with("/") ? TTR("Open in File Manager") : TTR("Show in File Manager"); @@ -2104,7 +2106,7 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) { if (!paths.empty()) { file_list_popup->clear(); file_list_popup->set_size(Size2(1, 1)); - _file_and_folders_fill_popup(file_list_popup, paths); + _file_and_folders_fill_popup(file_list_popup, paths, searched_string.length() == 0); file_list_popup->set_position(files->get_global_position() + p_pos); file_list_popup->popup(); } @@ -2112,6 +2114,9 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) { void FileSystemDock::_file_list_rmb_pressed(const Vector2 &p_pos) { // Right click on empty space for file list + if (searched_string.length() > 0) + return; + file_list_popup->clear(); file_list_popup->set_size(Size2(1, 1)); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index bf7306fc68..df6fa5f9d2 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -233,7 +233,7 @@ private: void _search_changed(const String &p_text, const Control *p_from); - void _file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths); + void _file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options = true); void _tree_rmb_select(const Vector2 &p_pos); void _file_list_rmb_select(int p_item, const Vector2 &p_pos); void _file_list_rmb_pressed(const Vector2 &p_pos); |