Use EditorDock for Search Results

This commit is contained in:
kobewi 2025-12-02 15:10:04 +01:00
parent 2ecefada8d
commit 51bfe186a9
4 changed files with 34 additions and 30 deletions

View file

@ -43,6 +43,7 @@
#include "editor/debugger/editor_debugger_node.h"
#include "editor/debugger/script_editor_debugger.h"
#include "editor/doc/editor_help_search.h"
#include "editor/docks/editor_dock_manager.h"
#include "editor/docks/filesystem_dock.h"
#include "editor/docks/inspector_dock.h"
#include "editor/docks/signals_dock.h"
@ -52,7 +53,6 @@
#include "editor/editor_string_names.h"
#include "editor/file_system/editor_paths.h"
#include "editor/gui/code_editor.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/gui/editor_toaster.h"
#include "editor/gui/window_wrapper.h"
@ -4146,9 +4146,7 @@ void ScriptEditor::_start_find_in_files(bool with_replace) {
panel->set_replace_text(find_in_files_dialog->get_replace_text());
panel->start_search();
EditorNode::get_bottom_panel()->move_item_to_end(find_in_files);
find_in_files_button->show();
EditorNode::get_bottom_panel()->make_item_visible(find_in_files);
find_in_files->make_visible();
}
void ScriptEditor::_on_find_in_files_modified_files(const PackedStringArray &paths) {
@ -4170,11 +4168,6 @@ void ScriptEditor::_update_code_editor_zoom_factor(CodeTextEditor *p_code_text_e
}
}
void ScriptEditor::_on_find_in_files_close_button_clicked() {
EditorNode::get_bottom_panel()->hide_bottom_panel();
find_in_files_button->hide();
}
void ScriptEditor::_window_changed(bool p_visible) {
make_floating->set_visible(!p_visible);
is_floating = p_visible;
@ -4549,13 +4542,12 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_FIND_REQUESTED, callable_mp(this, &ScriptEditor::_start_find_in_files).bind(false));
find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, callable_mp(this, &ScriptEditor::_start_find_in_files).bind(true));
add_child(find_in_files_dialog);
find_in_files = memnew(FindInFilesContainer);
find_in_files_button = EditorNode::get_bottom_panel()->add_item(TTRC("Search Results"), find_in_files, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_search_results_bottom_panel", TTRC("Toggle Search Results Bottom Panel")));
find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
EditorDockManager::get_singleton()->add_dock(find_in_files);
find_in_files->close();
find_in_files->connect("result_selected", callable_mp(this, &ScriptEditor::_on_find_in_files_result_selected));
find_in_files->connect("files_modified", callable_mp(this, &ScriptEditor::_on_find_in_files_modified_files));
find_in_files->connect("close_button_clicked", callable_mp(this, &ScriptEditor::_on_find_in_files_close_button_clicked));
find_in_files_button->hide();
history_pos = -1;