Prefix class names in the editor_script_editor module with Editor. Pt 1.

This commit is contained in:
Relintai 2023-02-18 16:37:54 +01:00
parent 990f8aaecd
commit 8f311ca275
26 changed files with 364 additions and 364 deletions

View File

@ -585,7 +585,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
Ref<Resource> res; Ref<Resource> res;
if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") {
#ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(drag_data["script_list_element"]);
if (se) { if (se) {
res = se->get_edited_resource(); res = se->get_edited_resource();
} }
@ -656,7 +656,7 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
Ref<Resource> dropped_resource; Ref<Resource> dropped_resource;
if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") {
#ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(drag_data["script_list_element"]);
if (se) { if (se) {
dropped_resource = se->get_edited_resource(); dropped_resource = se->get_edited_resource();
} }

View File

@ -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") { if (String(d["type"]) == "script_list_element") {
#ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(d["script_list_element"]); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(d["script_list_element"]);
if (se) { if (se) {
String sp = se->get_edited_resource()->get_path(); String sp = se->get_edited_resource()->get_path();
if (_is_script_type(EditorFileSystem::get_singleton()->get_file_type(sp))) { 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") { if (String(d["type"]) == "script_list_element") {
#ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED #ifdef MODULE_EDITOR_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(d["script_list_element"]); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(d["script_list_element"]);
if (se) { if (se) {
String sp = se->get_edited_resource()->get_path(); String sp = se->get_edited_resource()->get_path();
if (_is_script_type(EditorFileSystem::get_singleton()->get_file_type(sp))) { if (_is_script_type(EditorFileSystem::get_singleton()->get_file_type(sp))) {

View File

@ -71,7 +71,7 @@
// This function should be used to handle shortcuts that could otherwise // This function should be used to handle shortcuts that could otherwise
// be handled too late if they weren't handled here. // be handled too late if they weren't handled here.
void CodeTextEditor::_input(const Ref<InputEvent> &event) { void EditorCodeTextEditor::_input(const Ref<InputEvent> &event) {
const Ref<InputEventKey> key_event = event; const Ref<InputEventKey> key_event = event;
if (!key_event.is_valid() || !key_event->is_pressed()) { if (!key_event.is_valid() || !key_event->is_pressed()) {
return; return;
@ -99,7 +99,7 @@ void CodeTextEditor::_input(const Ref<InputEvent> &event) {
} }
} }
void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { void EditorCodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) { if (mb.is_valid()) {
@ -145,23 +145,23 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
} }
} }
void CodeTextEditor::_zoom_in() { void EditorCodeTextEditor::_zoom_in() {
font_resize_val += MAX(EDSCALE, 1.0f); font_resize_val += MAX(EDSCALE, 1.0f);
_zoom_changed(); _zoom_changed();
} }
void CodeTextEditor::_zoom_out() { void EditorCodeTextEditor::_zoom_out() {
font_resize_val -= MAX(EDSCALE, 1.0f); font_resize_val -= MAX(EDSCALE, 1.0f);
_zoom_changed(); _zoom_changed();
} }
void CodeTextEditor::_zoom_changed() { void EditorCodeTextEditor::_zoom_changed() {
if (font_resize_timer->get_time_left() == 0) { if (font_resize_timer->get_time_left() == 0) {
font_resize_timer->start(); font_resize_timer->start();
} }
} }
void CodeTextEditor::_reset_zoom() { void EditorCodeTextEditor::_reset_zoom() {
Ref<DynamicFont> font = text_editor->get_theme_font("font"); // Reset source font size to default. Ref<DynamicFont> font = text_editor->get_theme_font("font"); // Reset source font size to default.
if (font.is_valid()) { 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()); String line = text_editor->get_line(text_editor->cursor_get_line());
int positional_column = 0; int positional_column = 0;
@ -190,7 +190,7 @@ void CodeTextEditor::_line_col_changed() {
line_and_col_txt->set_text(sb.as_string()); line_and_col_txt->set_text(sb.as_string());
} }
void CodeTextEditor::_text_changed() { void EditorCodeTextEditor::_text_changed() {
if (text_editor->is_insert_text_operation()) { if (text_editor->is_insert_text_operation()) {
code_complete_timer->start(); code_complete_timer->start();
} }
@ -198,14 +198,14 @@ void CodeTextEditor::_text_changed() {
idle->start(); idle->start();
} }
void CodeTextEditor::_code_complete_timer_timeout() { void EditorCodeTextEditor::_code_complete_timer_timeout() {
if (!is_visible_in_tree()) { if (!is_visible_in_tree()) {
return; return;
} }
text_editor->query_code_comple(); text_editor->query_code_comple();
} }
void CodeTextEditor::_complete_request() { void EditorCodeTextEditor::_complete_request() {
List<ScriptCodeCompletionOption> entries; List<ScriptCodeCompletionOption> entries;
String ctext = text_editor->get_text_for_completion(); String ctext = text_editor->get_text_for_completion();
_code_complete_script(ctext, &entries); _code_complete_script(ctext, &entries);
@ -223,7 +223,7 @@ void CodeTextEditor::_complete_request() {
text_editor->code_complete(entries, forced); text_editor->code_complete(entries, forced);
} }
Ref<Texture> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) { Ref<Texture> EditorCodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) {
Ref<Texture> tex; Ref<Texture> tex;
switch (p_option.kind) { switch (p_option.kind) {
case ScriptCodeCompletionOption::KIND_CLASS: { case ScriptCodeCompletionOption::KIND_CLASS: {
@ -267,13 +267,13 @@ Ref<Texture> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOpti
return tex; return tex;
} }
void CodeTextEditor::_font_resize_timeout() { void EditorCodeTextEditor::_font_resize_timeout() {
if (_add_font_size(font_resize_val)) { if (_add_font_size(font_resize_val)) {
font_resize_val = 0; font_resize_val = 0;
} }
} }
bool CodeTextEditor::_add_font_size(int p_delta) { bool EditorCodeTextEditor::_add_font_size(int p_delta) {
Ref<DynamicFont> font = text_editor->get_theme_font("font"); Ref<DynamicFont> font = text_editor->get_theme_font("font");
if (font.is_valid()) { 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_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_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")); 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")); 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; bool trimed_whitespace = false;
for (int i = 0; i < text_editor->get_line_count(); i++) { for (int i = 0; i < text_editor->get_line_count(); i++) {
String line = text_editor->get_line(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; int final_line = text_editor->get_line_count() - 1;
String line = text_editor->get_line(final_line); 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"); int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size");
String indent = ""; 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"); int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size");
indent_size -= 1; 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()) { if (!text_editor->is_selection_active()) {
return; return;
} }
@ -505,7 +505,7 @@ void CodeTextEditor::convert_case(CaseStyle p_case) {
text_editor->end_complex_operation(); text_editor->end_complex_operation();
} }
void CodeTextEditor::move_lines_up() { void EditorCodeTextEditor::move_lines_up() {
text_editor->begin_complex_operation(); text_editor->begin_complex_operation();
if (text_editor->is_selection_active()) { if (text_editor->is_selection_active()) {
int from_line = text_editor->get_selection_from_line(); int from_line = text_editor->get_selection_from_line();
@ -551,7 +551,7 @@ void CodeTextEditor::move_lines_up() {
text_editor->update(); text_editor->update();
} }
void CodeTextEditor::move_lines_down() { void EditorCodeTextEditor::move_lines_down() {
text_editor->begin_complex_operation(); text_editor->begin_complex_operation();
if (text_editor->is_selection_active()) { if (text_editor->is_selection_active()) {
int from_line = text_editor->get_selection_from_line(); int from_line = text_editor->get_selection_from_line();
@ -597,7 +597,7 @@ void CodeTextEditor::move_lines_down() {
text_editor->update(); 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() // this is currently intended to be called within delete_lines()
// so `begin_complex_operation` is omitted here // so `begin_complex_operation` is omitted here
text_editor->set_line(p_line, ""); text_editor->set_line(p_line, "");
@ -612,7 +612,7 @@ void CodeTextEditor::_delete_line(int p_line) {
text_editor->cursor_set_line(p_line); text_editor->cursor_set_line(p_line);
} }
void CodeTextEditor::delete_lines() { void EditorCodeTextEditor::delete_lines() {
text_editor->begin_complex_operation(); text_editor->begin_complex_operation();
if (text_editor->is_selection_active()) { if (text_editor->is_selection_active()) {
int to_line = text_editor->get_selection_to_line(); int to_line = text_editor->get_selection_to_line();
@ -630,7 +630,7 @@ void CodeTextEditor::delete_lines() {
text_editor->end_complex_operation(); text_editor->end_complex_operation();
} }
void CodeTextEditor::duplicate_selection() { void EditorCodeTextEditor::duplicate_selection() {
const int cursor_column = text_editor->cursor_get_column(); const int cursor_column = text_editor->cursor_get_column();
int from_line = text_editor->cursor_get_line(); int from_line = text_editor->cursor_get_line();
int to_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(); text_editor->update();
} }
void CodeTextEditor::toggle_inline_comment(const String &delimiter) { void EditorCodeTextEditor::toggle_inline_comment(const String &delimiter) {
text_editor->begin_complex_operation(); text_editor->begin_complex_operation();
if (text_editor->is_selection_active()) { if (text_editor->is_selection_active()) {
int begin = text_editor->get_selection_from_line(); int begin = text_editor->get_selection_from_line();
@ -751,33 +751,33 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
text_editor->update(); text_editor->update();
} }
void CodeTextEditor::goto_line(int p_line) { void EditorCodeTextEditor::goto_line(int p_line) {
text_editor->deselect(); text_editor->deselect();
text_editor->unfold_line(p_line); text_editor->unfold_line(p_line);
text_editor->call_deferred("cursor_set_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->unfold_line(p_line);
text_editor->call_deferred("cursor_set_line", p_line); text_editor->call_deferred("cursor_set_line", p_line);
text_editor->call_deferred("cursor_set_column", p_begin); text_editor->call_deferred("cursor_set_column", p_begin);
text_editor->select(p_line, p_begin, p_line, p_end); 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); goto_line(p_line);
text_editor->call_deferred("center_viewport_to_cursor"); 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); text_editor->set_executing_line(p_line);
} }
void CodeTextEditor::clear_executing_line() { void EditorCodeTextEditor::clear_executing_line() {
text_editor->clear_executing_line(); text_editor->clear_executing_line();
} }
Variant CodeTextEditor::get_edit_state() { Variant EditorCodeTextEditor::get_edit_state() {
Dictionary state; Dictionary state;
state["scroll_position"] = text_editor->get_v_scroll(); state["scroll_position"] = text_editor->get_v_scroll();
@ -806,7 +806,7 @@ Variant CodeTextEditor::get_edit_state() {
return 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; Dictionary state = p_state;
/* update the row first as it sets the column to 0 */ /* 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); error->set_text(p_error);
if (p_error != "") { if (p_error != "") {
error->set_default_cursor_shape(CURSOR_POINTING_HAND); 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_line = p_line;
error_column = p_column; error_column = p_column;
} }
void CodeTextEditor::goto_error() { void EditorCodeTextEditor::goto_error() {
if (error->get_text() != "") { if (error->get_text() != "") {
text_editor->cursor_set_line(error_line); text_editor->cursor_set_line(error_line);
text_editor->cursor_set_column(error_column); 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")); text_editor->add_theme_font_override("font", get_theme_font("source", "EditorFonts"));
error->add_theme_font_override("font", get_theme_font("status_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(); _update_font();
font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); 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")); 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(); _validate_script();
emit_signal("validate_script"); emit_signal("validate_script");
} }
void CodeTextEditor::validate_script() { void EditorCodeTextEditor::validate_script() {
idle->start(); idle->start();
} }
void CodeTextEditor::_warning_label_gui_input(const Ref<InputEvent> &p_event) { void EditorCodeTextEditor::_warning_label_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
_warning_button_pressed(); _warning_button_pressed();
} }
} }
void CodeTextEditor::_warning_button_pressed() { void EditorCodeTextEditor::_warning_button_pressed() {
_set_show_warnings_panel(!is_warnings_panel_opened); _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; is_warnings_panel_opened = p_show;
emit_signal("show_warnings_panel", 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")); 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<InputEvent> &p_event) { void EditorCodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
goto_error(); goto_error();
} }
} }
void CodeTextEditor::_notification(int p_what) { void EditorCodeTextEditor::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_load_theme_settings(); _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_text(itos(p_warning_nb));
warning_count_label->set_visible(p_warning_nb > 0); warning_count_label->set_visible(p_warning_nb > 0);
warning_button->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(); int line = text_editor->cursor_get_line();
text_editor->set_line_as_bookmark(line, !text_editor->is_line_set_as_bookmark(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<int> bmarks; List<int> bmarks;
text_editor->get_bookmarks(&bmarks); text_editor->get_bookmarks(&bmarks);
if (bmarks.size() <= 0) { if (bmarks.size() <= 0) {
@ -1002,7 +1002,7 @@ void CodeTextEditor::goto_next_bookmark() {
} }
} }
void CodeTextEditor::goto_prev_bookmark() { void EditorCodeTextEditor::goto_prev_bookmark() {
List<int> bmarks; List<int> bmarks;
text_editor->get_bookmarks(&bmarks); text_editor->get_bookmarks(&bmarks);
if (bmarks.size() <= 0) { if (bmarks.size() <= 0) {
@ -1027,7 +1027,7 @@ void CodeTextEditor::goto_prev_bookmark() {
} }
} }
void CodeTextEditor::remove_all_bookmarks() { void EditorCodeTextEditor::remove_all_bookmarks() {
List<int> bmarks; List<int> bmarks;
text_editor->get_bookmarks(&bmarks); text_editor->get_bookmarks(&bmarks);
@ -1036,41 +1036,41 @@ void CodeTextEditor::remove_all_bookmarks() {
} }
} }
void CodeTextEditor::_bind_methods() { void EditorCodeTextEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input); ClassDB::bind_method(D_METHOD("_input"), &EditorCodeTextEditor::_input);
ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input); ClassDB::bind_method("_text_editor_gui_input", &EditorCodeTextEditor::_text_editor_gui_input);
ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed); ClassDB::bind_method("_line_col_changed", &EditorCodeTextEditor::_line_col_changed);
ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed); ClassDB::bind_method("_text_changed", &EditorCodeTextEditor::_text_changed);
ClassDB::bind_method("_on_settings_change", &CodeTextEditor::_on_settings_change); ClassDB::bind_method("_on_settings_change", &EditorCodeTextEditor::_on_settings_change);
ClassDB::bind_method("_text_changed_idle_timeout", &CodeTextEditor::_text_changed_idle_timeout); ClassDB::bind_method("_text_changed_idle_timeout", &EditorCodeTextEditor::_text_changed_idle_timeout);
ClassDB::bind_method("_code_complete_timer_timeout", &CodeTextEditor::_code_complete_timer_timeout); ClassDB::bind_method("_code_complete_timer_timeout", &EditorCodeTextEditor::_code_complete_timer_timeout);
ClassDB::bind_method("_complete_request", &CodeTextEditor::_complete_request); ClassDB::bind_method("_complete_request", &EditorCodeTextEditor::_complete_request);
ClassDB::bind_method("_font_resize_timeout", &CodeTextEditor::_font_resize_timeout); ClassDB::bind_method("_font_resize_timeout", &EditorCodeTextEditor::_font_resize_timeout);
ClassDB::bind_method("_error_pressed", &CodeTextEditor::_error_pressed); ClassDB::bind_method("_error_pressed", &EditorCodeTextEditor::_error_pressed);
ClassDB::bind_method("_toggle_scripts_pressed", &CodeTextEditor::_toggle_scripts_pressed); ClassDB::bind_method("_toggle_scripts_pressed", &EditorCodeTextEditor::_toggle_scripts_pressed);
ClassDB::bind_method("_warning_button_pressed", &CodeTextEditor::_warning_button_pressed); ClassDB::bind_method("_warning_button_pressed", &EditorCodeTextEditor::_warning_button_pressed);
ClassDB::bind_method("_warning_label_gui_input", &CodeTextEditor::_warning_label_gui_input); ClassDB::bind_method("_warning_label_gui_input", &EditorCodeTextEditor::_warning_label_gui_input);
ADD_SIGNAL(MethodInfo("validate_script")); ADD_SIGNAL(MethodInfo("validate_script"));
ADD_SIGNAL(MethodInfo("load_theme_settings")); ADD_SIGNAL(MethodInfo("load_theme_settings"));
ADD_SIGNAL(MethodInfo("show_warnings_panel")); 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_func = p_code_complete_func;
code_complete_ud = p_ud; code_complete_ud = p_ud;
} }
void CodeTextEditor::show_toggle_scripts_button() { void EditorCodeTextEditor::show_toggle_scripts_button() {
toggle_scripts_button->show(); 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_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() + ")"); 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; code_complete_func = nullptr;
ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL); 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); 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); 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. // 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); add_child(find_replace_bar);
find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL); find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL);
find_replace_bar->hide(); find_replace_bar->hide();

View File

@ -52,16 +52,16 @@ class TextureButton;
class Timer; class Timer;
class ToolButton; class ToolButton;
struct ScriptCodeCompletionOption; struct ScriptCodeCompletionOption;
class GotoLineDialog; class EditorGotoLineDialog;
class FindReplaceBar; class EditorFindReplaceBar;
typedef void (*CodeTextEditorCodeCompleteFunc)(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_forced); typedef void (*EditorCodeTextEditorCodeCompleteFunc)(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_forced);
class CodeTextEditor : public VBoxContainer { class EditorCodeTextEditor : public VBoxContainer {
GDCLASS(CodeTextEditor, VBoxContainer); GDCLASS(EditorCodeTextEditor, VBoxContainer);
TextEdit *text_editor; TextEdit *text_editor;
FindReplaceBar *find_replace_bar; EditorFindReplaceBar *find_replace_bar;
HBoxContainer *status_bar; HBoxContainer *status_bar;
ToolButton *toggle_scripts_button; ToolButton *toggle_scripts_button;
@ -97,7 +97,7 @@ class CodeTextEditor : public VBoxContainer {
void _zoom_changed(); void _zoom_changed();
void _reset_zoom(); void _reset_zoom();
CodeTextEditorCodeCompleteFunc code_complete_func; EditorCodeTextEditorCodeCompleteFunc code_complete_func;
void *code_complete_ud; void *code_complete_ud;
void _warning_label_gui_input(const Ref<InputEvent> &p_event); void _warning_label_gui_input(const Ref<InputEvent> &p_event);
@ -161,7 +161,7 @@ public:
void set_error_pos(int p_line, int p_column); void set_error_pos(int p_line, int p_column);
void update_line_and_column() { _line_col_changed(); } void update_line_and_column() { _line_col_changed(); }
TextEdit *get_text_edit() { return text_editor; } 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() {} virtual void apply_code() {}
void goto_error(); void goto_error();
@ -170,14 +170,14 @@ public:
void goto_prev_bookmark(); void goto_prev_bookmark();
void remove_all_bookmarks(); 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 validate_script();
void show_toggle_scripts_button(); void show_toggle_scripts_button();
void update_toggle_scripts_button(); void update_toggle_scripts_button();
CodeTextEditor(); EditorCodeTextEditor();
}; };
#endif // CODE_EDITOR_H #endif // CODE_EDITOR_H

View File

@ -37,10 +37,10 @@
#include "scene/gui/tree.h" #include "scene/gui/tree.h"
#include "scene/main/node.h" #include "scene/main/node.h"
void ConnectionInfoDialog::ok_pressed() { void EditorConnectionInfoDialog::ok_pressed() {
} }
void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_nodes) { void EditorConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_nodes) {
method->set_text(p_method); method->set_text(p_method);
tree->clear(); tree->clear();
@ -79,7 +79,7 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n
popup_centered(Size2(600, 300) * EDSCALE); popup_centered(Size2(600, 300) * EDSCALE);
} }
ConnectionInfoDialog::ConnectionInfoDialog() { EditorConnectionInfoDialog::EditorConnectionInfoDialog() {
set_title(TTR("Connections to method:")); set_title(TTR("Connections to method:"));
VBoxContainer *vbc = memnew(VBoxContainer); VBoxContainer *vbc = memnew(VBoxContainer);

View File

@ -37,8 +37,8 @@ class Label;
class Node; class Node;
class Tree; class Tree;
class ConnectionInfoDialog : public AcceptDialog { class EditorConnectionInfoDialog : public AcceptDialog {
GDCLASS(ConnectionInfoDialog, AcceptDialog); GDCLASS(EditorConnectionInfoDialog, AcceptDialog);
Label *method; Label *method;
Tree *tree; Tree *tree;
@ -48,7 +48,7 @@ class ConnectionInfoDialog : public AcceptDialog {
public: public:
void popup_connections(String p_method, Vector<Node *> p_nodes); void popup_connections(String p_method, Vector<Node *> p_nodes);
ConnectionInfoDialog(); EditorConnectionInfoDialog();
}; };
#endif // SCRIPT_TEXT_EDITOR_H #endif // SCRIPT_TEXT_EDITOR_H

View File

@ -49,7 +49,7 @@
#include "scene/resources/font.h" #include "scene/resources/font.h"
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
void FindReplaceBar::_notification(int p_what) { void EditorFindReplaceBar::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) { if (p_what == NOTIFICATION_READY) {
find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons"));
find_next->set_icon(get_theme_icon("MoveDown", "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<InputEvent> &p_event) { void EditorFindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event; Ref<InputEventKey> k = p_event;
if (!k.is_valid() || !k->is_pressed()) { if (!k.is_valid() || !k->is_pressed()) {
return; return;
@ -96,7 +96,7 @@ void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &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; int line, col;
String text = get_search_text(); 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; return found;
} }
void FindReplaceBar::_replace() { void EditorFindReplaceBar::_replace() {
bool selection_enabled = text_edit->is_selection_active(); bool selection_enabled = text_edit->is_selection_active();
Point2i selection_begin, selection_end; Point2i selection_begin, selection_end;
if (selection_enabled) { 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"); text_edit->disconnect("text_changed", this, "_editor_text_changed");
// Line as x so it gets priority in comparison, column as y. // 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()); Point2i orig_cursor(text_edit->cursor_get_line(), text_edit->cursor_get_column());
@ -267,7 +267,7 @@ void FindReplaceBar::_replace_all() {
results_count = -1; 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_line = text_edit->cursor_get_line();
r_col = text_edit->cursor_get_column(); 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) { if (results_count != -1) {
return; 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) { if (search_text->get_text().empty() || results_count == -1) {
matches_label->hide(); matches_label->hide();
} else { } else {
@ -329,7 +329,7 @@ void FindReplaceBar::_update_matches_label() {
} }
} }
bool FindReplaceBar::search_current() { bool EditorFindReplaceBar::search_current() {
uint32_t flags = 0; uint32_t flags = 0;
if (is_whole_words()) { if (is_whole_words()) {
@ -345,7 +345,7 @@ bool FindReplaceBar::search_current() {
return _search(flags, line, col); return _search(flags, line, col);
} }
bool FindReplaceBar::search_prev() { bool EditorFindReplaceBar::search_prev() {
if (!is_visible()) { if (!is_visible()) {
popup_search(true); popup_search(true);
} }
@ -380,7 +380,7 @@ bool FindReplaceBar::search_prev() {
return _search(flags, line, col); return _search(flags, line, col);
} }
bool FindReplaceBar::search_next() { bool EditorFindReplaceBar::search_next() {
if (!is_visible()) { if (!is_visible()) {
popup_search(true); popup_search(true);
} }
@ -417,7 +417,7 @@ bool FindReplaceBar::search_next() {
return _search(flags, line, col); return _search(flags, line, col);
} }
void FindReplaceBar::_hide_bar() { void EditorFindReplaceBar::_hide_bar() {
if (replace_text->has_focus() || search_text->has_focus()) { if (replace_text->has_focus() || search_text->has_focus()) {
text_edit->grab_focus(); text_edit->grab_focus();
} }
@ -428,7 +428,7 @@ void FindReplaceBar::_hide_bar() {
hide(); 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(); show();
if (p_show_only) { if (p_show_only) {
return; 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(); replace_text->hide();
hbc_button_replace->hide(); hbc_button_replace->hide();
hbc_option_replace->hide(); hbc_option_replace->hide();
@ -469,7 +469,7 @@ void FindReplaceBar::popup_search(bool p_show_only) {
_show_search(false, p_show_only); _show_search(false, p_show_only);
} }
void FindReplaceBar::popup_replace() { void EditorFindReplaceBar::popup_replace() {
if (!replace_text->is_visible_in_tree()) { if (!replace_text->is_visible_in_tree()) {
replace_text->show(); replace_text->show();
hbc_button_replace->show(); hbc_button_replace->show();
@ -481,12 +481,12 @@ void FindReplaceBar::popup_replace() {
_show_search(is_visible() || text_edit->is_selection_active()); _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; results_count = -1;
search_current(); search_current();
} }
void FindReplaceBar::_editor_text_changed() { void EditorFindReplaceBar::_editor_text_changed() {
results_count = -1; results_count = -1;
if (is_visible_in_tree()) { if (is_visible_in_tree()) {
preserve_cursor = true; 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; results_count = -1;
search_current(); 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)) { if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
search_prev(); search_prev();
} else { } 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()) { if (selection_only->is_pressed() && text_edit->is_selection_active()) {
_replace_all(); _replace_all();
_hide_bar(); _hide_bar();
} }
} }
String FindReplaceBar::get_search_text() const { String EditorFindReplaceBar::get_search_text() const {
return search_text->get_text(); return search_text->get_text();
} }
String FindReplaceBar::get_replace_text() const { String EditorFindReplaceBar::get_replace_text() const {
return replace_text->get_text(); return replace_text->get_text();
} }
bool FindReplaceBar::is_case_sensitive() const { bool EditorFindReplaceBar::is_case_sensitive() const {
return case_sensitive->is_pressed(); return case_sensitive->is_pressed();
} }
bool FindReplaceBar::is_whole_words() const { bool EditorFindReplaceBar::is_whole_words() const {
return whole_words->is_pressed(); return whole_words->is_pressed();
} }
bool FindReplaceBar::is_selection_only() const { bool EditorFindReplaceBar::is_selection_only() const {
return selection_only->is_pressed(); 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); 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; results_count = -1;
text_edit = p_text_edit; text_edit = p_text_edit;
text_edit->connect("text_changed", this, "_editor_text_changed"); text_edit->connect("text_changed", this, "_editor_text_changed");
} }
void FindReplaceBar::_bind_methods() { void EditorFindReplaceBar::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &FindReplaceBar::_unhandled_input); ClassDB::bind_method("_unhandled_input", &EditorFindReplaceBar::_unhandled_input);
ClassDB::bind_method("_editor_text_changed", &FindReplaceBar::_editor_text_changed); ClassDB::bind_method("_editor_text_changed", &EditorFindReplaceBar::_editor_text_changed);
ClassDB::bind_method("_search_text_changed", &FindReplaceBar::_search_text_changed); ClassDB::bind_method("_search_text_changed", &EditorFindReplaceBar::_search_text_changed);
ClassDB::bind_method("_search_text_entered", &FindReplaceBar::_search_text_entered); ClassDB::bind_method("_search_text_entered", &EditorFindReplaceBar::_search_text_entered);
ClassDB::bind_method("_replace_text_entered", &FindReplaceBar::_replace_text_entered); ClassDB::bind_method("_replace_text_entered", &EditorFindReplaceBar::_replace_text_entered);
ClassDB::bind_method("_search_current", &FindReplaceBar::search_current); ClassDB::bind_method("_search_current", &EditorFindReplaceBar::search_current);
ClassDB::bind_method("_search_next", &FindReplaceBar::search_next); ClassDB::bind_method("_search_next", &EditorFindReplaceBar::search_next);
ClassDB::bind_method("_search_prev", &FindReplaceBar::search_prev); ClassDB::bind_method("_search_prev", &EditorFindReplaceBar::search_prev);
ClassDB::bind_method("_replace_pressed", &FindReplaceBar::_replace); ClassDB::bind_method("_replace_pressed", &EditorFindReplaceBar::_replace);
ClassDB::bind_method("_replace_all_pressed", &FindReplaceBar::_replace_all); ClassDB::bind_method("_replace_all_pressed", &EditorFindReplaceBar::_replace_all);
ClassDB::bind_method("_search_options_changed", &FindReplaceBar::_search_options_changed); ClassDB::bind_method("_search_options_changed", &EditorFindReplaceBar::_search_options_changed);
ClassDB::bind_method("_hide_pressed", &FindReplaceBar::_hide_bar); ClassDB::bind_method("_hide_pressed", &EditorFindReplaceBar::_hide_bar);
ADD_SIGNAL(MethodInfo("search")); ADD_SIGNAL(MethodInfo("search"));
ADD_SIGNAL(MethodInfo("error")); ADD_SIGNAL(MethodInfo("error"));
} }
FindReplaceBar::FindReplaceBar() { EditorFindReplaceBar::EditorFindReplaceBar() {
results_count = -1; results_count = -1;
replace_all_mode = false; replace_all_mode = false;
preserve_cursor = false; preserve_cursor = false;

View File

@ -51,8 +51,8 @@ class Texture;
class TextureButton; class TextureButton;
class ToolButton; class ToolButton;
class FindReplaceBar : public HBoxContainer { class EditorFindReplaceBar : public HBoxContainer {
GDCLASS(FindReplaceBar, HBoxContainer); GDCLASS(EditorFindReplaceBar, HBoxContainer);
LineEdit *search_text; LineEdit *search_text;
Label *matches_label; Label *matches_label;
@ -122,7 +122,7 @@ public:
bool search_prev(); bool search_prev();
bool search_next(); bool search_next();
FindReplaceBar(); EditorFindReplaceBar();
}; };
#endif // CODE_EDITOR_H #endif // CODE_EDITOR_H

View File

@ -37,7 +37,7 @@
#include "editor/editor_scale.h" #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; text_editor = p_edit;
line->set_text(itos(text_editor->cursor_get_line())); line->set_text(itos(text_editor->cursor_get_line()));
@ -46,11 +46,11 @@ void GotoLineDialog::popup_find_line(TextEdit *p_edit) {
line->grab_focus(); line->grab_focus();
} }
int GotoLineDialog::get_line() const { int EditorGotoLineDialog::get_line() const {
return line->get_text().to_int(); 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()) { if (get_line() < 1 || get_line() > text_editor->get_line_count()) {
return; return;
} }
@ -59,7 +59,7 @@ void GotoLineDialog::ok_pressed() {
hide(); hide();
} }
GotoLineDialog::GotoLineDialog() { EditorGotoLineDialog::EditorGotoLineDialog() {
set_title(TTR("Go to Line")); set_title(TTR("Go to Line"));
VBoxContainer *vbc = memnew(VBoxContainer); VBoxContainer *vbc = memnew(VBoxContainer);

View File

@ -37,8 +37,8 @@ class Label;
class LineEdit; class LineEdit;
class TextEdit; class TextEdit;
class GotoLineDialog : public ConfirmationDialog { class EditorGotoLineDialog : public ConfirmationDialog {
GDCLASS(GotoLineDialog, ConfirmationDialog); GDCLASS(EditorGotoLineDialog, ConfirmationDialog);
Label *line_label; Label *line_label;
LineEdit *line; LineEdit *line;
@ -51,7 +51,7 @@ public:
void popup_find_line(TextEdit *p_edit); void popup_find_line(TextEdit *p_edit);
int get_line() const; int get_line() const;
GotoLineDialog(); EditorGotoLineDialog();
}; };
#endif // CODE_EDITOR_H #endif // CODE_EDITOR_H

View File

@ -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); 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++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -222,7 +222,7 @@ void ScriptEditor::_script_created(Ref<Script> p_script) {
} }
void ScriptEditor::_goto_script_line2(int p_line) { void ScriptEditor::_goto_script_line2(int p_line) {
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (current) { if (current) {
current->goto_line(p_line); current->goto_line(p_line);
} }
@ -234,8 +234,8 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
if (edit(p_script, p_line, 0)) { if (edit(p_script, p_line, 0)) {
editor->push_item(p_script.ptr()); editor->push_item(p_script.ptr());
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (ScriptTextEditor *script_text_editor = Object::cast_to<ScriptTextEditor>(current)) { if (EditorScriptTextEditor *script_text_editor = Object::cast_to<EditorScriptTextEditor>(current)) {
script_text_editor->goto_line_centered(p_line); script_text_editor->goto_line_centered(p_line);
} else if (current) { } else if (current) {
current->goto_line(p_line, true); current->goto_line(p_line, true);
@ -248,7 +248,7 @@ void ScriptEditor::_set_execution(REF p_script, int p_line) {
Ref<Script> script = Object::cast_to<Script>(*p_script); Ref<Script> script = Object::cast_to<Script>(*p_script);
if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) { if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -264,7 +264,7 @@ void ScriptEditor::_clear_execution(REF p_script) {
Ref<Script> script = Object::cast_to<Script>(*p_script); Ref<Script> script = Object::cast_to<Script>(*p_script);
if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) { if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -276,13 +276,13 @@ void ScriptEditor::_clear_execution(REF p_script) {
} }
} }
ScriptEditorBase *ScriptEditor::_get_current_editor() const { EditorScriptEditorBase *ScriptEditor::_get_current_editor() const {
int selected = tab_container->get_current_tab(); int selected = tab_container->get_current_tab();
if (selected < 0 || selected >= tab_container->get_child_count()) { if (selected < 0 || selected >= tab_container->get_child_count()) {
return nullptr; return nullptr;
} }
return Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected)); return Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(selected));
} }
void ScriptEditor::_update_history_arrows() { void ScriptEditor::_update_history_arrows() {
@ -294,8 +294,8 @@ void ScriptEditor::_save_history() {
if (history_pos >= 0 && history_pos < history.size() && history[history_pos].control == tab_container->get_current_tab_control()) { if (history_pos >= 0 && history_pos < history.size() && history[history_pos].control == tab_container->get_current_tab_control()) {
Node *n = tab_container->get_current_tab_control(); Node *n = tab_container->get_current_tab_control();
if (Object::cast_to<ScriptEditorBase>(n)) { if (Object::cast_to<EditorScriptEditorBase>(n)) {
history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_edit_state(); history.write[history_pos].state = Object::cast_to<EditorScriptEditorBase>(n)->get_edit_state();
} }
if (Object::cast_to<EditorHelp>(n)) { if (Object::cast_to<EditorHelp>(n)) {
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll(); history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
@ -314,7 +314,7 @@ void ScriptEditor::_save_history() {
} }
void ScriptEditor::_go_to_tab(int p_idx) { void ScriptEditor::_go_to_tab(int p_idx) {
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (current) { if (current) {
if (current->is_unsaved()) { if (current->is_unsaved()) {
current->apply_code(); current->apply_code();
@ -329,8 +329,8 @@ void ScriptEditor::_go_to_tab(int p_idx) {
if (history_pos >= 0 && history_pos < history.size() && history[history_pos].control == tab_container->get_current_tab_control()) { if (history_pos >= 0 && history_pos < history.size() && history[history_pos].control == tab_container->get_current_tab_control()) {
Node *n = tab_container->get_current_tab_control(); Node *n = tab_container->get_current_tab_control();
if (Object::cast_to<ScriptEditorBase>(n)) { if (Object::cast_to<EditorScriptEditorBase>(n)) {
history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_edit_state(); history.write[history_pos].state = Object::cast_to<EditorScriptEditorBase>(n)->get_edit_state();
} }
if (Object::cast_to<EditorHelp>(n)) { if (Object::cast_to<EditorHelp>(n)) {
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll(); history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
@ -349,19 +349,19 @@ void ScriptEditor::_go_to_tab(int p_idx) {
c = tab_container->get_current_tab_control(); c = tab_container->get_current_tab_control();
if (Object::cast_to<ScriptEditorBase>(c)) { if (Object::cast_to<EditorScriptEditorBase>(c)) {
script_name_label->set_text(Object::cast_to<ScriptEditorBase>(c)->get_name()); script_name_label->set_text(Object::cast_to<EditorScriptEditorBase>(c)->get_name());
script_icon->set_texture(Object::cast_to<ScriptEditorBase>(c)->get_icon()); script_icon->set_texture(Object::cast_to<EditorScriptEditorBase>(c)->get_icon());
if (is_visible_in_tree()) { if (is_visible_in_tree()) {
Object::cast_to<ScriptEditorBase>(c)->ensure_focus(); Object::cast_to<EditorScriptEditorBase>(c)->ensure_focus();
} }
Ref<Script> script = Object::cast_to<ScriptEditorBase>(c)->get_edited_resource(); Ref<Script> script = Object::cast_to<EditorScriptEditorBase>(c)->get_edited_resource();
if (script != nullptr) { if (script != nullptr) {
notify_script_changed(script); notify_script_changed(script);
} }
Object::cast_to<ScriptEditorBase>(c)->validate(); Object::cast_to<EditorScriptEditorBase>(c)->validate();
} }
if (Object::cast_to<EditorHelp>(c)) { if (Object::cast_to<EditorHelp>(c)) {
script_name_label->set_text(Object::cast_to<EditorHelp>(c)->get_class()); script_name_label->set_text(Object::cast_to<EditorHelp>(c)->get_class());
@ -487,7 +487,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
Node *tselected = tab_container->get_child(selected); Node *tselected = tab_container->get_child(selected);
ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tselected); EditorScriptEditorBase *current = Object::cast_to<EditorScriptEditorBase>(tselected);
if (current) { if (current) {
Ref<Script> script = current->get_edited_resource(); Ref<Script> script = current->get_edited_resource();
if (p_save) { if (p_save) {
@ -569,7 +569,7 @@ void ScriptEditor::_close_docs_tab() {
} }
void ScriptEditor::_copy_script_path() { void ScriptEditor::_copy_script_path() {
ScriptEditorBase *se = _get_current_editor(); EditorScriptEditorBase *se = _get_current_editor();
if (se) { if (se) {
RES script = se->get_edited_resource(); RES script = se->get_edited_resource();
OS::get_singleton()->set_clipboard(script->get_path()); OS::get_singleton()->set_clipboard(script->get_path());
@ -599,7 +599,7 @@ void ScriptEditor::_queue_close_tabs() {
script_close_queue.pop_front(); script_close_queue.pop_front();
tab_container->set_current_tab(idx); tab_container->set_current_tab(idx);
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(idx)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(idx));
if (se) { if (se) {
// Maybe there are unsaved changes. // Maybe there are unsaved changes.
if (se->is_unsaved()) { if (se->is_unsaved()) {
@ -613,7 +613,7 @@ void ScriptEditor::_queue_close_tabs() {
} }
} }
void ScriptEditor::_ask_close_current_unsaved_tab(ScriptEditorBase *current) { void ScriptEditor::_ask_close_current_unsaved_tab(EditorScriptEditorBase *current) {
erase_tab_confirm->set_text(TTR("Close and save changes?") + "\n\"" + current->get_name() + "\""); erase_tab_confirm->set_text(TTR("Close and save changes?") + "\n\"" + current->get_name() + "\"");
erase_tab_confirm->popup_centered_minsize(); erase_tab_confirm->popup_centered_minsize();
} }
@ -622,7 +622,7 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
apply_scripts(); apply_scripts();
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -663,7 +663,7 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
void ScriptEditor::reload_scripts() { void ScriptEditor::reload_scripts() {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -707,7 +707,7 @@ void ScriptEditor::reload_scripts() {
void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) { void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -726,7 +726,7 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
void ScriptEditor::_scene_saved_callback(const String &p_path) { void ScriptEditor::_scene_saved_callback(const String &p_path) {
// If scene was saved, mark all built-in scripts from that scene as saved. // If scene was saved, mark all built-in scripts from that scene as saved.
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -770,7 +770,7 @@ bool ScriptEditor::_test_script_times_on_disk(RES p_for_script) {
bool use_autoreload = bool(EDITOR_DEF("text_editor/files/auto_reload_scripts_on_external_change", false)); bool use_autoreload = bool(EDITOR_DEF("text_editor/files/auto_reload_scripts_on_external_change", false));
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (se) { if (se) {
RES edited_res = se->get_edited_resource(); RES edited_res = se->get_edited_resource();
if (p_for_script.is_valid() && edited_res.is_valid() && p_for_script != edited_res) { if (p_for_script.is_valid() && edited_res.is_valid() && p_for_script != edited_res) {
@ -850,7 +850,7 @@ void ScriptEditor::_file_dialog_action(String p_file) {
} }
} break; } break;
case FILE_SAVE_AS: { case FILE_SAVE_AS: {
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (current) { if (current) {
RES resource = current->get_edited_resource(); RES resource = current->get_edited_resource();
String path = ProjectSettings::get_singleton()->localize_path(p_file); String path = ProjectSettings::get_singleton()->localize_path(p_file);
@ -880,7 +880,7 @@ void ScriptEditor::_file_dialog_action(String p_file) {
} }
Ref<Script> ScriptEditor::_get_current_script() { Ref<Script> ScriptEditor::_get_current_script() {
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (current) { if (current) {
Ref<Script> script = current->get_edited_resource(); Ref<Script> script = current->get_edited_resource();
@ -911,7 +911,7 @@ bool ScriptEditor::is_scripts_panel_toggled() {
} }
void ScriptEditor::_menu_option(int p_option) { void ScriptEditor::_menu_option(int p_option) {
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
switch (p_option) { switch (p_option) {
case FILE_NEW: { case FILE_NEW: {
script_create_dialog->config("Node", "new_script", false, false); script_create_dialog->config("Node", "new_script", false, false);
@ -1037,7 +1037,7 @@ void ScriptEditor::_menu_option(int p_option) {
} break; } break;
case TOGGLE_SCRIPTS_PANEL: { case TOGGLE_SCRIPTS_PANEL: {
if (current) { if (current) {
ScriptTextEditor *editor = Object::cast_to<ScriptTextEditor>(current); EditorScriptTextEditor *editor = Object::cast_to<EditorScriptTextEditor>(current);
toggle_scripts_panel(); toggle_scripts_panel();
if (editor) { if (editor) {
editor->update_toggle_scripts_button(); editor->update_toggle_scripts_button();
@ -1312,7 +1312,7 @@ bool ScriptEditor::_has_docs_tab() const {
bool ScriptEditor::_has_script_tab() const { bool ScriptEditor::_has_script_tab() const {
const int child_count = tab_container->get_child_count(); const int child_count = tab_container->get_child_count();
for (int i = 0; i < child_count; i++) { for (int i = 0; i < child_count; i++) {
if (Object::cast_to<ScriptEditorBase>(tab_container->get_child(i))) { if (Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i))) {
return true; return true;
} }
} }
@ -1419,7 +1419,7 @@ void ScriptEditor::_notification(int p_what) {
} }
bool ScriptEditor::can_take_away_focus() const { bool ScriptEditor::can_take_away_focus() const {
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (current) { if (current) {
return current->can_lose_focus_on_node_selection(); return current->can_lose_focus_on_node_selection();
} else { } else {
@ -1429,7 +1429,7 @@ bool ScriptEditor::can_take_away_focus() const {
void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) { void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (se) { if (se) {
Ref<Script> script = se->get_edited_resource(); Ref<Script> script = se->get_edited_resource();
@ -1459,7 +1459,7 @@ void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) { void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -1487,14 +1487,14 @@ void ScriptEditor::ensure_focus_current() {
return; return;
} }
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (current) { if (current) {
current->ensure_focus(); current->ensure_focus();
} }
} }
void ScriptEditor::_members_overview_selected(int p_idx) { void ScriptEditor::_members_overview_selected(int p_idx) {
ScriptEditorBase *se = _get_current_editor(); EditorScriptEditorBase *se = _get_current_editor();
if (!se) { if (!se) {
return; return;
} }
@ -1525,7 +1525,7 @@ void ScriptEditor::_script_selected(int p_idx) {
void ScriptEditor::ensure_select_current() { void ScriptEditor::ensure_select_current() {
if (tab_container->get_child_count() && tab_container->get_current_tab() >= 0) { if (tab_container->get_child_count() && tab_container->get_current_tab() >= 0) {
ScriptEditorBase *se = _get_current_editor(); EditorScriptEditorBase *se = _get_current_editor();
if (se) { if (se) {
se->enable_editor(); se->enable_editor();
@ -1579,7 +1579,7 @@ struct _ScriptEditorItemData {
}; };
void ScriptEditor::_update_members_overview_visibility() { void ScriptEditor::_update_members_overview_visibility() {
ScriptEditorBase *se = _get_current_editor(); EditorScriptEditorBase *se = _get_current_editor();
if (!se) { if (!se) {
members_overview_alphabeta_sort_button->set_visible(false); members_overview_alphabeta_sort_button->set_visible(false);
members_overview->set_visible(false); members_overview->set_visible(false);
@ -1606,7 +1606,7 @@ void ScriptEditor::_toggle_members_overview_alpha_sort(bool p_alphabetic_sort) {
void ScriptEditor::_update_members_overview() { void ScriptEditor::_update_members_overview() {
members_overview->clear(); members_overview->clear();
ScriptEditorBase *se = _get_current_editor(); EditorScriptEditorBase *se = _get_current_editor();
if (!se) { if (!se) {
return; return;
} }
@ -1735,7 +1735,7 @@ void ScriptEditor::_update_script_names() {
Vector<_ScriptEditorItemData> sedata; Vector<_ScriptEditorItemData> sedata;
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (se) { if (se) {
Ref<Texture> icon = se->get_icon(); Ref<Texture> icon = se->get_icon();
String path = se->get_edited_resource()->get_path(); String path = se->get_edited_resource()->get_path();
@ -1877,7 +1877,7 @@ void ScriptEditor::_update_script_names() {
script_list->select(index); script_list->select(index);
script_name_label->set_text(sedata_filtered[i].name); script_name_label->set_text(sedata_filtered[i].name);
script_icon->set_texture(sedata_filtered[i].icon); script_icon->set_texture(sedata_filtered[i].icon);
ScriptEditorBase *se = _get_current_editor(); EditorScriptEditorBase *se = _get_current_editor();
if (se) { if (se) {
se->enable_editor(); se->enable_editor();
_update_selected_editor_menu(); _update_selected_editor_menu();
@ -1898,7 +1898,7 @@ void ScriptEditor::_update_script_names() {
void ScriptEditor::_update_script_connections() { void ScriptEditor::_update_script_connections() {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(tab_container->get_child(i)); EditorScriptTextEditor *ste = Object::cast_to<EditorScriptTextEditor>(tab_container->get_child(i));
if (!ste) { if (!ste) {
continue; continue;
} }
@ -2047,7 +2047,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
} }
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -2076,7 +2076,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
// doesn't have it, make a new one // doesn't have it, make a new one
ScriptEditorBase *se = nullptr; EditorScriptEditorBase *se = nullptr;
for (int i = script_editor_func_count - 1; i >= 0; i--) { for (int i = script_editor_func_count - 1; i >= 0; i--) {
se = script_editor_funcs[i](p_resource); se = script_editor_funcs[i](p_resource);
@ -2148,7 +2148,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
} }
void ScriptEditor::save_current_script() { void ScriptEditor::save_current_script() {
ScriptEditorBase *current = _get_current_editor(); EditorScriptEditorBase *current = _get_current_editor();
if (!current || _test_script_times_on_disk()) { if (!current || _test_script_times_on_disk()) {
return; return;
} }
@ -2193,7 +2193,7 @@ void ScriptEditor::save_all_scripts() {
Vector<String> scenes_to_save; Vector<String> scenes_to_save;
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -2247,7 +2247,7 @@ void ScriptEditor::save_all_scripts() {
void ScriptEditor::apply_scripts() const { void ScriptEditor::apply_scripts() const {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -2279,7 +2279,7 @@ void ScriptEditor::_editor_stop() {
debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_CONTINUE), true); debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_CONTINUE), true);
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -2296,7 +2296,7 @@ void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const
editor->push_item(script.ptr()); editor->push_item(script.ptr());
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -2347,7 +2347,7 @@ void ScriptEditor::_editor_settings_changed() {
} }
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -2403,7 +2403,7 @@ Variant ScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
String preview_name = ""; String preview_name = "";
Ref<Texture> preview_icon; Ref<Texture> preview_icon;
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(cur_node); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(cur_node);
if (se) { if (se) {
preview_name = se->get_name(); preview_name = se->get_name();
preview_icon = se->get_icon(); preview_icon = se->get_icon();
@ -2439,7 +2439,7 @@ bool ScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data
if (String(d["type"]) == "script_list_element") { if (String(d["type"]) == "script_list_element") {
Node *node = d["script_list_element"]; Node *node = d["script_list_element"];
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(node);
if (se) { if (se) {
return true; return true;
} }
@ -2456,7 +2456,7 @@ bool ScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data
} }
Node *node = get_node((nodes[0])); Node *node = get_node((nodes[0]));
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(node);
if (se) { if (se) {
return true; return true;
} }
@ -2502,7 +2502,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
if (String(d["type"]) == "script_list_element") { if (String(d["type"]) == "script_list_element") {
Node *node = d["script_list_element"]; Node *node = d["script_list_element"];
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(node);
EditorHelp *eh = Object::cast_to<EditorHelp>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node);
if (se || eh) { if (se || eh) {
int new_index = 0; int new_index = 0;
@ -2522,7 +2522,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
} }
Node *node = get_node(nodes[0]); Node *node = get_node(nodes[0]);
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(node);
EditorHelp *eh = Object::cast_to<EditorHelp>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node);
if (se || eh) { if (se || eh) {
int new_index = 0; int new_index = 0;
@ -2647,7 +2647,7 @@ void ScriptEditor::_make_script_list_context_menu() {
return; return;
} }
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(selected));
if (se) { if (se) {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save"), FILE_SAVE); context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save"), FILE_SAVE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save_as"), FILE_SAVE_AS); context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save_as"), FILE_SAVE_AS);
@ -2738,7 +2738,7 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
} }
if (!script_info.empty()) { if (!script_info.empty()) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(tab_container->get_tab_count() - 1)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(tab_container->get_tab_count() - 1));
if (se) { if (se) {
se->set_edit_state(script_info["state"]); se->set_edit_state(script_info["state"]);
} }
@ -2771,7 +2771,7 @@ void ScriptEditor::get_window_layout(Ref<ConfigFile> p_layout) {
Array helps; Array helps;
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (se) { if (se) {
String path = se->get_edited_resource()->get_path(); String path = se->get_edited_resource()->get_path();
if (!path.is_resource_file()) { if (!path.is_resource_file()) {
@ -2856,7 +2856,7 @@ void ScriptEditor::_update_selected_editor_menu() {
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
bool current = tab_container->get_current_tab() == i; bool current = tab_container->get_current_tab() == i;
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (se && se->get_edit_menu()) { if (se && se->get_edit_menu()) {
if (current) { if (current) {
se->get_edit_menu()->show(); se->get_edit_menu()->show();
@ -2890,8 +2890,8 @@ void ScriptEditor::_update_selected_editor_menu() {
void ScriptEditor::_update_history_pos(int p_new_pos) { void ScriptEditor::_update_history_pos(int p_new_pos) {
Node *n = tab_container->get_current_tab_control(); Node *n = tab_container->get_current_tab_control();
if (Object::cast_to<ScriptEditorBase>(n)) { if (Object::cast_to<EditorScriptEditorBase>(n)) {
history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_edit_state(); history.write[history_pos].state = Object::cast_to<EditorScriptEditorBase>(n)->get_edit_state();
} }
if (Object::cast_to<EditorHelp>(n)) { if (Object::cast_to<EditorHelp>(n)) {
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll(); history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
@ -2902,11 +2902,11 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
n = history[history_pos].control; n = history[history_pos].control;
if (Object::cast_to<ScriptEditorBase>(n)) { if (Object::cast_to<EditorScriptEditorBase>(n)) {
Object::cast_to<ScriptEditorBase>(n)->set_edit_state(history[history_pos].state); Object::cast_to<EditorScriptEditorBase>(n)->set_edit_state(history[history_pos].state);
Object::cast_to<ScriptEditorBase>(n)->ensure_focus(); Object::cast_to<EditorScriptEditorBase>(n)->ensure_focus();
Ref<Script> script = Object::cast_to<ScriptEditorBase>(n)->get_edited_resource(); Ref<Script> script = Object::cast_to<EditorScriptEditorBase>(n)->get_edited_resource();
if (script != nullptr) { if (script != nullptr) {
notify_script_changed(script); notify_script_changed(script);
} }
@ -2939,7 +2939,7 @@ Vector<Ref<Script>> ScriptEditor::get_open_scripts() const {
Vector<Ref<Script>> out_scripts = Vector<Ref<Script>>(); Vector<Ref<Script>> out_scripts = Vector<Ref<Script>>();
for (int i = 0; i < tab_container->get_child_count(); i++) { for (int i = 0; i < tab_container->get_child_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); EditorScriptEditorBase *se = Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(i));
if (!se) { if (!se) {
continue; continue;
} }
@ -3054,7 +3054,7 @@ void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_numb
if (script.is_valid()) { if (script.is_valid()) {
edit(script); edit(script);
ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(_get_current_editor()); EditorScriptTextEditor *ste = Object::cast_to<EditorScriptTextEditor>(_get_current_editor());
if (ste) { if (ste) {
ste->goto_line_selection(line_number - 1, begin, end); ste->goto_line_selection(line_number - 1, begin, end);
} }

View File

@ -78,11 +78,11 @@ class Timer;
class ToolButton; class ToolButton;
class Tree; class Tree;
class VSplitContainer; class VSplitContainer;
class ScriptEditorQuickOpen; class EditorScriptEditorQuickOpen;
class ScriptEditorDebugger; class ScriptEditorDebugger;
typedef SyntaxHighlighter *(*CreateSyntaxHighlighterFunc)(); typedef SyntaxHighlighter *(*CreateSyntaxHighlighterFunc)();
typedef ScriptEditorBase *(*CreateScriptEditorFunc)(const RES &p_resource); typedef EditorScriptEditorBase *(*CreateScriptEditorFunc)(const RES &p_resource);
class EditorScriptCodeCompletionCache; class EditorScriptCodeCompletionCache;
class FindInFilesDialog; class FindInFilesDialog;
@ -259,7 +259,7 @@ class ScriptEditor : public PanelContainer {
void _copy_script_path(); void _copy_script_path();
void _ask_close_current_unsaved_tab(ScriptEditorBase *current); void _ask_close_current_unsaved_tab(EditorScriptEditorBase *current);
bool grab_focus_block; bool grab_focus_block;
@ -294,7 +294,7 @@ class ScriptEditor : public PanelContainer {
void _show_debugger(bool p_show); void _show_debugger(bool p_show);
void _script_created(Ref<Script> p_script); void _script_created(Ref<Script> p_script);
ScriptEditorBase *_get_current_editor() const; EditorScriptEditorBase *_get_current_editor() const;
void _save_layout(); void _save_layout();
void _editor_settings_changed(); void _editor_settings_changed();

View File

@ -30,7 +30,7 @@
#include "editor_script_editor_base.h" #include "editor_script_editor_base.h"
void ScriptEditorBase::_bind_methods() { void EditorScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("name_changed")); ADD_SIGNAL(MethodInfo("name_changed"));
ADD_SIGNAL(MethodInfo("edited_script_changed")); ADD_SIGNAL(MethodInfo("edited_script_changed"));
ADD_SIGNAL(MethodInfo("request_help", PropertyInfo(Variant::STRING, "topic"))); ADD_SIGNAL(MethodInfo("request_help", PropertyInfo(Variant::STRING, "topic")));

View File

@ -36,8 +36,8 @@
class SyntaxHighlighter; class SyntaxHighlighter;
class Texture; class Texture;
class ScriptEditorBase : public VBoxContainer { class EditorScriptEditorBase : public VBoxContainer {
GDCLASS(ScriptEditorBase, VBoxContainer); GDCLASS(EditorScriptEditorBase, VBoxContainer);
protected: protected:
static void _bind_methods(); static void _bind_methods();
@ -81,7 +81,7 @@ public:
virtual void validate() = 0; virtual void validate() = 0;
ScriptEditorBase() {} EditorScriptEditorBase() {}
}; };
#endif // SCRIPT_EDITOR_PLUGIN_H #endif // SCRIPT_EDITOR_PLUGIN_H

View File

@ -37,7 +37,7 @@
#include "scene/gui/tree.h" #include "scene/gui/tree.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
void ScriptEditorQuickOpen::popup_dialog(const Vector<String> &p_functions, bool p_dontclear) { void EditorScriptEditorQuickOpen::popup_dialog(const Vector<String> &p_functions, bool p_dontclear) {
popup_centered_ratio(0.6); popup_centered_ratio(0.6);
if (p_dontclear) { if (p_dontclear) {
search_box->select_all(); search_box->select_all();
@ -49,11 +49,11 @@ void ScriptEditorQuickOpen::popup_dialog(const Vector<String> &p_functions, bool
_update_search(); _update_search();
} }
void ScriptEditorQuickOpen::_text_changed(const String &p_newtext) { void EditorScriptEditorQuickOpen::_text_changed(const String &p_newtext) {
_update_search(); _update_search();
} }
void ScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) { void EditorScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> k = p_ie; Ref<InputEventKey> k = p_ie;
if (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_PAGEUP || k->get_scancode() == KEY_PAGEDOWN)) { if (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_PAGEUP || k->get_scancode() == KEY_PAGEDOWN)) {
@ -62,7 +62,7 @@ void ScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
} }
} }
void ScriptEditorQuickOpen::_update_search() { void EditorScriptEditorQuickOpen::_update_search() {
search_options->clear(); search_options->clear();
TreeItem *root = search_options->create_item(); TreeItem *root = search_options->create_item();
@ -80,7 +80,7 @@ void ScriptEditorQuickOpen::_update_search() {
get_ok()->set_disabled(root->get_children() == nullptr); get_ok()->set_disabled(root->get_children() == nullptr);
} }
void ScriptEditorQuickOpen::_confirmed() { void EditorScriptEditorQuickOpen::_confirmed() {
TreeItem *ti = search_options->get_selected(); TreeItem *ti = search_options->get_selected();
if (!ti) { if (!ti) {
return; return;
@ -91,7 +91,7 @@ void ScriptEditorQuickOpen::_confirmed() {
hide(); hide();
} }
void ScriptEditorQuickOpen::_notification(int p_what) { void EditorScriptEditorQuickOpen::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: { case NOTIFICATION_ENTER_TREE: {
connect("confirmed", this, "_confirmed"); connect("confirmed", this, "_confirmed");
@ -108,15 +108,15 @@ void ScriptEditorQuickOpen::_notification(int p_what) {
} }
} }
void ScriptEditorQuickOpen::_bind_methods() { void EditorScriptEditorQuickOpen::_bind_methods() {
ClassDB::bind_method(D_METHOD("_text_changed"), &ScriptEditorQuickOpen::_text_changed); ClassDB::bind_method(D_METHOD("_text_changed"), &EditorScriptEditorQuickOpen::_text_changed);
ClassDB::bind_method(D_METHOD("_confirmed"), &ScriptEditorQuickOpen::_confirmed); ClassDB::bind_method(D_METHOD("_confirmed"), &EditorScriptEditorQuickOpen::_confirmed);
ClassDB::bind_method(D_METHOD("_sbox_input"), &ScriptEditorQuickOpen::_sbox_input); ClassDB::bind_method(D_METHOD("_sbox_input"), &EditorScriptEditorQuickOpen::_sbox_input);
ADD_SIGNAL(MethodInfo("goto_line", PropertyInfo(Variant::INT, "line"))); ADD_SIGNAL(MethodInfo("goto_line", PropertyInfo(Variant::INT, "line")));
} }
ScriptEditorQuickOpen::ScriptEditorQuickOpen() { EditorScriptEditorQuickOpen::EditorScriptEditorQuickOpen() {
VBoxContainer *vbc = memnew(VBoxContainer); VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc); add_child(vbc);
search_box = memnew(LineEdit); search_box = memnew(LineEdit);

View File

@ -39,8 +39,8 @@
class LineEdit; class LineEdit;
class Tree; class Tree;
class ScriptEditorQuickOpen : public ConfirmationDialog { class EditorScriptEditorQuickOpen : public ConfirmationDialog {
GDCLASS(ScriptEditorQuickOpen, ConfirmationDialog); GDCLASS(EditorScriptEditorQuickOpen, ConfirmationDialog);
LineEdit *search_box; LineEdit *search_box;
Tree *search_options; Tree *search_options;
@ -60,7 +60,7 @@ protected:
public: public:
void popup_dialog(const Vector<String> &p_functions, bool p_dontclear = false); void popup_dialog(const Vector<String> &p_functions, bool p_dontclear = false);
ScriptEditorQuickOpen(); EditorScriptEditorQuickOpen();
}; };
#endif // SCRIPT_EDITOR_PLUGIN_H #endif // SCRIPT_EDITOR_PLUGIN_H

View File

@ -76,7 +76,7 @@
#include "editor_goto_line_dialog.h" #include "editor_goto_line_dialog.h"
#include "editor_find_replace_bar.h" #include "editor_find_replace_bar.h"
Vector<String> ScriptTextEditor::get_functions() { Vector<String> EditorScriptTextEditor::get_functions() {
String errortxt; String errortxt;
int line = -1, col; int line = -1, col;
TextEdit *te = code_editor->get_text_edit(); TextEdit *te = code_editor->get_text_edit();
@ -94,7 +94,7 @@ Vector<String> ScriptTextEditor::get_functions() {
return functions; return functions;
} }
void ScriptTextEditor::apply_code() { void EditorScriptTextEditor::apply_code() {
if (script.is_null()) { if (script.is_null()) {
return; return;
} }
@ -103,11 +103,11 @@ void ScriptTextEditor::apply_code() {
_update_member_keywords(); _update_member_keywords();
} }
RES ScriptTextEditor::get_edited_resource() const { RES EditorScriptTextEditor::get_edited_resource() const {
return script; return script;
} }
void ScriptTextEditor::set_edited_resource(const RES &p_res) { void EditorScriptTextEditor::set_edited_resource(const RES &p_res) {
ERR_FAIL_COND(script.is_valid()); ERR_FAIL_COND(script.is_valid());
ERR_FAIL_COND(p_res.is_null()); ERR_FAIL_COND(p_res.is_null());
@ -121,7 +121,7 @@ void ScriptTextEditor::set_edited_resource(const RES &p_res) {
code_editor->update_line_and_column(); code_editor->update_line_and_column();
} }
void ScriptTextEditor::enable_editor() { void EditorScriptTextEditor::enable_editor() {
if (editor_enabled) { if (editor_enabled) {
return; return;
} }
@ -134,7 +134,7 @@ void ScriptTextEditor::enable_editor() {
_validate_script(); _validate_script();
} }
void ScriptTextEditor::_update_member_keywords() { void EditorScriptTextEditor::_update_member_keywords() {
member_keywords.clear(); member_keywords.clear();
code_editor->get_text_edit()->clear_member_keywords(); code_editor->get_text_edit()->clear_member_keywords();
Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color"); Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
@ -167,7 +167,7 @@ void ScriptTextEditor::_update_member_keywords() {
} }
} }
void ScriptTextEditor::_load_theme_settings() { void EditorScriptTextEditor::_load_theme_settings() {
TextEdit *text_edit = code_editor->get_text_edit(); TextEdit *text_edit = code_editor->get_text_edit();
text_edit->clear_colors(); text_edit->clear_colors();
@ -254,7 +254,7 @@ void ScriptTextEditor::_load_theme_settings() {
} }
} }
void ScriptTextEditor::_set_theme_for_script() { void EditorScriptTextEditor::_set_theme_for_script() {
if (!theme_loaded) { if (!theme_loaded) {
return; return;
} }
@ -358,11 +358,11 @@ void ScriptTextEditor::_set_theme_for_script() {
} }
} }
void ScriptTextEditor::_show_warnings_panel(bool p_show) { void EditorScriptTextEditor::_show_warnings_panel(bool p_show) {
warnings_panel->set_visible(p_show); warnings_panel->set_visible(p_show);
} }
void ScriptTextEditor::_warning_clicked(Variant p_line) { void EditorScriptTextEditor::_warning_clicked(Variant p_line) {
if (p_line.get_type() == Variant::INT) { if (p_line.get_type() == Variant::INT) {
goto_line_centered(p_line.operator int64_t()); goto_line_centered(p_line.operator int64_t());
} else if (p_line.get_type() == Variant::DICTIONARY) { } else if (p_line.get_type() == Variant::DICTIONARY) {
@ -372,7 +372,7 @@ void ScriptTextEditor::_warning_clicked(Variant p_line) {
} }
} }
void ScriptTextEditor::reload_text() { void EditorScriptTextEditor::reload_text() {
ERR_FAIL_COND(script.is_null()); ERR_FAIL_COND(script.is_null());
TextEdit *te = code_editor->get_text_edit(); TextEdit *te = code_editor->get_text_edit();
@ -392,7 +392,7 @@ void ScriptTextEditor::reload_text() {
code_editor->update_line_and_column(); code_editor->update_line_and_column();
} }
void ScriptTextEditor::add_callback(const String &p_function, PoolStringArray p_args) { void EditorScriptTextEditor::add_callback(const String &p_function, PoolStringArray p_args) {
String code = code_editor->get_text_edit()->get_text(); String code = code_editor->get_text_edit()->get_text();
int pos = script->get_language()->find_function(p_function, code); int pos = script->get_language()->find_function(p_function, code);
if (pos == -1) { if (pos == -1) {
@ -409,23 +409,23 @@ void ScriptTextEditor::add_callback(const String &p_function, PoolStringArray p_
code_editor->get_text_edit()->cursor_set_column(1); code_editor->get_text_edit()->cursor_set_column(1);
} }
bool ScriptTextEditor::show_members_overview() { bool EditorScriptTextEditor::show_members_overview() {
return true; return true;
} }
void ScriptTextEditor::update_settings() { void EditorScriptTextEditor::update_settings() {
code_editor->update_editor_settings(); code_editor->update_editor_settings();
} }
bool ScriptTextEditor::is_unsaved() { bool EditorScriptTextEditor::is_unsaved() {
return code_editor->get_text_edit()->get_version() != code_editor->get_text_edit()->get_saved_version(); return code_editor->get_text_edit()->get_version() != code_editor->get_text_edit()->get_saved_version();
} }
Variant ScriptTextEditor::get_edit_state() { Variant EditorScriptTextEditor::get_edit_state() {
return code_editor->get_edit_state(); return code_editor->get_edit_state();
} }
void ScriptTextEditor::set_edit_state(const Variant &p_state) { void EditorScriptTextEditor::set_edit_state(const Variant &p_state) {
code_editor->set_edit_state(p_state); code_editor->set_edit_state(p_state);
Dictionary state = p_state; Dictionary state = p_state;
@ -443,55 +443,55 @@ void ScriptTextEditor::set_edit_state(const Variant &p_state) {
} }
} }
void ScriptTextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) { void EditorScriptTextEditor::_convert_case(EditorCodeTextEditor::CaseStyle p_case) {
code_editor->convert_case(p_case); code_editor->convert_case(p_case);
} }
void ScriptTextEditor::trim_trailing_whitespace() { void EditorScriptTextEditor::trim_trailing_whitespace() {
code_editor->trim_trailing_whitespace(); code_editor->trim_trailing_whitespace();
} }
void ScriptTextEditor::insert_final_newline() { void EditorScriptTextEditor::insert_final_newline() {
code_editor->insert_final_newline(); code_editor->insert_final_newline();
} }
void ScriptTextEditor::convert_indent_to_spaces() { void EditorScriptTextEditor::convert_indent_to_spaces() {
code_editor->convert_indent_to_spaces(); code_editor->convert_indent_to_spaces();
} }
void ScriptTextEditor::convert_indent_to_tabs() { void EditorScriptTextEditor::convert_indent_to_tabs() {
code_editor->convert_indent_to_tabs(); code_editor->convert_indent_to_tabs();
} }
void ScriptTextEditor::tag_saved_version() { void EditorScriptTextEditor::tag_saved_version() {
code_editor->get_text_edit()->tag_saved_version(); code_editor->get_text_edit()->tag_saved_version();
} }
void ScriptTextEditor::goto_line(int p_line, bool p_with_error) { void EditorScriptTextEditor::goto_line(int p_line, bool p_with_error) {
code_editor->goto_line(p_line); code_editor->goto_line(p_line);
} }
void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) { void EditorScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
code_editor->goto_line_selection(p_line, p_begin, p_end); code_editor->goto_line_selection(p_line, p_begin, p_end);
} }
void ScriptTextEditor::goto_line_centered(int p_line) { void EditorScriptTextEditor::goto_line_centered(int p_line) {
code_editor->goto_line_centered(p_line); code_editor->goto_line_centered(p_line);
} }
void ScriptTextEditor::set_executing_line(int p_line) { void EditorScriptTextEditor::set_executing_line(int p_line) {
code_editor->set_executing_line(p_line); code_editor->set_executing_line(p_line);
} }
void ScriptTextEditor::clear_executing_line() { void EditorScriptTextEditor::clear_executing_line() {
code_editor->clear_executing_line(); code_editor->clear_executing_line();
} }
void ScriptTextEditor::ensure_focus() { void EditorScriptTextEditor::ensure_focus() {
code_editor->get_text_edit()->grab_focus(); code_editor->get_text_edit()->grab_focus();
} }
String ScriptTextEditor::get_name() { String EditorScriptTextEditor::get_name() {
String name; String name;
name = script->get_path().get_file(); name = script->get_path().get_file();
@ -514,7 +514,7 @@ String ScriptTextEditor::get_name() {
return name; return name;
} }
Ref<Texture> ScriptTextEditor::get_icon() { Ref<Texture> EditorScriptTextEditor::get_icon() {
if (get_parent_control() && get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) { if (get_parent_control() && get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) {
return get_parent_control()->get_theme_icon(script->get_class(), "EditorIcons"); return get_parent_control()->get_theme_icon(script->get_class(), "EditorIcons");
} }
@ -522,7 +522,7 @@ Ref<Texture> ScriptTextEditor::get_icon() {
return Ref<Texture>(); return Ref<Texture>();
} }
void ScriptTextEditor::_validate_script() { void EditorScriptTextEditor::_validate_script() {
String errortxt; String errortxt;
int line = -1, col; int line = -1, col;
TextEdit *te = code_editor->get_text_edit(); TextEdit *te = code_editor->get_text_edit();
@ -639,7 +639,7 @@ void ScriptTextEditor::_validate_script() {
emit_signal("edited_script_changed"); emit_signal("edited_script_changed");
} }
void ScriptTextEditor::_update_bookmark_list() { void EditorScriptTextEditor::_update_bookmark_list() {
bookmarks_menu->clear(); bookmarks_menu->clear();
bookmarks_menu->set_size(Size2(1, 1)); bookmarks_menu->set_size(Size2(1, 1));
@ -670,7 +670,7 @@ void ScriptTextEditor::_update_bookmark_list() {
} }
} }
void ScriptTextEditor::_bookmark_item_pressed(int p_idx) { void EditorScriptTextEditor::_bookmark_item_pressed(int p_idx) {
if (p_idx < 4) { // Any item before the separator. if (p_idx < 4) { // Any item before the separator.
_edit_option(bookmarks_menu->get_item_id(p_idx)); _edit_option(bookmarks_menu->get_item_id(p_idx));
} else { } else {
@ -771,12 +771,12 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
} }
} }
void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) { void EditorScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
ScriptTextEditor *ste = (ScriptTextEditor *)p_ud; EditorScriptTextEditor *ste = (EditorScriptTextEditor *)p_ud;
ste->_code_complete_script(p_code, r_options, r_force); ste->_code_complete_script(p_code, r_options, r_force);
} }
void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) { void EditorScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
if (color_panel->is_visible_in_tree()) { if (color_panel->is_visible_in_tree()) {
return; return;
} }
@ -791,7 +791,7 @@ void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCo
} }
} }
void ScriptTextEditor::_update_breakpoint_list() { void EditorScriptTextEditor::_update_breakpoint_list() {
breakpoints_menu->clear(); breakpoints_menu->clear();
breakpoints_menu->set_size(Size2(1, 1)); breakpoints_menu->set_size(Size2(1, 1));
@ -822,7 +822,7 @@ void ScriptTextEditor::_update_breakpoint_list() {
} }
} }
void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) { void EditorScriptTextEditor::_breakpoint_item_pressed(int p_idx) {
if (p_idx < 4) { // Any item before the separator. if (p_idx < 4) { // Any item before the separator.
_edit_option(breakpoints_menu->get_item_id(p_idx)); _edit_option(breakpoints_menu->get_item_id(p_idx));
} else { } else {
@ -831,11 +831,11 @@ void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) {
} }
} }
void ScriptTextEditor::_breakpoint_toggled(int p_row) { void EditorScriptTextEditor::_breakpoint_toggled(int p_row) {
ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(script->get_path(), p_row + 1, code_editor->get_text_edit()->is_line_set_as_breakpoint(p_row)); ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(script->get_path(), p_row + 1, code_editor->get_text_edit()->is_line_set_as_breakpoint(p_row));
} }
void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_column) { void EditorScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_column) {
Node *base = get_tree()->get_edited_scene_root(); Node *base = get_tree()->get_edited_scene_root();
if (base) { if (base) {
base = _find_node_for_script(base, base, script); base = _find_node_for_script(base, base, script);
@ -949,19 +949,19 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
} }
} }
String ScriptTextEditor::_get_absolute_path(const String &rel_path) { String EditorScriptTextEditor::_get_absolute_path(const String &rel_path) {
String base_path = script->get_path().get_base_dir(); String base_path = script->get_path().get_base_dir();
String path = base_path.plus_file(rel_path); String path = base_path.plus_file(rel_path);
return path.replace("///", "//").simplify_path(); return path.replace("///", "//").simplify_path();
} }
void ScriptTextEditor::update_toggle_scripts_button() { void EditorScriptTextEditor::update_toggle_scripts_button() {
if (code_editor != nullptr) { if (code_editor != nullptr) {
code_editor->update_toggle_scripts_button(); code_editor->update_toggle_scripts_button();
} }
} }
void ScriptTextEditor::_update_connected_methods() { void EditorScriptTextEditor::_update_connected_methods() {
TextEdit *text_edit = code_editor->get_text_edit(); TextEdit *text_edit = code_editor->get_text_edit();
text_edit->clear_info_icons(); text_edit->clear_info_icons();
missing_connections.clear(); missing_connections.clear();
@ -1034,7 +1034,7 @@ void ScriptTextEditor::_update_connected_methods() {
} }
} }
void ScriptTextEditor::_lookup_connections(int p_row, String p_method) { void EditorScriptTextEditor::_lookup_connections(int p_row, String p_method) {
Node *base = get_tree()->get_edited_scene_root(); Node *base = get_tree()->get_edited_scene_root();
if (!base) { if (!base) {
return; return;
@ -1044,7 +1044,7 @@ void ScriptTextEditor::_lookup_connections(int p_row, String p_method) {
connection_info_dialog->popup_connections(p_method, nodes); connection_info_dialog->popup_connections(p_method, nodes);
} }
void ScriptTextEditor::_edit_option(int p_op) { void EditorScriptTextEditor::_edit_option(int p_op) {
TextEdit *tx = code_editor->get_text_edit(); TextEdit *tx = code_editor->get_text_edit();
switch (p_op) { switch (p_op) {
@ -1159,13 +1159,13 @@ void ScriptTextEditor::_edit_option(int p_op) {
color_panel->popup(); color_panel->popup();
} break; } break;
case EDIT_TO_UPPERCASE: { case EDIT_TO_UPPERCASE: {
_convert_case(CodeTextEditor::UPPER); _convert_case(EditorCodeTextEditor::UPPER);
} break; } break;
case EDIT_TO_LOWERCASE: { case EDIT_TO_LOWERCASE: {
_convert_case(CodeTextEditor::LOWER); _convert_case(EditorCodeTextEditor::LOWER);
} break; } break;
case EDIT_CAPITALIZE: { case EDIT_CAPITALIZE: {
_convert_case(CodeTextEditor::CAPITALIZE); _convert_case(EditorCodeTextEditor::CAPITALIZE);
} break; } break;
case EDIT_EVALUATE: { case EDIT_EVALUATE: {
Expression expression; Expression expression;
@ -1326,7 +1326,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
} }
} }
void ScriptTextEditor::_edit_option_toggle_inline_comment() { void EditorScriptTextEditor::_edit_option_toggle_inline_comment() {
if (script.is_null()) { if (script.is_null()) {
return; return;
} }
@ -1346,12 +1346,12 @@ void ScriptTextEditor::_edit_option_toggle_inline_comment() {
code_editor->toggle_inline_comment(delimiter); code_editor->toggle_inline_comment(delimiter);
} }
void ScriptTextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) { void EditorScriptTextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
highlighters[p_highlighter->get_name()] = p_highlighter; highlighters[p_highlighter->get_name()] = p_highlighter;
highlighter_menu->add_radio_check_item(p_highlighter->get_name()); highlighter_menu->add_radio_check_item(p_highlighter->get_name());
} }
void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) { void EditorScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
TextEdit *te = code_editor->get_text_edit(); TextEdit *te = code_editor->get_text_edit();
te->_set_syntax_highlighting(p_highlighter); te->_set_syntax_highlighting(p_highlighter);
if (p_highlighter != nullptr) { if (p_highlighter != nullptr) {
@ -1361,7 +1361,7 @@ void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter)
} }
} }
void ScriptTextEditor::_change_syntax_highlighter(int p_idx) { void EditorScriptTextEditor::_change_syntax_highlighter(int p_idx) {
RBMap<String, SyntaxHighlighter *>::Element *el = highlighters.front(); RBMap<String, SyntaxHighlighter *>::Element *el = highlighters.front();
while (el != nullptr) { while (el != nullptr) {
highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(el->key()), false); highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(el->key()), false);
@ -1371,40 +1371,40 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
set_syntax_highlighter(highlighters[highlighter_menu->get_item_text(p_idx)]); set_syntax_highlighter(highlighters[highlighter_menu->get_item_text(p_idx)]);
} }
void ScriptTextEditor::_bind_methods() { void EditorScriptTextEditor::_bind_methods() {
ClassDB::bind_method("_validate_script", &ScriptTextEditor::_validate_script); ClassDB::bind_method("_validate_script", &EditorScriptTextEditor::_validate_script);
ClassDB::bind_method("_update_bookmark_list", &ScriptTextEditor::_update_bookmark_list); ClassDB::bind_method("_update_bookmark_list", &EditorScriptTextEditor::_update_bookmark_list);
ClassDB::bind_method("_bookmark_item_pressed", &ScriptTextEditor::_bookmark_item_pressed); ClassDB::bind_method("_bookmark_item_pressed", &EditorScriptTextEditor::_bookmark_item_pressed);
ClassDB::bind_method("_load_theme_settings", &ScriptTextEditor::_load_theme_settings); ClassDB::bind_method("_load_theme_settings", &EditorScriptTextEditor::_load_theme_settings);
ClassDB::bind_method("_update_breakpoint_list", &ScriptTextEditor::_update_breakpoint_list); ClassDB::bind_method("_update_breakpoint_list", &EditorScriptTextEditor::_update_breakpoint_list);
ClassDB::bind_method("_breakpoint_item_pressed", &ScriptTextEditor::_breakpoint_item_pressed); ClassDB::bind_method("_breakpoint_item_pressed", &EditorScriptTextEditor::_breakpoint_item_pressed);
ClassDB::bind_method("_breakpoint_toggled", &ScriptTextEditor::_breakpoint_toggled); ClassDB::bind_method("_breakpoint_toggled", &EditorScriptTextEditor::_breakpoint_toggled);
ClassDB::bind_method("_lookup_connections", &ScriptTextEditor::_lookup_connections); ClassDB::bind_method("_lookup_connections", &EditorScriptTextEditor::_lookup_connections);
ClassDB::bind_method("_update_connected_methods", &ScriptTextEditor::_update_connected_methods); ClassDB::bind_method("_update_connected_methods", &EditorScriptTextEditor::_update_connected_methods);
ClassDB::bind_method("_change_syntax_highlighter", &ScriptTextEditor::_change_syntax_highlighter); ClassDB::bind_method("_change_syntax_highlighter", &EditorScriptTextEditor::_change_syntax_highlighter);
ClassDB::bind_method("_edit_option", &ScriptTextEditor::_edit_option); ClassDB::bind_method("_edit_option", &EditorScriptTextEditor::_edit_option);
ClassDB::bind_method("_goto_line", &ScriptTextEditor::_goto_line); ClassDB::bind_method("_goto_line", &EditorScriptTextEditor::_goto_line);
ClassDB::bind_method("_lookup_symbol", &ScriptTextEditor::_lookup_symbol); ClassDB::bind_method("_lookup_symbol", &EditorScriptTextEditor::_lookup_symbol);
ClassDB::bind_method("_text_edit_gui_input", &ScriptTextEditor::_text_edit_gui_input); ClassDB::bind_method("_text_edit_gui_input", &EditorScriptTextEditor::_text_edit_gui_input);
ClassDB::bind_method("_show_warnings_panel", &ScriptTextEditor::_show_warnings_panel); ClassDB::bind_method("_show_warnings_panel", &EditorScriptTextEditor::_show_warnings_panel);
ClassDB::bind_method("_warning_clicked", &ScriptTextEditor::_warning_clicked); ClassDB::bind_method("_warning_clicked", &EditorScriptTextEditor::_warning_clicked);
ClassDB::bind_method("_color_changed", &ScriptTextEditor::_color_changed); ClassDB::bind_method("_color_changed", &EditorScriptTextEditor::_color_changed);
ClassDB::bind_method("_prepare_edit_menu", &ScriptTextEditor::_prepare_edit_menu); ClassDB::bind_method("_prepare_edit_menu", &EditorScriptTextEditor::_prepare_edit_menu);
ClassDB::bind_method("get_drag_data_fw", &ScriptTextEditor::get_drag_data_fw); ClassDB::bind_method("get_drag_data_fw", &EditorScriptTextEditor::get_drag_data_fw);
ClassDB::bind_method("can_drop_data_fw", &ScriptTextEditor::can_drop_data_fw); ClassDB::bind_method("can_drop_data_fw", &EditorScriptTextEditor::can_drop_data_fw);
ClassDB::bind_method("drop_data_fw", &ScriptTextEditor::drop_data_fw); ClassDB::bind_method("drop_data_fw", &EditorScriptTextEditor::drop_data_fw);
} }
Control *ScriptTextEditor::get_edit_menu() { Control *EditorScriptTextEditor::get_edit_menu() {
return edit_hb; return edit_hb;
} }
void ScriptTextEditor::clear_edit_menu() { void EditorScriptTextEditor::clear_edit_menu() {
memdelete(edit_hb); memdelete(edit_hb);
} }
void ScriptTextEditor::reload(bool p_soft) { void EditorScriptTextEditor::reload(bool p_soft) {
TextEdit *te = code_editor->get_text_edit(); TextEdit *te = code_editor->get_text_edit();
Ref<Script> scr = script; Ref<Script> scr = script;
if (scr.is_null()) { if (scr.is_null()) {
@ -1416,22 +1416,22 @@ void ScriptTextEditor::reload(bool p_soft) {
scr->get_language()->reload_tool_script(scr, soft); scr->get_language()->reload_tool_script(scr, soft);
} }
void ScriptTextEditor::get_breakpoints(List<int> *p_breakpoints) { void EditorScriptTextEditor::get_breakpoints(List<int> *p_breakpoints) {
code_editor->get_text_edit()->get_breakpoints(p_breakpoints); code_editor->get_text_edit()->get_breakpoints(p_breakpoints);
} }
void ScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj) { void EditorScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj) {
code_editor->get_text_edit()->set_tooltip_request_func(p_obj, p_method, this); code_editor->get_text_edit()->set_tooltip_request_func(p_obj, p_method, this);
} }
void ScriptTextEditor::set_debugger_active(bool p_active) { void EditorScriptTextEditor::set_debugger_active(bool p_active) {
} }
Variant ScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { Variant EditorScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
return Variant(); return Variant();
} }
bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { bool EditorScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
Dictionary d = p_data; Dictionary d = p_data;
if (d.has("type") && if (d.has("type") &&
(String(d["type"]) == "resource" || (String(d["type"]) == "resource" ||
@ -1467,7 +1467,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return nullptr; return nullptr;
} }
void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { void EditorScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
Dictionary d = p_data; Dictionary d = p_data;
TextEdit *te = code_editor->get_text_edit(); TextEdit *te = code_editor->get_text_edit();
@ -1559,7 +1559,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
} }
} }
void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { void EditorScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
Ref<InputEventMouseButton> mb = ev; Ref<InputEventMouseButton> mb = ev;
Ref<InputEventKey> k = ev; Ref<InputEventKey> k = ev;
Point2 local_pos; Point2 local_pos;
@ -1658,7 +1658,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
} }
} }
void ScriptTextEditor::_color_changed(const Color &p_color) { void EditorScriptTextEditor::_color_changed(const Color &p_color) {
String new_args; String new_args;
if (p_color.a == 1.0f) { if (p_color.a == 1.0f) {
new_args = String("(" + rtos(p_color.r) + ", " + rtos(p_color.g) + ", " + rtos(p_color.b) + ")"); new_args = String("(" + rtos(p_color.r) + ", " + rtos(p_color.g) + ", " + rtos(p_color.b) + ")");
@ -1679,14 +1679,14 @@ void ScriptTextEditor::_color_changed(const Color &p_color) {
code_editor->get_text_edit()->update(); code_editor->get_text_edit()->update();
} }
void ScriptTextEditor::_prepare_edit_menu() { void EditorScriptTextEditor::_prepare_edit_menu() {
const TextEdit *tx = code_editor->get_text_edit(); const TextEdit *tx = code_editor->get_text_edit();
PopupMenu *popup = edit_menu->get_popup(); PopupMenu *popup = edit_menu->get_popup();
popup->set_item_disabled(popup->get_item_index(EDIT_UNDO), !tx->has_undo()); popup->set_item_disabled(popup->get_item_index(EDIT_UNDO), !tx->has_undo());
popup->set_item_disabled(popup->get_item_index(EDIT_REDO), !tx->has_redo()); popup->set_item_disabled(popup->get_item_index(EDIT_REDO), !tx->has_redo());
} }
void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p_foldable, bool p_open_docs, bool p_goto_definition, Vector2 p_pos) { void EditorScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p_foldable, bool p_open_docs, bool p_goto_definition, Vector2 p_pos) {
context_menu->clear(); context_menu->clear();
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO); context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO); context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
@ -1734,7 +1734,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->popup(); context_menu->popup();
} }
void ScriptTextEditor::_enable_code_editor() { void EditorScriptTextEditor::_enable_code_editor() {
ERR_FAIL_COND(code_editor->get_parent()); ERR_FAIL_COND(code_editor->get_parent());
VSplitContainer *editor_box = memnew(VSplitContainer); VSplitContainer *editor_box = memnew(VSplitContainer);
@ -1777,11 +1777,11 @@ void ScriptTextEditor::_enable_code_editor() {
color_picker->set_raw_mode(true); color_picker->set_raw_mode(true);
} }
quick_open = memnew(ScriptEditorQuickOpen); quick_open = memnew(EditorScriptEditorQuickOpen);
quick_open->connect("goto_line", this, "_goto_line"); quick_open->connect("goto_line", this, "_goto_line");
add_child(quick_open); add_child(quick_open);
goto_line_dialog = memnew(GotoLineDialog); goto_line_dialog = memnew(EditorGotoLineDialog);
add_child(goto_line_dialog); add_child(goto_line_dialog);
add_child(connection_info_dialog); add_child(connection_info_dialog);
@ -1861,12 +1861,12 @@ void ScriptTextEditor::_enable_code_editor() {
goto_menu->get_popup()->connect("id_pressed", this, "_edit_option"); goto_menu->get_popup()->connect("id_pressed", this, "_edit_option");
} }
ScriptTextEditor::ScriptTextEditor() { EditorScriptTextEditor::EditorScriptTextEditor() {
theme_loaded = false; theme_loaded = false;
script_is_valid = false; script_is_valid = false;
editor_enabled = false; editor_enabled = false;
code_editor = memnew(CodeTextEditor); code_editor = memnew(EditorCodeTextEditor);
code_editor->add_theme_constant_override("separation", 2); code_editor->add_theme_constant_override("separation", 2);
code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
code_editor->set_code_complete_func(_code_complete_scripts, this); code_editor->set_code_complete_func(_code_complete_scripts, this);
@ -1927,12 +1927,12 @@ ScriptTextEditor::ScriptTextEditor() {
quick_open = nullptr; quick_open = nullptr;
goto_line_dialog = nullptr; goto_line_dialog = nullptr;
connection_info_dialog = memnew(ConnectionInfoDialog); connection_info_dialog = memnew(EditorConnectionInfoDialog);
code_editor->get_text_edit()->set_drag_forwarding(this); code_editor->get_text_edit()->set_drag_forwarding(this);
} }
ScriptTextEditor::~ScriptTextEditor() { EditorScriptTextEditor::~EditorScriptTextEditor() {
for (const RBMap<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) { for (const RBMap<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) {
if (E->get() != NULL) { if (E->get() != NULL) {
memdelete(E->get()); memdelete(E->get());
@ -1957,14 +1957,14 @@ ScriptTextEditor::~ScriptTextEditor() {
} }
} }
static ScriptEditorBase *create_editor(const RES &p_resource) { static EditorScriptEditorBase *create_editor(const RES &p_resource) {
if (Object::cast_to<Script>(*p_resource)) { if (Object::cast_to<Script>(*p_resource)) {
return memnew(ScriptTextEditor); return memnew(EditorScriptTextEditor);
} }
return nullptr; return nullptr;
} }
void ScriptTextEditor::register_editor() { void EditorScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/undo", TTR("Undo"), KEY_MASK_CMD | KEY_Z); ED_SHORTCUT("script_text_editor/undo", TTR("Undo"), KEY_MASK_CMD | KEY_Z);
ED_SHORTCUT("script_text_editor/redo", TTR("Redo"), KEY_MASK_CMD | KEY_Y); ED_SHORTCUT("script_text_editor/redo", TTR("Redo"), KEY_MASK_CMD | KEY_Y);
ED_SHORTCUT("script_text_editor/cut", TTR("Cut"), KEY_MASK_CMD | KEY_X); ED_SHORTCUT("script_text_editor/cut", TTR("Cut"), KEY_MASK_CMD | KEY_X);
@ -2041,6 +2041,6 @@ void ScriptTextEditor::register_editor() {
ScriptEditor::register_create_script_editor_function(create_editor); ScriptEditor::register_create_script_editor_function(create_editor);
} }
void ScriptTextEditor::validate() { void EditorScriptTextEditor::validate() {
this->code_editor->validate_script(); this->code_editor->validate_script();
} }

View File

@ -64,13 +64,13 @@ class SyntaxHighlighter;
class Texture; class Texture;
class Tree; class Tree;
struct ScriptCodeCompletionOption; struct ScriptCodeCompletionOption;
class ScriptEditorQuickOpen; class EditorScriptEditorQuickOpen;
class ConnectionInfoDialog; class EditorConnectionInfoDialog;
class ScriptTextEditor : public ScriptEditorBase { class EditorScriptTextEditor : public EditorScriptEditorBase {
GDCLASS(ScriptTextEditor, ScriptEditorBase); GDCLASS(EditorScriptTextEditor, EditorScriptEditorBase);
CodeTextEditor *code_editor; EditorCodeTextEditor *code_editor;
RichTextLabel *warnings_panel; RichTextLabel *warnings_panel;
Ref<Script> script; Ref<Script> script;
@ -94,9 +94,9 @@ class ScriptTextEditor : public ScriptEditorBase {
PopupMenu *context_menu; PopupMenu *context_menu;
PopupMenu *convert_case; PopupMenu *convert_case;
GotoLineDialog *goto_line_dialog; EditorGotoLineDialog *goto_line_dialog;
ScriptEditorQuickOpen *quick_open; EditorScriptEditorQuickOpen *quick_open;
ConnectionInfoDialog *connection_info_dialog; EditorConnectionInfoDialog *connection_info_dialog;
PopupPanel *color_panel; PopupPanel *color_panel;
ColorPicker *color_picker; ColorPicker *color_picker;
@ -201,7 +201,7 @@ protected:
void _lookup_connections(int p_row, String p_method); void _lookup_connections(int p_row, String p_method);
void _convert_case(CodeTextEditor::CaseStyle p_case); void _convert_case(EditorCodeTextEditor::CaseStyle p_case);
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
@ -258,8 +258,8 @@ public:
virtual void validate(); virtual void validate();
ScriptTextEditor(); EditorScriptTextEditor();
~ScriptTextEditor(); ~EditorScriptTextEditor();
}; };
#endif // SCRIPT_TEXT_EDITOR_H #endif // SCRIPT_TEXT_EDITOR_H

View File

@ -450,13 +450,13 @@ void TextEditor::_edit_option(int p_op) {
convert_indent_to_tabs(); convert_indent_to_tabs();
} break; } break;
case EDIT_TO_UPPERCASE: { case EDIT_TO_UPPERCASE: {
_convert_case(CodeTextEditor::UPPER); _convert_case(EditorCodeTextEditor::UPPER);
} break; } break;
case EDIT_TO_LOWERCASE: { case EDIT_TO_LOWERCASE: {
_convert_case(CodeTextEditor::LOWER); _convert_case(EditorCodeTextEditor::LOWER);
} break; } break;
case EDIT_CAPITALIZE: { case EDIT_CAPITALIZE: {
_convert_case(CodeTextEditor::CAPITALIZE); _convert_case(EditorCodeTextEditor::CAPITALIZE);
} break; } break;
case SEARCH_FIND: { case SEARCH_FIND: {
code_editor->get_find_replace_bar()->popup_search(); code_editor->get_find_replace_bar()->popup_search();
@ -500,7 +500,7 @@ void TextEditor::_edit_option(int p_op) {
} }
} }
void TextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) { void TextEditor::_convert_case(EditorCodeTextEditor::CaseStyle p_case) {
code_editor->convert_case(p_case); code_editor->convert_case(p_case);
} }
@ -515,7 +515,7 @@ void TextEditor::_bind_methods() {
ClassDB::bind_method("_prepare_edit_menu", &TextEditor::_prepare_edit_menu); ClassDB::bind_method("_prepare_edit_menu", &TextEditor::_prepare_edit_menu);
} }
static ScriptEditorBase *create_editor(const RES &p_resource) { static EditorScriptEditorBase *create_editor(const RES &p_resource) {
if (Object::cast_to<TextFile>(*p_resource)) { if (Object::cast_to<TextFile>(*p_resource)) {
return memnew(TextEditor); return memnew(TextEditor);
} }
@ -617,7 +617,7 @@ void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is
TextEditor::TextEditor() { TextEditor::TextEditor() {
editor_enabled = false; editor_enabled = false;
code_editor = memnew(CodeTextEditor); code_editor = memnew(EditorCodeTextEditor);
add_child(code_editor); add_child(code_editor);
code_editor->add_theme_constant_override("separation", 0); code_editor->add_theme_constant_override("separation", 0);
code_editor->connect("load_theme_settings", this, "_load_theme_settings"); code_editor->connect("load_theme_settings", this, "_load_theme_settings");
@ -715,7 +715,7 @@ TextEditor::TextEditor() {
bookmarks_menu->connect("about_to_show", this, "_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("index_pressed", this, "_bookmark_item_pressed");
goto_line_dialog = memnew(GotoLineDialog); goto_line_dialog = memnew(EditorGotoLineDialog);
add_child(goto_line_dialog); add_child(goto_line_dialog);
code_editor->get_text_edit()->set_drag_forwarding(this); code_editor->get_text_edit()->set_drag_forwarding(this);

View File

@ -55,11 +55,11 @@ class TextFile;
class Texture; class Texture;
struct Vector2; struct Vector2;
class TextEditor : public ScriptEditorBase { class TextEditor : public EditorScriptEditorBase {
GDCLASS(TextEditor, ScriptEditorBase); GDCLASS(TextEditor, EditorScriptEditorBase);
private: private:
CodeTextEditor *code_editor; EditorCodeTextEditor *code_editor;
Ref<TextFile> text_file; Ref<TextFile> text_file;
bool editor_enabled; bool editor_enabled;
@ -71,7 +71,7 @@ private:
PopupMenu *bookmarks_menu; PopupMenu *bookmarks_menu;
PopupMenu *context_menu; PopupMenu *context_menu;
GotoLineDialog *goto_line_dialog; EditorGotoLineDialog *goto_line_dialog;
struct ColorsCache { struct ColorsCache {
Color font_color; Color font_color;
@ -131,7 +131,7 @@ protected:
void _change_syntax_highlighter(int p_idx); void _change_syntax_highlighter(int p_idx);
void _load_theme_settings(); void _load_theme_settings();
void _convert_case(CodeTextEditor::CaseStyle p_case); void _convert_case(EditorCodeTextEditor::CaseStyle p_case);
void _validate_script(); void _validate_script();

View File

@ -14,11 +14,11 @@ void register_editor_code_editor_types(ModuleRegistrationLevel p_level) {
//ClassDB::register_class<>(); //ClassDB::register_class<>();
ClassDB::register_virtual_class<ScriptEditor>(); ClassDB::register_virtual_class<ScriptEditor>();
ClassDB::register_virtual_class<ScriptEditorBase>(); ClassDB::register_virtual_class<EditorScriptEditorBase>();
//ClassDB::register_class<TextEditor>(); //ClassDB::register_class<TextEditor>();
//ClassDB::register_class<ScriptTextEditor>(); //ClassDB::register_class<EditorScriptTextEditor>();
//ClassDB::register_class<CodeTextEditor>(); //ClassDB::register_class<EditorCodeTextEditor>();
} }
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED

View File

@ -181,7 +181,7 @@ void ScriptEditorPlugin::edited_scene_changed() {
} }
ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
ScriptTextEditor::register_editor(); //register one for text scripts EditorScriptTextEditor::register_editor(); //register one for text scripts
TextEditor::register_editor(); TextEditor::register_editor();
editor = p_node; editor = p_node;

View File

@ -705,7 +705,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
hbc->add_theme_style_override("panel", p_node->get_gui_base()->get_theme_stylebox("ScriptEditorPanel", "EditorStyles")); hbc->add_theme_style_override("panel", p_node->get_gui_base()->get_theme_stylebox("ScriptEditorPanel", "EditorStyles"));
main_container->add_child(shader_editor); main_container->add_child(shader_editor);
goto_line_dialog = memnew(GotoLineDialog); goto_line_dialog = memnew(EditorGotoLineDialog);
add_child(goto_line_dialog); add_child(goto_line_dialog);
disk_changed = memnew(ConfirmationDialog); disk_changed = memnew(ConfirmationDialog);

View File

@ -50,8 +50,8 @@ class MenuButton;
class PopupMenu; class PopupMenu;
struct ScriptCodeCompletionOption; struct ScriptCodeCompletionOption;
class ShaderTextEditor : public CodeTextEditor { class ShaderTextEditor : public EditorCodeTextEditor {
GDCLASS(ShaderTextEditor, CodeTextEditor); GDCLASS(ShaderTextEditor, EditorCodeTextEditor);
Ref<Shader> shader; Ref<Shader> shader;
@ -111,7 +111,7 @@ class ShaderEditor : public MarginContainer {
PopupMenu *context_menu; PopupMenu *context_menu;
uint64_t idle; uint64_t idle;
GotoLineDialog *goto_line_dialog; EditorGotoLineDialog *goto_line_dialog;
ConfirmationDialog *erase_tab_confirm; ConfirmationDialog *erase_tab_confirm;
ConfirmationDialog *disk_changed; ConfirmationDialog *disk_changed;

View File

@ -234,7 +234,7 @@ TextEditorVanillaEditor::TextEditorVanillaEditor() {
text_editor->set("custom_constants/completion_max_width", 20); text_editor->set("custom_constants/completion_max_width", 20);
text_editor->set("custom_constants/completion_scroll_width", 20); text_editor->set("custom_constants/completion_scroll_width", 20);
_find_replace_bar = memnew(FindReplaceBar); _find_replace_bar = memnew(EditorFindReplaceBar);
_find_replace_bar->set_text_edit(text_editor); _find_replace_bar->set_text_edit(text_editor);
add_child(_find_replace_bar); add_child(_find_replace_bar);
_find_replace_bar->hide(); _find_replace_bar->hide();

View File

@ -17,7 +17,7 @@ class CheckBox;
class Button; class Button;
class TextureRect; class TextureRect;
class Label; class Label;
class FindReplaceBar; class EditorFindReplaceBar;
class TextEditorVanillaEditor : public VBoxContainer { class TextEditorVanillaEditor : public VBoxContainer {
GDCLASS(TextEditorVanillaEditor, VBoxContainer); GDCLASS(TextEditorVanillaEditor, VBoxContainer);
@ -65,7 +65,7 @@ protected:
Label *file_info_c_counter; Label *file_info_c_counter;
CheckBox *file_info_read_only; CheckBox *file_info_read_only;
FindReplaceBar *_find_replace_bar; EditorFindReplaceBar *_find_replace_bar;
String current_path; String current_path;
String current_filename; String current_filename;