diff options
Diffstat (limited to 'editor/plugins/text_editor.cpp')
-rw-r--r-- | editor/plugins/text_editor.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 0cef5a8b6f..a8b6d74c1f 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -163,7 +163,7 @@ String TextEditor::get_name() { return name; } -Ref<Texture> TextEditor::get_icon() { +Ref<Texture2D> TextEditor::get_icon() { return EditorNode::get_singleton()->get_object_icon(text_file.operator->(), ""); } @@ -185,7 +185,7 @@ void TextEditor::set_edited_resource(const RES &p_res) { code_editor->update_line_and_column(); } -void TextEditor::add_callback(const String &p_function, PoolStringArray p_args) { +void TextEditor::add_callback(const String &p_function, PackedStringArray p_args) { } void TextEditor::set_debugger_active(bool p_active) { @@ -491,6 +491,12 @@ void TextEditor::_edit_option(int p_op) { // So this will be delegated to the ScriptEditor. emit_signal("search_in_files_requested", selected_text); } break; + case REPLACE_IN_FILES: { + + String selected_text = code_editor->get_text_edit()->get_selection_text(); + + emit_signal("replace_in_files_requested", selected_text); + } break; case SEARCH_GOTO_LINE: { goto_line_dialog->popup_find_line(tx); @@ -627,19 +633,19 @@ TextEditor::TextEditor() { code_editor = memnew(CodeTextEditor); add_child(code_editor); code_editor->add_constant_override("separation", 0); - code_editor->connect("load_theme_settings", this, "_load_theme_settings"); - code_editor->connect("validate_script", this, "_validate_script"); + code_editor->connect_compat("load_theme_settings", this, "_load_theme_settings"); + code_editor->connect_compat("validate_script", this, "_validate_script"); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); code_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); update_settings(); code_editor->get_text_edit()->set_context_menu_enabled(false); - code_editor->get_text_edit()->connect("gui_input", this, "_text_edit_gui_input"); + code_editor->get_text_edit()->connect_compat("gui_input", this, "_text_edit_gui_input"); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect("id_pressed", this, "_edit_option"); + context_menu->connect_compat("id_pressed", this, "_edit_option"); edit_hb = memnew(HBoxContainer); @@ -647,7 +653,7 @@ TextEditor::TextEditor() { edit_hb->add_child(search_menu); search_menu->set_text(TTR("Search")); search_menu->set_switch_on_hover(true); - search_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + search_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); @@ -655,12 +661,13 @@ TextEditor::TextEditor() { search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE); search_menu->get_popup()->add_separator(); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES); + search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES); edit_menu = memnew(MenuButton); edit_hb->add_child(edit_menu); edit_menu->set_text(TTR("Edit")); edit_menu->set_switch_on_hover(true); - edit_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + edit_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO); @@ -693,7 +700,7 @@ TextEditor::TextEditor() { convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase")), EDIT_TO_UPPERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase")), EDIT_TO_LOWERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE); - convert_case->connect("id_pressed", this, "_edit_option"); + convert_case->connect_compat("id_pressed", this, "_edit_option"); highlighters["Standard"] = NULL; highlighter_menu = memnew(PopupMenu); @@ -701,24 +708,24 @@ TextEditor::TextEditor() { edit_menu->get_popup()->add_child(highlighter_menu); edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu"); highlighter_menu->add_radio_check_item(TTR("Standard")); - highlighter_menu->connect("id_pressed", this, "_change_syntax_highlighter"); + highlighter_menu->connect_compat("id_pressed", this, "_change_syntax_highlighter"); MenuButton *goto_menu = memnew(MenuButton); edit_hb->add_child(goto_menu); goto_menu->set_text(TTR("Go To")); goto_menu->set_switch_on_hover(true); - goto_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + goto_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); goto_menu->get_popup()->add_separator(); bookmarks_menu = memnew(PopupMenu); - bookmarks_menu->set_name(TTR("Bookmarks")); + bookmarks_menu->set_name("Bookmarks"); goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->connect("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect_compat("about_to_show", this, "_update_bookmark_list"); + bookmarks_menu->connect_compat("index_pressed", this, "_bookmark_item_pressed"); goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); |