diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-10-07 11:43:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-07 11:43:39 +0200 |
commit | c5da418b0bebec626df34f69ca924838be74827a (patch) | |
tree | 001d9073d2f5edcf8db51fc52561fe9cbb616db5 /editor | |
parent | 7aa580a84e0b34dc8e49f44432b4612a9d2436c9 (diff) | |
parent | 7063878243b55f211dc80bf09af400de191b4b9e (diff) |
Merge pull request #22698 from Calinou/fix-find-files-hidpi
Fix Find in Files font size on hiDPI displays
Diffstat (limited to 'editor')
-rw-r--r-- | editor/find_in_files.cpp | 13 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 2af81b8ac7..f88d1b24a6 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,12 +335,12 @@ FindInFilesDialog::FindInFilesDialog() { HBoxContainer *hbc = memnew(HBoxContainer); _whole_words_checkbox = memnew(CheckBox); - _whole_words_checkbox->set_text(TTR("Whole words")); + _whole_words_checkbox->set_text(TTR("Whole Words")); _whole_words_checkbox->set_pressed(true); hbc->add_child(_whole_words_checkbox); _match_case_checkbox = memnew(CheckBox); - _match_case_checkbox->set_text(TTR("Match case")); + _match_case_checkbox->set_text(TTR("Match Case")); _match_case_checkbox->set_pressed(true); hbc->add_child(_match_case_checkbox); @@ -548,7 +549,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); @@ -569,7 +570,7 @@ FindInFilesPanel::FindInFilesPanel() { } _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"); @@ -702,7 +703,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) { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d26e1a39f6..7e11c4a253 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3173,9 +3173,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, this, "_start_find_in_files", varray(true)); add_child(find_in_files_dialog); find_in_files = memnew(FindInFilesPanel); - find_in_files_button = editor->add_bottom_panel_item(TTR("Search results"), find_in_files); + find_in_files_button = editor->add_bottom_panel_item(TTR("Search Results"), find_in_files); find_in_files_button->set_tooltip(TTR("Search in files")); - find_in_files->set_custom_minimum_size(Size2(0, 200)); + find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE); find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, this, "_on_find_in_files_result_selected"); find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, this, "_on_find_in_files_modified_files"); find_in_files->hide(); |