1 diff --git a/configure.ac b/configure.ac
2 index 088e8f3b5..bded3c54c 100644
5 @@ -196,13 +196,15 @@ AC_SUBST(GMODULE_LIBS)
7 AC_ARG_WITH(cgraph, AS_HELP_STRING([--with-cgraph], [Required flag for cross-compilation to define capability of graphviz]), [], with_cgraph=check)
8 AC_ARG_ENABLE(valadoc, AS_HELP_STRING([--disable-valadoc], [Disable valadoc]), enable_valadoc=$enableval, enable_valadoc=yes)
9 +AC_ARG_ENABLE(graphviz, AS_HELP_STRING([--disable-graphviz], [Disable graphviz usage for valadoc]), enable_graphviz=$enableval, enable_graphviz=yes)
10 AS_IF([test "$VALAC" != :], [FOUND_VALAC_VERION=`$VALAC --version | sed 's/Vala *//'`
11 AS_VERSION_COMPARE(["$FOUND_VALAC_VERION"], ["$VALAC_VALADOC_REQUIRED"], [
12 AC_MSG_WARN([Force disable build of valadoc, valac >= $VALAC_VALADOC_REQUIRED is required])
16 -if test x$enable_valadoc = xyes; then
17 +if test x$enable_valadoc = xyes && test x$enable_graphviz = xyes; then
18 + VALAFLAGS="$VALAFLAGS -D HAVE_GRAPHVIZ"
19 PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
20 AC_MSG_CHECKING([for CGRAPH])
21 cgraph_tmp_LIBADD="$LIBADD"
22 @@ -244,6 +246,7 @@ if test x$enable_valadoc = xyes; then
24 AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes")
25 AM_CONDITIONAL(ENABLE_VALADOC, test x$enable_valadoc = xyes)
26 +AM_CONDITIONAL(ENABLE_GRAPHVIZ, test x$enable_graphviz = xyes)
28 AC_PATH_PROG([G_IR_COMPILER], [g-ir-compiler], :)
29 AM_CONDITIONAL(HAVE_G_IR_COMPILER, test "$G_IR_COMPILER" != :)
30 diff --git a/libvaladoc/Makefile.am b/libvaladoc/Makefile.am
31 index dad9a9e99..e23266606 100644
32 --- a/libvaladoc/Makefile.am
33 +++ b/libvaladoc/Makefile.am
34 @@ -119,10 +119,6 @@ libvaladoc_la_VALASOURCES = \
35 content/tablerow.vala \
39 - charts/chartfactory.vala \
40 - charts/hierarchychart.vala \
41 - charts/simplechartfactory.vala \
42 parser/manyrule.vala \
43 parser/oneofrule.vala \
44 parser/optionalrule.vala \
45 @@ -149,19 +145,34 @@ libvaladoc_la_VALASOURCES = \
46 highlighter/codetoken.vala \
47 highlighter/highlighter.vala \
48 html/basicdoclet.vala \
49 - html/htmlchartfactory.vala \
50 html/linkhelper.vala \
51 html/cssclassresolver.vala \
52 html/htmlmarkupwriter.vala \
53 html/htmlrenderer.vala \
57 +libvaladoc_la_VALASOURCES += \
59 + charts/chartfactory.vala \
60 + charts/hierarchychart.vala \
61 + charts/simplechartfactory.vala \
62 + html/htmlchartfactory.vala \
66 libvaladoc@PACKAGE_SUFFIX@_la_SOURCES = \
67 libvaladoc.vala.stamp \
68 $(libvaladoc_la_VALASOURCES:.vala=.c) \
73 +libvaladoc@PACKAGE_SUFFIX@_la_SOURCES += \
76 +LIBGVC_PKG = --vapidir $(top_srcdir)/vapi --pkg libgvc
79 valadoc@PACKAGE_SUFFIX@.vapi valadoc.h: libvaladoc.vala.stamp
80 libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES)
82 @@ -174,7 +185,7 @@ libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES)
84 --vapi valadoc@PACKAGE_SUFFIX@.vapi \
85 --vapidir $(top_srcdir)/vapi --pkg gmodule-2.0 \
86 - --vapidir $(top_srcdir)/vapi --pkg libgvc \
88 --vapidir $(top_srcdir)/gee --pkg gee \
89 --vapidir $(top_srcdir)/vala --pkg vala \
90 --vapidir $(top_srcdir)/ccode --pkg ccode \
91 @@ -206,6 +217,9 @@ nodist_pkgconfig_DATA = valadoc@PACKAGE_SUFFIX@.pc
93 valadoc@PACKAGE_SUFFIX@.pc: valadoc.pc
96 + sed -i "s/libgvc //g" $@
99 vapidir = $(datadir)/vala/vapi
100 dist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.vapi
101 @@ -213,6 +227,9 @@ nodist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.deps
103 valadoc@PACKAGE_SUFFIX@.deps: valadoc.deps
106 + sed -i "s/libgvc//g" $@
110 $(libvaladoc_la_VALASOURCES) \
111 diff --git a/libvaladoc/html/basicdoclet.vala b/libvaladoc/html/basicdoclet.vala
112 index f4999efd4..03871d687 100644
113 --- a/libvaladoc/html/basicdoclet.vala
114 +++ b/libvaladoc/html/basicdoclet.vala
115 @@ -46,7 +46,11 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
116 protected HtmlRenderer _renderer;
117 protected Html.MarkupWriter writer;
118 protected Html.CssClassResolver cssresolver;
120 protected Charts.Factory image_factory;
122 + protected void* image_factory;
124 protected ErrorReporter reporter;
125 protected string package_list_link = "../index.html";
127 @@ -120,7 +124,9 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
128 this.linker = new LinkHelper ();
130 _renderer = new HtmlRenderer (settings, this.linker, this.cssresolver);
132 this.image_factory = new SimpleChartFactory (settings, linker);
137 @@ -1028,6 +1034,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
140 protected void write_image_block (Api.Node element) {
142 if (element is Class || element is Interface || element is Struct) {
143 unowned string format = (settings.use_svg_images ? "svg" : "png");
144 var chart = new Charts.Hierarchy (image_factory, element);
145 @@ -1047,6 +1054,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
146 this.get_img_path_html (element, format)});
147 writer.add_usemap (chart);
152 public void write_namespace_content (Namespace node, Api.Node? parent) {
153 diff --git a/libvaladoc/html/htmlmarkupwriter.vala b/libvaladoc/html/htmlmarkupwriter.vala
154 index 5aa4afdea..e79b0b8f5 100644
155 --- a/libvaladoc/html/htmlmarkupwriter.vala
156 +++ b/libvaladoc/html/htmlmarkupwriter.vala
157 @@ -51,12 +51,16 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter {
162 public unowned MarkupWriter add_usemap (Charts.Chart chart) {
163 string? buf = (string?) chart.write_buffer ("cmapx");
169 + public unowned MarkupWriter add_usemap (void* chart) {