valadoc r19 - in trunk/src: doclets/devhelp/deps doclets/devhelp/doclet doclets/devhelp/linkhelper doclets/html/doclet doclets/html/linkhelper doclets/htmlhelpers doclets/valadoc.org/doclet libvaladoc valadoc



Author: flobrosch
Date: Sun Nov 16 02:52:23 2008
New Revision: 19
URL: http://svn.gnome.org/viewvc/valadoc?rev=19&view=rev

Log:

Bugfixes:
 - property types

html-doclet, valadoc.org-doclet, devhelp-doclet:
 - new main page




Modified:
   trunk/src/doclets/devhelp/deps/style.css
   trunk/src/doclets/devhelp/doclet/template.vala
   trunk/src/doclets/devhelp/linkhelper/helper.vala
   trunk/src/doclets/html/doclet/template.vala
   trunk/src/doclets/html/linkhelper/helper.vala
   trunk/src/doclets/htmlhelpers/htmlhelpers.vala
   trunk/src/doclets/valadoc.org/doclet/template.vala
   trunk/src/libvaladoc/doctree.vala
   trunk/src/libvaladoc/drawer.vala
   trunk/src/valadoc/valadoc.vala

Modified: trunk/src/doclets/devhelp/deps/style.css
==============================================================================
--- trunk/src/doclets/devhelp/deps/style.css	(original)
+++ trunk/src/doclets/devhelp/deps/style.css	Sun Nov 16 02:52:23 2008
@@ -388,7 +388,7 @@
 .navi_method, .main_inline_navigation_method {
 	list-style-image: url(method.png)
 }
-.navi_struct, .main_list_stru {
+.navi_struct, .main_list_stru, .main_inline_navigation_struct {
 	list-style-image: url(struct.png)
 }
 .navi_iface, .main_navigation_interface, .main_list_iface {

Modified: trunk/src/doclets/devhelp/doclet/template.vala
==============================================================================
--- trunk/src/doclets/devhelp/doclet/template.vala	(original)
+++ trunk/src/doclets/devhelp/doclet/template.vala	Sun Nov 16 02:52:23 2008
@@ -150,7 +150,7 @@
 	private string package_dir_name = "";
 	private DevhelpFormat devhelp;
 
-	protected override string get_link ( Valadoc.Basic p1, Valadoc.Basic p2 ) {
+	protected override string get_link ( Valadoc.Basic p1, Valadoc.Basic? p2 ) {
 		return this.get_html_link ( this.settings, p1, p2 );		
 	}
 
@@ -202,6 +202,7 @@
 
 		GLib.FileStream ifile = GLib.FileStream.open ( path + "index.htm", "w" );
 		this.write_file_header ( ifile, "style.css", pkg_name );
+		this.write_file_content ( ifile, file, file );
 		this.write_file_footer ( ifile );
 		ifile = null;
 
@@ -216,7 +217,7 @@
 
 		GLib.FileStream file = GLib.FileStream.open ( rpath, "w" );
 		this.write_file_header ( file, "style.css", ns.full_name() );
-		this.write_namespace_content ( file, ns );
+		this.write_namespace_content ( file, ns, ns );
 		this.write_file_footer ( file );
 		file = null;
 
@@ -263,7 +264,7 @@
 
 		GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
 		this.write_file_header ( file, "style.css", iface.full_name() );
-		this.write_interface_content ( file, iface );
+		this.write_interface_content ( file, iface, iface );
 		this.write_file_footer ( file );
 		file = null;
 	}
@@ -292,7 +293,7 @@
 
 		GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
 		this.write_file_header ( file, "style.css", cl.full_name() );
-		this.write_class_content ( file, cl );
+		this.write_class_content ( file, cl, cl );
 		this.write_file_footer ( file );
 		file = null;
 	}
@@ -317,7 +318,7 @@
 		this.write_file_header ( file, "style.css", stru.full_name() );
 
 		// HIER CRASHT ES!!
-		this.write_struct_content ( file, stru );
+		this.write_struct_content ( file, stru, stru );
 		this.write_file_footer ( file );
 		file = null;
 	}
@@ -333,7 +334,7 @@
 
 		GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
 		this.write_file_header ( file, "style.css", errdom.full_name() );
-		this.write_error_domain_content ( file, errdom );
+		this.write_error_domain_content ( file, errdom, errdom );
 		this.write_file_footer ( file );
 		file = null;
 	}
@@ -350,7 +351,7 @@
 
 		GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
 		this.write_file_header ( file, "style.css", en.full_name() );
-		this.write_enum_content ( file, en );
+		this.write_enum_content ( file, en, en );
 		this.write_file_footer ( file );
 		file = null;
 	}

