summaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-12-03 15:29:29 +0100
committerGitHub <noreply@github.com>2021-12-03 15:29:29 +0100
commitaaabc0abcc139a8212c400756016596281ef09c5 (patch)
tree88307c059aaf4dd5cd22f919a63074cf25901e27 /editor/editor_help.cpp
parent8762d8fa5d8c4fd6ef3e44270089538dbc6d2f7c (diff)
parent397e56964dfb6555d2aa431391e3d308a0ec3e0d (diff)
Merge pull request #55520 from pycbouh/docs-sort-group-newline-theme-and-enums
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp95
1 files changed, 64 insertions, 31 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index f520877256..4082dcefbc 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -237,8 +237,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
class_desc->push_cell();
class_desc->push_paragraph(RichTextLabel::ALIGN_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
} else {
- static const char32_t prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
- class_desc->add_text(String(prefix));
+ _add_bulletpoint();
}
_add_type(p_method.return_type, p_method.return_enum);
@@ -314,6 +313,11 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
}
}
+void EditorHelp::_add_bulletpoint() {
+ static const char32_t prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
+ class_desc->add_text(String(prefix));
+}
+
Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (!doc->class_list.has(p_class)) {
return ERR_DOES_NOT_EXIST;
@@ -837,27 +841,54 @@ void EditorHelp::_update_doc() {
class_desc->pop();
class_desc->pop();
+ class_desc->add_newline();
+ class_desc->add_newline();
+
class_desc->push_indent(1);
- class_desc->push_table(2);
- class_desc->set_table_column_expand(1, true);
+
+ String theme_data_type;
+ Map<String, String> data_type_names;
+ data_type_names["color"] = TTR("Colors");
+ data_type_names["constant"] = TTR("Constants");
+ data_type_names["font"] = TTR("Fonts");
+ data_type_names["font_size"] = TTR("Font Sizes");
+ data_type_names["icon"] = TTR("Icons");
+ data_type_names["style"] = TTR("Styles");
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
- class_desc->push_cell();
- class_desc->push_paragraph(RichTextLabel::ALIGN_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
+ if (theme_data_type != cd.theme_properties[i].data_type) {
+ theme_data_type = cd.theme_properties[i].data_type;
+
+ class_desc->push_color(title_color);
+ class_desc->push_font(doc_title_font);
+ if (data_type_names.has(theme_data_type)) {
+ class_desc->add_text(data_type_names[theme_data_type]);
+ } else {
+ class_desc->add_text("");
+ }
+ class_desc->pop();
+ class_desc->pop();
+
+ class_desc->add_newline();
+ class_desc->add_newline();
+ }
+
+ // Theme item header.
class_desc->push_font(doc_code_font);
+ _add_bulletpoint();
+
+ // Theme item object type.
_add_type(cd.theme_properties[i].type);
- class_desc->pop();
- class_desc->pop();
- class_desc->pop();
- class_desc->push_cell();
- class_desc->push_font(doc_code_font);
+ // Theme item name.
class_desc->push_color(headline_color);
+ class_desc->add_text(" ");
_add_text(cd.theme_properties[i].name);
class_desc->pop();
+ // Theme item default value.
if (cd.theme_properties[i].default_value != "") {
class_desc->push_color(symbol_color);
class_desc->add_text(" [" + TTR("default:") + " ");
@@ -870,23 +901,25 @@ void EditorHelp::_update_doc() {
class_desc->pop();
}
- class_desc->pop();
+ class_desc->pop(); // monofont
+ // Theme item description.
if (cd.theme_properties[i].description != "") {
class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- class_desc->add_text(U" – ");
+ class_desc->push_indent(1);
_add_text(DTR(cd.theme_properties[i].description));
- class_desc->pop();
- class_desc->pop();
+ class_desc->pop(); // indent
+ class_desc->pop(); // color
+ class_desc->pop(); // font
}
- class_desc->pop(); // cell
+
+ class_desc->add_newline();
+ class_desc->add_newline();
}
- class_desc->pop(); // table
class_desc->pop();
class_desc->add_newline();
- class_desc->add_newline();
}
// Signals
@@ -909,10 +942,10 @@ void EditorHelp::_update_doc() {
for (int i = 0; i < cd.signals.size(); i++) {
signal_line[cd.signals[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
+
class_desc->push_font(doc_code_font); // monofont
class_desc->push_color(headline_color);
- static const char32_t prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
- class_desc->add_text(String(prefix));
+ _add_bulletpoint();
_add_text(cd.signals[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1043,8 +1076,7 @@ void EditorHelp::_update_doc() {
class_desc->push_font(doc_code_font);
class_desc->push_color(headline_color);
- static const char32_t prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
- class_desc->add_text(String(prefix));
+ _add_bulletpoint();
_add_text(enum_list[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1054,10 +1086,12 @@ void EditorHelp::_update_doc() {
_add_text(_fix_constant(enum_list[i].value));
class_desc->pop();
class_desc->pop();
- if (enum_list[i].description != "") {
+
+ class_desc->add_newline();
+
+ if (enum_list[i].description.strip_edges() != "") {
class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- class_desc->add_text(U" – ");
_add_text(DTR(enum_list[i].description));
class_desc->pop();
class_desc->pop();
@@ -1103,13 +1137,11 @@ void EditorHelp::_update_doc() {
Vector<float> color = stripped.split_floats(",");
if (color.size() >= 3) {
class_desc->push_color(Color(color[0], color[1], color[2]));
- static const char32_t prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
- class_desc->add_text(String(prefix));
+ _add_bulletpoint();
class_desc->pop();
}
} else {
- static const char32_t prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
- class_desc->add_text(String(prefix));
+ _add_bulletpoint();
}
class_desc->push_color(headline_color);
@@ -1123,10 +1155,12 @@ void EditorHelp::_update_doc() {
class_desc->pop();
class_desc->pop();
+
+ class_desc->add_newline();
+
if (constants[i].description != "") {
class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- class_desc->add_text(U" – ");
_add_text(DTR(constants[i].description));
class_desc->pop();
class_desc->pop();
@@ -1167,8 +1201,7 @@ void EditorHelp::_update_doc() {
class_desc->push_cell();
class_desc->push_font(doc_code_font);
- static const char32_t prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
- class_desc->add_text(String(prefix));
+ _add_bulletpoint();
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->add_text(" ");