summaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp101
1 files changed, 66 insertions, 35 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 2c4d3035a4..cc7f1cac43 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -555,7 +555,7 @@ void EditorHelp::_class_desc_select(const String &p_select) {
if (select.find(".") != -1) {
class_name = select.get_slice(".", 0);
} else {
- class_name = "@Global Scope";
+ class_name = "@GlobalScope";
}
emit_signal("go_to_help", "class_enum:" + class_name + ":" + select);
return;
@@ -1045,12 +1045,17 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop(); // end monofont
if (cd.signals[i].description != "") {
+ class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- class_desc->add_text(" ");
+ class_desc->push_indent(1);
+ // class_desc->add_text(" ");
_add_text(cd.signals[i].description);
+ class_desc->pop(); // indent
class_desc->pop();
+ class_desc->pop(); // font
}
class_desc->add_newline();
+ class_desc->add_newline();
}
class_desc->pop();
@@ -1129,11 +1134,14 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop();
if (enum_list[i].description != "") {
class_desc->push_font(doc_font);
- class_desc->add_text(" ");
+ //class_desc->add_text(" ");
+ class_desc->push_indent(1);
class_desc->push_color(comment_color);
_add_text(enum_list[i].description);
class_desc->pop();
class_desc->pop();
+ class_desc->pop(); // indent
+ class_desc->add_newline();
}
class_desc->add_newline();
@@ -1177,11 +1185,14 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop();
if (constants[i].description != "") {
class_desc->push_font(doc_font);
- class_desc->add_text(" ");
+ class_desc->push_indent(1);
+ //class_desc->add_text(" ");
class_desc->push_color(comment_color);
_add_text(constants[i].description);
class_desc->pop();
class_desc->pop();
+ class_desc->pop(); // indent
+ class_desc->add_newline();
}
class_desc->add_newline();
@@ -1231,54 +1242,62 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
method_line[cd.properties[i].name] = class_desc->get_line_count() - 2;
+ class_desc->push_table(2);
+ class_desc->set_table_column_expand(1, 1);
+
+ class_desc->push_cell();
class_desc->push_font(doc_code_font);
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
-
class_desc->add_text(" ");
+ class_desc->pop(); // font
+ class_desc->pop(); // cell
+
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
- class_desc->pop(); //color
-
- class_desc->add_text(" ");
+ class_desc->pop(); // color
+ class_desc->pop(); // font
+ class_desc->pop(); // cell
- class_desc->pop(); //font
+ //class_desc->add_text(" ");
if (cd.properties[i].setter != "") {
- class_desc->push_font(doc_font);
-
- class_desc->push_indent(2);
- class_desc->push_color(comment_color);
- class_desc->add_text("Setter: ");
- class_desc->pop();
+ class_desc->push_cell();
+ class_desc->pop(); // cell
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
class_desc->push_color(text_color);
class_desc->add_text(cd.properties[i].setter + "(value)");
- class_desc->pop(); //color
-
- class_desc->pop(); //indent
-
- class_desc->pop(); //font
+ class_desc->pop(); // color
+ class_desc->push_color(comment_color);
+ class_desc->add_text(" setter");
+ class_desc->pop(); // color
+ class_desc->pop(); // font
+ class_desc->pop(); // cell
}
if (cd.properties[i].getter != "") {
- class_desc->push_font(doc_font);
-
- class_desc->push_indent(2);
- class_desc->push_color(comment_color);
- class_desc->add_text("Getter: ");
- class_desc->pop();
+ class_desc->push_cell();
+ class_desc->pop(); // cell
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
class_desc->push_color(text_color);
class_desc->add_text(cd.properties[i].getter + "()");
class_desc->pop(); //color
-
- class_desc->pop(); //indent
-
+ class_desc->push_color(comment_color);
+ class_desc->add_text(" getter");
+ class_desc->pop(); //color
class_desc->pop(); //font
+ class_desc->pop(); //cell
}
+ class_desc->pop(); // table
+
class_desc->add_newline();
class_desc->push_color(text_color);
@@ -1459,9 +1478,10 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp");
Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8);
- String bbcode = p_bbcode.replace("\t", " ").replace("\r", " ").strip_edges();
+ String bbcode = p_bbcode.dedent().replace("\t", "").replace("\r", "").strip_edges();
List<String> tag_stack;
+ bool code_tag = false;
int pos = 0;
while (pos < bbcode.length()) {
@@ -1472,7 +1492,10 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
brk_pos = bbcode.length();
if (brk_pos > pos) {
- p_rt->add_text(bbcode.substr(pos, brk_pos - pos));
+ String text = bbcode.substr(pos, brk_pos - pos);
+ if (!code_tag)
+ text = text.replace("\n", "\n\n");
+ p_rt->add_text(text);
}
if (brk_pos == bbcode.length())
@@ -1481,7 +1504,11 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
int brk_end = bbcode.find("]", brk_pos + 1);
if (brk_end == -1) {
- p_rt->add_text(bbcode.substr(brk_pos, bbcode.length() - brk_pos));
+
+ String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
+ if (!code_tag)
+ text = text.replace("\n", "\n\n");
+ p_rt->add_text(text);
break;
}
@@ -1490,20 +1517,23 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
if (tag.begins_with("/")) {
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1, tag.length());
- if (tag_stack.size()) {
- }
if (!tag_ok) {
p_rt->add_text("[");
- pos++;
+ pos = brk_pos + 1;
continue;
}
tag_stack.pop_front();
pos = brk_end + 1;
+ code_tag = false;
if (tag != "/img")
p_rt->pop();
+ } else if (code_tag) {
+
+ p_rt->add_text("[");
+ pos = brk_pos + 1;
} else if (tag.begins_with("method ")) {
@@ -1540,6 +1570,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
//use monospace font
p_rt->push_font(doc_code_font);
+ code_tag = true;
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "center") {