|
@@ -96,8 +96,8 @@ void EditorHelp::_class_desc_select(const String &p_select) {
|
|
emit_signal("go_to_help", "class_name:" + p_select.substr(1, p_select.length()));
|
|
emit_signal("go_to_help", "class_name:" + p_select.substr(1, p_select.length()));
|
|
return;
|
|
return;
|
|
} else if (p_select.begins_with("@")) {
|
|
} else if (p_select.begins_with("@")) {
|
|
- String tag = p_select.substr(1, 6);
|
|
|
|
- String link = p_select.substr(7, p_select.length());
|
|
|
|
|
|
+ String tag = p_select.substr(1, 8).rstrip(" ");
|
|
|
|
+ String link = p_select.substr(9, p_select.length());
|
|
|
|
|
|
String topic;
|
|
String topic;
|
|
Map<String, int> *table = NULL;
|
|
Map<String, int> *table = NULL;
|
|
@@ -108,24 +108,50 @@ void EditorHelp::_class_desc_select(const String &p_select) {
|
|
} else if (tag == "member") {
|
|
} else if (tag == "member") {
|
|
topic = "class_property";
|
|
topic = "class_property";
|
|
table = &this->property_line;
|
|
table = &this->property_line;
|
|
- } else if (tag == "enum ") {
|
|
|
|
|
|
+ } else if (tag == "enum") {
|
|
topic = "class_enum";
|
|
topic = "class_enum";
|
|
table = &this->enum_line;
|
|
table = &this->enum_line;
|
|
} else if (tag == "signal") {
|
|
} else if (tag == "signal") {
|
|
topic = "class_signal";
|
|
topic = "class_signal";
|
|
table = &this->signal_line;
|
|
table = &this->signal_line;
|
|
|
|
+ } else if (tag == "constant") {
|
|
|
|
+ topic = "class_constant";
|
|
|
|
+ table = &this->constant_line;
|
|
} else {
|
|
} else {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
if (link.find(".") != -1) {
|
|
if (link.find(".") != -1) {
|
|
-
|
|
|
|
emit_signal("go_to_help", topic + ":" + link.get_slice(".", 0) + ":" + link.get_slice(".", 1));
|
|
emit_signal("go_to_help", topic + ":" + link.get_slice(".", 0) + ":" + link.get_slice(".", 1));
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
- if (!table->has(link))
|
|
|
|
- return;
|
|
|
|
- class_desc->scroll_to_line((*table)[link]);
|
|
|
|
|
|
+ if (table->has(link)) {
|
|
|
|
+ // Found in the current page
|
|
|
|
+ class_desc->scroll_to_line((*table)[link]);
|
|
|
|
+ } else {
|
|
|
|
+ if (topic == "class_enum") {
|
|
|
|
+ // Try to find the enum in @GlobalScope
|
|
|
|
+ const DocData::ClassDoc &cd = doc->class_list["@GlobalScope"];
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < cd.constants.size(); i++) {
|
|
|
|
+ if (cd.constants[i].enumeration == link) {
|
|
|
|
+ // Found in @GlobalScope
|
|
|
|
+ emit_signal("go_to_help", topic + ":@GlobalScope:" + link);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if (topic == "class_constant") {
|
|
|
|
+ // Try to find the constant in @GlobalScope
|
|
|
|
+ const DocData::ClassDoc &cd = doc->class_list["@GlobalScope"];
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < cd.constants.size(); i++) {
|
|
|
|
+ if (cd.constants[i].name == link) {
|
|
|
|
+ // Found in @GlobalScope
|
|
|
|
+ emit_signal("go_to_help", topic + ":@GlobalScope:" + link);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} else if (p_select.begins_with("http")) {
|
|
} else if (p_select.begins_with("http")) {
|
|
OS::get_singleton()->shell_open(p_select);
|
|
OS::get_singleton()->shell_open(p_select);
|
|
@@ -733,6 +759,9 @@ void EditorHelp::_update_doc() {
|
|
if (cd.name == "@GlobalScope")
|
|
if (cd.name == "@GlobalScope")
|
|
enumValuesContainer[enum_list[i].name] = enumStartingLine;
|
|
enumValuesContainer[enum_list[i].name] = enumStartingLine;
|
|
|
|
|
|
|
|
+ // Add the enum constant line to the constant_line map so we can locate it as a constant
|
|
|
|
+ constant_line[enum_list[i].name] = class_desc->get_line_count() - 2;
|
|
|
|
+
|
|
class_desc->push_font(doc_code_font);
|
|
class_desc->push_font(doc_code_font);
|
|
class_desc->push_color(headline_color);
|
|
class_desc->push_color(headline_color);
|
|
_add_text(enum_list[i].name);
|
|
_add_text(enum_list[i].name);
|
|
@@ -1160,10 +1189,10 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
|
|
p_rt->add_text("[");
|
|
p_rt->add_text("[");
|
|
pos = brk_pos + 1;
|
|
pos = brk_pos + 1;
|
|
|
|
|
|
- } else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ")) {
|
|
|
|
|
|
+ } else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ")) {
|
|
|
|
|
|
String link_target = tag.substr(tag.find(" ") + 1, tag.length());
|
|
String link_target = tag.substr(tag.find(" ") + 1, tag.length());
|
|
- String link_tag = tag.substr(0, tag.find(" ")).rpad(6);
|
|
|
|
|
|
+ String link_tag = tag.substr(0, tag.find(" ")).rpad(8);
|
|
p_rt->push_color(link_color);
|
|
p_rt->push_color(link_color);
|
|
p_rt->push_meta("@" + link_tag + link_target);
|
|
p_rt->push_meta("@" + link_tag + link_target);
|
|
p_rt->add_text(link_target + (tag.begins_with("method ") ? "()" : ""));
|
|
p_rt->add_text(link_target + (tag.begins_with("method ") ? "()" : ""));
|