[valadoc] libvaladoc/vapi: index for sub-classes / required classes / implementing classes / sub-interfaces li
- From: Florian Brosch <flobrosch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [valadoc] libvaladoc/vapi: index for sub-classes / required classes / implementing classes / sub-interfaces li
- Date: Sun, 21 Mar 2010 21:48:56 +0000 (UTC)
commit aa0a389ffee2e4749ec9a0c5f1a5988f2ba06162
Author: Florian Brosch <flo brosch gmail com>
Date: Fri Feb 19 02:33:50 2010 +0100
libvaladoc/vapi: index for sub-classes / required classes / implementing classes / sub-interfaces
libvaladoc/html: provides new indexed information (Bug #599960)
icons/Makefile.am | 5 +-
icons/coll_close.png | Bin 0 -> 185 bytes
icons/coll_open.png | Bin 0 -> 204 bytes
icons/scripts.js | 46 ++++++++++++
icons/style.css | 49 +++++++++++--
src/doclets/devhelp/Makefile.am | 2 +-
src/doclets/devhelp/doclet.vala | 12 ++-
src/doclets/htm/doclet.vala | 15 +++--
src/doclets/valadoc.org/doclet.vala | 18 +++--
src/libvaladoc/api/class.vala | 52 ++++++++++++++
src/libvaladoc/api/interface.vala | 47 ++++++++++++
src/libvaladoc/api/item.vala | 3 +
src/libvaladoc/api/node.vala | 34 ++++++++-
src/libvaladoc/api/tree.vala | 7 ++
src/libvaladoc/html/basicdoclet.vala | 109 ++++++++++++++++++++++++-----
src/libvaladoc/html/globals.vala | 10 +++
src/libvaladoc/html/htmlmarkupwriter.vala | 6 ++
src/vapi/libgvc.vapi | 4 +-
18 files changed, 371 insertions(+), 48 deletions(-)
---
diff --git a/icons/Makefile.am b/icons/Makefile.am
index 5dd768a..5869bff 100644
--- a/icons/Makefile.am
+++ b/icons/Makefile.am
@@ -4,7 +4,7 @@ NULL =
iconsdir = $(datadir)/valadoc/icons
-dist_icons_DATA = \
+dist_icons_DATA = \
warning.png \
abstractclass.png \
abstractmethod.png \
@@ -32,6 +32,9 @@ dist_icons_DATA = \
constructor.png \
virtualmethod.png \
virtualproperty.png \
+ scripts.js \
+ coll_close.png \
+ coll_open.png \
$(NULL)
diff --git a/icons/coll_close.png b/icons/coll_close.png
new file mode 100644
index 0000000..948573a
Binary files /dev/null and b/icons/coll_close.png differ
diff --git a/icons/coll_open.png b/icons/coll_open.png
new file mode 100644
index 0000000..d2124a2
Binary files /dev/null and b/icons/coll_open.png differ
diff --git a/icons/scripts.js b/icons/scripts.js
new file mode 100644
index 0000000..eb79093
--- /dev/null
+++ b/icons/scripts.js
@@ -0,0 +1,46 @@
+/* markupwriter.vala
+ *
+ * Copyright (C) 2008-2009 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo brosch gmail com>
+ */
+
+function get_path (path) {
+ var pos = path.lastIndexOf ('/');
+ if (pos < 0) {
+ return '';
+ }
+
+ return path.substring (pos, -1) + '/';
+}
+
+function toggle_box (self, id) {
+ var element = document.getElementById (id);
+ if (element == null) {
+ return ;
+ }
+
+ if (element.style.display == 'block') {
+ element.style.display = 'none';
+ self.src = get_path (self.src) + 'coll_open.png';
+ } else {
+ element.style.display = 'block';
+ self.src = get_path (self.src) + 'coll_close.png';
+ }
+}
+
diff --git a/icons/style.css b/icons/style.css
index 3124d44..f0248a8 100644
--- a/icons/style.css
+++ b/icons/style.css
@@ -302,7 +302,7 @@ h3.main_title {
background-position:center right;
border:0px;
}
-.description a.abstract_class, .brief_description a.abstract_class {
+a.abstract_class, .description a.abstract_class, .brief_description a.abstract_class {
background-image:url(abstractclass.png);
display:inline-block;
padding-right:17px;
@@ -351,7 +351,7 @@ h3.main_title {
background-position:center right;
border:0px;
}
-.description a.virtual_method, .brief_description a.virtual_method {
+a.virtual_method, .description a.virtual_method, .brief_description a.virtual_method {
background-image:url(virtualmethod.png);
display:inline-block;
padding-right:17px;
@@ -466,8 +466,7 @@ h3.main_title {
-.navi_main a, .navi_inline a,
-a.external_link
+.navi_main a, .navi_inline a, a.external_link
{
text-decoration: none;
color: #214b87;
@@ -485,7 +484,6 @@ ul.no_bullet > li {
list-style-type:Â none;
}
-
.main_see_list {
}
@@ -496,13 +494,50 @@ ul.no_bullet > li {
font: monospace;
color: #ff01ff;
}
-
.main_code_definition a, .leaf_code_definition a {
text-decoration: none;
color: inherit;
}
-
.main_code_definition a:hover, .leaf_code_definition a:hover {
text-decoration: underline;
}
+
+.box {
+}
+.box .headline {
+ background-color: #eeeeff;
+ border-color: #aaaaff;
+ border-style: solid;
+ border-width: 1px;
+ margin: auto;
+ width: 90%;
+ margin-top: 20px;
+}
+.box .text {
+ font-weight: bold;
+ float: left;
+}
+.box .toggle {
+ text-align: right;
+ float: clear;
+}
+.box .content {
+ border-color: #aaaaff;
+ border-width: 0 1 1 1;
+ border-style: solid;
+ overflow: auto;
+ display: none;
+ margin: auto;
+ width: 90%;
+}
+.box .column {
+ float: left;
+ width: 33%;
+}
+
+.namespace_note {
+}
+.package_note {
+}
+
diff --git a/src/doclets/devhelp/Makefile.am b/src/doclets/devhelp/Makefile.am
index 6fb7847..8527e11 100644
--- a/src/doclets/devhelp/Makefile.am
+++ b/src/doclets/devhelp/Makefile.am
@@ -37,7 +37,7 @@ libdoclet_la_SOURCES = \
libdoclet.vala.stamp: $(libdoclet_la_VALASOURCES)
- $(VALAC) -C --vapidir $(top_srcdir)/src/vapi --vapidir $(top_srcdir)/src/vapi/libvaladoc --pkg vala-1.0 --pkg gee-1.0 --pkg valadoc-1.0 --basedir . $^
+ $(VALAC) -C --vapidir $(top_srcdir)/src/vapi --vapidir $(top_srcdir)/src/libvaladoc --pkg vala-1.0 --pkg gee-1.0 --pkg valadoc-1.0 --basedir . $^
touch $@
diff --git a/src/doclets/devhelp/doclet.vala b/src/doclets/devhelp/doclet.vala
index f67dc24..6dfef15 100755
--- a/src/doclets/devhelp/doclet.vala
+++ b/src/doclets/devhelp/doclet.vala
@@ -108,6 +108,10 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
private const string css_path_wiki = "../devhelpstyle.css";
private const string css_path = "devhelpstyle.css";
+ private const string js_path_wiki = "../scripts.js";
+ private const string js_path = "scripts.js";
+
+
private ArrayList<Api.Node> nodes = new ArrayList<Api.Node> ();
private string package_dir_name = ""; // remove
private Api.Tree tree;
@@ -132,7 +136,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
DirUtils.create (this.settings.path, 0777);
- write_wiki_pages (tree, css_path_wiki, Path.build_filename (this.settings.path, this.settings.pkg_name, "content"));
+ write_wiki_pages (tree, css_path_wiki, js_path_wiki, Path.build_filename (this.settings.path, this.settings.pkg_name, "content"));
tree.accept (this);
}
@@ -168,7 +172,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (filepath, "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, pkg_name);
+ write_file_header (this.css_path, this.js_path, pkg_name);
write_package_content (package, package, wikipage);
write_file_footer ();
file = null;
@@ -213,7 +217,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (css_path, node.full_name ());
+ write_file_header (css_path, js_path, node.full_name ());
write_symbol_content (node);
write_file_footer ();
file = null;
@@ -236,7 +240,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (css_path, node.full_name());
+ write_file_header (css_path, js_path, node.full_name());
write_symbol_content (node);
write_file_footer ();
file = null;
diff --git a/src/doclets/htm/doclet.vala b/src/doclets/htm/doclet.vala
index 74ccee5..aaf2ccb 100755
--- a/src/doclets/htm/doclet.vala
+++ b/src/doclets/htm/doclet.vala
@@ -108,6 +108,11 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
private const string css_path_wiki = "../style.css";
private const string css_path = "../style.css";
+
+ private const string js_path_package = "scripts.js";
+ private const string js_path_wiki = "../scripts.js";
+ private const string js_path = "../scripts.js";
+
construct {
_renderer = new HtmlRenderer (this);
}
@@ -122,12 +127,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
DirUtils.create (this.settings.path, 0777);
copy_directory (icons_dir, settings.path);
- write_wiki_pages (tree, css_path_wiki, Path.build_filename(settings.path, "content"));
+ write_wiki_pages (tree, css_path_wiki, js_path_wiki, Path.build_filename(settings.path, "content"));
GLib.FileStream file = GLib.FileStream.open (GLib.Path.build_filename ( settings.path, "index.html" ), "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path_package, settings.pkg_name);
+ write_file_header (this.css_path_package, this.js_path_package, settings.pkg_name);
write_navi_packages (tree);
write_package_index_content (tree);
write_file_footer ();
@@ -150,7 +155,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (GLib.Path.build_filename ( path, "index.htm" ), "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, pkg_name);
+ write_file_header (this.css_path, this.js_path, pkg_name);
write_navi_package (package);
write_package_content (package, package);
write_file_footer ();
@@ -166,7 +171,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, ns.full_name ());
+ write_file_header (this.css_path, this.js_path, ns.full_name ());
write_navi_symbol (ns);
write_namespace_content (ns, ns);
write_file_footer ();
@@ -182,7 +187,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (css_path, node.full_name());
+ write_file_header (css_path, js_path, node.full_name());
if (is_internal_node (node)) {
write_navi_symbol (node);
} else {
diff --git a/src/doclets/valadoc.org/doclet.vala b/src/doclets/valadoc.org/doclet.vala
index 44268d7..fb48291 100755
--- a/src/doclets/valadoc.org/doclet.vala
+++ b/src/doclets/valadoc.org/doclet.vala
@@ -97,9 +97,6 @@ namespace Valadoc.ValadocOrg {
public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet {
- private const string css_path_wiki = "../../wiki-style.css";
- private const string css_path = "../reference-style.css";
-
private ArrayList<Api.Node> nodes = new ArrayList<Api.Node> ();
private string package_dir_name = ""; // remove
private Api.Tree tree;
@@ -122,7 +119,7 @@ public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet {
DirUtils.create (this.settings.path, 0777);
- write_wiki_pages (tree, css_path_wiki, Path.build_filename (this.settings.path, this.settings.pkg_name, "content"));
+ write_wiki_pages (tree, "", "", Path.build_filename (this.settings.path, this.settings.pkg_name, "content"));
tree.accept (this);
}
@@ -136,6 +133,7 @@ public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet {
string path = GLib.Path.build_filename (this.settings.path, pkg_name);
string imgpath = GLib.Path.build_filename (path, "img");
+ chart_directory = Path.build_filename ("/doc/", pkg_name);
var rt = DirUtils.create (path, 0777);
rt = DirUtils.create (imgpath, 0777);
@@ -178,7 +176,7 @@ public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new Html.MarkupWriter (file, false);
_renderer.set_writer (writer);
- write_symbol_content (node, Path.build_filename ("/doc/", node.package.name));
+ write_symbol_content (node);
file = null;
@@ -204,7 +202,7 @@ public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new Html.MarkupWriter (file, false);
_renderer.set_writer (writer);
- write_symbol_content (node, Path.build_filename ("/doc/", node.package.name));
+ write_symbol_content (node);
file = null;
@@ -224,6 +222,14 @@ public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet {
node.accept_all_children (this);
}
+ protected override void write_wiki_page (WikiPage page, string contentp, string css_path, string js_path, string pkg_name) {
+ GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.ndup(page.name.len()-7).replace ("/", ".")+"wiki.tpl"), "w");
+ writer = new Html.MarkupWriter (file);
+ _renderer.set_writer (writer);
+ _renderer.set_container (page);
+ _renderer.render (page.documentation);
+ }
+
public override void visit_namespace (Api.Namespace item) {
process_compound_node (item);
}
diff --git a/src/libvaladoc/api/class.vala b/src/libvaladoc/api/class.vala
index e3fe29b..37434c2 100644
--- a/src/libvaladoc/api/class.vala
+++ b/src/libvaladoc/api/class.vala
@@ -53,6 +53,21 @@ public class Valadoc.Api.Class : TypeSymbol {
return this.interfaces;
}
+ private Collection<TypeReference> _full_implemented_interfaces = null;
+
+ public Collection<TypeReference> get_full_implemented_interface_list () {
+ if (_full_implemented_interfaces == null) {
+ _full_implemented_interfaces = new HashSet<TypeReference> ();
+ _full_implemented_interfaces.add_all (this.interfaces);
+
+ if (base_type != null) {
+ _full_implemented_interfaces.add_all (((Class) base_type.data_type).get_full_implemented_interface_list ());
+ }
+ }
+
+ return _full_implemented_interfaces;
+ }
+
public bool is_abstract {
get {
return this.vclass.is_abstract;
@@ -82,6 +97,43 @@ public class Valadoc.Api.Class : TypeSymbol {
}
}
+ private Set<Interface> _known_derived_interfaces = new TreeSet<Interface> ();
+ private Set<Class> _known_child_classes = new TreeSet<Class> ();
+
+ public Collection<Class> get_known_child_classes () {
+ return _known_child_classes.read_only_view;
+ }
+
+ public Collection<Interface> get_known_derived_interfaces () {
+ return _known_derived_interfaces.read_only_view;
+ }
+
+ internal void register_derived_interface (Interface iface) {
+ _known_derived_interfaces.add (iface);
+ }
+
+ internal void register_child_class (Class cl) {
+ if (this.base_type != null) {
+ ((Class) this.base_type.data_type).register_child_class (cl);
+ }
+
+ _known_child_classes.add (cl);
+ }
+
+ internal override void resolve_children (Tree root) {
+ // base class:
+ if (this.base_type != null) {
+ ((Class) this.base_type.data_type).register_child_class (this);
+ }
+
+ // implemented interfaces:
+ foreach (var iface in get_full_implemented_interface_list ()) {
+ ((Interface) iface.data_type).register_implementation (this);
+ }
+
+ base.resolve_children (root);
+ }
+
internal override void resolve_type_references (Tree root) {
var lst = this.vclass.get_base_types ();
this.set_parent_type_references (root, lst);
diff --git a/src/libvaladoc/api/interface.vala b/src/libvaladoc/api/interface.vala
index e7bb315..c6b68af 100644
--- a/src/libvaladoc/api/interface.vala
+++ b/src/libvaladoc/api/interface.vala
@@ -34,6 +34,22 @@ public class Valadoc.Api.Interface : TypeSymbol {
return this.interfaces;
}
+
+ private Collection<TypeReference> _full_implemented_interfaces = null;
+
+ public Collection<TypeReference> get_all_implemented_interface_list () {
+ if (_full_implemented_interfaces == null) {
+ _full_implemented_interfaces = new HashSet<TypeReference> ();
+ _full_implemented_interfaces.add_all (this.interfaces);
+
+ if (base_type != null) {
+ _full_implemented_interfaces.add_all (((Class) base_type.data_type).get_full_implemented_interface_list ());
+ }
+ }
+
+ return _full_implemented_interfaces;
+ }
+
public string? get_cname () {
return ((Vala.Interface) symbol).get_cname ();
}
@@ -63,6 +79,37 @@ public class Valadoc.Api.Interface : TypeSymbol {
}
}
+ private Set<Interface> _known_related_interfaces = new TreeSet<Interface> ();
+ private Set<Class> _known_implementations = new TreeSet<Class> ();
+
+ public Collection<Class> get_known_implementations () {
+ return _known_implementations;
+ }
+
+ public Collection<Interface> get_known_related_interfaces () {
+ return _known_related_interfaces;
+ }
+
+ internal void register_related_interface (Interface iface) {
+ _known_related_interfaces.add (iface);
+ }
+
+ internal void register_implementation (Class cl) {
+ _known_implementations.add (cl);
+ }
+
+ internal override void resolve_children (Tree root) {
+ if (base_type != null) {
+ ((Class) this.base_type.data_type).register_derived_interface (this);
+ }
+
+ foreach (var iface in get_all_implemented_interface_list ()) {
+ ((Interface) iface.data_type).register_related_interface (this);
+ }
+
+ base.resolve_children (root);
+ }
+
internal override void resolve_type_references (Tree root) {
var prerequisites = ((Vala.Interface) symbol).get_prerequisites ();
this.set_prerequisites (root, prerequisites);
diff --git a/src/libvaladoc/api/item.vala b/src/libvaladoc/api/item.vala
index ecb087a..bd4da7b 100644
--- a/src/libvaladoc/api/item.vala
+++ b/src/libvaladoc/api/item.vala
@@ -31,6 +31,9 @@ public abstract class Valadoc.Api.Item : Object {
internal virtual void resolve_type_references (Tree root) {
}
+ internal virtual void resolve_children (Tree root) {
+ }
+
internal virtual void process_comments (Settings settings, DocumentationParser parser) {
}
diff --git a/src/libvaladoc/api/node.vala b/src/libvaladoc/api/node.vala
index 498df4a..6e496c9 100644
--- a/src/libvaladoc/api/node.vala
+++ b/src/libvaladoc/api/node.vala
@@ -91,6 +91,36 @@ public abstract class Valadoc.Api.Node : Item, Visitable, Documentation, Compara
children.add (child);
}
+ internal override void resolve_children (Tree root) {
+ var list = per_type_children.get (NodeType.NAMESPACE);
+ if (list != null) {
+ foreach (Node node in list) {
+ node.resolve_children (root);
+ }
+ }
+
+ list = per_type_children.get (NodeType.STRUCT);
+ if (list != null) {
+ foreach (Node node in list) {
+ node.resolve_children (root);
+ }
+ }
+
+ list = per_type_children.get (NodeType.CLASS);
+ if (list != null) {
+ foreach (Node node in list) {
+ node.resolve_children (root);
+ }
+ }
+
+ list = per_type_children.get (NodeType.INTERFACE);
+ if (list != null) {
+ foreach (Node node in list) {
+ node.resolve_children (root);
+ }
+ }
+ }
+
internal override void resolve_type_references (Tree root) {
foreach (Node node in per_name_children.values) {
node.resolve_type_references (root);
@@ -200,8 +230,7 @@ public abstract class Valadoc.Api.Node : Item, Visitable, Documentation, Compara
if (ast == null)
return null;
}
- this._package = (Valadoc.Api.Package)ast;
- }
+ this._package = (Valadoc.Api.Package)ast; }
return this._package;
}
}
@@ -237,4 +266,3 @@ public abstract class Valadoc.Api.Node : Item, Visitable, Documentation, Compara
return strcmp (name, node.name);
}
}
-
diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala
index e19ab22..9a99f8d 100644
--- a/src/libvaladoc/api/tree.vala
+++ b/src/libvaladoc/api/tree.vala
@@ -359,6 +359,7 @@ public class Valadoc.Api.Tree {
Api.NodeBuilder builder = new NodeBuilder (this);
this.context.accept(builder);
this.resolve_type_references ();
+ this.resolve_children ();
this.add_dependencies_to_source_package ();
return true;
}
@@ -377,6 +378,12 @@ public class Valadoc.Api.Tree {
}
}
+ private void resolve_children () {
+ foreach (Package pkg in packages) {
+ pkg.resolve_children (this);
+ }
+ }
+
private Package? get_source_package () {
foreach (Package pkg in packages) {
if (!pkg.is_package) {
diff --git a/src/libvaladoc/html/basicdoclet.vala b/src/libvaladoc/html/basicdoclet.vala
index a7de069..ea400d9 100755
--- a/src/libvaladoc/html/basicdoclet.vala
+++ b/src/libvaladoc/html/basicdoclet.vala
@@ -28,6 +28,9 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
protected HtmlRenderer _renderer;
protected Html.MarkupWriter writer;
+ protected string chart_directory = "img";
+ protected string icon_directory = "..";
+
public abstract void process (Settings settings, Api.Tree tree);
protected string? get_link (Api.Node element, Api.Node? pos) {
@@ -65,7 +68,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
}
}
- protected void write_wiki_pages (Api.Tree tree, string css_path_wiki, string contentp) {
+ protected void write_wiki_pages (Api.Tree tree, string css_path_wiki, string js_path_wiki, string contentp) {
if (tree.wikitree == null) {
return ;
}
@@ -85,17 +88,21 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
foreach (WikiPage page in pages) {
if (page.name != "index.valadoc") {
- GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.ndup(page.name.len()-7).replace ("/", ".")+"html"), "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- this.write_file_header (css_path_wiki, this.settings.pkg_name);
- _renderer.set_container (page);
- _renderer.render (page.documentation);
- this.write_file_footer ();
+ write_wiki_page (page, contentp, css_path_wiki, js_path_wiki, this.settings.pkg_name);
}
}
}
+ protected virtual void write_wiki_page (WikiPage page, string contentp, string css_path, string js_path, string pkg_name) {
+ GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.ndup(page.name.len()-7).replace ("/", ".")+"html"), "w");
+ writer = new MarkupWriter (file);
+ _renderer.set_writer (writer);
+ this.write_file_header (css_path, js_path, pkg_name);
+ _renderer.set_container (page);
+ _renderer.render (page.documentation);
+ this.write_file_footer ();
+ }
+
protected void write_navi_top_entry (Api.Node element, Api.Node? parent) {
string style = get_html_css_class (element);
@@ -234,9 +241,10 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
return;
}
- writer.simple_tag ("br");
+ writer.start_tag ("div", {"class", css_package_note});
writer.start_tag ("b").text ("Package:").end_tag ("b");
writer.text (" ").text (package);
+ writer.end_tag ("div");
}
protected void write_namespace_note (Api.Node element) {
@@ -249,9 +257,10 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
return;
}
- writer.simple_tag ("br");
+ writer.start_tag ("div", {"class", css_namespace_note});
writer.start_tag ("b").text ("Namespace:").end_tag ("b");
writer.text (" ").text (ns.full_name());
+ writer.end_tag ("div");
}
private void write_brief_description (Api.Node element , Api.Node? pos) {
@@ -345,18 +354,81 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
writer.end_tag ("div");
}
- public void write_symbol_content (Api.Node node, string image_path_prefix = "") {
+ private int html_id_counter = 0;
+
+ private void write_known_symbols_node (Gee.Collection<Api.Node> nodes, Api.Node container, string headline) {
+ if (nodes.size > 0) {
+ var html_id = "box-content-" + html_id_counter.to_string ();
+ html_id_counter++;
+
+
+ writer.start_tag ("div", {"class", css_box});
+
+ // headline:
+ writer.start_tag ("div", {"class", css_box_headline});
+ writer.start_tag ("div", {"class", css_box_headline_text}).text (headline).end_tag ("div");
+ writer.start_tag ("div", {"class", css_box_headline_toggle});
+ writer.start_tag ("img", {"onclick", "toggle_box (this, '" + html_id + "')", "src", Path.build_filename (icon_directory, "coll_open.png")});
+ writer.raw_text (" ");
+ writer.end_tag ("div");
+ writer.end_tag ("div");
+
+
+ // content:
+ int[] list_sizes = {0, 0, 0};
+ list_sizes[0] = nodes.size;
+ list_sizes[2] = list_sizes[0]/3;
+ list_sizes[0] -= list_sizes[2];
+ list_sizes[1] = list_sizes[0]/2;
+ list_sizes[0] -= list_sizes[1];
+
+ writer.start_tag ("div", {"class", css_box_content, "id", html_id});
+
+ var iter = nodes.iterator ();
+
+ for (int i = 0; i < list_sizes.length; i++) {
+ writer.start_tag ("div", {"class", css_box_column});
+ writer.start_tag ("ul", {"class", css_inline_navigation});
+
+ for (int p = 0; p < list_sizes[i] && iter.next (); p++) {
+ var node = iter.get ();
+ writer.start_tag ("li", {"class", get_html_css_class (node)});
+ writer.link (get_link (node, container), node.name);
+ writer.end_tag ("li");
+ }
+
+ writer.end_tag ("ul");
+ writer.end_tag ("div");
+ }
+
+ writer.end_tag ("div"); // end content
+
+ writer.end_tag ("div"); // end box
+ }
+ }
+
+ public void write_symbol_content (Api.Node node) {
string full_name = node.full_name ();
writer.start_tag ("div", {"class", css_style_content});
writer.start_tag ("h1", {"class", css_title, full_name}).text (node.name).end_tag ("h1");
writer.simple_tag ("hr", {"class", css_headline_hr});
- this.write_image_block (node, image_path_prefix);
+ this.write_image_block (node);
writer.start_tag ("h2", {"class", css_title}).text ("Description:").end_tag ("h2");
writer.start_tag ("div", {"class", css_code_definition});
this.write_signature (node, node);
writer.end_tag ("div");
this.write_documentation (node, node);
+ if (node is Class) {
+ var cl = node as Class;
+ write_known_symbols_node (cl.get_known_child_classes (), cl, "All known sub-classes:");
+ write_known_symbols_node (cl.get_known_derived_interfaces (), cl, "Required by:");
+ } else if (node is Interface) {
+ var iface = node as Interface;
+ write_known_symbols_node (iface.get_known_implementations (), iface, "All known implementing classes:");
+ write_known_symbols_node (iface.get_known_related_interfaces (), iface, "All known sub-interfaces:");
+ }
+
if (node.parent is Namespace) {
writer.simple_tag ("br");
this.write_namespace_note (node);
@@ -393,6 +465,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
write_children (node, Api.NodeType.SIGNAL, "Signals", node);
write_children (node, Api.NodeType.FIELD, "Fields", node);
}
+
writer.end_tag ("div");
}
@@ -458,11 +531,11 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
}
protected string get_img_path (Api.Node element) {
- return "img/" + element.full_name () + ".png";
+ return Path.build_filename (chart_directory, element.full_name () + ".png");
}
protected string get_img_real_path (Api.Node element) {
- return this.settings.path + "/" + element.package.name + "/" + "img/" + element.full_name () + ".png";
+ return Path.build_filename (settings.path, element.package.name, chart_directory, element.full_name () + ".png");
}
protected void write_children (Api.Node node, Api.NodeType type, string type_string, Api.Node? container) {
@@ -491,16 +564,13 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
}
}
- protected void write_image_block (Api.Node element, string path_prefix = "") {
+ protected void write_image_block (Api.Node element) {
if (!(element is Class || element is Interface || element is Struct)) {
return;
}
string realimgpath = this.get_img_real_path (element);
string imgpath = this.get_img_path (element);
- if (path_prefix != null) {
- imgpath = Path.build_filename (path_prefix, imgpath);
- }
if (element is Class) {
Diagrams.write_class_diagram ((Class)element, realimgpath);
@@ -577,11 +647,12 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
writer.end_tag ("div");
}
- protected void write_file_header (string css, string? title) {
+ protected void write_file_header (string css, string js, string? title) {
writer.start_tag ("html");
writer.start_tag ("head");
writer.start_tag ("title").text ("Vala Binding Reference").end_tag ("title");
writer.stylesheet_link (css);
+ writer.javascript_link (js);
writer.end_tag ("head");
writer.start_tag ("body");
writer.start_tag ("div", {"class", css_site_header});
diff --git a/src/libvaladoc/html/globals.vala b/src/libvaladoc/html/globals.vala
index c4b82de..b3df0f1 100755
--- a/src/libvaladoc/html/globals.vala
+++ b/src/libvaladoc/html/globals.vala
@@ -51,6 +51,7 @@ namespace Valadoc.Html {
public const string css_package_index = "package_index";
public const string css_brief_description = "brief_description";
public const string css_description = "description";
+ public const string css_known_list = "known_nodes";
public const string css_leaf_brief_description = "leaf_brief_description";
public const string css_leaf_code_definition = "leaf_code_definition";
@@ -95,6 +96,15 @@ namespace Valadoc.Html {
public const string css_style_content = "site_content";
public const string css_style_body = "site_body";
+ public const string css_box_headline_text = "text";
+ public const string css_box_headline_toggle = "toggle";
+ public const string css_box_headline = "headline";
+ public const string css_box_content = "content";
+ public const string css_box_column = "column";
+ public const string css_box = "box";
+
+ public const string css_namespace_note = "namespace_note";
+ public const string css_package_note = "package_note";
public delegate string? HtmlLink (Settings settings, Documentation element, Documentation? pos);
public HtmlLink get_html_link_imp;
diff --git a/src/libvaladoc/html/htmlmarkupwriter.vala b/src/libvaladoc/html/htmlmarkupwriter.vala
index e48865d..cb007e6 100755
--- a/src/libvaladoc/html/htmlmarkupwriter.vala
+++ b/src/libvaladoc/html/htmlmarkupwriter.vala
@@ -55,6 +55,12 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter {
return this;
}
+ public MarkupWriter javascript_link (string url) {
+ start_tag ("script", {"src", url, "type", "text/javascript"});
+ end_tag ("script");
+ return this;
+ }
+
private override bool inline_element (string name) {
return name != "html"
&& name != "head"
diff --git a/src/vapi/libgvc.vapi b/src/vapi/libgvc.vapi
index 5f8f874..e581f31 100755
--- a/src/vapi/libgvc.vapi
+++ b/src/vapi/libgvc.vapi
@@ -6,7 +6,7 @@ namespace Graphviz {
//check the headerfile, // rename
[CCode (cprefix = "", cheader_filename="gvc.h")]
-public enum GraphType {
+public enum GraphType { // => GraphKind
AGDIGRAPHSTRICT,
AGRAPHSTRICT,
AGDIGRAPH,
@@ -369,7 +369,7 @@ public class Context {
public int parse_args ( [CCode (array_length_pos = 0.9)] string[] argv );
[CCode (cname = "gvContext")]
- public static Context context ( );
+ public static Context context ( ); // => GraphKind
[CCode (cname = "gvLayout")]
public int layout ( Graph g, string engine );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]