]> granicus.if.org Git - graphviz/commitdiff
Prototype new version of xdot providing anchor information
authorerg <devnull@localhost>
Thu, 30 Sep 2010 20:17:39 +0000 (20:17 +0000)
committererg <devnull@localhost>
Thu, 30 Sep 2010 20:17:39 +0000 (20:17 +0000)
plugin/core/gvrender_core_dot.c

index 978066a6abbd1edc255fa6214aa5a518db89122a..808f2c0a03e7b63fd94e636c6add1f3a7c31bb94 100644 (file)
@@ -38,6 +38,8 @@
 
 #define GNEW(t)          (t*)malloc(sizeof(t))
 
+/* #define NEW_XDOT */
+
 typedef enum {
        FORMAT_DOT,
        FORMAT_CANON,
@@ -246,6 +248,42 @@ static void xdot_end_edge(GVJ_t* job)
     penwidth[EMIT_HLABEL] = 1;
 }
 
+#ifdef NEW_XDOT
+/* xdot_begin_anchor:
+ * The encoding of which fields are present assumes that one of the fields is present,
+ * so there is never a 0 after the H.
+ */
+static void xdot_begin_anchor(GVJ_t * job, char *href, char *tooltip, char *target, char *id)
+{
+    emit_state_t emit_state = job->obj->emit_state;
+    char buf[3];  /* very small integer */
+    unsigned int flags = 0;
+
+    agxbput(xbufs[emit_state], "H ");
+    if (href)
+       flags |= 1;
+    if (tooltip)
+       flags |= 2;
+    if (target)
+       flags |= 4;
+    sprintf (buf, "%d ", flags);
+    agxbput(xbufs[emit_state], buf);
+    if (href)
+       xdot_str (job, "", href);
+    if (tooltip)
+       xdot_str (job, "", tooltip);
+    if (target)
+       xdot_str (job, "", target);
+}
+
+static void xdot_end_anchor(GVJ_t * job)
+{
+    emit_state_t emit_state = job->obj->emit_state;
+
+    agxbput(xbufs[emit_state], "H 0 ");
+}
+#endif
+
 static void xdot_end_cluster(GVJ_t * job)
 {
     Agraph_t* cluster_g = job->obj->u.sg;
@@ -609,8 +647,13 @@ gvrender_engine_t xdot_engine = {
     xdot_end_node,
     0,                         /* xdot_begin_edge */
     xdot_end_edge,
-    0,                         /* xdot_begin_anchor */
-    0,                         /* xdot_end_anchor */
+#ifdef NEW_XDOT
+    xdot_begin_anchor,
+    xdot_end_anchor,
+#else
+    0,                          /* xdot_begin_anchor */
+    0,                          /* xdot_end_anchor */
+#endif
     0,                         /* xdot_begin_label */
     0,                         /* xdot_end_label */
     xdot_textpara,
@@ -632,7 +675,10 @@ gvrender_features_t render_features_dot = {
 };
 
 gvrender_features_t render_features_xdot = {
-    GVRENDER_DOES_TRANSFORM,   /* not really - uses raw graph coords */  /* flags */
+    GVRENDER_DOES_TRANSFORM    /* not really - uses raw graph coords */  
+       | GVRENDER_DOES_MAPS
+       | GVRENDER_DOES_TARGETS
+       | GVRENDER_DOES_TOOLTIPS, /* flags */
     0.,                         /* default pad - graph units */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */