Hide Search Results by default. Show it on first search and push it at the end. Add a close button to hide it back. Also switch to Script Editor if a searched line is clicked.

This commit is contained in:
AeioMuch
2024-02-25 15:40:39 +01:00
parent fe01776f05
commit 5cf6f3c779
4 changed files with 31 additions and 12 deletions

View File

@ -566,6 +566,7 @@ void FindInFilesDialog::_bind_methods() {
//-----------------------------------------------------------------------------
const char *FindInFilesPanel::SIGNAL_RESULT_SELECTED = "result_selected";
const char *FindInFilesPanel::SIGNAL_FILES_MODIFIED = "files_modified";
const char *FindInFilesPanel::SIGNAL_CLOSE_BUTTON_CLICKED = "close_button_clicked";
FindInFilesPanel::FindInFilesPanel() {
_finder = memnew(FindInFiles);
@ -611,6 +612,11 @@ FindInFilesPanel::FindInFilesPanel() {
_cancel_button->hide();
hbc->add_child(_cancel_button);
_close_button = memnew(Button);
_close_button->set_text(TTR("Close"));
_close_button->connect("pressed", callable_mp(this, &FindInFilesPanel::_on_close_button_clicked));
hbc->add_child(_close_button);
vbc->add_child(hbc);
}
@ -842,6 +848,10 @@ void FindInFilesPanel::_on_cancel_button_clicked() {
stop_search();
}
void FindInFilesPanel::_on_close_button_clicked() {
emit_signal(SNAME(SIGNAL_CLOSE_BUTTON_CLICKED));
}
void FindInFilesPanel::_on_result_selected() {
TreeItem *item = _results_display->get_selected();
HashMap<TreeItem *, Result>::Iterator E = _result_items.find(item);
@ -1009,4 +1019,6 @@ void FindInFilesPanel::_bind_methods() {
PropertyInfo(Variant::INT, "end")));
ADD_SIGNAL(MethodInfo(SIGNAL_FILES_MODIFIED, PropertyInfo(Variant::STRING, "paths")));
ADD_SIGNAL(MethodInfo(SIGNAL_CLOSE_BUTTON_CLICKED));
}