diff options
Diffstat (limited to 'editor/editor_help_search.cpp')
-rw-r--r-- | editor/editor_help_search.cpp | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 27e61362ed..8bad46e4d0 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,7 +31,9 @@ #include "editor_help_search.h" #include "core/os/keyboard.h" +#include "editor_feature_profile.h" #include "editor_node.h" +#include "editor_scale.h" void EditorHelpSearch::_update_icons() { @@ -109,7 +111,7 @@ void EditorHelpSearch::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { - connect("confirmed", this, "_confirmed"); + connect_compat("confirmed", this, "_confirmed"); _update_icons(); } break; case NOTIFICATION_POPUP_HIDE: { @@ -170,7 +172,11 @@ void EditorHelpSearch::popup_dialog(const String &p_term) { if (p_term == "") { search_box->clear(); } else { - old_search = true; + if (old_term == p_term) + old_search = true; + else + old_term = p_term; + search_box->set_text(p_term); search_box->select_all(); } @@ -198,30 +204,30 @@ EditorHelpSearch::EditorHelpSearch() { vbox->add_child(hbox); search_box = memnew(LineEdit); - search_box->set_custom_minimum_size(Size2(200, 0)); + search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE); search_box->set_h_size_flags(SIZE_EXPAND_FILL); - search_box->connect("gui_input", this, "_search_box_gui_input"); - search_box->connect("text_changed", this, "_search_box_text_changed"); + search_box->connect_compat("gui_input", this, "_search_box_gui_input"); + search_box->connect_compat("text_changed", this, "_search_box_text_changed"); register_text_enter(search_box); hbox->add_child(search_box); case_sensitive_button = memnew(ToolButton); - case_sensitive_button->set_tooltip("Case Sensitive"); - case_sensitive_button->connect("pressed", this, "_update_results"); + case_sensitive_button->set_tooltip(TTR("Case Sensitive")); + case_sensitive_button->connect_compat("pressed", this, "_update_results"); case_sensitive_button->set_toggle_mode(true); case_sensitive_button->set_focus_mode(FOCUS_NONE); hbox->add_child(case_sensitive_button); hierarchy_button = memnew(ToolButton); - hierarchy_button->set_tooltip("Show Hierarchy"); - hierarchy_button->connect("pressed", this, "_update_results"); + hierarchy_button->set_tooltip(TTR("Show Hierarchy")); + hierarchy_button->connect_compat("pressed", this, "_update_results"); hierarchy_button->set_toggle_mode(true); hierarchy_button->set_pressed(true); hierarchy_button->set_focus_mode(FOCUS_NONE); hbox->add_child(hierarchy_button); filter_combo = memnew(OptionButton); - filter_combo->set_custom_minimum_size(Size2(200, 0)); + filter_combo->set_custom_minimum_size(Size2(200, 0) * EDSCALE); filter_combo->set_stretch_ratio(0); // Fixed width. filter_combo->add_item(TTR("Display All"), SEARCH_ALL); filter_combo->add_separator(); @@ -231,7 +237,7 @@ EditorHelpSearch::EditorHelpSearch() { filter_combo->add_item(TTR("Constants Only"), SEARCH_CONSTANTS); filter_combo->add_item(TTR("Properties Only"), SEARCH_PROPERTIES); filter_combo->add_item(TTR("Theme Properties Only"), SEARCH_THEME_ITEMS); - filter_combo->connect("item_selected", this, "_filter_combo_item_selected"); + filter_combo->connect_compat("item_selected", this, "_filter_combo_item_selected"); hbox->add_child(filter_combo); // Create the results tree. @@ -241,12 +247,12 @@ EditorHelpSearch::EditorHelpSearch() { results_tree->set_column_title(0, TTR("Name")); results_tree->set_column_title(1, TTR("Member Type")); results_tree->set_column_expand(1, false); - results_tree->set_column_min_width(1, 150); - results_tree->set_custom_minimum_size(Size2(0, 100)); + results_tree->set_column_min_width(1, 150 * EDSCALE); + results_tree->set_custom_minimum_size(Size2(0, 100) * EDSCALE); results_tree->set_hide_root(true); results_tree->set_select_mode(Tree::SELECT_ROW); - results_tree->connect("item_activated", this, "_confirmed"); - results_tree->connect("item_selected", get_ok(), "set_disabled", varray(false)); + results_tree->connect_compat("item_activated", this, "_confirmed"); + results_tree->connect_compat("item_selected", get_ok(), "set_disabled", varray(false)); vbox->add_child(results_tree, true); } @@ -301,7 +307,7 @@ bool EditorHelpSearch::Runner::_slice() { case PHASE_MAX: return true; default: - WARN_PRINTS("Invalid or unhandled phase in EditorHelpSearch::Runner, aborting search."); + WARN_PRINT("Invalid or unhandled phase in EditorHelpSearch::Runner, aborting search."); return true; }; @@ -477,7 +483,7 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_ TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const DocData::ClassDoc *p_doc, bool p_gray) { - Ref<Texture> icon = empty_icon; + Ref<Texture2D> icon = empty_icon; if (ui_service->has_icon(p_doc->name, "EditorIcons")) icon = ui_service->get_icon(p_doc->name, "EditorIcons"); else if (ClassDB::class_exists(p_doc->name) && ClassDB::is_parent_class(p_doc->name, "Object")) @@ -513,7 +519,7 @@ TreeItem *EditorHelpSearch::Runner::_create_method_item(TreeItem *p_parent, cons tooltip += ", "; } tooltip += ")"; - return _create_member_item(p_parent, p_class_doc->name, "MemberMethod", p_doc->name, "Method", "method", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberMethod", p_doc->name, TTRC("Method"), "method", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc) { @@ -528,13 +534,13 @@ TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, cons tooltip += ", "; } tooltip += ")"; - return _create_member_item(p_parent, p_class_doc->name, "MemberSignal", p_doc->name, "Signal", "signal", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberSignal", p_doc->name, TTRC("Signal"), "signal", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_constant_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ConstantDoc *p_doc) { String tooltip = p_class_doc->name + "." + p_doc->name; - return _create_member_item(p_parent, p_class_doc->name, "MemberConstant", p_doc->name, "Constant", "constant", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberConstant", p_doc->name, TTRC("Constant"), "constant", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc) { @@ -542,18 +548,18 @@ TreeItem *EditorHelpSearch::Runner::_create_property_item(TreeItem *p_parent, co String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name; tooltip += "\n " + p_class_doc->name + "." + p_doc->setter + "(value) setter"; tooltip += "\n " + p_class_doc->name + "." + p_doc->getter + "() getter"; - return _create_member_item(p_parent, p_class_doc->name, "MemberProperty", p_doc->name, "Property", "property", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberProperty", p_doc->name, TTRC("Property"), "property", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc) { String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name; - return _create_member_item(p_parent, p_class_doc->name, "MemberTheme", p_doc->name, "Theme Property", "theme_item", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberTheme", p_doc->name, TTRC("Theme Property"), "theme_item", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, const String &p_class_name, const String &p_icon, const String &p_name, const String &p_type, const String &p_metatype, const String &p_tooltip) { - Ref<Texture> icon; + Ref<Texture2D> icon; String text; if (search_flags & SEARCH_SHOW_HIERARCHY) { icon = ui_service->get_icon(p_icon, "EditorIcons"); @@ -571,7 +577,7 @@ TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, cons TreeItem *item = results_tree->create_item(p_parent); item->set_icon(0, icon); item->set_text(0, text); - item->set_text(1, TTR(p_type)); + item->set_text(1, TTRGET(p_type)); item->set_tooltip(0, p_tooltip); item->set_tooltip(1, p_tooltip); item->set_metadata(0, "class_" + p_metatype + ":" + p_class_name + ":" + p_name); |