diff options
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 078c1e9238..b8c1ba2e96 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -62,6 +62,7 @@ void ScriptEditorBase::_bind_methods() { ADD_SIGNAL(MethodInfo("go_to_help", PropertyInfo(Variant::STRING, "what"))); // TODO: This signal is no use for VisualScript. ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text"))); + ADD_SIGNAL(MethodInfo("replace_in_files_requested", PropertyInfo(Variant::STRING, "text"))); } static bool _is_built_in_script(Script *p_script) { @@ -1093,6 +1094,10 @@ void ScriptEditor::_menu_option(int p_option) { _on_find_in_files_requested(""); } break; + case REPLACE_IN_FILES: { + + _on_replace_in_files_requested(""); + } break; case SEARCH_HELP: { help_search_dialog->popup_dialog(); @@ -2196,6 +2201,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra se->connect("go_to_help", this, "_help_class_goto"); se->connect("request_save_history", this, "_save_history"); se->connect("search_in_files_requested", this, "_on_find_in_files_requested"); + se->connect("replace_in_files_requested", this, "_on_replace_in_files_requested"); //test for modification, maybe the script was not edited but was loaded @@ -3025,7 +3031,16 @@ void ScriptEditor::_script_changed() { void ScriptEditor::_on_find_in_files_requested(String text) { + find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::SEARCH_MODE); + find_in_files_dialog->set_search_text(text); + find_in_files_dialog->popup_centered_minsize(); +} + +void ScriptEditor::_on_replace_in_files_requested(String text) { + + find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::REPLACE_MODE); find_in_files_dialog->set_search_text(text); + find_in_files_dialog->set_replace_text(""); find_in_files_dialog->popup_centered_minsize(); } @@ -3078,6 +3093,7 @@ void ScriptEditor::_start_find_in_files(bool with_replace) { f->set_filter(find_in_files_dialog->get_filter()); find_in_files->set_with_replace(with_replace); + find_in_files->set_replace_text(find_in_files_dialog->get_replace_text()); find_in_files->start_search(); editor->make_bottom_panel_item_visible(find_in_files); @@ -3153,6 +3169,7 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_filter_methods_text_changed", &ScriptEditor::_filter_methods_text_changed); ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); ClassDB::bind_method("_on_find_in_files_requested", &ScriptEditor::_on_find_in_files_requested); + ClassDB::bind_method("_on_replace_in_files_requested", &ScriptEditor::_on_replace_in_files_requested); ClassDB::bind_method("_start_find_in_files", &ScriptEditor::_start_find_in_files); ClassDB::bind_method("_on_find_in_files_result_selected", &ScriptEditor::_on_find_in_files_result_selected); ClassDB::bind_method("_on_find_in_files_modified_files", &ScriptEditor::_on_find_in_files_modified_files); |