summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-09 21:07:27 +0200
committerGitHub <noreply@github.com>2021-06-09 21:07:27 +0200
commit58c123511167cf5679d3bcf19f66efe8dbfd4db0 (patch)
tree7036664c66f25929bd4b580f4b730432ca3cf9a6 /editor/plugins
parent4f54470c2ce81c6636e5152400d5c1a08ac8bbff (diff)
parentda6aebeb4c6e36385a180644d8080ec580e3fadb (diff)
Merge pull request #49265 from KoBeWi/keepfreplace_2_keepers_of_replace
Move FindReplaceBar out of CodeTextEditor
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/script_editor_plugin.cpp13
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp4
-rw-r--r--editor/plugins/script_text_editor.h2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp5
-rw-r--r--editor/plugins/text_editor.cpp4
-rw-r--r--editor/plugins/text_editor.h1
7 files changed, 30 insertions, 1 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 4b7faec228..d66217ec2d 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1640,10 +1640,13 @@ void ScriptEditor::ensure_select_current() {
ScriptEditorBase *se = _get_current_editor();
if (se) {
se->enable_editor();
+ se->set_find_replace_bar(find_replace_bar);
if (!grab_focus_block && is_visible_in_tree()) {
se->ensure_focus();
}
+ } else {
+ find_replace_bar->hide();
}
}
@@ -3379,11 +3382,19 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
help_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
help_overview->set_v_size_flags(SIZE_EXPAND_FILL);
+ VBoxContainer *code_editor_container = memnew(VBoxContainer);
+ script_split->add_child(code_editor_container);
+
tab_container = memnew(TabContainer);
tab_container->set_tabs_visible(false);
tab_container->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
- script_split->add_child(tab_container);
+ code_editor_container->add_child(tab_container);
tab_container->set_h_size_flags(SIZE_EXPAND_FILL);
+ tab_container->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ find_replace_bar = memnew(FindReplaceBar);
+ code_editor_container->add_child(find_replace_bar);
+ find_replace_bar->hide();
ED_SHORTCUT("script_editor/window_sort", TTR("Sort"));
ED_SHORTCUT("script_editor/window_move_up", TTR("Move Up"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_UP);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 9ae63b7c4f..1d379059d4 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -162,6 +162,7 @@ public:
virtual void set_tooltip_request_func(String p_method, Object *p_obj) = 0;
virtual Control *get_edit_menu() = 0;
virtual void clear_edit_menu() = 0;
+ virtual void set_find_replace_bar(FindReplaceBar *p_bar) = 0;
virtual Control *get_base_editor() const = 0;
@@ -270,6 +271,7 @@ class ScriptEditor : public PanelContainer {
ConfirmationDialog *erase_tab_confirm;
ScriptCreateDialog *script_create_dialog;
Button *scripts_visible;
+ FindReplaceBar *find_replace_bar;
String current_theme;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index a29e51e8fb..8fa6b66eda 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1358,6 +1358,10 @@ void ScriptTextEditor::clear_edit_menu() {
memdelete(edit_hb);
}
+void ScriptTextEditor::set_find_replace_bar(FindReplaceBar *p_bar) {
+ code_editor->set_find_replace_bar(p_bar);
+}
+
void ScriptTextEditor::reload(bool p_soft) {
CodeEdit *te = code_editor->get_text_editor();
Ref<Script> scr = script;
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index f784bbe1f8..7bb961bf19 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -233,6 +233,8 @@ public:
Control *get_edit_menu() override;
virtual void clear_edit_menu() override;
+ virtual void set_find_replace_bar(FindReplaceBar *p_bar) override;
+
static void register_editor();
virtual Control *get_base_editor() const override;
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 3beef78bfc..e4a5a3796e 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -751,6 +751,11 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
editor_box->set_v_size_flags(SIZE_EXPAND_FILL);
editor_box->add_child(shader_editor);
+ FindReplaceBar *bar = memnew(FindReplaceBar);
+ main_container->add_child(bar);
+ bar->hide();
+ shader_editor->set_find_replace_bar(bar);
+
warnings_panel = memnew(RichTextLabel);
warnings_panel->set_custom_minimum_size(Size2(0, 100 * EDSCALE));
warnings_panel->set_h_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index e1c6e61a0b..dc7f85a790 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -281,6 +281,10 @@ void TextEditor::clear_edit_menu() {
memdelete(edit_hb);
}
+void TextEditor::set_find_replace_bar(FindReplaceBar *p_bar) {
+ code_editor->set_find_replace_bar(p_bar);
+}
+
void TextEditor::_edit_option(int p_op) {
CodeEdit *tx = code_editor->get_text_editor();
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index abb75cc9d8..4e667dc676 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -139,6 +139,7 @@ public:
virtual Control *get_edit_menu() override;
virtual void clear_edit_menu() override;
+ virtual void set_find_replace_bar(FindReplaceBar *p_bar) override;
virtual void validate() override;