From 8f311ca2754f2e35253f9c6b8175070ba188eac3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 18 Feb 2023 16:37:54 +0100 Subject: [PATCH] Prefix class names in the editor_script_editor module with `Editor`. Pt 1. --- editor/editor_resource_picker.cpp | 4 +- editor/scene_tree_editor.cpp | 4 +- .../editor_code_text_editor.cpp | 138 ++++++------ .../editor_code_text_editor.h | 20 +- .../editor_connection_info_dialog.cpp | 6 +- .../editor_connection_info_dialog.h | 6 +- .../editor_find_replace_bar.cpp | 82 ++++---- .../editor_find_replace_bar.h | 6 +- .../editor_goto_line_dialog.cpp | 8 +- .../editor_goto_line_dialog.h | 6 +- .../editor_script_editor.cpp | 138 ++++++------ .../editor_code_editor/editor_script_editor.h | 8 +- .../editor_script_editor_base.cpp | 2 +- .../editor_script_editor_base.h | 6 +- .../editor_script_editor_quick_open.cpp | 22 +- .../editor_script_editor_quick_open.h | 6 +- .../editor_script_text_editor.cpp | 198 +++++++++--------- .../editor_script_text_editor.h | 22 +- .../editor_code_editor/editor_text_editor.cpp | 14 +- .../editor_code_editor/editor_text_editor.h | 10 +- .../editor_code_editor/register_types.cpp | 6 +- .../script_editor_plugin.cpp | 2 +- .../shader_editor/shader_editor_plugin.cpp | 2 +- .../shader_editor/shader_editor_plugin.h | 6 +- .../text_editor_vanilla_editor.cpp | 2 +- .../text_editor/text_editor_vanilla_editor.h | 4 +- 26 files changed, 364 insertions(+), 364 deletions(-) diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index e3fd74109..b386e7f09 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -585,7 +585,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const { Ref res; if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED - ScriptEditorBase *se = Object::cast_to(drag_data["script_list_element"]); + EditorScriptEditorBase *se = Object::cast_to(drag_data["script_list_element"]); if (se) { res = se->get_edited_resource(); } @@ -656,7 +656,7 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_ Ref dropped_resource; if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED - ScriptEditorBase *se = Object::cast_to(drag_data["script_list_element"]); + EditorScriptEditorBase *se = Object::cast_to(drag_data["script_list_element"]); if (se) { dropped_resource = se->get_edited_resource(); } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 63f629319..88488b272 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -1132,7 +1132,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d if (String(d["type"]) == "script_list_element") { #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED - ScriptEditorBase *se = Object::cast_to(d["script_list_element"]); + EditorScriptEditorBase *se = Object::cast_to(d["script_list_element"]); if (se) { String sp = se->get_edited_resource()->get_path(); if (_is_script_type(EditorFileSystem::get_singleton()->get_file_type(sp))) { @@ -1185,7 +1185,7 @@ void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, if (String(d["type"]) == "script_list_element") { #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED - ScriptEditorBase *se = Object::cast_to(d["script_list_element"]); + EditorScriptEditorBase *se = Object::cast_to(d["script_list_element"]); if (se) { String sp = se->get_edited_resource()->get_path(); if (_is_script_type(EditorFileSystem::get_singleton()->get_file_type(sp))) { diff --git a/editor_modules/editor_code_editor/editor_code_text_editor.cpp b/editor_modules/editor_code_editor/editor_code_text_editor.cpp index a4ce7a070..0a8841b15 100644 --- a/editor_modules/editor_code_editor/editor_code_text_editor.cpp +++ b/editor_modules/editor_code_editor/editor_code_text_editor.cpp @@ -71,7 +71,7 @@ // This function should be used to handle shortcuts that could otherwise // be handled too late if they weren't handled here. -void CodeTextEditor::_input(const Ref &event) { +void EditorCodeTextEditor::_input(const Ref &event) { const Ref key_event = event; if (!key_event.is_valid() || !key_event->is_pressed()) { return; @@ -99,7 +99,7 @@ void CodeTextEditor::_input(const Ref &event) { } } -void CodeTextEditor::_text_editor_gui_input(const Ref &p_event) { +void EditorCodeTextEditor::_text_editor_gui_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid()) { @@ -145,23 +145,23 @@ void CodeTextEditor::_text_editor_gui_input(const Ref &p_event) { } } -void CodeTextEditor::_zoom_in() { +void EditorCodeTextEditor::_zoom_in() { font_resize_val += MAX(EDSCALE, 1.0f); _zoom_changed(); } -void CodeTextEditor::_zoom_out() { +void EditorCodeTextEditor::_zoom_out() { font_resize_val -= MAX(EDSCALE, 1.0f); _zoom_changed(); } -void CodeTextEditor::_zoom_changed() { +void EditorCodeTextEditor::_zoom_changed() { if (font_resize_timer->get_time_left() == 0) { font_resize_timer->start(); } } -void CodeTextEditor::_reset_zoom() { +void EditorCodeTextEditor::_reset_zoom() { Ref font = text_editor->get_theme_font("font"); // Reset source font size to default. if (font.is_valid()) { @@ -170,7 +170,7 @@ void CodeTextEditor::_reset_zoom() { } } -void CodeTextEditor::_line_col_changed() { +void EditorCodeTextEditor::_line_col_changed() { String line = text_editor->get_line(text_editor->cursor_get_line()); int positional_column = 0; @@ -190,7 +190,7 @@ void CodeTextEditor::_line_col_changed() { line_and_col_txt->set_text(sb.as_string()); } -void CodeTextEditor::_text_changed() { +void EditorCodeTextEditor::_text_changed() { if (text_editor->is_insert_text_operation()) { code_complete_timer->start(); } @@ -198,14 +198,14 @@ void CodeTextEditor::_text_changed() { idle->start(); } -void CodeTextEditor::_code_complete_timer_timeout() { +void EditorCodeTextEditor::_code_complete_timer_timeout() { if (!is_visible_in_tree()) { return; } text_editor->query_code_comple(); } -void CodeTextEditor::_complete_request() { +void EditorCodeTextEditor::_complete_request() { List entries; String ctext = text_editor->get_text_for_completion(); _code_complete_script(ctext, &entries); @@ -223,7 +223,7 @@ void CodeTextEditor::_complete_request() { text_editor->code_complete(entries, forced); } -Ref CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) { +Ref EditorCodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) { Ref tex; switch (p_option.kind) { case ScriptCodeCompletionOption::KIND_CLASS: { @@ -267,13 +267,13 @@ Ref CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOpti return tex; } -void CodeTextEditor::_font_resize_timeout() { +void EditorCodeTextEditor::_font_resize_timeout() { if (_add_font_size(font_resize_val)) { font_resize_val = 0; } } -bool CodeTextEditor::_add_font_size(int p_delta) { +bool EditorCodeTextEditor::_add_font_size(int p_delta) { Ref font = text_editor->get_theme_font("font"); if (font.is_valid()) { @@ -290,7 +290,7 @@ bool CodeTextEditor::_add_font_size(int p_delta) { } } -void CodeTextEditor::update_editor_settings() { +void EditorCodeTextEditor::update_editor_settings() { text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences")); text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line")); @@ -322,7 +322,7 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); } -void CodeTextEditor::trim_trailing_whitespace() { +void EditorCodeTextEditor::trim_trailing_whitespace() { bool trimed_whitespace = false; for (int i = 0; i < text_editor->get_line_count(); i++) { String line = text_editor->get_line(i); @@ -349,7 +349,7 @@ void CodeTextEditor::trim_trailing_whitespace() { } } -void CodeTextEditor::insert_final_newline() { +void EditorCodeTextEditor::insert_final_newline() { int final_line = text_editor->get_line_count() - 1; String line = text_editor->get_line(final_line); @@ -367,7 +367,7 @@ void CodeTextEditor::insert_final_newline() { } } -void CodeTextEditor::convert_indent_to_spaces() { +void EditorCodeTextEditor::convert_indent_to_spaces() { int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); String indent = ""; @@ -411,7 +411,7 @@ void CodeTextEditor::convert_indent_to_spaces() { } } -void CodeTextEditor::convert_indent_to_tabs() { +void EditorCodeTextEditor::convert_indent_to_tabs() { int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); indent_size -= 1; @@ -460,7 +460,7 @@ void CodeTextEditor::convert_indent_to_tabs() { } } -void CodeTextEditor::convert_case(CaseStyle p_case) { +void EditorCodeTextEditor::convert_case(CaseStyle p_case) { if (!text_editor->is_selection_active()) { return; } @@ -505,7 +505,7 @@ void CodeTextEditor::convert_case(CaseStyle p_case) { text_editor->end_complex_operation(); } -void CodeTextEditor::move_lines_up() { +void EditorCodeTextEditor::move_lines_up() { text_editor->begin_complex_operation(); if (text_editor->is_selection_active()) { int from_line = text_editor->get_selection_from_line(); @@ -551,7 +551,7 @@ void CodeTextEditor::move_lines_up() { text_editor->update(); } -void CodeTextEditor::move_lines_down() { +void EditorCodeTextEditor::move_lines_down() { text_editor->begin_complex_operation(); if (text_editor->is_selection_active()) { int from_line = text_editor->get_selection_from_line(); @@ -597,7 +597,7 @@ void CodeTextEditor::move_lines_down() { text_editor->update(); } -void CodeTextEditor::_delete_line(int p_line) { +void EditorCodeTextEditor::_delete_line(int p_line) { // this is currently intended to be called within delete_lines() // so `begin_complex_operation` is omitted here text_editor->set_line(p_line, ""); @@ -612,7 +612,7 @@ void CodeTextEditor::_delete_line(int p_line) { text_editor->cursor_set_line(p_line); } -void CodeTextEditor::delete_lines() { +void EditorCodeTextEditor::delete_lines() { text_editor->begin_complex_operation(); if (text_editor->is_selection_active()) { int to_line = text_editor->get_selection_to_line(); @@ -630,7 +630,7 @@ void CodeTextEditor::delete_lines() { text_editor->end_complex_operation(); } -void CodeTextEditor::duplicate_selection() { +void EditorCodeTextEditor::duplicate_selection() { const int cursor_column = text_editor->cursor_get_column(); int from_line = text_editor->cursor_get_line(); int to_line = text_editor->cursor_get_line(); @@ -674,7 +674,7 @@ void CodeTextEditor::duplicate_selection() { text_editor->update(); } -void CodeTextEditor::toggle_inline_comment(const String &delimiter) { +void EditorCodeTextEditor::toggle_inline_comment(const String &delimiter) { text_editor->begin_complex_operation(); if (text_editor->is_selection_active()) { int begin = text_editor->get_selection_from_line(); @@ -751,33 +751,33 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) { text_editor->update(); } -void CodeTextEditor::goto_line(int p_line) { +void EditorCodeTextEditor::goto_line(int p_line) { text_editor->deselect(); text_editor->unfold_line(p_line); text_editor->call_deferred("cursor_set_line", p_line); } -void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) { +void EditorCodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) { text_editor->unfold_line(p_line); text_editor->call_deferred("cursor_set_line", p_line); text_editor->call_deferred("cursor_set_column", p_begin); text_editor->select(p_line, p_begin, p_line, p_end); } -void CodeTextEditor::goto_line_centered(int p_line) { +void EditorCodeTextEditor::goto_line_centered(int p_line) { goto_line(p_line); text_editor->call_deferred("center_viewport_to_cursor"); } -void CodeTextEditor::set_executing_line(int p_line) { +void EditorCodeTextEditor::set_executing_line(int p_line) { text_editor->set_executing_line(p_line); } -void CodeTextEditor::clear_executing_line() { +void EditorCodeTextEditor::clear_executing_line() { text_editor->clear_executing_line(); } -Variant CodeTextEditor::get_edit_state() { +Variant EditorCodeTextEditor::get_edit_state() { Dictionary state; state["scroll_position"] = text_editor->get_v_scroll(); @@ -806,7 +806,7 @@ Variant CodeTextEditor::get_edit_state() { return state; } -void CodeTextEditor::set_edit_state(const Variant &p_state) { +void EditorCodeTextEditor::set_edit_state(const Variant &p_state) { Dictionary state = p_state; /* update the row first as it sets the column to 0 */ @@ -841,7 +841,7 @@ void CodeTextEditor::set_edit_state(const Variant &p_state) { } } -void CodeTextEditor::set_error(const String &p_error) { +void EditorCodeTextEditor::set_error(const String &p_error) { error->set_text(p_error); if (p_error != "") { error->set_default_cursor_shape(CURSOR_POINTING_HAND); @@ -850,12 +850,12 @@ void CodeTextEditor::set_error(const String &p_error) { } } -void CodeTextEditor::set_error_pos(int p_line, int p_column) { +void EditorCodeTextEditor::set_error_pos(int p_line, int p_column) { error_line = p_line; error_column = p_column; } -void CodeTextEditor::goto_error() { +void EditorCodeTextEditor::goto_error() { if (error->get_text() != "") { text_editor->cursor_set_line(error_line); text_editor->cursor_set_column(error_column); @@ -863,7 +863,7 @@ void CodeTextEditor::goto_error() { } } -void CodeTextEditor::_update_font() { +void EditorCodeTextEditor::_update_font() { text_editor->add_theme_font_override("font", get_theme_font("source", "EditorFonts")); error->add_theme_font_override("font", get_theme_font("status_source", "EditorFonts")); @@ -880,7 +880,7 @@ void CodeTextEditor::_update_font() { } } -void CodeTextEditor::_on_settings_change() { +void EditorCodeTextEditor::_on_settings_change() { _update_font(); font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); @@ -900,43 +900,43 @@ void CodeTextEditor::_on_settings_change() { idle->set_wait_time(EDITOR_GET("text_editor/completion/idle_parse_delay")); } -void CodeTextEditor::_text_changed_idle_timeout() { +void EditorCodeTextEditor::_text_changed_idle_timeout() { _validate_script(); emit_signal("validate_script"); } -void CodeTextEditor::validate_script() { +void EditorCodeTextEditor::validate_script() { idle->start(); } -void CodeTextEditor::_warning_label_gui_input(const Ref &p_event) { +void EditorCodeTextEditor::_warning_label_gui_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { _warning_button_pressed(); } } -void CodeTextEditor::_warning_button_pressed() { +void EditorCodeTextEditor::_warning_button_pressed() { _set_show_warnings_panel(!is_warnings_panel_opened); } -void CodeTextEditor::_set_show_warnings_panel(bool p_show) { +void EditorCodeTextEditor::_set_show_warnings_panel(bool p_show) { is_warnings_panel_opened = p_show; emit_signal("show_warnings_panel", p_show); } -void CodeTextEditor::_toggle_scripts_pressed() { +void EditorCodeTextEditor::_toggle_scripts_pressed() { toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); } -void CodeTextEditor::_error_pressed(const Ref &p_event) { +void EditorCodeTextEditor::_error_pressed(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { goto_error(); } } -void CodeTextEditor::_notification(int p_what) { +void EditorCodeTextEditor::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { _load_theme_settings(); @@ -963,7 +963,7 @@ void CodeTextEditor::_notification(int p_what) { } } -void CodeTextEditor::set_warning_nb(int p_warning_nb) { +void EditorCodeTextEditor::set_warning_nb(int p_warning_nb) { warning_count_label->set_text(itos(p_warning_nb)); warning_count_label->set_visible(p_warning_nb > 0); warning_button->set_visible(p_warning_nb > 0); @@ -972,12 +972,12 @@ void CodeTextEditor::set_warning_nb(int p_warning_nb) { } } -void CodeTextEditor::toggle_bookmark() { +void EditorCodeTextEditor::toggle_bookmark() { int line = text_editor->cursor_get_line(); text_editor->set_line_as_bookmark(line, !text_editor->is_line_set_as_bookmark(line)); } -void CodeTextEditor::goto_next_bookmark() { +void EditorCodeTextEditor::goto_next_bookmark() { List bmarks; text_editor->get_bookmarks(&bmarks); if (bmarks.size() <= 0) { @@ -1002,7 +1002,7 @@ void CodeTextEditor::goto_next_bookmark() { } } -void CodeTextEditor::goto_prev_bookmark() { +void EditorCodeTextEditor::goto_prev_bookmark() { List bmarks; text_editor->get_bookmarks(&bmarks); if (bmarks.size() <= 0) { @@ -1027,7 +1027,7 @@ void CodeTextEditor::goto_prev_bookmark() { } } -void CodeTextEditor::remove_all_bookmarks() { +void EditorCodeTextEditor::remove_all_bookmarks() { List bmarks; text_editor->get_bookmarks(&bmarks); @@ -1036,41 +1036,41 @@ void CodeTextEditor::remove_all_bookmarks() { } } -void CodeTextEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input); - ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input); - ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed); - ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed); - ClassDB::bind_method("_on_settings_change", &CodeTextEditor::_on_settings_change); - ClassDB::bind_method("_text_changed_idle_timeout", &CodeTextEditor::_text_changed_idle_timeout); - ClassDB::bind_method("_code_complete_timer_timeout", &CodeTextEditor::_code_complete_timer_timeout); - ClassDB::bind_method("_complete_request", &CodeTextEditor::_complete_request); - ClassDB::bind_method("_font_resize_timeout", &CodeTextEditor::_font_resize_timeout); - ClassDB::bind_method("_error_pressed", &CodeTextEditor::_error_pressed); - ClassDB::bind_method("_toggle_scripts_pressed", &CodeTextEditor::_toggle_scripts_pressed); - ClassDB::bind_method("_warning_button_pressed", &CodeTextEditor::_warning_button_pressed); - ClassDB::bind_method("_warning_label_gui_input", &CodeTextEditor::_warning_label_gui_input); +void EditorCodeTextEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("_input"), &EditorCodeTextEditor::_input); + ClassDB::bind_method("_text_editor_gui_input", &EditorCodeTextEditor::_text_editor_gui_input); + ClassDB::bind_method("_line_col_changed", &EditorCodeTextEditor::_line_col_changed); + ClassDB::bind_method("_text_changed", &EditorCodeTextEditor::_text_changed); + ClassDB::bind_method("_on_settings_change", &EditorCodeTextEditor::_on_settings_change); + ClassDB::bind_method("_text_changed_idle_timeout", &EditorCodeTextEditor::_text_changed_idle_timeout); + ClassDB::bind_method("_code_complete_timer_timeout", &EditorCodeTextEditor::_code_complete_timer_timeout); + ClassDB::bind_method("_complete_request", &EditorCodeTextEditor::_complete_request); + ClassDB::bind_method("_font_resize_timeout", &EditorCodeTextEditor::_font_resize_timeout); + ClassDB::bind_method("_error_pressed", &EditorCodeTextEditor::_error_pressed); + ClassDB::bind_method("_toggle_scripts_pressed", &EditorCodeTextEditor::_toggle_scripts_pressed); + ClassDB::bind_method("_warning_button_pressed", &EditorCodeTextEditor::_warning_button_pressed); + ClassDB::bind_method("_warning_label_gui_input", &EditorCodeTextEditor::_warning_label_gui_input); ADD_SIGNAL(MethodInfo("validate_script")); ADD_SIGNAL(MethodInfo("load_theme_settings")); ADD_SIGNAL(MethodInfo("show_warnings_panel")); } -void CodeTextEditor::set_code_complete_func(CodeTextEditorCodeCompleteFunc p_code_complete_func, void *p_ud) { +void EditorCodeTextEditor::set_code_complete_func(EditorCodeTextEditorCodeCompleteFunc p_code_complete_func, void *p_ud) { code_complete_func = p_code_complete_func; code_complete_ud = p_ud; } -void CodeTextEditor::show_toggle_scripts_button() { +void EditorCodeTextEditor::show_toggle_scripts_button() { toggle_scripts_button->show(); } -void CodeTextEditor::update_toggle_scripts_button() { +void EditorCodeTextEditor::update_toggle_scripts_button() { toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")"); } -CodeTextEditor::CodeTextEditor() { +EditorCodeTextEditor::EditorCodeTextEditor() { code_complete_func = nullptr; ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL); ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS); @@ -1081,7 +1081,7 @@ CodeTextEditor::CodeTextEditor() { text_editor->set_v_size_flags(SIZE_EXPAND_FILL); // Added second so it opens at the bottom, so it won't shift the entire text editor when opening. - find_replace_bar = memnew(FindReplaceBar); + find_replace_bar = memnew(EditorFindReplaceBar); add_child(find_replace_bar); find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL); find_replace_bar->hide(); diff --git a/editor_modules/editor_code_editor/editor_code_text_editor.h b/editor_modules/editor_code_editor/editor_code_text_editor.h index c667b7472..dd2eca5de 100644 --- a/editor_modules/editor_code_editor/editor_code_text_editor.h +++ b/editor_modules/editor_code_editor/editor_code_text_editor.h @@ -52,16 +52,16 @@ class TextureButton; class Timer; class ToolButton; struct ScriptCodeCompletionOption; -class GotoLineDialog; -class FindReplaceBar; +class EditorGotoLineDialog; +class EditorFindReplaceBar; -typedef void (*CodeTextEditorCodeCompleteFunc)(void *p_ud, const String &p_code, List *r_options, bool &r_forced); +typedef void (*EditorCodeTextEditorCodeCompleteFunc)(void *p_ud, const String &p_code, List *r_options, bool &r_forced); -class CodeTextEditor : public VBoxContainer { - GDCLASS(CodeTextEditor, VBoxContainer); +class EditorCodeTextEditor : public VBoxContainer { + GDCLASS(EditorCodeTextEditor, VBoxContainer); TextEdit *text_editor; - FindReplaceBar *find_replace_bar; + EditorFindReplaceBar *find_replace_bar; HBoxContainer *status_bar; ToolButton *toggle_scripts_button; @@ -97,7 +97,7 @@ class CodeTextEditor : public VBoxContainer { void _zoom_changed(); void _reset_zoom(); - CodeTextEditorCodeCompleteFunc code_complete_func; + EditorCodeTextEditorCodeCompleteFunc code_complete_func; void *code_complete_ud; void _warning_label_gui_input(const Ref &p_event); @@ -161,7 +161,7 @@ public: void set_error_pos(int p_line, int p_column); void update_line_and_column() { _line_col_changed(); } TextEdit *get_text_edit() { return text_editor; } - FindReplaceBar *get_find_replace_bar() { return find_replace_bar; } + EditorFindReplaceBar *get_find_replace_bar() { return find_replace_bar; } virtual void apply_code() {} void goto_error(); @@ -170,14 +170,14 @@ public: void goto_prev_bookmark(); void remove_all_bookmarks(); - void set_code_complete_func(CodeTextEditorCodeCompleteFunc p_code_complete_func, void *p_ud); + void set_code_complete_func(EditorCodeTextEditorCodeCompleteFunc p_code_complete_func, void *p_ud); void validate_script(); void show_toggle_scripts_button(); void update_toggle_scripts_button(); - CodeTextEditor(); + EditorCodeTextEditor(); }; #endif // CODE_EDITOR_H diff --git a/editor_modules/editor_code_editor/editor_connection_info_dialog.cpp b/editor_modules/editor_code_editor/editor_connection_info_dialog.cpp index a363416f5..b2838da4e 100644 --- a/editor_modules/editor_code_editor/editor_connection_info_dialog.cpp +++ b/editor_modules/editor_code_editor/editor_connection_info_dialog.cpp @@ -37,10 +37,10 @@ #include "scene/gui/tree.h" #include "scene/main/node.h" -void ConnectionInfoDialog::ok_pressed() { +void EditorConnectionInfoDialog::ok_pressed() { } -void ConnectionInfoDialog::popup_connections(String p_method, Vector p_nodes) { +void EditorConnectionInfoDialog::popup_connections(String p_method, Vector p_nodes) { method->set_text(p_method); tree->clear(); @@ -79,7 +79,7 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector p_n popup_centered(Size2(600, 300) * EDSCALE); } -ConnectionInfoDialog::ConnectionInfoDialog() { +EditorConnectionInfoDialog::EditorConnectionInfoDialog() { set_title(TTR("Connections to method:")); VBoxContainer *vbc = memnew(VBoxContainer); diff --git a/editor_modules/editor_code_editor/editor_connection_info_dialog.h b/editor_modules/editor_code_editor/editor_connection_info_dialog.h index 7959dfdb6..c346870ab 100644 --- a/editor_modules/editor_code_editor/editor_connection_info_dialog.h +++ b/editor_modules/editor_code_editor/editor_connection_info_dialog.h @@ -37,8 +37,8 @@ class Label; class Node; class Tree; -class ConnectionInfoDialog : public AcceptDialog { - GDCLASS(ConnectionInfoDialog, AcceptDialog); +class EditorConnectionInfoDialog : public AcceptDialog { + GDCLASS(EditorConnectionInfoDialog, AcceptDialog); Label *method; Tree *tree; @@ -48,7 +48,7 @@ class ConnectionInfoDialog : public AcceptDialog { public: void popup_connections(String p_method, Vector p_nodes); - ConnectionInfoDialog(); + EditorConnectionInfoDialog(); }; #endif // SCRIPT_TEXT_EDITOR_H diff --git a/editor_modules/editor_code_editor/editor_find_replace_bar.cpp b/editor_modules/editor_code_editor/editor_find_replace_bar.cpp index e738cbecc..d0d671728 100644 --- a/editor_modules/editor_code_editor/editor_find_replace_bar.cpp +++ b/editor_modules/editor_code_editor/editor_find_replace_bar.cpp @@ -49,7 +49,7 @@ #include "scene/resources/font.h" #include "scene/resources/texture.h" -void FindReplaceBar::_notification(int p_what) { +void EditorFindReplaceBar::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); @@ -71,7 +71,7 @@ void FindReplaceBar::_notification(int p_what) { } } -void FindReplaceBar::_unhandled_input(const Ref &p_event) { +void EditorFindReplaceBar::_unhandled_input(const Ref &p_event) { Ref k = p_event; if (!k.is_valid() || !k->is_pressed()) { return; @@ -96,7 +96,7 @@ void FindReplaceBar::_unhandled_input(const Ref &p_event) { } } -bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) { +bool EditorFindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) { int line, col; String text = get_search_text(); @@ -133,7 +133,7 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) return found; } -void FindReplaceBar::_replace() { +void EditorFindReplaceBar::_replace() { bool selection_enabled = text_edit->is_selection_active(); Point2i selection_begin, selection_end; if (selection_enabled) { @@ -178,7 +178,7 @@ void FindReplaceBar::_replace() { } } -void FindReplaceBar::_replace_all() { +void EditorFindReplaceBar::_replace_all() { text_edit->disconnect("text_changed", this, "_editor_text_changed"); // Line as x so it gets priority in comparison, column as y. Point2i orig_cursor(text_edit->cursor_get_line(), text_edit->cursor_get_column()); @@ -267,7 +267,7 @@ void FindReplaceBar::_replace_all() { results_count = -1; } -void FindReplaceBar::_get_search_from(int &r_line, int &r_col) { +void EditorFindReplaceBar::_get_search_from(int &r_line, int &r_col) { r_line = text_edit->cursor_get_line(); r_col = text_edit->cursor_get_column(); @@ -280,7 +280,7 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) { } } -void FindReplaceBar::_update_results_count() { +void EditorFindReplaceBar::_update_results_count() { if (results_count != -1) { return; } @@ -318,7 +318,7 @@ void FindReplaceBar::_update_results_count() { } } -void FindReplaceBar::_update_matches_label() { +void EditorFindReplaceBar::_update_matches_label() { if (search_text->get_text().empty() || results_count == -1) { matches_label->hide(); } else { @@ -329,7 +329,7 @@ void FindReplaceBar::_update_matches_label() { } } -bool FindReplaceBar::search_current() { +bool EditorFindReplaceBar::search_current() { uint32_t flags = 0; if (is_whole_words()) { @@ -345,7 +345,7 @@ bool FindReplaceBar::search_current() { return _search(flags, line, col); } -bool FindReplaceBar::search_prev() { +bool EditorFindReplaceBar::search_prev() { if (!is_visible()) { popup_search(true); } @@ -380,7 +380,7 @@ bool FindReplaceBar::search_prev() { return _search(flags, line, col); } -bool FindReplaceBar::search_next() { +bool EditorFindReplaceBar::search_next() { if (!is_visible()) { popup_search(true); } @@ -417,7 +417,7 @@ bool FindReplaceBar::search_next() { return _search(flags, line, col); } -void FindReplaceBar::_hide_bar() { +void EditorFindReplaceBar::_hide_bar() { if (replace_text->has_focus() || search_text->has_focus()) { text_edit->grab_focus(); } @@ -428,7 +428,7 @@ void FindReplaceBar::_hide_bar() { hide(); } -void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) { +void EditorFindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) { show(); if (p_show_only) { return; @@ -461,7 +461,7 @@ void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) { } } -void FindReplaceBar::popup_search(bool p_show_only) { +void EditorFindReplaceBar::popup_search(bool p_show_only) { replace_text->hide(); hbc_button_replace->hide(); hbc_option_replace->hide(); @@ -469,7 +469,7 @@ void FindReplaceBar::popup_search(bool p_show_only) { _show_search(false, p_show_only); } -void FindReplaceBar::popup_replace() { +void EditorFindReplaceBar::popup_replace() { if (!replace_text->is_visible_in_tree()) { replace_text->show(); hbc_button_replace->show(); @@ -481,12 +481,12 @@ void FindReplaceBar::popup_replace() { _show_search(is_visible() || text_edit->is_selection_active()); } -void FindReplaceBar::_search_options_changed(bool p_pressed) { +void EditorFindReplaceBar::_search_options_changed(bool p_pressed) { results_count = -1; search_current(); } -void FindReplaceBar::_editor_text_changed() { +void EditorFindReplaceBar::_editor_text_changed() { results_count = -1; if (is_visible_in_tree()) { preserve_cursor = true; @@ -495,12 +495,12 @@ void FindReplaceBar::_editor_text_changed() { } } -void FindReplaceBar::_search_text_changed(const String &p_text) { +void EditorFindReplaceBar::_search_text_changed(const String &p_text) { results_count = -1; search_current(); } -void FindReplaceBar::_search_text_entered(const String &p_text) { +void EditorFindReplaceBar::_search_text_entered(const String &p_text) { if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { search_prev(); } else { @@ -508,63 +508,63 @@ void FindReplaceBar::_search_text_entered(const String &p_text) { } } -void FindReplaceBar::_replace_text_entered(const String &p_text) { +void EditorFindReplaceBar::_replace_text_entered(const String &p_text) { if (selection_only->is_pressed() && text_edit->is_selection_active()) { _replace_all(); _hide_bar(); } } -String FindReplaceBar::get_search_text() const { +String EditorFindReplaceBar::get_search_text() const { return search_text->get_text(); } -String FindReplaceBar::get_replace_text() const { +String EditorFindReplaceBar::get_replace_text() const { return replace_text->get_text(); } -bool FindReplaceBar::is_case_sensitive() const { +bool EditorFindReplaceBar::is_case_sensitive() const { return case_sensitive->is_pressed(); } -bool FindReplaceBar::is_whole_words() const { +bool EditorFindReplaceBar::is_whole_words() const { return whole_words->is_pressed(); } -bool FindReplaceBar::is_selection_only() const { +bool EditorFindReplaceBar::is_selection_only() const { return selection_only->is_pressed(); } -void FindReplaceBar::set_error(const String &p_label) { +void EditorFindReplaceBar::set_error(const String &p_label) { emit_signal("error", p_label); } -void FindReplaceBar::set_text_edit(TextEdit *p_text_edit) { +void EditorFindReplaceBar::set_text_edit(TextEdit *p_text_edit) { results_count = -1; text_edit = p_text_edit; text_edit->connect("text_changed", this, "_editor_text_changed"); } -void FindReplaceBar::_bind_methods() { - ClassDB::bind_method("_unhandled_input", &FindReplaceBar::_unhandled_input); +void EditorFindReplaceBar::_bind_methods() { + ClassDB::bind_method("_unhandled_input", &EditorFindReplaceBar::_unhandled_input); - ClassDB::bind_method("_editor_text_changed", &FindReplaceBar::_editor_text_changed); - ClassDB::bind_method("_search_text_changed", &FindReplaceBar::_search_text_changed); - ClassDB::bind_method("_search_text_entered", &FindReplaceBar::_search_text_entered); - ClassDB::bind_method("_replace_text_entered", &FindReplaceBar::_replace_text_entered); - ClassDB::bind_method("_search_current", &FindReplaceBar::search_current); - ClassDB::bind_method("_search_next", &FindReplaceBar::search_next); - ClassDB::bind_method("_search_prev", &FindReplaceBar::search_prev); - ClassDB::bind_method("_replace_pressed", &FindReplaceBar::_replace); - ClassDB::bind_method("_replace_all_pressed", &FindReplaceBar::_replace_all); - ClassDB::bind_method("_search_options_changed", &FindReplaceBar::_search_options_changed); - ClassDB::bind_method("_hide_pressed", &FindReplaceBar::_hide_bar); + ClassDB::bind_method("_editor_text_changed", &EditorFindReplaceBar::_editor_text_changed); + ClassDB::bind_method("_search_text_changed", &EditorFindReplaceBar::_search_text_changed); + ClassDB::bind_method("_search_text_entered", &EditorFindReplaceBar::_search_text_entered); + ClassDB::bind_method("_replace_text_entered", &EditorFindReplaceBar::_replace_text_entered); + ClassDB::bind_method("_search_current", &EditorFindReplaceBar::search_current); + ClassDB::bind_method("_search_next", &EditorFindReplaceBar::search_next); + ClassDB::bind_method("_search_prev", &EditorFindReplaceBar::search_prev); + ClassDB::bind_method("_replace_pressed", &EditorFindReplaceBar::_replace); + ClassDB::bind_method("_replace_all_pressed", &EditorFindReplaceBar::_replace_all); + ClassDB::bind_method("_search_options_changed", &EditorFindReplaceBar::_search_options_changed); + ClassDB::bind_method("_hide_pressed", &EditorFindReplaceBar::_hide_bar); ADD_SIGNAL(MethodInfo("search")); ADD_SIGNAL(MethodInfo("error")); } -FindReplaceBar::FindReplaceBar() { +EditorFindReplaceBar::EditorFindReplaceBar() { results_count = -1; replace_all_mode = false; preserve_cursor = false; diff --git a/editor_modules/editor_code_editor/editor_find_replace_bar.h b/editor_modules/editor_code_editor/editor_find_replace_bar.h index 1f64b9034..7119721fa 100644 --- a/editor_modules/editor_code_editor/editor_find_replace_bar.h +++ b/editor_modules/editor_code_editor/editor_find_replace_bar.h @@ -51,8 +51,8 @@ class Texture; class TextureButton; class ToolButton; -class FindReplaceBar : public HBoxContainer { - GDCLASS(FindReplaceBar, HBoxContainer); +class EditorFindReplaceBar : public HBoxContainer { + GDCLASS(EditorFindReplaceBar, HBoxContainer); LineEdit *search_text; Label *matches_label; @@ -122,7 +122,7 @@ public: bool search_prev(); bool search_next(); - FindReplaceBar(); + EditorFindReplaceBar(); }; #endif // CODE_EDITOR_H diff --git a/editor_modules/editor_code_editor/editor_goto_line_dialog.cpp b/editor_modules/editor_code_editor/editor_goto_line_dialog.cpp index 8cafdf3fb..e9f806a67 100644 --- a/editor_modules/editor_code_editor/editor_goto_line_dialog.cpp +++ b/editor_modules/editor_code_editor/editor_goto_line_dialog.cpp @@ -37,7 +37,7 @@ #include "editor/editor_scale.h" -void GotoLineDialog::popup_find_line(TextEdit *p_edit) { +void EditorGotoLineDialog::popup_find_line(TextEdit *p_edit) { text_editor = p_edit; line->set_text(itos(text_editor->cursor_get_line())); @@ -46,11 +46,11 @@ void GotoLineDialog::popup_find_line(TextEdit *p_edit) { line->grab_focus(); } -int GotoLineDialog::get_line() const { +int EditorGotoLineDialog::get_line() const { return line->get_text().to_int(); } -void GotoLineDialog::ok_pressed() { +void EditorGotoLineDialog::ok_pressed() { if (get_line() < 1 || get_line() > text_editor->get_line_count()) { return; } @@ -59,7 +59,7 @@ void GotoLineDialog::ok_pressed() { hide(); } -GotoLineDialog::GotoLineDialog() { +EditorGotoLineDialog::EditorGotoLineDialog() { set_title(TTR("Go to Line")); VBoxContainer *vbc = memnew(VBoxContainer); diff --git a/editor_modules/editor_code_editor/editor_goto_line_dialog.h b/editor_modules/editor_code_editor/editor_goto_line_dialog.h index 5326b5ec9..a3c88d033 100644 --- a/editor_modules/editor_code_editor/editor_goto_line_dialog.h +++ b/editor_modules/editor_code_editor/editor_goto_line_dialog.h @@ -37,8 +37,8 @@ class Label; class LineEdit; class TextEdit; -class GotoLineDialog : public ConfirmationDialog { - GDCLASS(GotoLineDialog, ConfirmationDialog); +class EditorGotoLineDialog : public ConfirmationDialog { + GDCLASS(EditorGotoLineDialog, ConfirmationDialog); Label *line_label; LineEdit *line; @@ -51,7 +51,7 @@ public: void popup_find_line(TextEdit *p_edit); int get_line() const; - GotoLineDialog(); + EditorGotoLineDialog(); }; #endif // CODE_EDITOR_H diff --git a/editor_modules/editor_code_editor/editor_script_editor.cpp b/editor_modules/editor_code_editor/editor_script_editor.cpp index 4756655c5..27cf62a3c 100644 --- a/editor_modules/editor_code_editor/editor_script_editor.cpp +++ b/editor_modules/editor_code_editor/editor_script_editor.cpp @@ -205,7 +205,7 @@ void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) { debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_CONTINUE), !p_breaked); for (int i = 0; i < tab_container->get_child_count(); i++) { - ScriptEditorBase *se = Object::cast_to(tab_container->get_child(i)); + EditorScriptEditorBase *se = Object::cast_to(tab_container->get_child(i)); if (!se) { continue; } @@ -222,7 +222,7 @@ void ScriptEditor::_script_created(Ref