Modified: trunk/src/doclets/devhelp/linkhelper/helper.vala
==============================================================================
--- trunk/src/doclets/devhelp/linkhelper/helper.vala	(original)
+++ trunk/src/doclets/devhelp/linkhelper/helper.vala	Sun Nov 16 02:52:23 2008
@@ -26,12 +26,15 @@
 	protected string? get_html_link ( Settings settings, Basic element, Basic pos ) {
 		string tmp = "";
 		string prefix = "";
+
+		if ( element is Package ) {
+			return "../" + element.name + "/index.html";
+		}
 	
 		if ( element != pos ) {
 			prefix =  "../" + element.file.name;
 		}
 
-
 		if ( element is Valadoc.EnumValue || element is Valadoc.ErrorCode ) {
 			tmp = "#" + element.name;
 			element = element.parent;

Modified: trunk/src/doclets/html/doclet/template.vala
==============================================================================
--- trunk/src/doclets/html/doclet/template.vala	(original)
+++ trunk/src/doclets/html/doclet/template.vala	Sun Nov 16 02:52:23 2008
@@ -56,13 +56,17 @@
 		return css_path.str;
 	}
 
-	protected override string get_link ( Valadoc.Basic element, Valadoc.Basic pos ) {
+	protected override string get_link ( Valadoc.Basic element, Valadoc.Basic? pos ) {
 		return this.get_html_link ( this.settings, element, pos );
 	}
 
-	protected override void write_top_element ( GLib.FileStream file, Basic pos ) {
-		string top = get_html_top_link ( pos );
-		this.write_top_element_template ( file, top+"index.html" );
+	protected override void write_top_element ( GLib.FileStream file, Basic? pos ) {
+		string top = "";
+
+		if ( pos != null )
+			top = get_html_top_link ( pos ) ;
+
+		this.write_top_element_template ( file, top+"packages.html" );
 	}
 
 
@@ -105,10 +109,18 @@
 	}
 
 	protected override string get_img_real_path ( Basic element ) {
+		if ( element is Package ) {
+			return this.current_path + element.name + ".png";
+		}
+
 		return this.current_path + "tree.png";
 	}
 
 	protected override string get_img_path ( Basic element ) {
+		if ( element is Package ) {
+			return element.name + ".png";
+		}
+
 		return "tree.png";
 	}
 
@@ -118,19 +130,20 @@
 		this.is_vapi = file.is_external_package;
 		if ( this.is_vapi )
 			this.files.add ( file );
+		else
+			source_package = file;
 
-		string new_path = this.settings.path + this.package_name + "/";
-		bool dir_exists = FileUtils.test ( new_path, FileTest.EXISTS);
+		this.current_path = this.settings.path + this.package_name + "/";
 
-		var rt = DirUtils.create ( new_path, 0777 );
-		GLib.FileStream sfile = GLib.FileStream.open ( new_path + "index.html", "w" );
+		var rt = DirUtils.create ( this.current_path, 0777 );
+		GLib.FileStream sfile = GLib.FileStream.open ( this.current_path + "index.html", "w" );
 		this.write_file_header ( sfile, this.get_css_link ( ), file.name );
-		this.write_navi_file ( sfile, file );
-		this.write_file_content ( sfile, file );
+		this.write_navi_file ( sfile, file, file );
+		this.write_file_content ( sfile, file, file );
 		this.write_file_footer ( sfile );
 		sfile = null;
 
-		this.current_path = new_path;
+
 		file.visit_namespaces ( this );
 		this.current_path = null;
 	}
@@ -144,34 +157,31 @@
 		return true;
 	}
 
-	private Gee.ArrayList<Namespace> source_namespaces = new Gee.ArrayList<Namespace> ();
 	private Gee.ArrayList<Package> files = new Gee.ArrayList<Package> ();
+	private Package source_package;
 
 	public override void cleanups () {
 		this.directory_level = 0;
 		copy_directory ( Config.doclet_path + "deps/", this.settings.path );
 
-		GLib.FileStream sfile = GLib.FileStream.open ( this.settings.path + "index.html", "w" );
-		string title = ( this.settings.pkg_name == null )? "" : this.settings.pkg_name;
-		this.write_file_header ( sfile, this.get_css_link ( ), title );
 
-		if ( this.source_namespaces.size > 0 ) {
-			sfile.printf ( "<h2 class=\"%s\">Namespaces:</h2>\n", css_title );
-			sfile.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
-			foreach ( Namespace ns in this.source_namespaces ) {
-				string dir = (ns.name == null)? "0" : ns.name;
-				this.write_navi_entry_html_template_with_link ( sfile, css_inline_navigation_namespace, this.get_link(ns, null), (ns.name == null)? "Global Namespace" : ns.full_name () );
-			}		
-			sfile.puts ( "</ul>\n\n" );
+		if ( this.source_package != null ) {
+			GLib.FileStream sfile = GLib.FileStream.open ( this.settings.path + "index.html", "w" );
+			this.write_file_header ( sfile, this.get_css_link ( ), source_package.name );
+			this.write_navi_file ( sfile, source_package, null );
+			this.write_file_content ( sfile, source_package, null );
+			this.write_file_footer ( sfile );
+			sfile = null;
 		}
 
-		sfile.printf ( "<h2 class=\"%s\">Depencies:</h2>\n", css_title );
+		GLib.FileStream sfile = GLib.FileStream.open ( this.settings.path + "packages.html", "w" );
+		string title = ( this.settings.pkg_name == null )? "" : this.settings.pkg_name;
+		this.write_file_header ( sfile, this.get_css_link ( ), title );
+
+		sfile.printf ( "<h2 class=\"%s\">Packages:</h2>\n", css_title );
 		sfile.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 
 		foreach ( Package file in this.files ) {
-			if ( !this.is_depency ( file.name ) )
-				continue;
-
 			if ( this.settings.with_deps )
 				sfile.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s/index.html\">%s</a></li>\n", css_inline_navigation_package, css_navi_link, file.name, file.name );
 			else
@@ -273,10 +283,6 @@
 		string old_path = this.current_path;
 		this.directory_level++;
 
-		if ( !this.is_vapi )
-			this.source_namespaces.add ( ns );
-
-
 		if ( ns.name == null ) {
 			string tmp = this.current_path + "0/";
 			this.current_path = tmp;
@@ -290,7 +296,7 @@
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
 		this.write_file_header ( file, this.get_css_link ( ), ns.name );
 		this.write_navi_namespace ( file, ns );
-		this.write_namespace_content ( file, ns );
+		this.write_namespace_content ( file, ns, ns );
 		this.write_file_footer ( file );
 		file = null;
 
@@ -323,7 +329,7 @@
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
 		this.write_file_header ( file, this.get_css_link ( ), en.name );
 		this.write_navi_enum ( file, en, en );
-		this.write_enum_content ( file, en );
+		this.write_enum_content ( file, en, en );
 		this.write_file_footer ( file );
 		file = null;
 
@@ -343,7 +349,7 @@
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
 		this.write_file_header ( file, this.get_css_link ( ), errdom.name );
 		this.write_navi_error_domain ( file, errdom, errdom );
-		this.write_error_domain_content ( file, errdom );
+		this.write_error_domain_content ( file, errdom, errdom );
 		this.write_file_footer ( file );
 		file = null;
 
@@ -366,7 +372,7 @@
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
 		this.write_file_header ( file, this.get_css_link ( ), stru.name );
 		this.write_navi_struct ( file, stru, stru );
-		this.write_struct_content ( file, stru );
+		this.write_struct_content ( file, stru, stru );
 		this.write_file_footer ( file );
 		file = null;
 
@@ -395,7 +401,7 @@
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
 		this.write_file_header ( file, this.get_css_link ( ), cl.name );
 		this.write_navi_class ( file, cl, cl );
-		this.write_class_content ( file, cl );
+		this.write_class_content ( file, cl, cl );
 		this.write_file_footer ( file );
 		file = null;
 
@@ -421,7 +427,7 @@
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
 		this.write_file_header ( file, this.get_css_link ( ), iface.name );
 		this.write_navi_interface ( file, iface, iface );
-		this.write_interface_content ( file, iface );
+		this.write_interface_content ( file, iface, iface );
 		this.write_file_footer ( file );
 		file = null;
 

Modified: trunk/src/doclets/html/linkhelper/helper.vala
==============================================================================
--- trunk/src/doclets/html/linkhelper/helper.vala	(original)
+++ trunk/src/doclets/html/linkhelper/helper.vala	Sun Nov 16 02:52:23 2008
@@ -23,10 +23,7 @@
 
 
 public interface Valadoc.LinkHelper {
-	protected string get_html_top_link ( Valadoc.Basic? postag ) {
-		if ( postag == null )
-			return "";
-
+	protected string get_html_top_link ( Valadoc.Basic postag ) {
 		GLib.StringBuilder str = new GLib.StringBuilder ( "" );
 		Valadoc.Basic pos = postag;
 

Modified: trunk/src/doclets/htmlhelpers/htmlhelpers.vala
==============================================================================
--- trunk/src/doclets/htmlhelpers/htmlhelpers.vala	(original)
+++ trunk/src/doclets/htmlhelpers/htmlhelpers.vala	Sun Nov 16 02:52:23 2008
@@ -764,7 +764,7 @@
 public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
 	protected Valadoc.Langlet langlet;
 
-	protected abstract string get_link ( Valadoc.Basic p1, Valadoc.Basic p2 );
+	protected abstract string get_link ( Valadoc.Basic p1, Valadoc.Basic? p2 );
 
 
 	// Navi:
@@ -826,7 +826,7 @@
 
 		file.printf ( "<ul class=\"%s\">\n", css_navi );
 
-		if ( element == mself )
+		if ( element == mself || mself == null )
 			this.write_navi_entry ( file, element, mself, style, false );
 		else
 			this.write_navi_entry ( file, element, mself, style, true );
@@ -839,18 +839,16 @@
 		file.printf ( "<ul class=\"%s\">\n\t\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">Packages</a></li>\n</ul>\n<hr class=\"%s\">\n", css_navi, css_navi_package_index, css_navi_link, link, css_navi_hr );
 	}
 
-	protected virtual void write_top_element ( GLib.FileStream file, Basic pos ) {
+	//FIXME: Basic pos => 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<Basic> lst = new Gee.ArrayList<Basic> ();
 		Basic pos = element;
 
-		if ( mself == null )
-			mself = element;
-
-//		else if ( mself.name == null )
-//			mself = mself.parent;
+//		if ( mself == null )
+//			mself = element;
 
 		string package_name = element.file.name;
 
@@ -863,7 +861,10 @@
 
 		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 );
+			}
 		}
 	}
 
@@ -876,7 +877,7 @@
 		}
 	}
 
