diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 24 | ||||
-rw-r--r-- | editor/code_editor.h | 2 | ||||
-rw-r--r-- | editor/editor_help.cpp | 12 | ||||
-rw-r--r-- | editor/editor_spin_slider.cpp | 5 | ||||
-rw-r--r-- | editor/export_template_manager.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/text_editor.h | 1 |
9 files changed, 62 insertions, 19 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 89a88dc6e7..848a37c1d1 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -163,16 +163,16 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) result_col = col; _update_results_count(); - set_error(vformat(TTR("Found %d match(es)."), results_count)); } else { result_line = -1; result_col = -1; text_edit->set_search_text(""); text_edit->set_search_flags(p_flags); text_edit->set_current_search_result(line, col); - set_error(text.empty() ? "" : TTR("No Matches")); } + _update_matches_label(); + return found; } @@ -332,6 +332,18 @@ void FindReplaceBar::_update_results_count() { } } +void FindReplaceBar::_update_matches_label() { + + if (search_text->get_text().empty() || results_count == -1) { + matches_label->hide(); + } else { + matches_label->show(); + + matches_label->add_color_override("font_color", results_count > 0 ? Color(1, 1, 1) : EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count)); + } +} + bool FindReplaceBar::search_current() { uint32_t flags = 0; @@ -411,7 +423,6 @@ void FindReplaceBar::_hide_bar() { text_edit->set_search_text(""); result_line = -1; result_col = -1; - set_error(""); hide(); } @@ -557,6 +568,7 @@ FindReplaceBar::FindReplaceBar() { vbc_lineedit = memnew(VBoxContainer); add_child(vbc_lineedit); + vbc_lineedit->set_alignment(ALIGN_CENTER); vbc_lineedit->set_h_size_flags(SIZE_EXPAND_FILL); VBoxContainer *vbc_button = memnew(VBoxContainer); add_child(vbc_button); @@ -565,8 +577,10 @@ FindReplaceBar::FindReplaceBar() { HBoxContainer *hbc_button_search = memnew(HBoxContainer); vbc_button->add_child(hbc_button_search); + hbc_button_search->set_alignment(ALIGN_END); hbc_button_replace = memnew(HBoxContainer); vbc_button->add_child(hbc_button_replace); + hbc_button_replace->set_alignment(ALIGN_END); HBoxContainer *hbc_option_search = memnew(HBoxContainer); vbc_option->add_child(hbc_option_search); @@ -580,6 +594,10 @@ FindReplaceBar::FindReplaceBar() { search_text->connect("text_changed", this, "_search_text_changed"); search_text->connect("text_entered", this, "_search_text_entered"); + matches_label = memnew(Label); + hbc_button_search->add_child(matches_label); + matches_label->hide(); + find_prev = memnew(ToolButton); hbc_button_search->add_child(find_prev); find_prev->set_focus_mode(FOCUS_NONE); diff --git a/editor/code_editor.h b/editor/code_editor.h index 700e72627c..a4b3aa312f 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -64,6 +64,7 @@ class FindReplaceBar : public HBoxContainer { GDCLASS(FindReplaceBar, HBoxContainer); LineEdit *search_text; + Label *matches_label; ToolButton *find_prev; ToolButton *find_next; CheckBox *case_sensitive; @@ -90,6 +91,7 @@ class FindReplaceBar : public HBoxContainer { void _get_search_from(int &r_line, int &r_col); void _update_results_count(); + void _update_matches_label(); void _show_search(); void _hide_bar(); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 7aa24c7476..385b6924df 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1738,19 +1738,13 @@ void FindBar::_update_results_count() { void FindBar::_update_matches_label() { - if (results_count > 0) { - matches_label->show(); - - matches_label->add_color_override("font_color", Color(1, 1, 1)); - matches_label->set_text(vformat(TTR("Found %d match(es)."), results_count)); - } else if (search_text->get_text().empty()) { - + if (search_text->get_text().empty() || results_count == -1) { matches_label->hide(); } else { matches_label->show(); - matches_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); - matches_label->set_text(TTR("No Matches")); + matches_label->add_color_override("font_color", results_count > 0 ? Color(1, 1, 1) : EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count)); } } diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 9966394025..379b8a2980 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -347,6 +347,11 @@ void EditorSpinSlider::_value_input_closed() { //focus_exited signal void EditorSpinSlider::_value_focus_exited() { + + // discontinue because the focus_exit was caused by right-click context menu + if (value_input->get_menu()->is_visible()) + return; + _evaluate_input_text(); // focus is not on the same element after the vlalue_input was exited // -> focus is on next element diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 8a5f77c25f..72a4b43737 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -69,6 +69,9 @@ void ExportTemplateManager::_update_template_list() { memdelete(d); String current_version = VERSION_FULL_CONFIG; + // Downloadable export templates are only available for stable, alpha, beta and RC versions. + // Therefore, don't display download-related features when using a development version + const bool downloads_available = String(VERSION_STATUS) != String("dev"); Label *current = memnew(Label); current->set_h_size_flags(SIZE_EXPAND_FILL); @@ -76,10 +79,14 @@ void ExportTemplateManager::_update_template_list() { if (templates.has(current_version)) { current->add_color_override("font_color", get_color("success_color", "Editor")); - Button *redownload = memnew(Button); - redownload->set_text(TTR("Re-Download")); - current_hb->add_child(redownload); - redownload->connect("pressed", this, "_download_template", varray(current_version)); + + // Only display a redownload button if it can be downloaded in the first place + if (downloads_available) { + Button *redownload = memnew(Button); + redownload->set_text(TTR("Redownload")); + current_hb->add_child(redownload); + redownload->connect("pressed", this, "_download_template", varray(current_version)); + } Button *uninstall = memnew(Button); uninstall->set_text(TTR("Uninstall")); @@ -91,6 +98,12 @@ void ExportTemplateManager::_update_template_list() { current->add_color_override("font_color", get_color("error_color", "Editor")); Button *redownload = memnew(Button); redownload->set_text(TTR("Download")); + + if (!downloads_available) { + redownload->set_disabled(true); + redownload->set_tooltip(TTR("Official export templates aren't available for development builds.")); + } + redownload->connect("pressed", this, "_download_template", varray(current_version)); current_hb->add_child(redownload); current->set_text(current_version + " " + TTR("(Missing)")); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 89b34f11f0..76c7545874 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1064,6 +1064,7 @@ void ScriptEditor::_menu_option(int p_option) { save_all_scripts(); } break; case SEARCH_IN_FILES: { + _on_find_in_files_requested(""); } break; case SEARCH_HELP: { diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index cc999107d5..bded590351 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1197,7 +1197,6 @@ void ScriptTextEditor::_edit_option(int p_op) { // Yep, because it doesn't make sense to instance this dialog for every single script open... // So this will be delegated to the ScriptEditor. emit_signal("search_in_files_requested", selected_text); - } break; case SEARCH_LOCATE_FUNCTION: { diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index eb0794ba77..89e419ede8 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -482,6 +482,14 @@ void TextEditor::_edit_option(int p_op) { code_editor->get_find_replace_bar()->popup_replace(); } break; + case SEARCH_IN_FILES: { + + String selected_text = code_editor->get_text_edit()->get_selection_text(); + + // Yep, because it doesn't make sense to instance this dialog for every single script open... + // So this will be delegated to the ScriptEditor. + emit_signal("search_in_files_requested", selected_text); + } break; case SEARCH_GOTO_LINE: { goto_line_dialog->popup_find_line(tx); @@ -558,7 +566,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { int to_column = tx->get_selection_to_column(); if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) { - // Right click is outside the selected text + // Right click is outside the selected text. tx->deselect(); } } @@ -636,13 +644,15 @@ TextEditor::TextEditor() { search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE); + search_menu->get_popup()->add_separator(); + search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES); edit_menu = memnew(MenuButton); + edit_hb->add_child(edit_menu); edit_menu->set_text(TTR("Edit")); edit_menu->set_switch_on_hover(true); edit_menu->get_popup()->connect("id_pressed", this, "_edit_option"); - edit_hb->add_child(edit_menu); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO); edit_menu->get_popup()->add_separator(); diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index c69e1672c5..c8b49a61e0 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -87,6 +87,7 @@ private: SEARCH_FIND_NEXT, SEARCH_FIND_PREV, SEARCH_REPLACE, + SEARCH_IN_FILES, SEARCH_GOTO_LINE, BOOKMARK_TOGGLE, BOOKMARK_GOTO_NEXT, |