diff options
Diffstat (limited to 'editor/find_in_files.cpp')
-rw-r--r-- | editor/find_in_files.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 2af81b8ac7..0ccaa95fb7 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -31,6 +31,7 @@ #include "find_in_files.h" #include "core/os/dir_access.h" #include "core/os/os.h" +#include "editor_node.h" #include "editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" @@ -300,7 +301,7 @@ const char *FindInFilesDialog::SIGNAL_REPLACE_REQUESTED = "replace_requested"; FindInFilesDialog::FindInFilesDialog() { - set_custom_minimum_size(Size2(400, 190)); + set_custom_minimum_size(Size2(400, 190) * EDSCALE); set_resizable(true); set_title(TTR("Find in Files")); @@ -334,13 +335,11 @@ FindInFilesDialog::FindInFilesDialog() { HBoxContainer *hbc = memnew(HBoxContainer); _whole_words_checkbox = memnew(CheckBox); - _whole_words_checkbox->set_text(TTR("Whole words")); - _whole_words_checkbox->set_pressed(true); + _whole_words_checkbox->set_text(TTR("Whole Words")); hbc->add_child(_whole_words_checkbox); _match_case_checkbox = memnew(CheckBox); - _match_case_checkbox->set_text(TTR("Match case")); - _match_case_checkbox->set_pressed(true); + _match_case_checkbox->set_text(TTR("Match Case")); hbc->add_child(_match_case_checkbox); gc->add_child(hbc); @@ -548,7 +547,7 @@ FindInFilesPanel::FindInFilesPanel() { hbc->add_child(find_label); _search_text_label = memnew(Label); - _search_text_label->add_font_override("font", get_font("source", "EditorFonts")); + _search_text_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts")); hbc->add_child(_search_text_label); _progress_bar = memnew(ProgressBar); @@ -562,14 +561,14 @@ FindInFilesPanel::FindInFilesPanel() { _cancel_button = memnew(Button); _cancel_button->set_text(TTR("Cancel")); _cancel_button->connect("pressed", this, "_on_cancel_button_clicked"); - _cancel_button->set_disabled(true); + _cancel_button->hide(); hbc->add_child(_cancel_button); vbc->add_child(hbc); } _results_display = memnew(Tree); - _results_display->add_font_override("font", get_font("source", "EditorFonts")); + _results_display->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts")); _results_display->set_v_size_flags(SIZE_EXPAND_FILL); _results_display->connect("item_selected", this, "_on_result_selected"); _results_display->connect("item_edited", this, "_on_item_edited"); @@ -641,7 +640,7 @@ void FindInFilesPanel::start_search() { _finder->start(); update_replace_buttons(); - _cancel_button->set_disabled(false); + _cancel_button->show(); } void FindInFilesPanel::stop_search() { @@ -651,7 +650,7 @@ void FindInFilesPanel::stop_search() { _status_label->set_text(""); update_replace_buttons(); set_progress_visible(false); - _cancel_button->set_disabled(true); + _cancel_button->hide(); } void FindInFilesPanel::_notification(int p_what) { @@ -687,7 +686,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin // Do this first because it resets properties of the cell... item->set_cell_mode(text_index, TreeItem::CELL_MODE_CUSTOM); - String item_text = String::num_int64(line_number) + ": " + text.replace("\t", " "); + String item_text = vformat("%3s: %s", line_number, text.replace("\t", " ")); item->set_text(text_index, item_text); item->set_custom_draw(text_index, this, "_draw_result_text"); @@ -702,7 +701,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin r.begin = begin; r.end = end; r.draw_begin = (item_text_width - raw_text_width) + font->get_string_size(text.left(r.begin)).x; - r.draw_width = font->get_string_size(text.substr(r.begin, r.end - r.begin + 1)).x; + r.draw_width = font->get_string_size(text.substr(r.begin, r.end - r.begin)).x; _result_items[item] = r; if (_with_replace) { @@ -753,7 +752,7 @@ void FindInFilesPanel::_on_finished() { _status_label->set_text(TTR("Search complete")); update_replace_buttons(); set_progress_visible(false); - _cancel_button->set_disabled(true); + _cancel_button->hide(); } void FindInFilesPanel::_on_cancel_button_clicked() { |