Improve the editor help display

- Write the type after the parameter name for consistency with
  the GDScript static typing syntax.
- Remove ":" after headers since they're already distinguished
  by their size.
- Remove spaces before/aftere parentheses in method/signal
  argument lists.
This commit is contained in:
Hugo Locurcio 2019-09-20 22:40:22 +02:00
parent 25a1bfed5c
commit 5b3805b8e5
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C

View file

@ -257,16 +257,17 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
}
class_desc->push_color(symbol_color);
class_desc->add_text(p_method.arguments.size() || is_vararg ? "( " : "(");
class_desc->add_text("(");
class_desc->pop();
for (int j = 0; j < p_method.arguments.size(); j++) {
class_desc->push_color(text_color);
if (j > 0)
class_desc->add_text(", ");
_add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration);
class_desc->add_text(" ");
_add_text(p_method.arguments[j].name);
class_desc->add_text(": ");
_add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration);
if (p_method.arguments[j].default_value != "") {
class_desc->push_color(symbol_color);
@ -291,7 +292,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
}
class_desc->push_color(symbol_color);
class_desc->add_text(p_method.arguments.size() || is_vararg ? " )" : ")");
class_desc->add_text(")");
class_desc->pop();
if (p_method.qualifiers != "") {
@ -424,7 +425,7 @@ void EditorHelp::_update_doc() {
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Brief Description:"));
class_desc->add_text(TTR("Brief Description"));
class_desc->pop();
class_desc->pop();
@ -451,7 +452,7 @@ void EditorHelp::_update_doc() {
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("Properties:"));
class_desc->add_text(TTR("Properties"));
class_desc->pop();
class_desc->pop();
@ -547,7 +548,7 @@ void EditorHelp::_update_doc() {
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("Methods:"));
class_desc->add_text(TTR("Methods"));
class_desc->pop();
class_desc->pop();
@ -618,7 +619,7 @@ void EditorHelp::_update_doc() {
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("Theme Properties:"));
class_desc->add_text(TTR("Theme Properties"));
class_desc->pop();
class_desc->pop();
@ -685,7 +686,7 @@ void EditorHelp::_update_doc() {
section_line.push_back(Pair<String, int>(TTR("Signals"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Signals:"));
class_desc->add_text(TTR("Signals"));
class_desc->pop();
class_desc->pop();
@ -702,15 +703,16 @@ void EditorHelp::_update_doc() {
_add_text(cd.signals[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
class_desc->add_text(cd.signals[i].arguments.size() ? "( " : "(");
class_desc->add_text("(");
class_desc->pop();
for (int j = 0; j < cd.signals[i].arguments.size(); j++) {
class_desc->push_color(text_color);
if (j > 0)
class_desc->add_text(", ");
_add_type(cd.signals[i].arguments[j].type);
class_desc->add_text(" ");
_add_text(cd.signals[i].arguments[j].name);
class_desc->add_text(": ");
_add_type(cd.signals[i].arguments[j].type);
if (cd.signals[i].arguments[j].default_value != "") {
class_desc->push_color(symbol_color);
@ -723,7 +725,7 @@ void EditorHelp::_update_doc() {
}
class_desc->push_color(symbol_color);
class_desc->add_text(cd.signals[i].arguments.size() ? " )" : ")");
class_desc->add_text(")");
class_desc->pop();
class_desc->pop(); // end monofont
if (cd.signals[i].description != "") {
@ -770,7 +772,7 @@ void EditorHelp::_update_doc() {
section_line.push_back(Pair<String, int>(TTR("Enumerations"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Enumerations:"));
class_desc->add_text(TTR("Enumerations"));
class_desc->pop();
class_desc->pop();
class_desc->push_indent(1);
@ -856,7 +858,7 @@ void EditorHelp::_update_doc() {
section_line.push_back(Pair<String, int>(TTR("Constants"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Constants:"));
class_desc->add_text(TTR("Constants"));
class_desc->pop();
class_desc->pop();
class_desc->push_indent(1);
@ -916,7 +918,7 @@ void EditorHelp::_update_doc() {
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("Class Description:"));
class_desc->add_text(TTR("Class Description"));
class_desc->pop();
class_desc->pop();
@ -938,7 +940,7 @@ void EditorHelp::_update_doc() {
{
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Online Tutorials:"));
class_desc->add_text(TTR("Online Tutorials"));
class_desc->pop();
class_desc->pop();
class_desc->push_indent(1);
@ -980,7 +982,7 @@ void EditorHelp::_update_doc() {
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 Descriptions:"));
class_desc->add_text(TTR("Property Descriptions"));
class_desc->pop();
class_desc->pop();
@ -1090,7 +1092,7 @@ void EditorHelp::_update_doc() {
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 Descriptions:"));
class_desc->add_text(TTR("Method Descriptions"));
class_desc->pop();
class_desc->pop();