diff options
Diffstat (limited to 'tools/editor/editor_help.cpp')
-rw-r--r-- | tools/editor/editor_help.cpp | 107 |
1 files changed, 59 insertions, 48 deletions
diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 4f44331b0b..1bc09c5102 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -629,7 +629,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->add_text("Class: "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/base_type_color")); - class_desc->add_text(p_class); + _add_text(p_class); class_desc->pop(); class_desc->pop(); class_desc->pop(); @@ -647,7 +647,6 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); class_desc->add_newline(); class_desc->add_newline(); - class_desc->add_newline(); } @@ -661,8 +660,13 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { //class_desc->add_newline(); class_desc->add_newline(); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_indent(1); _add_text(cd.brief_description); - class_desc->add_newline(); + class_desc->pop(); + class_desc->pop(); + class_desc->pop(); class_desc->add_newline(); class_desc->add_newline(); } @@ -693,7 +697,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_meta("@"+cd.methods[i].name); } class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->add_text(cd.methods[i].name); + _add_text(cd.methods[i].name); class_desc->pop(); if (cd.methods[i].description!="") class_desc->pop(); @@ -705,13 +709,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (j>0) class_desc->add_text(", "); _add_type(cd.methods[i].arguments[j].type); - class_desc->add_text(" "+cd.methods[i].arguments[j].name); + class_desc->add_text(" "); + _add_text(cd.methods[i].arguments[j].name); if (cd.methods[i].arguments[j].default_value!="") { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text("="); class_desc->pop(); - class_desc->add_text(cd.methods[i].arguments[j].default_value); + _add_text(cd.methods[i].arguments[j].default_value); } class_desc->pop(); @@ -723,7 +728,8 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.methods[i].qualifiers!="") { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); - class_desc->add_text(" "+cd.methods[i].qualifiers); + class_desc->add_text(" "); + _add_text(cd.methods[i].qualifiers); class_desc->pop(); } @@ -739,6 +745,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.properties.size()) { + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text("Members:"); @@ -756,7 +763,8 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_font(doc_code_font); _add_type(cd.properties[i].type); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->add_text(" "+cd.properties[i].name); + class_desc->add_text(" "); + _add_text(cd.properties[i].name); class_desc->pop(); class_desc->pop(); @@ -764,7 +772,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_font(doc_font); class_desc->add_text(" "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); - class_desc->add_text(cd.properties[i].description); + _add_text(cd.properties[i].description); class_desc->pop(); class_desc->pop(); @@ -799,7 +807,8 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_font(doc_code_font); _add_type(cd.theme_properties[i].type); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->add_text(" "+cd.theme_properties[i].name); + class_desc->add_text(" "); + _add_text(cd.theme_properties[i].name); class_desc->pop(); class_desc->pop(); @@ -807,7 +816,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_font(doc_font); class_desc->add_text(" "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); - class_desc->add_text(cd.theme_properties[i].description); + _add_text(cd.theme_properties[i].description); class_desc->pop(); class_desc->pop(); @@ -816,10 +825,9 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); } + class_desc->add_newline(); class_desc->pop(); - class_desc->add_newline(); - class_desc->add_newline(); } if (cd.signals.size()) { @@ -838,11 +846,11 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { for(int i=0;i<cd.signals.size();i++) { signal_line[cd.signals[i].name]=class_desc->get_line_count()-2; //gets overriden if description - class_desc->push_font(doc_code_font); + class_desc->push_font(doc_code_font); // monofont //_add_type("void"); //class_desc->add_text(" "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->add_text(cd.signals[i].name); + _add_text(cd.signals[i].name); class_desc->pop(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text(cd.signals[i].arguments.size()?"( ":"("); @@ -852,13 +860,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (j>0) class_desc->add_text(", "); _add_type(cd.signals[i].arguments[j].type); - class_desc->add_text(" "+cd.signals[i].arguments[j].name); + class_desc->add_text(" "); + _add_text(cd.signals[i].arguments[j].name); if (cd.signals[i].arguments[j].default_value!="") { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text("="); class_desc->pop(); - class_desc->add_text(cd.signals[i].arguments[j].default_value); + _add_text(cd.signals[i].arguments[j].default_value); } class_desc->pop(); @@ -867,21 +876,21 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text(cd.signals[i].arguments.size()?" )":")"); class_desc->pop(); + class_desc->pop(); // end monofont if (cd.signals[i].description!="") { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); - class_desc->add_text(" "+cd.signals[i].description); + class_desc->add_text(" "); + _add_text(cd.signals[i].description); class_desc->pop(); } - class_desc->pop();//monofont class_desc->add_newline(); } class_desc->pop(); class_desc->add_newline(); - class_desc->add_newline(); } @@ -903,20 +912,20 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { constant_line[cd.constants[i].name]=class_desc->get_line_count()-2; class_desc->push_font(doc_code_font); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/base_type_color")); - class_desc->add_text(cd.constants[i].name); + _add_text(cd.constants[i].name); class_desc->pop(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text(" = "); class_desc->pop(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); - class_desc->add_text(cd.constants[i].value); + _add_text(cd.constants[i].value); class_desc->pop(); class_desc->pop(); if (cd.constants[i].description!="") { class_desc->push_font(doc_font); class_desc->add_text(" "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); - class_desc->add_text(cd.constants[i].description); + _add_text(cd.constants[i].description); class_desc->pop(); class_desc->pop(); } @@ -926,7 +935,6 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); class_desc->add_newline(); - class_desc->add_newline(); } @@ -934,7 +942,6 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.description!="") { description_line=class_desc->get_line_count()-2; - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text("Description:"); @@ -942,8 +949,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); class_desc->add_newline(); - _add_text(cd.description); class_desc->add_newline(); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_indent(1); + _add_text(cd.description); + class_desc->pop(); + class_desc->pop(); + class_desc->pop(); class_desc->add_newline(); class_desc->add_newline(); } @@ -958,22 +971,18 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); class_desc->add_newline(); - class_desc->push_indent(1); for(int i=0;i<cd.methods.size();i++) { method_line[cd.methods[i].name]=class_desc->get_line_count()-2; - if( cd.methods[i].description != "") { - class_desc->add_newline(); - } class_desc->push_font(doc_code_font); _add_type(cd.methods[i].return_type); class_desc->add_text(" "); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); - class_desc->add_text(cd.methods[i].name); + _add_text(cd.methods[i].name); class_desc->pop(); class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text(cd.methods[i].arguments.size()?"( ":"("); @@ -983,13 +992,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (j>0) class_desc->add_text(", "); _add_type(cd.methods[i].arguments[j].type); - class_desc->add_text(" "+cd.methods[i].arguments[j].name); + class_desc->add_text(" "); + _add_text(cd.methods[i].arguments[j].name); if (cd.methods[i].arguments[j].default_value!="") { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); class_desc->add_text("="); class_desc->pop(); - class_desc->add_text(cd.methods[i].arguments[j].default_value); + _add_text(cd.methods[i].arguments[j].default_value); } class_desc->pop(); @@ -1001,19 +1011,23 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.methods[i].qualifiers!="") { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); - class_desc->add_text(" "+cd.methods[i].qualifiers); + class_desc->add_text(" "); + _add_text(cd.methods[i].qualifiers); class_desc->pop(); } class_desc->pop(); - if( cd.methods[i].description != "") { - class_desc->add_text(" "); - _add_text(cd.methods[i].description); - class_desc->add_newline(); - class_desc->add_newline(); - } + class_desc->add_newline(); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_font( get_font("normal","Fonts") ); + class_desc->push_indent(1); + _add_text(cd.methods[i].description); + class_desc->pop(); + class_desc->pop(); + class_desc->pop(); + class_desc->add_newline(); class_desc->add_newline(); class_desc->add_newline(); @@ -1082,9 +1096,9 @@ void EditorHelp::_help_callback(const String& p_topic) { void EditorHelp::_add_text(const String& p_bbcode) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + /*class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); class_desc->push_font( get_font("normal","Fonts") ); - class_desc->push_indent(1); + class_desc->push_indent(1);*/ int pos = 0; List<String> tag_stack; @@ -1162,7 +1176,7 @@ void EditorHelp::_add_text(const String& p_bbcode) { } else if (tag=="i") { //use italics font - //class_desc->push_font(get_font("italic","Fonts")); + class_desc->push_font(get_font("italic","Fonts")); pos=brk_end+1; tag_stack.push_front(tag); } else if (tag=="code") { @@ -1298,8 +1312,9 @@ void EditorHelp::_add_text(const String& p_bbcode) { } } + /*class_desc->pop(); class_desc->pop(); - class_desc->pop(); + class_desc->pop();*/ } @@ -1341,9 +1356,6 @@ void EditorHelp::_notification(int p_what) { } } - - - void EditorHelp::go_to_help(const String& p_help) { _help_callback(p_help); @@ -1417,7 +1429,6 @@ EditorHelp::EditorHelp() { Panel *pc = memnew( Panel ); Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) ); style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") ); - pc->set_v_size_flags(SIZE_EXPAND_FILL); pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit")); vbc->add_child(pc); class_desc = memnew( RichTextLabel ); |