Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@ -36,7 +36,6 @@
|
||||
#include "editor_scale.h"
|
||||
|
||||
void EditorHelpSearch::_update_icons() {
|
||||
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
|
||||
@ -48,7 +47,6 @@ void EditorHelpSearch::_update_icons() {
|
||||
}
|
||||
|
||||
void EditorHelpSearch::_update_results() {
|
||||
|
||||
String term = search_box->get_text();
|
||||
|
||||
int search_flags = filter_combo->get_selected_id();
|
||||
@ -62,7 +60,6 @@ void EditorHelpSearch::_update_results() {
|
||||
}
|
||||
|
||||
void EditorHelpSearch::_search_box_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
// Redirect up and down navigational key events to the results list.
|
||||
Ref<InputEventKey> key = p_event;
|
||||
if (key.is_valid()) {
|
||||
@ -79,17 +76,14 @@ void EditorHelpSearch::_search_box_gui_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
void EditorHelpSearch::_search_box_text_changed(const String &p_text) {
|
||||
|
||||
_update_results();
|
||||
}
|
||||
|
||||
void EditorHelpSearch::_filter_combo_item_selected(int p_option) {
|
||||
|
||||
_update_results();
|
||||
}
|
||||
|
||||
void EditorHelpSearch::_confirmed() {
|
||||
|
||||
TreeItem *item = results_tree->get_selected();
|
||||
if (!item)
|
||||
return;
|
||||
@ -103,25 +97,20 @@ void EditorHelpSearch::_confirmed() {
|
||||
}
|
||||
|
||||
void EditorHelpSearch::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
_update_icons();
|
||||
} break;
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
||||
connect("confirmed", this, "_confirmed");
|
||||
_update_icons();
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
|
||||
results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
|
||||
get_ok()->set_disabled(true);
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
|
||||
} break;
|
||||
case NOTIFICATION_PROCESS: {
|
||||
|
||||
// Update background search.
|
||||
if (search.is_valid()) {
|
||||
if (search->work()) {
|
||||
@ -146,7 +135,6 @@ void EditorHelpSearch::_notification(int p_what) {
|
||||
}
|
||||
|
||||
void EditorHelpSearch::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_update_results"), &EditorHelpSearch::_update_results);
|
||||
ClassDB::bind_method(D_METHOD("_search_box_gui_input"), &EditorHelpSearch::_search_box_gui_input);
|
||||
ClassDB::bind_method(D_METHOD("_search_box_text_changed"), &EditorHelpSearch::_search_box_text_changed);
|
||||
@ -156,12 +144,10 @@ void EditorHelpSearch::_bind_methods() {
|
||||
}
|
||||
|
||||
void EditorHelpSearch::popup_dialog() {
|
||||
|
||||
popup_dialog(search_box->get_text());
|
||||
}
|
||||
|
||||
void EditorHelpSearch::popup_dialog(const String &p_term) {
|
||||
|
||||
// Restore valid window bounds or pop up at default size.
|
||||
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "search_help", Rect2());
|
||||
if (saved_size != Rect2())
|
||||
@ -185,7 +171,6 @@ void EditorHelpSearch::popup_dialog(const String &p_term) {
|
||||
}
|
||||
|
||||
EditorHelpSearch::EditorHelpSearch() {
|
||||
|
||||
old_search = false;
|
||||
|
||||
set_hide_on_ok(false);
|
||||
@ -257,7 +242,6 @@ EditorHelpSearch::EditorHelpSearch() {
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_is_class_disabled_by_feature_profile(const StringName &p_class) {
|
||||
|
||||
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
|
||||
if (profile.is_null()) {
|
||||
return false;
|
||||
@ -265,7 +249,6 @@ bool EditorHelpSearch::Runner::_is_class_disabled_by_feature_profile(const Strin
|
||||
|
||||
StringName class_name = p_class;
|
||||
while (class_name != StringName()) {
|
||||
|
||||
if (!ClassDB::class_exists(class_name)) {
|
||||
return false;
|
||||
}
|
||||
@ -280,7 +263,6 @@ bool EditorHelpSearch::Runner::_is_class_disabled_by_feature_profile(const Strin
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_slice() {
|
||||
|
||||
bool phase_done = false;
|
||||
switch (phase) {
|
||||
case PHASE_MATCH_CLASSES_INIT:
|
||||
@ -317,7 +299,6 @@ bool EditorHelpSearch::Runner::_slice() {
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_phase_match_classes_init() {
|
||||
|
||||
iterator_doc = EditorHelp::get_doc_data()->class_list.front();
|
||||
matches.clear();
|
||||
matched_item = NULL;
|
||||
@ -327,10 +308,8 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() {
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_phase_match_classes() {
|
||||
|
||||
DocData::ClassDoc &class_doc = iterator_doc->value();
|
||||
if (!_is_class_disabled_by_feature_profile(class_doc.name)) {
|
||||
|
||||
matches[class_doc.name] = ClassMatch();
|
||||
ClassMatch &match = matches[class_doc.name];
|
||||
|
||||
@ -376,7 +355,6 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_phase_class_items_init() {
|
||||
|
||||
iterator_match = matches.front();
|
||||
|
||||
results_tree->clear();
|
||||
@ -387,7 +365,6 @@ bool EditorHelpSearch::Runner::_phase_class_items_init() {
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_phase_class_items() {
|
||||
|
||||
ClassMatch &match = iterator_match->value();
|
||||
|
||||
if (search_flags & SEARCH_SHOW_HIERARCHY) {
|
||||
@ -403,14 +380,12 @@ bool EditorHelpSearch::Runner::_phase_class_items() {
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_phase_member_items_init() {
|
||||
|
||||
iterator_match = matches.front();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_phase_member_items() {
|
||||
|
||||
ClassMatch &match = iterator_match->value();
|
||||
|
||||
TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY) ? class_items[match.doc->name] : root_item;
|
||||
@ -430,7 +405,6 @@ bool EditorHelpSearch::Runner::_phase_member_items() {
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::_phase_select_match() {
|
||||
|
||||
if (matched_item)
|
||||
matched_item->select(0);
|
||||
return true;
|
||||
@ -463,7 +437,6 @@ void EditorHelpSearch::Runner::_match_item(TreeItem *p_item, const String &p_tex
|
||||
}
|
||||
|
||||
TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_match) {
|
||||
|
||||
if (class_items.has(p_match.doc->name))
|
||||
return class_items[p_match.doc->name];
|
||||
|
||||
@ -484,7 +457,6 @@ 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;
|
||||
if (ui_service->has_icon(p_doc->name, "EditorIcons"))
|
||||
icon = ui_service->get_icon(p_doc->name, "EditorIcons");
|
||||
@ -510,7 +482,6 @@ TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const
|
||||
}
|
||||
|
||||
TreeItem *EditorHelpSearch::Runner::_create_method_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc) {
|
||||
|
||||
String tooltip = p_doc->return_type + " " + p_class_doc->name + "." + p_doc->name + "(";
|
||||
for (int i = 0; i < p_doc->arguments.size(); i++) {
|
||||
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
|
||||
@ -525,7 +496,6 @@ TreeItem *EditorHelpSearch::Runner::_create_method_item(TreeItem *p_parent, cons
|
||||
}
|
||||
|
||||
TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc) {
|
||||
|
||||
String tooltip = p_doc->return_type + " " + p_class_doc->name + "." + p_doc->name + "(";
|
||||
for (int i = 0; i < p_doc->arguments.size(); i++) {
|
||||
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
|
||||
@ -540,13 +510,11 @@ TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, cons
|
||||
}
|
||||
|
||||
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, TTRC("Constant"), "constant", tooltip);
|
||||
}
|
||||
|
||||
TreeItem *EditorHelpSearch::Runner::_create_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;
|
||||
tooltip += "\n " + p_class_doc->name + "." + p_doc->setter + "(value) setter";
|
||||
tooltip += "\n " + p_class_doc->name + "." + p_doc->getter + "() getter";
|
||||
@ -554,13 +522,11 @@ TreeItem *EditorHelpSearch::Runner::_create_property_item(TreeItem *p_parent, co
|
||||
}
|
||||
|
||||
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, 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;
|
||||
String text;
|
||||
if (search_flags & SEARCH_SHOW_HIERARCHY) {
|
||||
@ -590,7 +556,6 @@ TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, cons
|
||||
}
|
||||
|
||||
bool EditorHelpSearch::Runner::work(uint64_t slot) {
|
||||
|
||||
// Return true when the search has been completed, otherwise false.
|
||||
const uint64_t until = OS::get_singleton()->get_ticks_usec() + slot;
|
||||
while (!_slice())
|
||||
|
||||
Reference in New Issue
Block a user