diff options
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r-- | editor/editor_help.cpp | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 8d371714cf..60040f641b 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -88,10 +88,8 @@ void EditorHelpSearch::IncrementalSearch::phase1(Map<String, DocData::ClassDoc>: TreeItem *item = search_options->create_item(root); item->set_metadata(0, "class_name:" + E->key()); item->set_text(0, E->key() + " (Class)"); - if (search->has_icon(E->key(), "EditorIcons")) - item->set_icon(0, search->get_icon(E->key(), "EditorIcons")); - else - item->set_icon(0, def_icon); + Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(E->key(), "Node"); + item->set_icon(0, icon); } } @@ -99,11 +97,7 @@ void EditorHelpSearch::IncrementalSearch::phase2(Map<String, DocData::ClassDoc>: DocData::ClassDoc &c = E->get(); - Ref<Texture> cicon; - if (search->has_icon(E->key(), "EditorIcons")) - cicon = search->get_icon(E->key(), "EditorIcons"); - else - cicon = def_icon; + Ref<Texture> cicon = EditorNode::get_singleton()->get_class_icon(E->key(), "Node"); for (int i = 0; i < c.methods.size(); i++) { if ((term.begins_with(".") && c.methods[i].name.begins_with(term.right(1))) || (term.ends_with("(") && c.methods[i].name.ends_with(term.left(term.length() - 1).strip_edges())) || (term.begins_with(".") && term.ends_with("(") && c.methods[i].name == term.substr(1, term.length() - 2).strip_edges()) || c.methods[i].name.findn(term) != -1) { @@ -343,10 +337,8 @@ void EditorHelpIndex::add_type(const String &p_type, HashMap<String, TreeItem *> item->set_tooltip(0, EditorHelp::get_doc_data()->class_list[p_type].brief_description); item->set_text(0, p_type); - if (has_icon(p_type, "EditorIcons")) { - - item->set_icon(0, get_icon(p_type, "EditorIcons")); - } + Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(p_type); + item->set_icon(0, icon); p_types[p_type] = item; } @@ -760,6 +752,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { } void EditorHelp::_update_doc() { + if (!doc->class_list.has(edited_class)) + return; scroll_locked = true; @@ -776,6 +770,7 @@ void EditorHelp::_update_doc() { Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts"); String link_color_text = title_color.to_html(false); + // Class name section_line.push_back(Pair<String, int>(TTR("Top"), 0)); class_desc->push_font(doc_title_font); class_desc->push_color(title_color); @@ -787,18 +782,18 @@ void EditorHelp::_update_doc() { class_desc->pop(); class_desc->add_newline(); + // Inheritance tree + + // Ascendents if (cd.inherits != "") { class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); + class_desc->push_font(doc_font); class_desc->add_text(TTR("Inherits:") + " "); class_desc->pop(); - class_desc->pop(); String inherits = cd.inherits; - class_desc->push_font(doc_font); - while (inherits != "") { _add_type(inherits); @@ -813,6 +808,7 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Descendents if (ClassDB::class_exists(cd.name)) { bool found = false; @@ -824,13 +820,10 @@ void EditorHelp::_update_doc() { if (!found) { class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); + class_desc->push_font(doc_font); class_desc->add_text(TTR("Inherited by:") + " "); class_desc->pop(); - class_desc->pop(); - found = true; - class_desc->push_font(doc_font); } if (prev) { @@ -853,6 +846,7 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); class_desc->add_newline(); + // Brief description if (cd.brief_description != "") { class_desc->push_color(title_color); @@ -874,15 +868,16 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Properties overview Set<String> skip_methods; bool property_descr = false; if (cd.properties.size()) { - section_line.push_back(Pair<String, int>(TTR("Members"), class_desc->get_line_count() - 2)); + section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); - class_desc->add_text(TTR("Members:")); + class_desc->add_text(TTR("Properties:")); class_desc->pop(); class_desc->pop(); @@ -940,6 +935,7 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Methods overview bool method_descr = false; bool sort_methods = EditorSettings::get_singleton()->get("text_editor/help/sort_functions_alphabetically"); @@ -956,10 +952,10 @@ void EditorHelp::_update_doc() { if (sort_methods) methods.sort(); - section_line.push_back(Pair<String, int>(TTR("Public Methods"), class_desc->get_line_count() - 2)); + section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); - class_desc->add_text(TTR("Public Methods:")); + class_desc->add_text(TTR("Methods:")); class_desc->pop(); class_desc->pop(); @@ -1024,22 +1020,20 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Theme properties if (cd.theme_properties.size()) { - section_line.push_back(Pair<String, int>(TTR("GUI Theme Items"), class_desc->get_line_count() - 2)); + section_line.push_back(Pair<String, int>(TTR("Theme Properties"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); - class_desc->add_text(TTR("GUI Theme Items:")); + class_desc->add_text(TTR("Theme Properties:")); class_desc->pop(); class_desc->pop(); - // class_desc->add_newline(); class_desc->push_indent(1); class_desc->push_table(2); class_desc->set_table_column_expand(1, 1); - //class_desc->add_newline(); - for (int i = 0; i < cd.theme_properties.size(); i++) { theme_property_line[cd.theme_properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description @@ -1076,6 +1070,7 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Signals if (cd.signals.size()) { if (sort_methods) { @@ -1144,6 +1139,7 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Constants and enums if (cd.constants.size()) { Map<String, Vector<DocData::ConstantDoc> > enums; @@ -1163,6 +1159,7 @@ void EditorHelp::_update_doc() { } } + // Enums if (enums.size()) { section_line.push_back(Pair<String, int>(TTR("Enumerations"), class_desc->get_line_count() - 2)); @@ -1245,6 +1242,7 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Constants if (constants.size()) { section_line.push_back(Pair<String, int>(TTR("Constants"), class_desc->get_line_count() - 2)); @@ -1303,13 +1301,14 @@ void EditorHelp::_update_doc() { } } + // Class description if (cd.description != "") { - section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_line_count() - 2)); + section_line.push_back(Pair<String, int>(TTR("Class Description"), class_desc->get_line_count() - 2)); description_line = class_desc->get_line_count() - 2; class_desc->push_color(title_color); class_desc->push_font(doc_title_font); - class_desc->add_text(TTR("Description:")); + class_desc->add_text(TTR("Class Description:")); class_desc->pop(); class_desc->pop(); @@ -1326,8 +1325,8 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); } + // Online tutorials { - class_desc->push_color(title_color); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Online Tutorials:")); @@ -1365,12 +1364,14 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); class_desc->add_newline(); } + + // Property descriptions if (property_descr) { - section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_line_count() - 2)); + section_line.push_back(Pair<String, int>(TTR("Property Descriptions"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); - class_desc->add_text(TTR("Property Description:")); + class_desc->add_text(TTR("Property Descriptions:")); class_desc->pop(); class_desc->pop(); @@ -1458,12 +1459,13 @@ void EditorHelp::_update_doc() { } } + // Method descriptions if (method_descr) { - section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2)); + section_line.push_back(Pair<String, int>(TTR("Method Descriptions"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); - class_desc->add_text(TTR("Method Description:")); + class_desc->add_text(TTR("Method Descriptions:")); class_desc->pop(); class_desc->pop(); |