summaryrefslogtreecommitdiff
path: root/editor/find_in_files.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/find_in_files.cpp')
-rw-r--r--editor/find_in_files.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 5a7d4cede7..d73180c831 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -299,14 +299,14 @@ const char *FindInFilesDialog::SIGNAL_REPLACE_REQUESTED = "replace_requested";
FindInFilesDialog::FindInFilesDialog() {
- set_custom_minimum_size(Size2(500 * EDSCALE, 0));
+ set_min_size(Size2(500 * EDSCALE, 0));
set_title(TTR("Find in Files"));
VBoxContainer *vbc = memnew(VBoxContainer);
- vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
add_child(vbc);
GridContainer *gc = memnew(GridContainer);
@@ -318,7 +318,7 @@ FindInFilesDialog::FindInFilesDialog() {
gc->add_child(find_label);
_search_text_line_edit = memnew(LineEdit);
- _search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ _search_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
_search_text_line_edit->connect("text_changed", callable_mp(this, &FindInFilesDialog::_on_search_text_modified));
_search_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_search_text_entered));
gc->add_child(_search_text_line_edit);
@@ -329,7 +329,7 @@ FindInFilesDialog::FindInFilesDialog() {
gc->add_child(_replace_label);
_replace_text_line_edit = memnew(LineEdit);
- _replace_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ _replace_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
_replace_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_replace_text_entered));
_replace_text_line_edit->hide();
gc->add_child(_replace_text_line_edit);
@@ -362,7 +362,7 @@ FindInFilesDialog::FindInFilesDialog() {
hbc->add_child(prefix_label);
_folder_line_edit = memnew(LineEdit);
- _folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ _folder_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(_folder_line_edit);
Button *folder_button = memnew(Button);
@@ -371,7 +371,7 @@ FindInFilesDialog::FindInFilesDialog() {
hbc->add_child(folder_button);
_folder_dialog = memnew(FileDialog);
- _folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
+ _folder_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR);
_folder_dialog->connect("dir_selected", callable_mp(this, &FindInFilesDialog::_on_folder_selected));
add_child(_folder_dialog);
@@ -464,6 +464,7 @@ Set<String> FindInFilesDialog::get_filter() const {
void FindInFilesDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+
if (is_visible()) {
// Doesn't work more than once if not deferred...
_search_text_line_edit->call_deferred("grab_focus");
@@ -576,7 +577,7 @@ FindInFilesPanel::FindInFilesPanel() {
hbc->add_child(find_label);
_search_text_label = memnew(Label);
- _search_text_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
+ _search_text_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("source", "EditorFonts"));
hbc->add_child(_search_text_label);
_progress_bar = memnew(ProgressBar);
@@ -604,7 +605,7 @@ FindInFilesPanel::FindInFilesPanel() {
}
_results_display = memnew(Tree);
- _results_display->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
+ _results_display->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("source", "EditorFonts"));
_results_display->set_v_size_flags(SIZE_EXPAND_FILL);
_results_display->connect("item_selected", callable_mp(this, &FindInFilesPanel::_on_result_selected));
_results_display->connect("item_edited", callable_mp(this, &FindInFilesPanel::_on_item_edited));
@@ -707,7 +708,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin
TreeItem *file_item;
Map<String, TreeItem *>::Element *E = _file_items.find(fpath);
- if (E == NULL) {
+ if (E == nullptr) {
file_item = _results_display->create_item();
file_item->set_text(0, fpath);
file_item->set_metadata(0, fpath);
@@ -734,7 +735,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin
item->set_text(text_index, item_text);
item->set_custom_draw(text_index, this, "_draw_result_text");
- Ref<Font> font = _results_display->get_font("font");
+ Ref<Font> font = _results_display->get_theme_font("font");
float raw_text_width = font->get_string_size(text).x;
float item_text_width = font->get_string_size(item_text).x;
@@ -780,11 +781,11 @@ void FindInFilesPanel::_on_item_edited() {
TreeItem *item = _results_display->get_selected();
if (item->is_checked(0)) {
- item->set_custom_color(1, _results_display->get_color("font_color"));
+ item->set_custom_color(1, _results_display->get_theme_color("font_color"));
} else {
// Grey out
- Color color = _results_display->get_color("font_color");
+ Color color = _results_display->get_theme_color("font_color");
color.a /= 2.0;
item->set_custom_color(1, color);
}
@@ -812,7 +813,7 @@ void FindInFilesPanel::_on_result_selected() {
TreeItem *item = _results_display->get_selected();
Map<TreeItem *, Result>::Element *E = _result_items.find(item);
- if (E == NULL)
+ if (E == nullptr)
return;
Result r = E->value();
@@ -844,7 +845,7 @@ void FindInFilesPanel::_on_replace_all_clicked() {
continue;
Map<TreeItem *, Result>::Element *F = _result_items.find(item);
- ERR_FAIL_COND(F == NULL);
+ ERR_FAIL_COND(F == nullptr);
locations.push_back(F->value());
}