From: Florian Brosch Date: Wed, 5 Nov 2008 02:28:38 +0000 (+0000) Subject: - html-doclet, valadoc.org-doclet_ - Various navigation improvements. X-Git-Tag: 0.37.1~3^2~623 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa8427f50bc9a64bd6b9552242005e4cc17f6a4d;p=thirdparty%2Fvala.git - html-doclet, valadoc.org-doclet_ - Various navigation improvements. - html-doclet, valadoc.org-doclet_ - Various navigation improvements. svn path=/trunk/; revision=11 --- diff --git a/src/doclets/htmlhelpers/htmlhelpers.vala b/src/doclets/htmlhelpers/htmlhelpers.vala index f14995171..3bac04582 100644 --- a/src/doclets/htmlhelpers/htmlhelpers.vala +++ b/src/doclets/htmlhelpers/htmlhelpers.vala @@ -648,7 +648,8 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { file.printf ( "\n
\n", css_navi, css_navi_package_index, css_navi_link, link, css_navi_hr ); } - protected abstract void write_top_element ( GLib.FileStream file, Basic pos ); + protected virtual void write_top_element ( GLib.FileStream file, Basic pos ) { + } protected void write_top_elements ( GLib.FileStream file, Basic element, Basic? mself ) { Gee.ArrayList lst = new Gee.ArrayList (); @@ -668,7 +669,9 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { for ( int i = lst.size-1; i >= 0 ; i-- ) { Basic el = lst.get ( i ); - this.write_navi_top_entry ( file, el, mself ); + if ( el.name != null ) { + this.write_navi_top_entry ( file, el, mself ); + } } } @@ -681,24 +684,40 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { } } - protected void write_navi_file ( GLib.FileStream file, Package efile ) { + protected void write_navi_file ( GLib.FileStream file, Package efile, Basic? pos = null ) { Gee.ArrayList ns_list = new Gee.ArrayList (); this.fetch_subnamespace_names (efile, ns_list ); + file.printf ( "\t\t\t
\n", css_style_navigation ); - this.write_top_element_template ( file, "../index.html" ); + + + if ( pos == null ) + this.write_top_elements ( file, efile, efile ); + else + this.write_top_elements ( file, pos.parent.parent, pos ); + file.printf ( "\t\t\t\t
    \n", css_navi ); + + Namespace globals; + foreach ( Namespace ns in ns_list ) { - this.write_navi_entry ( file, ns, efile, css_navi_namespace, true, true ); + if ( ns.name == null ) + globals = ns; + else + this.write_navi_entry ( file, ns, (pos == null)? efile : pos, css_navi_namespace, true, true ); + } + + if ( globals != null ) { + this.write_navi_child_namespaces_inline_withouth_block ( file, globals, (pos == null)? efile : pos ); } file.puts ( "\t\t\t\t
\n" ); file.puts ( "\t\t\t
\n" ); } - protected void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself ) { - file.printf ( "
    \n", css_navi ); + protected void write_navi_child_namespaces_inline_withouth_block ( GLib.FileStream file, Namespace ns, Basic mself ) { this.write_navi_child_namespaces_without_childs ( file, ns, mself ); this.write_navi_child_classes_without_childs ( file, ns, mself ); this.write_navi_child_interfaces_without_childs ( file, ns, mself ); @@ -709,6 +728,11 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { this.write_navi_child_methods ( file, ns, mself ); this.write_navi_child_fields ( file, ns, mself ); this.write_navi_child_constants ( file, ns, mself ); + } + + protected void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself ) { + file.printf ( "
      \n", css_navi ); + this.write_navi_child_namespaces_inline_withouth_block ( file, ns, mself ); file.puts ( "
    \n" ); } @@ -820,24 +844,29 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { protected void write_navi_method ( GLib.FileStream file, Method m ) { Basic parent = m.parent; - file.printf ( "\t\t\t
    \n", css_style_navigation ); + if ( parent.name == null ) { + this.write_navi_file ( file, (Package)parent.parent, m ); + } + else { + file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, parent, m ); + this.write_top_elements ( file, parent, m ); - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, m ); - else if ( m.parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, m ); - else if ( m.parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, m ); - else if ( m.parent is Enum ) - this.write_navi_enum_inline ( file, (Enum)parent, m ); - else if ( m.parent is ErrorDomain ) - this.write_navi_error_domain_inline ( file, (ErrorDomain)parent, m ); - else if ( m.parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, m ); + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, m ); + else if ( m.parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, m ); + else if ( m.parent is Struct ) + this.write_navi_struct_inline ( file, (Struct)parent, m ); + else if ( m.parent is Enum ) + this.write_navi_enum_inline ( file, (Enum)parent, m ); + else if ( m.parent is ErrorDomain ) + this.write_navi_error_domain_inline ( file, (ErrorDomain)parent, m ); + else if ( m.parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, m ); - file.puts ( "\t\t\t
    \n" ); + file.puts ( "\t\t\t
    \n" ); + } } protected void write_navi_property ( GLib.FileStream file, Property prop ) { @@ -872,53 +901,68 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { protected void write_navi_constant ( GLib.FileStream file, Constant c ) { Basic parent = c.parent; - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, parent, c ); + if ( parent.name == null ) { + this.write_navi_file ( file, (Package)parent.parent, c ); + } + else { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, parent, c ); - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, c ); - else if ( parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, c ); - else if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, c ); - //else if ( parent is Interface ) - // this.write_navi_interface_inline ( file, (Interface)parent, c ); + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, c ); + else if ( parent is Struct ) + this.write_navi_struct_inline ( file, (Struct)parent, c ); + else if ( parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, c ); + //else if ( parent is Interface ) + // this.write_navi_interface_inline ( file, (Interface)parent, c ); - file.puts ( "\t\t\t
    \n" ); + file.puts ( "\t\t\t
    \n" ); + } } protected void write_navi_field ( GLib.FileStream file, Field f ) { Basic parent = f.parent; - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, parent, f ); + if ( parent.name == null ) { + this.write_navi_file ( file, (Package)parent.parent, f ); + } + else { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, parent, f ); - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, f ); - else if ( parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, f ); - else if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, f ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, f ); + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, f ); + else if ( parent is Struct ) + this.write_navi_struct_inline ( file, (Struct)parent, f ); + else if ( parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, f ); + else if ( parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, f ); - file.puts ( "\t\t\t
    \n" ); + file.puts ( "\t\t\t
    \n" ); + } } protected void write_navi_delegate ( GLib.FileStream file, Delegate del ) { Basic parent = del.parent; - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, parent, del ); + if ( parent.name == null ) { + this.write_navi_file ( file, (Package)parent.parent, del ); + } + else { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, parent, del ); - if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, del ); - else if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, del ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, del ); + if ( parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, del ); + else if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, del ); + else if ( parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, del ); - file.puts ( "\t\t\t
    \n" ); + file.puts ( "\t\t\t
    \n" ); + } } protected void write_navi_child_methods_collection ( GLib.FileStream file, Gee.Collection methods, Basic mself ) { @@ -1248,6 +1292,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); this.write_child_enum_values ( file, en ); + this.write_child_static_methods ( file, en ); this.write_child_methods ( file, en ); file.puts ( "\t\t\t\n" ); } @@ -1273,10 +1318,36 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { protected void write_child_methods ( GLib.FileStream file, MethodHandler mh ) { Gee.ReadOnlyCollection methods = mh.get_method_list (); - if ( methods.size > 0 ) { + + Gee.ArrayList imethods = new Gee.ArrayList ( ); + foreach ( Method m in methods ) { + if ( !m.is_static ) + imethods.add ( m ); + } + + if ( imethods.size > 0 ) { file.printf ( "

    Methods:

    \n", css_title ); file.printf ( "
      \n", css_inline_navigation ); - foreach ( Method m in methods ) { + foreach ( Method m in imethods ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m, mh), m.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_static_methods ( GLib.FileStream file, MethodHandler mh ) { + Gee.ReadOnlyCollection methods = mh.get_method_list (); + + Gee.ArrayList static_methods = new Gee.ArrayList ( ); + foreach ( Method m in methods ) { + if ( m.is_static ) + static_methods.add ( m ); + } + + if ( static_methods.size > 0 ) { + file.printf ( "

    Static Methods:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Method m in static_methods ) { file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m, mh), m.name ); } file.puts ( "
    \n" ); @@ -1300,6 +1371,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { } file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); this.write_child_construction_methods ( file, cl ); + this.write_child_static_methods ( file, cl ); this.write_child_classes ( file, cl ); this.write_child_structs ( file, cl ); this.write_child_enums ( file, cl ); @@ -1328,6 +1400,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { this.write_package_note ( file, iface ); } file.printf ( "\t\t\t\t

    Content:

    \n", css_title ); + this.write_child_static_methods ( file, iface ); this.write_child_classes ( file, iface ); this.write_child_structs ( file, iface ); this.write_child_delegates ( file, iface ); @@ -1351,6 +1424,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { } file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); this.write_child_error_values ( file, errdom ); + this.write_child_static_methods ( file, errdom ); this.write_child_methods ( file, errdom ); file.puts ( "\t\t\t\n" ); } @@ -1372,6 +1446,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { this.langlet.write_struct ( stru, file ); file.printf ( "\n\t\t\t\t\n" ); this.write_child_construction_methods ( file, stru ); + this.write_child_static_methods ( file, stru ); this.write_child_methods ( file, stru ); this.write_child_fields ( file, stru ); this.write_child_constants ( file, stru ); @@ -1536,7 +1611,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { } - protected void write_file_header ( GLib.FileStream file, string css, string title ) { + protected void write_file_header ( GLib.FileStream file, string css, string? title ) { file.puts ( "\n" ); file.puts ( "\t\n" ); file.puts ( "\t\tVala Binding Reference\n" ); @@ -1545,7 +1620,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { file.puts ( "\t\n\n" ); file.printf ( "\t
    \n", css_site_header ); - file.printf ( "\t\t%s Reference Manual\n", title ); + file.printf ( "\t\t%s Reference Manual\n", (title == null)? "" : title ); file.puts ( "\t
    \n\n" ); file.printf ( "\t\t
    \n", css_style_body );