]> granicus.if.org Git - graphviz/commitdiff
provide for "visited" and "deleted" states, in addition to "active", "selected"
authorellson <devnull@localhost>
Tue, 18 Oct 2005 18:46:29 +0000 (18:46 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 18:46:29 +0000 (18:46 +0000)
lib/common/arith.h
lib/common/const.h
lib/common/emit.c
lib/common/globals.h
lib/common/shapes.c
lib/common/types.h

index 68f0cc111b551f69e38d26f8bffd2af5c8928e97..727da454f3538bd84a11f0820c2b937189444829 100644 (file)
@@ -59,9 +59,16 @@ extern "C" {
 #endif
 #define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c)))
 
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#ifndef PI
+#define PI M_PI
+#endif
+
 #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
 #define RADIANS(deg)   ((deg)/180.0 * PI)
-#define DEGREES(rad)   ((rad)/PI * 180.0)
+#define DEGREES(rad)   ((rad)/M_PI * 180.0)
 
 #define SQR(a) ((a) * (a))
 
index 12f0d7c582014bb67c2c2a19712e4f419f162934..a91cbf3c88c3d6934d5231bfab375dcc9ce99957 100644 (file)
 #ifndef GV_CONST_H
 #define GV_CONST_H
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#ifndef PI
-#define PI M_PI
-#endif
-
 #define SMALLBUF       128
 #define LPAREN         '('
 #define RPAREN         ')'
 #define                DEFAULT_COLOR           "black"
 #define                DEFAULT_ACTIVEPENCOLOR  "yellow"
 #define                DEFAULT_ACTIVEFILLCOLOR "yellow"
+#define                DEFAULT_ACTIVEFONTCOLOR "black"
 #define                DEFAULT_SELECTEDPENCOLOR        "orange"
 #define                DEFAULT_SELECTEDFILLCOLOR       "orange"
+#define                DEFAULT_SELECTEDFONTCOLOR       "black"
+#define                DEFAULT_DELETEDPENCOLOR "lightgrey"
+#define                DEFAULT_DELETEDFILLCOLOR        "lightgrey"
+#define                DEFAULT_DELETEDFONTCOLOR        "darkgrey"
+#define                DEFAULT_VISITEDPENCOLOR "paleblue"
+#define                DEFAULT_VISITEDFILLCOLOR        "paleblue"
+#define                DEFAULT_VISITEDFONTCOLOR        "black"
 #define                DEFAULT_FONTSIZE        14.0
 #define                DEFAULT_LABEL_FONTSIZE  11.0    /* for head/taillabel */
 #define                MIN_FONTSIZE            1.0
index 98cecef4b4087cb15783b469a854e2bd807c8b2c..8a1695ba07901234a7841003732ad38e9f3fe3b7 100644 (file)
@@ -789,6 +789,18 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e)
            color = late_nnstring(e, E_activefillcolor, DEFAULT_ACTIVEFILLCOLOR);
            gvrender_set_fillcolor(job, color);
        }