-	protected void write_navi_file ( GLib.FileStream file, Package efile, Basic? pos = null ) {
+	protected void write_navi_file ( GLib.FileStream file, Package efile, Basic pos ) {
 		Gee.ArrayList<Namespace> ns_list = new Gee.ArrayList<Namespace> ();
 		this.fetch_subnamespace_names (efile, ns_list );
 
@@ -885,6 +886,8 @@
 
 
 		if ( pos == null )
+			this.write_top_elements ( file, efile, null );
+		else if ( pos == efile )
 			this.write_top_elements ( file, efile, efile );
 		else
 			this.write_top_elements ( file, pos.parent.parent, pos );
@@ -898,11 +901,11 @@
 			if ( ns.name == null )
 				globals = ns;
 			else
-				this.write_navi_entry ( file, ns, (pos == null)? efile : pos, css_navi_namespace, true, true );
+				this.write_navi_entry ( file, ns, pos, css_navi_namespace, true, true );
 		}
 
 		if ( globals != null ) {
-			this.write_navi_child_namespaces_inline_withouth_block ( file, globals, (pos == null)? efile : pos );
+			this.write_navi_child_namespaces_inline_withouth_block ( file, globals, pos );
 		}
 
 		file.puts ( "\t\t\t\t</ul>\n" );
@@ -917,8 +920,8 @@
 		this.write_navi_child_enums_without_childs ( file, ns, mself );
 		this.write_navi_child_error_domains_without_childs ( file, ns, mself );
 		this.write_navi_child_delegates ( file, ns, mself );
-		this.write_navi_child_static_methods ( file, ns, mself );
-		this.write_navi_child_methods ( file, ns, mself ); // remove
+		this.write_navi_child_static_methods ( file, ns, mself ); // remove
+		this.write_navi_child_methods ( file, ns, mself );
 		this.write_navi_child_fields ( file, ns, mself );
 		this.write_navi_child_constants ( file, ns, mself );
 	}
@@ -931,6 +934,7 @@
 		}
 
 		this.write_navi_child_namespaces_inline_withouth_block ( file, ns, mself );
+
 		file.puts ( "</ul>\n" );
 	}
 
@@ -1531,7 +1535,7 @@
 		file.puts ( "\t\t\t</div>\n" );
 	}
 
-	public void write_enum_content ( GLib.FileStream file, Enum en ) {
+	public void write_enum_content ( GLib.FileStream file, Enum en, Basic? mself ) {
 		string full_name = en.full_name ( );
 		file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
 		file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
@@ -1547,8 +1551,8 @@
 
 		file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
 		this.write_child_enum_values ( file, en );
-		this.write_child_static_methods ( file, en );
-		this.write_child_methods ( file, en );
+		this.write_child_static_methods ( file, en, mself );
+		this.write_child_methods ( file, en, mself );
 		file.puts ( "\t\t\t</div>\n" );
 	}
 
@@ -1571,21 +1575,42 @@
 		}
 	}
 
