diff options
Diffstat (limited to 'editor/code_editor.h')
-rw-r--r-- | editor/code_editor.h | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/editor/code_editor.h b/editor/code_editor.h index b38170cbf5..3c52a0c6e8 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -57,6 +57,8 @@ public: GotoLineDialog(); }; +class CodeTextEditor; + class FindReplaceBar : public HBoxContainer { GDCLASS(FindReplaceBar, HBoxContainer); @@ -77,6 +79,7 @@ class FindReplaceBar : public HBoxContainer { HBoxContainer *hbc_button_replace; HBoxContainer *hbc_option_replace; + CodeTextEditor *base_text_editor = nullptr; CodeEdit *text_editor; int result_line; @@ -96,13 +99,13 @@ class FindReplaceBar : public HBoxContainer { void _editor_text_changed(); void _search_options_changed(bool p_pressed); void _search_text_changed(const String &p_text); - void _search_text_entered(const String &p_text); - void _replace_text_entered(const String &p_text); + void _search_text_submitted(const String &p_text); + void _replace_text_submitted(const String &p_text); void _update_size(); protected: void _notification(int p_what); - void _unhandled_input(const Ref<InputEvent> &p_event); + virtual void unhandled_input(const Ref<InputEvent> &p_event) override; bool _search(uint32_t p_flags, int p_from_line, int p_from_col); @@ -120,7 +123,7 @@ public: bool is_selection_only() const; void set_error(const String &p_label); - void set_text_edit(CodeEdit *p_text_edit); + void set_text_edit(CodeTextEditor *p_text_editor); void popup_search(bool p_show_only = false); void popup_replace(); @@ -138,12 +141,12 @@ class CodeTextEditor : public VBoxContainer { GDCLASS(CodeTextEditor, VBoxContainer); CodeEdit *text_editor; - FindReplaceBar *find_replace_bar; + FindReplaceBar *find_replace_bar = nullptr; HBoxContainer *status_bar; Button *toggle_scripts_button; + Button *error_button; Button *warning_button; - Label *warning_count_label; Label *line_and_col_txt; @@ -160,14 +163,15 @@ class CodeTextEditor : public VBoxContainer { int error_column; void _on_settings_change(); + void _apply_settings_change(); - void _update_font(); + void _update_text_editor_theme(); void _complete_request(); Ref<Texture2D> _get_completion_icon(const ScriptCodeCompletionOption &p_option); void _font_resize_timeout(); bool _add_font_size(int p_delta); - void _input(const Ref<InputEvent> &event); + virtual void input(const Ref<InputEvent> &event) override; void _text_editor_gui_input(const Ref<InputEvent> &p_event); void _zoom_in(); void _zoom_out(); @@ -180,8 +184,9 @@ class CodeTextEditor : public VBoxContainer { CodeTextEditorCodeCompleteFunc code_complete_func; void *code_complete_ud; - void _warning_label_gui_input(const Ref<InputEvent> &p_event); + void _error_button_pressed(); void _warning_button_pressed(); + void _set_show_errors_panel(bool p_show); void _set_show_warnings_panel(bool p_show); void _error_pressed(const Ref<InputEvent> &p_event); @@ -201,6 +206,7 @@ protected: static void _bind_methods(); bool is_warnings_panel_opened; + bool is_errors_panel_opened; public: void trim_trailing_whitespace(); @@ -219,7 +225,7 @@ public: void move_lines_up(); void move_lines_down(); void delete_lines(); - void clone_lines_down(); + void duplicate_selection(); /// Toggle inline comment on currently selected lines, or on current line if nothing is selected, /// by adding or removing comment delimiter @@ -234,7 +240,8 @@ public: Variant get_edit_state(); void set_edit_state(const Variant &p_state); - void set_warning_nb(int p_warning_nb); + void set_error_count(int p_error_count); + void set_warning_count(int p_warning_count); void update_editor_settings(); void set_error(const String &p_error); @@ -242,6 +249,8 @@ public: void update_line_and_column() { _line_col_changed(); } CodeEdit *get_text_editor() { return text_editor; } FindReplaceBar *get_find_replace_bar() { return find_replace_bar; } + void set_find_replace_bar(FindReplaceBar *p_bar); + void remove_find_replace_bar(); virtual void apply_code() {} void goto_error(); |