+       else if (ED_deleted(e)) {
+           color = late_nnstring(e, E_deletedpencolor, DEFAULT_DELETEDPENCOLOR);
+           gvrender_set_pencolor(job, color);
+           color = late_nnstring(e, E_deletedfillcolor, DEFAULT_DELETEDFILLCOLOR);
+           gvrender_set_fillcolor(job, color);
+       }
+       else if (ED_visited(e)) {
+           color = late_nnstring(e, E_visitedpencolor, DEFAULT_VISITEDPENCOLOR);
+           gvrender_set_pencolor(job, color);
+           color = late_nnstring(e, E_visitedfillcolor, DEFAULT_VISITEDFILLCOLOR);
+           gvrender_set_fillcolor(job, color);
+       }
        /* if more than one color - then generate parallel beziers, one per color */
        if (numc) {
            /* calculate and save offset vector spline and initialize first offset spline */
@@ -990,6 +1002,8 @@ static void init_gvc_from_graph(GVC_t * gvc, graph_t * g)
     char *p;
     int i;
 
+    gvc->g = g;
+
     /* margins */
     gvc->graph_sets_margin = FALSE;
     if ((p = agget(g, "margin"))) {
@@ -1407,6 +1421,18 @@ void emit_clusters(GVJ_t * job, Agraph_t * g, int flags)
            color = late_nnstring(sg, G_activefillcolor, DEFAULT_ACTIVEFILLCOLOR);
            gvrender_set_fillcolor(job, color);
        }
+       else if (GD_deleted(sg)) {
+           color = late_nnstring(e, G_deletedpencolor, DEFAULT_DELETEDPENCOLOR);
+           gvrender_set_pencolor(job, color);
+           color = late_nnstring(e, G_deletedfillcolor, DEFAULT_DELETEDFILLCOLOR);
+           gvrender_set_fillcolor(job, color);
+       }
+       else if (GD_visited(sg)) {
+           color = late_nnstring(e, G_visitedpencolor, DEFAULT_VISITEDPENCOLOR);
+           gvrender_set_pencolor(job, color);
+           color = late_nnstring(e, G_visitedfillcolor, DEFAULT_VISITEDFILLCOLOR);
+           gvrender_set_fillcolor(job, color);
+       }
        else {
            if (((color = agget(sg, "pencolor")) != 0) && color[0])
                gvrender_set_pencolor(job, color);
@@ -1779,8 +1805,6 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g)
     gvc->numkeys = gvevent_key_binding_size;
 
     for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
-       job->g = g;
-
         if (!job->output_file) {        /* if not yet opened */
             if (job->output_filename == NULL) {
                 job->output_file = stdout;
@@ -1793,7 +1817,6 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g)
            agerr (AGERR, "renderer for %s is unavailable\n", job->output_langname);
            return -1;
        }
-
         
        if (gvc->active_jobs && strcmp(job->output_langname,gvc->active_jobs->output_langname) != 0) {
            /* finalize previous jobs */
index 8cb1c46371e0c56fbbcedc4f6b5491d9496ae731..3007565d4a5796fbc474f1897e46198de4a57521 100644 (file)
@@ -92,11 +92,15 @@ extern "C" {
     EXTERN attrsym_t
        *G_activepencolor, *G_activefillcolor,
        *G_selectedpencolor, *G_selectedfillcolor,
+       *G_visitedpencolor, *G_visitedfillcolor,
+       *G_deletedpencolor, *G_deletedfillcolor,
        *G_peripheries;
     EXTERN attrsym_t
        *N_height, *N_width, *N_shape, *N_color, *N_fillcolor,
        *N_activepencolor, *N_activefillcolor,
        *N_selectedpencolor, *N_selectedfillcolor,
+       *N_visitedpencolor, *N_visitedfillcolor,
+       *N_deletedpencolor, *N_deletedfillcolor,
        *N_fontsize, *N_fontname, *N_fontcolor,
        *N_label, *N_nojustify, *N_style, *N_showboxes,
        *N_sides, *N_peripheries, *N_orientation,
@@ -106,6 +110,8 @@ extern "C" {
        *E_weight, *E_minlen, *E_color,
        *E_activepencolor, *E_activefillcolor,
        *E_selectedpencolor, *E_selectedfillcolor,
+       *E_visitedpencolor, *E_visitedfillcolor,
+       *E_deletedpencolor, *E_deletedfillcolor,
        *E_fontsize, *E_fontname, *E_fontcolor,
        *E_label, *E_dir, *E_style, *E_decorate,
        *E_showboxes, *E_arrowsz, *E_constr, *E_layer,
index 802e317f8561bef380684559d82406f4544a47ed..21eb51de6a68a80462d63cfe86c13bbf27fe3cd2 100644 (file)
@@ -1239,6 +1239,20 @@ static void poly_gencode(GVJ_t * job, node_t * n)
         gvrender_set_fillcolor(job, color);
        filled = TRUE;
     }
+    else if (ND_deleted(n)) {
+        color = late_nnstring(n, N_deletedpencolor, DEFAULT_DELETEDPENCOLOR);
+        gvrender_set_pencolor(job, color);
+        color = late_nnstring(n, N_deletedfillcolor, DEFAULT_DELETEDFILLCOLOR);
+        gvrender_set_fillcolor(job, color);
+       filled = TRUE;
+    }
+    else if (ND_visited(n)) {
+        color = late_nnstring(n, N_visitedpencolor, DEFAULT_VISITEDPENCOLOR);
+        gvrender_set_pencolor(job, color);
+        color = late_nnstring(n, N_visitedfillcolor, DEFAULT_VISITEDFILLCOLOR);
+        gvrender_set_fillcolor(job, color);
+       filled = TRUE;
+    }
     else {
         if (style & FILLED) {
            gvrender_set_fillcolor(job, findFill(n)); /* emit fill color */
index 55efdc4d415659a0be1f854f1c9f86ba0ebc68e0..241cc6fed4f97ce81088c2cec65f0b30c4a76e88 100644 (file)
@@ -312,8 +312,7 @@ extern "C" {
        point border[4];        /* sizes of margins for graph labels */
        bool has_labels;
        bool has_images;
-       bool active;
-       bool selected;
+       bool active, selected, visited, deleted;  /* Graph state for GUI ops */
        unsigned char charset; /* input character set */
        int rankdir;
        int ht1, ht2;           /* below and above extremal ranks */
@@ -370,6 +369,7 @@ extern "C" {
 #define GD_clust(g) (g)->u.clust
 #define GD_cluster_was_collapsed(g) (g)->u.cluster_was_collapsed
 #define GD_comp(g) (g)->u.comp
+#define GD_deleted(g) (g)->u.deleted
 #define GD_dist(g) (g)->u.dist
 #define GD_drawing(g) (g)->u.drawing
 #define GD_exact_ranksep(g) (g)->u.exact_ranksep
@@ -414,6 +414,7 @@ extern "C" {
 #define GD_spring(g) (g)->u.spring
 #define GD_sum_t(g) (g)->u.sum_t
 #define GD_t(g) (g)->u.t
+#define GD_visited(g) (g)->u.visited
 
     typedef struct Agnodeinfo_t {
        shape_desc *shape;
@@ -426,8 +427,7 @@ extern "C" {
        void *alg;
        char state;
        bool clustnode;
-       bool active;
-       bool selected;
+       bool active, selected, visited, deleted;  /* Node state for GUI ops */
 
 #ifndef DOT_ONLY
        bool pinned;
@@ -474,6 +474,7 @@ extern "C" {
 #define ND_bb(n) (n)->u.bb
 #define ND_clust(n) (n)->u.clust
 #define ND_coord_i(n) (n)->u.coord
+#define ND_deleted(n) (n)->u.deleted
 #define ND_dist(n) (n)->u.dist
 #define ND_flat_in(n) (n)->u.flat_in
 #define ND_flat_out(n) (n)->u.flat_out
@@ -517,6 +518,7 @@ extern "C" {
 #define ND_clustnode(n) (n)->u.clustnode
 #define ND_tree_in(n) (n)->u.tree_in
 #define ND_tree_out(n) (n)->u.tree_out
+#define ND_visited(n) (n)->u.visited
 #define ND_weight_class(n) (n)->u.weight_class
 #define ND_width(n) (n)->u.width
 #define ND_xsize(n) (n)->u.xsize
@@ -531,8 +533,7 @@ extern "C" {
        char label_ontop;
        edge_t *to_orig;        /* for dot's shapes.c    */
        void *alg;
-       bool active;
-       bool selected;
+       bool active, selected, visited, deleted;  /* Edge state for GUI ops */
 
 #ifndef DOT_ONLY
        double factor;
@@ -557,6 +558,7 @@ extern "C" {
 #define ED_conc_opp_flag(e) (e)->u.conc_opp_flag
 #define ED_count(e) (e)->u.count
 #define ED_cutvalue(e) (e)->u.cutvalue
+#define ED_deleted(e) (e)->u.deleted
 #define ED_dist(e) (e)->u.dist
 #define ED_edge_type(e) (e)->u.edge_type
 #define ED_adjacent(e) (e)->u.adjacent
@@ -575,6 +577,7 @@ extern "C" {
 #define ED_to_orig(e) (e)->u.to_orig
 #define ED_to_virt(e) (e)->u.to_virt
 #define ED_tree_index(e) (e)->u.tree_index
+#define ED_visited(e) (e)->u.visited
 #define ED_weight(e) (e)->u.weight
 #define ED_xpenalty(e) (e)->u.xpenalty