-	protected void write_child_namespaces ( GLib.FileStream file, NamespaceHandler nh, Basic? mself = null ) {
-		Gee.ReadOnlyCollection<Namespace> nsl = nh.get_namespace_list ();
-		if ( nsl.size > 0 ) {
-			file.printf ( "<h3 class=\"%s\">Namespaces:</h3>\n", css_title );
-			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
-			foreach ( Namespace ns in nsl ) {
-				if ( ns.name != null ) {
-					file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_namespace, css_navi_link, this.get_link(ns, (mself == null)? nh : mself), ns.name );
+	protected void write_child_namespaces ( GLib.FileStream file, NamespaceHandler nh, Basic? mself ) {
+		Gee.ArrayList<Namespace> nsl = new Gee.ArrayList<Namespace> ();
+		this.fetch_subnamespace_names ( nh, nsl );
+
+		if ( nsl.size == 0 )
+			return ;
+
+		if ( nsl.size == 1 ) {
+			if ( nsl.get(0).name == null )
+				return ;
+		}
+
+		bool with_childs = (mself == null)? false : mself is Package;
+
+		file.printf ( "<h3 class=\"%s\">Namespaces:</h3>\n", css_title );
+		file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+		foreach ( Namespace ns in nsl ) {
+			if ( ns.name != null ) {
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_namespace, css_navi_link, this.get_link(ns, mself), ns.name );
+				if ( with_childs == true ) {
+					this.write_child_classes ( file, ns, mself );
+					this.write_child_interfaces ( file, ns, mself );
+					this.write_child_structs ( file, ns, mself );
+					this.write_child_enums ( file, ns, mself );
+					this.write_child_errordomains ( file, ns, mself );
+					this.write_child_delegates ( file, ns, mself );
+					this.write_child_methods ( file, ns, mself );
+					this.write_child_fields ( file, ns, mself );
+					this.write_child_constants ( file, ns, mself );
 				}
 			}
-			file.puts ( "</ul>\n" );
 		}
+		file.puts ( "</ul>\n" );
 	}
 
-	protected void write_child_methods ( GLib.FileStream file, MethodHandler mh, Basic? mself = null ) {
+	protected void write_child_methods ( GLib.FileStream file, MethodHandler mh, Basic? mself ) {
 		Gee.ReadOnlyCollection<Method> methods = mh.get_method_list ();
 
 		Gee.ArrayList<Method> imethods = new Gee.ArrayList<Method> ( );
@@ -1598,13 +1623,37 @@
 			file.printf ( "<h3 class=\"%s\">Methods:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Method m in imethods ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, (mself == null)? mh : mself), m.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_static_methods ( GLib.FileStream file, MethodHandler mh ) {
+	protected void write_child_dependencies ( GLib.FileStream file, Package package, Basic? mself ) {
+		Gee.ReadOnlyCollection<Package> deps = package.get_full_dependency_list ();
+		if ( deps.size == 0 )
+			return ;
+
+		file.printf ( "<h2 class=\"%s\">Dependencies:</h2>\n", css_title );
+
+		/*
+		string realimgpath = this.get_img_real_path ( package );
+		string imgpath = this.get_img_path ( package );
+
+		Diagrams.write_dependency_diagram ( package, realimgpath );
+
+		/ / image
+		file.printf ( "<img cass=\"%s\" src=\"%s\"/>\n", css_diagram, imgpath );
+		*/
+
+		file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+		foreach ( Package p in deps ) {
+			file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_package, css_navi_link, this.get_link(p, mself), p.name );
+		}
+		file.puts ( "</ul>\n" );
+	}
+
+	protected void write_child_static_methods ( GLib.FileStream file, MethodHandler mh, Basic? mself ) {
 		Gee.ReadOnlyCollection<Method> methods = mh.get_method_list ();
 
 		Gee.ArrayList<Method> static_methods = new Gee.ArrayList<Method> ( );
@@ -1617,13 +1666,13 @@
 			file.printf ( "<h3 class=\"%s\">Static Methods:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Method m in static_methods ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mh), m.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	public void write_class_content ( GLib.FileStream file, Class cl ) {
+	public void write_class_content ( GLib.FileStream file, Class cl, Basic? mself ) {
 		string full_name = cl.full_name ( );
 		file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
 		file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
@@ -1640,21 +1689,21 @@
 			this.write_package_note ( file, cl );
 		}
 		file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\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 );
-		this.write_child_delegates ( file, cl );
-		this.write_child_methods ( file, cl );
-		this.write_child_signals ( file, cl );
-		this.write_child_properties ( file, cl );
-		this.write_child_fields ( file, cl );
-		this.write_child_constants ( file, cl );
+		this.write_child_construction_methods ( file, cl, mself );
+		this.write_child_static_methods ( file, cl, mself );
+		this.write_child_classes ( file, cl, mself );
+		this.write_child_structs ( file, cl, mself );
+		this.write_child_enums ( file, cl, mself );
+		this.write_child_delegates ( file, cl, mself );
+		this.write_child_methods ( file, cl, mself );
+		this.write_child_signals ( file, cl, mself );
+		this.write_child_properties ( file, cl, mself );
+		this.write_child_fields ( file, cl, mself );
+		this.write_child_constants ( file, cl, mself );
 		file.puts ( "\t\t\t</div>\n" );
 	}
 
-	public void write_interface_content ( GLib.FileStream file, Interface iface ) {
+	public void write_interface_content ( GLib.FileStream file, Interface iface, Basic? mself ) {
 		string full_name = iface.full_name ();
 		file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
 		file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
@@ -1671,18 +1720,18 @@
 			this.write_package_note ( file, iface );
 		}
 		file.printf ( "\t\t\t\t<h2 class=\"%s\">Content:</h2>\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 );
-		this.write_child_methods ( file, iface );
-		this.write_child_signals ( file, iface );
-		this.write_child_properties ( file, iface );
-		this.write_child_fields ( file, iface );
+		this.write_child_static_methods ( file, iface, mself );
+		this.write_child_classes ( file, iface, mself );
+		this.write_child_structs ( file, iface, mself );
+		this.write_child_delegates ( file, iface, mself );
+		this.write_child_methods ( file, iface, mself );
+		this.write_child_signals ( file, iface, mself );
+		this.write_child_properties ( file, iface, mself );
+		this.write_child_fields ( file, iface, mself );
 		file.puts ( "\t\t\t</div>\n" );
 	}
 
-	public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom ) {
+	public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom, Basic? mself ) {
 		string full_name = errdom.full_name ( );
 		file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
 		file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
@@ -1696,12 +1745,12 @@
 		}
 		file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
 		this.write_child_error_values ( file, errdom );
-		this.write_child_static_methods ( file, errdom );
-		this.write_child_methods ( file, errdom );
+		this.write_child_static_methods ( file, errdom, mself );
+		this.write_child_methods ( file, errdom, mself );
 		file.puts ( "\t\t\t</div>\n" );
 	}
 
-	public void write_struct_content ( GLib.FileStream file, Struct stru ) {
+	public void write_struct_content ( GLib.FileStream file, Struct stru, Basic? mself ) {
 		string full_name = stru.full_name ( );
 		file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
 		file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
@@ -1720,11 +1769,11 @@
 			this.write_package_note ( file, stru );
 		}
 		file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
-		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 );
+		this.write_child_construction_methods ( file, stru, mself );
+		this.write_child_static_methods ( file, stru, mself );
+		this.write_child_methods ( file, stru, mself );
+		this.write_child_fields ( file, stru, mself );
+		this.write_child_constants ( file, stru, mself );
 		file.puts ( "\t\t\t</div>\n" );
 	}
 
@@ -1734,49 +1783,49 @@
 	protected abstract string get_img_path ( Basic element );
 
 
-	protected void write_child_constants ( GLib.FileStream file, ConstantHandler ch, Basic? mself = null ) {
+	protected void write_child_constants ( GLib.FileStream file, ConstantHandler ch, Basic? mself ) {
 		Gee.ReadOnlyCollection<Constant> constants = ch.get_constant_list ();
 		if ( constants.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Constants:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Constant c in constants ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (c), css_navi_link, this.get_link(c, (mself == null)? ch : mself), c.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (c), css_navi_link, this.get_link(c, mself), c.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_enums ( GLib.FileStream file, EnumHandler eh, Basic? mself = null ) {
+	protected void write_child_enums ( GLib.FileStream file, EnumHandler eh, Basic? mself ) {
 		Gee.Collection<Enum> enums = eh.get_enum_list ();
 		if ( enums.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Enums:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Enum en in enums ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (en), css_navi_link, this.get_link(en, (mself == null)? eh : mself), en.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (en), css_navi_link, this.get_link(en, mself), en.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_errordomains ( GLib.FileStream file, ErrorDomainHandler eh, Basic? mself = null ) {
+	protected void write_child_errordomains ( GLib.FileStream file, ErrorDomainHandler eh, Basic? mself ) {
 		Gee.Collection<ErrorDomain> errdoms = eh.get_error_domain_list ();
 		if ( errdoms.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Errordomains:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( ErrorDomain err in errdoms ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (err), css_navi_link,  this.get_link(err, (mself == null)? eh : mself), err.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (err), css_navi_link,  this.get_link(err, mself), err.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh ) {
+	protected void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh, Basic? mself ) {
 		Gee.ReadOnlyCollection<Method> methods = cmh.get_construction_method_list ();
 		if ( methods.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Construction Methods:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Method m in methods ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, cmh), m.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
@@ -1800,43 +1849,43 @@
 		file.printf ( "<img cass=\"%s\" src=\"%s\"/>\n", css_diagram, imgpath );
 	}
 
-	protected void write_child_fields ( GLib.FileStream file, FieldHandler fh, Basic? mself = null ) {
+	protected void write_child_fields ( GLib.FileStream file, FieldHandler fh, Basic? mself ) {
 		Gee.ReadOnlyCollection<Field> fields = fh.get_field_list ();
 		if ( fields.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Fields:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Field f in fields ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class(f), css_navi_link, this.get_link(f, (mself == null)? fh : mself), f.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class(f), css_navi_link, this.get_link(f, mself), f.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_properties ( GLib.FileStream file, PropertyHandler ph ) {
+	protected void write_child_properties ( GLib.FileStream file, PropertyHandler ph, Basic? mself ) {
 		Gee.ReadOnlyCollection<Property> properties = ph.get_property_list ();
 		if ( properties.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Properties:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Property prop in properties ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (prop), css_navi_link, this.get_link(prop, ph), prop.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (prop), css_navi_link, this.get_link(prop, mself), prop.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_signals ( GLib.FileStream file, SignalHandler sh ) {
+	protected void write_child_signals ( GLib.FileStream file, SignalHandler sh, Basic? mself ) {
 		Gee.ReadOnlyCollection<Signal> signals = sh.get_signal_list ();
 		if ( signals.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Signals:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Signal sig in signals ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (sig), css_navi_link, this.get_link(sig, sh), sig.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (sig), css_navi_link, this.get_link(sig, mself), sig.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_classes ( GLib.FileStream file, ClassHandler clh, Basic? mself = null ) {
+	protected void write_child_classes ( GLib.FileStream file, ClassHandler clh, Basic? mself ) {
 		Gee.ReadOnlyCollection<Class> classes = clh.get_class_list ();
 		if ( classes.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Classes:</h3>\n", css_title );
@@ -1850,49 +1899,49 @@
 					name = subcl.name;
 				}
 
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (subcl), css_navi_link, this.get_link(subcl, (mself == null)? clh : mself), name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (subcl), css_navi_link, this.get_link(subcl, mself ), name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_interfaces ( GLib.FileStream file, InterfaceHandler ih, Basic? mself = null ) {
+	protected void write_child_interfaces ( GLib.FileStream file, InterfaceHandler ih, Basic? mself ) {
 		Gee.Collection<Interface> ifaces = ih.get_interface_list ( );
 		if ( ifaces.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Interfaces:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Interface iface in ifaces ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (iface), css_navi_link, this.get_link(iface, (mself == null)? ih : mself), iface.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (iface), css_navi_link, this.get_link(iface, mself), iface.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_delegates ( GLib.FileStream file, DelegateHandler dh, Basic? mself = null ) {
+	protected void write_child_delegates ( GLib.FileStream file, DelegateHandler dh, Basic? mself ) {
 		Gee.Collection<Delegate> delegates = dh.get_delegate_list ();
 		if ( delegates.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Delegates:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Delegate d in delegates ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (d), css_navi_link, this.get_link(d, (mself == null)? dh : mself), d.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (d), css_navi_link, this.get_link(d, mself), d.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	protected void write_child_structs ( GLib.FileStream file, StructHandler struh, Basic? mself = null ) {
+	protected void write_child_structs ( GLib.FileStream file, StructHandler struh, Basic? mself ) {
 		Gee.Collection<Struct> structs = struh.get_struct_list ();
 		if ( structs.size > 0 ) {
 			file.printf ( "<h3 class=\"%s\">Structs:</h3>\n", css_title );
 			file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 			foreach ( Struct stru in structs ) {
-				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class ( stru ), css_navi_link, this.get_link(stru, (mself == null)? struh : mself), stru.name );
+				file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class ( stru ), css_navi_link, this.get_link(stru, mself), stru.name );
 			}
 			file.puts ( "</ul>\n" );
 		}
 	}
 
-	public void write_namespace_content ( GLib.FileStream file, Namespace ns ) {
+	public void write_namespace_content ( GLib.FileStream file, Namespace ns, Basic? mself ) {
 		file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
 		file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name () );
 		file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_hr );
@@ -1901,23 +1950,23 @@
 
 		file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
 		if ( ns.name == null )
-			this.write_child_namespaces ( file, (Package)ns.parent, ns );
+			this.write_child_namespaces ( file, (Package)ns.parent, mself );
 		else
-			this.write_child_namespaces ( file, ns );
+			this.write_child_namespaces ( file, ns, mself );
 
-		this.write_child_classes ( file, ns );
-		this.write_child_interfaces ( file, ns );
-		this.write_child_structs ( file, ns );
-		this.write_child_enums ( file, ns );
-		this.write_child_errordomains ( file, ns );
-		this.write_child_delegates ( file, ns );
-		this.write_child_methods ( file, ns );
-		this.write_child_fields ( file, ns );
-		this.write_child_constants ( file, ns );
+		this.write_child_classes ( file, ns, mself );
+		this.write_child_interfaces ( file, ns, mself );
+		this.write_child_structs ( file, ns, mself );
+		this.write_child_enums ( file, ns, mself );
+		this.write_child_errordomains ( file, ns, mself );
+		this.write_child_delegates ( file, ns, mself );
+		this.write_child_methods ( file, ns, mself );
+		this.write_child_fields ( file, ns, mself );
+		this.write_child_constants ( file, ns, mself );
 		file.puts ( "\t\t\t</div>\n" );
 	}
 
-	protected void write_file_content ( GLib.FileStream file, Package f ) {
+	protected void write_file_content ( GLib.FileStream file, Package f, Basic? mself ) {
 		file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
 		file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, f.name );
 		file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
@@ -1925,21 +1974,23 @@
 
 		file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
 
-		this.write_child_namespaces ( file, f );
+		this.write_child_namespaces ( file, f, mself );
 
 		foreach ( Namespace ns in f.get_namespace_list() ) {
 			if ( ns.name == null ) {
-				this.write_child_classes ( file, ns, f );
-				this.write_child_interfaces ( file, ns, f );
-				this.write_child_structs ( file, ns, f );
-				this.write_child_enums ( file, ns, f );
-				this.write_child_errordomains ( file, ns, f );
-				this.write_child_delegates ( file, ns, f );
-				this.write_child_methods ( file, ns, f );
-				this.write_child_fields ( file, ns, f );
-				this.write_child_constants ( file, ns, f );
+				this.write_child_classes ( file, ns, mself );
+				this.write_child_interfaces ( file, ns, mself );
+				this.write_child_structs ( file, ns, mself );
+				this.write_child_enums ( file, ns, mself );
+				this.write_child_errordomains ( file, ns, mself );
+				this.write_child_delegates ( file, ns, mself );
+				this.write_child_methods ( file, ns, mself );
+				this.write_child_fields ( file, ns, mself );
+				this.write_child_constants ( file, ns, mself );
 			}
 		}
+
+		this.write_child_dependencies ( file, f, mself );
 		file.puts ( "\t\t\t</div>\n" );
 	}
 

Modified: trunk/src/doclets/valadoc.org/doclet/template.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/doclet/template.vala	(original)
+++ trunk/src/doclets/valadoc.org/doclet/template.vala	Sun Nov 16 02:52:23 2008
@@ -46,11 +46,11 @@
 	private string current_path = null;
 	private bool is_vapi = false;
 
-	protected override string get_link ( Valadoc.Basic p1, Valadoc.Basic p2 ) {
+	protected override string get_link ( Valadoc.Basic p1, Valadoc.Basic? p2 ) {
 		return this.get_html_link ( this.settings, p1 );
 	}
 
-	private override void write_top_element ( GLib.FileStream file, Basic pos ) {
+	private override void write_top_element ( GLib.FileStream file, Basic? pos ) {
 		this.write_top_element_template ( file, "?" );
 	}
 
@@ -112,7 +112,13 @@
 		var rt = DirUtils.create ( new_path, 0777 );
 
 		GLib.FileStream nav = GLib.FileStream.open ( new_path + "navi.html", "w" );
-		this.write_navi_file ( nav, file );
+		this.write_navi_file ( nav, file, file );
+		nav = null;
+
+		GLib.FileStream sfile = GLib.FileStream.open ( new_path + "index.html", "w" );
+		this.write_file_content ( sfile, file, file );
+		sfile = null;
+
 
 		this.current_path = new_path;
 		file.visit_namespaces ( this );
@@ -138,7 +144,7 @@
 		navi = null;
 
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
-		this.write_namespace_content ( file, ns );
+		this.write_namespace_content ( file, ns, ns );
 		file = null;
 
 		// file:
@@ -178,7 +184,7 @@
 		navi = null;
 
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
-		this.write_interface_content ( file, iface );
+		this.write_interface_content ( file, iface, iface );
 		file = null;
 
 		this.current_path = old_path;
@@ -209,7 +215,7 @@
 		cname = null;
 
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
-		this.write_class_content ( file, cl );
+		this.write_class_content ( file, cl, cl );
 		file = null;
 
 		this.current_path = old_path;
@@ -229,12 +235,15 @@
 		this.write_navi_struct ( navi, stru, stru );
 		navi = null;
 
+		// FIXME: libbonoboui-2.0
 		GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" );
-		cname.puts ( stru.get_cname() );
-		cname = null;
+		if ( cname != null ) {
+			cname.puts ( stru.get_cname() );
+			cname = null;
+		}
 
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
-		this.write_struct_content ( file, stru );
+		this.write_struct_content ( file, stru, stru );
 		file = null;
 
 		this.current_path = old_path;
@@ -256,7 +265,7 @@
 		navi = null;
 
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
-		this.write_error_domain_content ( file, errdom );
+		this.write_error_domain_content ( file, errdom, errdom );
 		file = null;
 
 		this.current_path = old_path;
@@ -279,7 +288,7 @@
 		navi = null;
 
 		GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
-		this.write_enum_content ( file, en );
+		this.write_enum_content ( file, en, en );
 		file = null;
 
 		this.current_path = old_path;

Modified: trunk/src/libvaladoc/doctree.vala
==============================================================================
--- trunk/src/libvaladoc/doctree.vala	(original)
+++ trunk/src/libvaladoc/doctree.vala	Sun Nov 16 02:52:23 2008
@@ -1816,7 +1816,7 @@
 			if ( node == null )
 				return false;
 
-			if ( node is Vala.Constant )
+			if ( node is Vala.Constant || node is Vala.Property )
 				return false;
 
 			if ( node is Vala.FormalParameter ) {
@@ -4238,7 +4238,7 @@
 	}
 }
 
-// rename to Package
+
 public class Valadoc.Package : Basic, NamespaceHandler {
 	public Gee.ArrayList<Namespace> namespaces {
 		default = new Gee.ArrayList<Namespace>();
@@ -4251,6 +4251,60 @@
 		 get;
 	}
 
+	// internal
+	public void set_dependency_list ( Gee.ArrayList<Package> list ) {
+		this._dependencies = list;
+	}
+
+	private Gee.ArrayList<Package> _dependencies;
+
+	// internal remove
+	public bool is_dependency ( Package dep ) {
+		if ( dep == this )
+			return false;
+
+		foreach ( Package pkg in this._dependencies ) {
+			if ( pkg == dep ) {
+				return true;
+			}
+
+			bool tmp = pkg.is_dependency ( dep );
+			if ( tmp == true ) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public Gee.ReadOnlyCollection<Package> get_full_dependency_list () {
+		Gee.ArrayList<Package> list = new Gee.ArrayList<Package> ();
+
+		if ( this._dependencies == null )
+			return new Gee.ReadOnlyCollection<Package> ( list );
+
+		foreach ( Package pkg in this._dependencies ) {
+			if ( list.contains ( pkg ) == false ) {
+				list.add ( pkg );
+			}
+
+			var pkg_list = pkg.get_full_dependency_list ();
+			foreach ( Package pkg2 in pkg_list ) {
+				if ( list.contains ( pkg2 ) == false ) {
+					list.add ( pkg2 );
+				}
+			}
+		}
+		return new Gee.ReadOnlyCollection<Package> ( list );
+	}
+
+	public Gee.ReadOnlyCollection<Package> get_dependency_list () {
+		if ( this._dependencies == null ) {
+			return new Gee.ReadOnlyCollection<Package> ( new Gee.ArrayList<Package> () );
+		}
+
+		return new Gee.ReadOnlyCollection<Package> ( this._dependencies );
+	}
+
 	private string extract_package_name ( Vala.SourceFile vfile ) {
 		if ( vfile.filename.has_suffix (".vapi") ) {
 			string file_name = GLib.Path.get_basename (vfile.filename);
@@ -4366,6 +4420,7 @@
 		}
 	}
 
+
 	private weak Basic?  search_symbol_in_namespace ( Basic element, string[] params ) {
 		return this.search_symbol_in_symbol ( element.nspace, params );
 	}
@@ -4556,6 +4611,7 @@
 		this.context.accept( this );
 		this.set_type_references ( );
 		this.inheritance ( ); // remove
+		this.add_dependencies ();
 	}
 
 	// internal
@@ -4613,13 +4669,74 @@
 		return file.search_element_vala ( params, 0 );
 	}
 
+	private Gee.ArrayList<Package>? load_dependency_list ( string vapi_path ) {
+		if ( vapi_path.has_suffix ( ".vapi" ) ) {
+			string deps_filename = vapi_path.ndup ( vapi_path.size() - ".vapi".size() ) + ".deps";
+			Gee.ArrayList<Package> list = new Gee.ArrayList<Package> ();
+
+			if (FileUtils.test (deps_filename, FileTest.EXISTS)) {
+				try {
+					string deps_content;
+					ulong deps_len;
+
+					FileUtils.get_contents (deps_filename, out deps_content, out deps_len);
+					foreach (string dep in deps_content.split ("\n")) {
+						if (dep != "") {
+							foreach ( Package pkg in this.files ) {
+								if ( pkg.name == dep ) {
+									list.add ( pkg );
+									continue ;
+								}
+							}
+						}
+					}
+				} catch (FileError e) {
+					Report.error (null, "Unable to read dependency file: %s".printf (e.message));
+				}
+			}
+			return list;
+		}
+		return null;
+	}
+
+	private Gee.ArrayList<weak Vala.SourceFile> vfiles = new Gee.ArrayList<weak Vala.SourceFile> ();
+	private Package source_package;
+
+	private void add_dependencies () {
+		foreach ( weak Vala.SourceFile vfile in this.vfiles ) {
+			Gee.ArrayList<Package>? deps = this.load_dependency_list ( vfile.filename );
+			if ( deps != null ) {
+				Package pkg = this.get_file ( vfile );
+				pkg.set_dependency_list ( deps );
+			}
+		}
+
+		if ( this.source_package != null ) {
+			Gee.ArrayList<Package> list = new Gee.ArrayList<Package> ();
+			foreach ( Package pkg in this.files ) {
+				if ( pkg != this.source_package ) {
+					list.add ( pkg );
+				}
+			}
+			this.source_package.set_dependency_list ( list );
+		}
+
+		this.source_package = null;
+		this.vfiles = null;
+	}
+
 	// internal
 	public Package get_file ( Vala.SourceFile vfile ) {
 		Package file = this.find_file( vfile );
 		if ( file != null )
 			return file;
 
-		var tmp = new Package ( this.settings,vfile, this ); 
+		Package tmp = new Package ( this.settings, vfile, this ); 
+		if ( tmp.is_external_package )
+			this.vfiles.add ( vfile );
+		else
+			this.source_package = tmp;
+
 		this.files.add ( tmp );
 		return tmp;
 	}

Modified: trunk/src/libvaladoc/drawer.vala
==============================================================================
--- trunk/src/libvaladoc/drawer.vala	(original)
+++ trunk/src/libvaladoc/drawer.vala	Sun Nov 16 02:52:23 2008
@@ -7,6 +7,7 @@
 
 
 namespace Valadoc.Diagrams {
+	// replace with .full_name
 	private static inline string get_diagram_node_name ( DataType type ) {
 		string name = "";
 		if ( type.nspace.full_name() != null ) {
@@ -15,6 +16,59 @@
 		return name + type.name;
 	}
 
+	private static void draw_package_parents ( Package package, Graphviz.Graph g, Graphviz.Node me ) {
+		weak Graphviz.Node? node = g.find_node ( package.name );
+
+
+		Gee.Collection<Package> packlst = package.get_dependency_list ( );
+
+		foreach ( Package pkg in packlst ) {
+			weak Graphviz.Node gpkg = draw_package ( g, pkg, me );
+			draw_package_parents ( pkg, g, gpkg );
+		}
+	}
+
+	private static weak Graphviz.Node draw_package ( Graph g, Package package, Graphviz.Node? parent ) {
+		string name = package.name;
+		weak Graphviz.Node? node = g.find_node ( name );
+		if ( node == null ) {
+			node = g.node ( name );
+			node.set_safe ( "shape", "box", "" );
+			node.set_safe ( "fontname", "Times", "" );
+		}
+
+		if ( parent != null ) {
+			if ( g.find_edge( parent, node ) == null ) {
+				weak Edge edge = g.edge ( node, parent );
+				edge.set_safe ( "dir", "back", "" );
+			}
+		}
+
+		return node;
+	}
+
+	public static void write_dependency_diagram ( Package package, string path ) {
+		string[] params2 = new string[5];
+		params2[0] = "";
+		params2[1] = "-T";
+		params2[2] = "png";
+		params2[3] = "-o";
+		params2[4] = path;
+
+		Graphviz.Context cntxt = Context.context( );
+		cntxt.parse_args ( params2 );
+
+		Graphviz.Graph g = Graph.open ( "g", GraphType.AGRAPH );
+		g.set_safe ( "rank", "", "" );
+
+		weak Graphviz.Node me = draw_package ( g, package, null );
+		draw_package_parents ( package, g, me );
+
+		cntxt.layout_jobs ( g );
+		cntxt.render_jobs ( g );
+		cntxt.free_layout ( g );
+	}
+
 	public static void write_struct_diagram ( Struct stru, string path ) {
 		string[] params2 = new string[5];
 		params2[0] = "";

Modified: trunk/src/valadoc/valadoc.vala
==============================================================================
--- trunk/src/valadoc/valadoc.vala	(original)
+++ trunk/src/valadoc/valadoc.vala	Sun Nov 16 02:52:23 2008
@@ -298,22 +298,24 @@
 		return true;
 	}
 
-	private bool load_taglets ( string fulldirpath, out Gee.HashMap<string, Type>? taglets, out Type strtag ) {
+	private bool load_taglets ( string fulldirpath, out Gee.HashMap<string, Type>? taglets2, out Type strtag ) {
 		void* function;
 		GLib.Dir dir;
 
 		string pluginpath = fulldirpath + "taglets/";
 
 		Gee.ArrayList<Module*> modules = new Gee.ArrayList<weak Module*> ( );
-		Gee.HashMap<string, Type> taglets =
-			new Gee.HashMap<string, Type> ( GLib.str_hash, GLib.str_equal );
+
+
+//		Gee.HashMap<string, Type> taglets =
+			taglets2 = new Gee.HashMap<string, Type> ( GLib.str_hash, GLib.str_equal );
 
 		try {
 			dir = GLib.Dir.open ( pluginpath );
 		}
 		catch ( FileError err ) {
 			stdout.printf ( "Can't load plugin. %s\n", pluginpath );
-			taglets = null;
+			taglets2 = null;
 			return false;
 		}
 
@@ -326,7 +328,7 @@
 			Module* module = Module.open ( tagletpath, ModuleFlags.BIND_LAZY);
 			if (module == null) {
 				stdout.printf ( "Can't load plugin.\n" );
-				taglets = null;
+				taglets2 = null;
 				return false;
 			}
 
@@ -335,7 +337,7 @@
 
 			string? name;
 
-			GLib.Type type = tagletregisterfkt ( taglets );
+			GLib.Type type = tagletregisterfkt ( taglets2 );
 
 			if ( entry == "libtagletstring.so" || entry == "libtagletstring.dll" )
 				strtag = type;
@@ -378,13 +380,12 @@
 		return true;
 	}
 
-
 	private string get_pkg_name ( ) {
 		if ( this.pkg_name == null ) {
 			if ( this.directory.has_suffix ( "/" ) )
-				pkg_name = GLib.Path.get_dirname ( this.directory );
+				this.pkg_name = GLib.Path.get_dirname ( this.directory );
 			else
-				pkg_name = GLib.Path.get_basename ( this.directory );
+				this.pkg_name = GLib.Path.get_basename ( this.directory );
 		}
 
 		return this.pkg_name;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]