]> granicus.if.org Git - graphviz/commitdiff
*** empty log message ***
authorarif <devnull@localhost>
Fri, 1 Aug 2008 14:33:38 +0000 (14:33 +0000)
committerarif <devnull@localhost>
Fri, 1 Aug 2008 14:33:38 +0000 (14:33 +0000)
26 files changed:
cmd/smyrna/glexpose.c
cmd/smyrna/gui/gui.h
cmd/smyrna/gui/topviewsettings.c
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topfisheyeview.c
cmd/smyrna/topfisheyeview.h
cmd/smyrna/topview.c
cmd/smyrna/topviewdata.h
cmd/smyrna/viewport.c
cmd/smyrna/viewport.h
lib/agutil/dynattr.c
lib/agutil/nodeq.c
lib/cgraph/cghdr.h
lib/common/input.c
lib/common/render.h
lib/common/types.h
lib/gvc/gvc.c
lib/gvc/gvc.h
lib/gvc/gvconfig.c
lib/gvc/gvcontext.c
lib/gvc/gvevent.c
lib/gvc/gvlayout.c
lib/gvc/gvloadimage.c
lib/gvc/gvplugin.c
lib/gvc/gvrender.c
lib/gvc/gvusershape.c

index 91ce700b63e1fb0f21620538e2b6b2296b5f80b6..dd136633ecaf4dad134083a116ec059c7634ba78 100644 (file)
@@ -146,8 +146,7 @@ int glexpose_drawgraph(ViewInfo * view)
            if(!view->Topview->is_top_fisheye)
                drawTopViewGraph(view->g[view->activeGraph]);   //view->Topview style dots and straight lines
            else {
-//             drawtopologicalfisheye(view->Topview);
-               drawtopologicalfisheye2(view->Topview);
+                       drawtopologicalfisheye(view->Topview);
            }
            glCompSetDraw(view->Topview->topviewmenu);
        }
index 9591874a4520e74ccd06006545ef87f5012e7dae..cd526f96610011733ec149b4fae3297ad5c89d33 100644 (file)
@@ -23,7 +23,7 @@
 #include <gtk/gtkgl.h>
 #include <glade/glade.h>
 #include "callbacks.h"
-#include "cgraph.h"
+#include "agraph.h"
 
 
 
index a07d35d36cfa0a481f2ae980a1f90a0888941384..cd96e1514ef036fc754f8c3b1a86bad6b9a01aee 100644 (file)
@@ -313,13 +313,30 @@ int load_settings_from_graph(Agraph_t * g)
     buf = agget(view->g[view->activeGraph], "defaultnodeshape");
     if (!buf)
        buf = agget(view->default_attributes, "defaultnodeshape");
-    if (buf) {
-       /*select the right item in combo box */
-       gtk_combo_box_set_active((GtkComboBox *)
+    if (buf)
+       {
+               /*select the right item in combo box */
+               gtk_combo_box_set_active((GtkComboBox *)
                                 glade_xml_get_widget(xml,
                                                      "settingscombobox1"),
                                 atoi(buf));
-    }
+
+       }
+
+    /*Node Shape Combo, 0:opengl dots, 1:circle ,2:box */
+    buf = agget(view->g[view->activeGraph], "defaultselectionmethod");
+    if (!buf)
+       buf = agget(view->default_attributes, "defaultselectionmethod");
+    if (buf)
+       {
+               /*select the right item in combo box */
+               gtk_combo_box_set_active((GtkComboBox *)
+                                glade_xml_get_widget(xml,
+                                                     "settingscombobox1"),
+                                atoi(buf));
+
+       }
+       
     return 1;
 }
 
@@ -423,6 +440,7 @@ int update_graph_from_settings(Agraph_t * g)
                                    "settingsscale2", g);
 
        get_combobox_widget_to_attribute("defaultnodeshape","settingscombobox1", g)     ;
+       get_combobox_widget_to_attribute("defaultselectionmethod","settingscombobox2", g)       ;
        return 1;
 }
 
index 4b62d5389df4c83bb6ed1c1b1b041abf16668661..b8d1419c9b7e188c612309a7163527590bea539b 100644 (file)
@@ -36,7 +36,7 @@
 #endif
 
 #include <gtk/gtk.h>
-#include "cgraph.h"
+#include "agraph.h"
 #include <GL/gl.h>
 #include <GL/glu.h>
 #include <gtk/gtkgl.h>
@@ -332,7 +332,8 @@ typedef struct _custom_object_data  //has to be attached to every Node, Edge, Gra
 typedef struct _selection {
     int Active;                        //0 there is no selection need to be applied
     char Type;                 //0     single selection , 1 rectangle , 2 rectangleX 
-    float X, Y, W, H;          //selection boundries
+       int PickingType;        //0 normal, union,2 subtract 3 intersection
+       float X, Y, W, H;               //selection boundries
     int Anti;                  //subtract selections if 1
     int AlreadySelected;       //for single selections to avoid selecting more than one object
     RGBColor SelectionColor;
index 32c158982b64ec003dfe395e80e824c2c06383a4..36e978f8e8079231224f0cac28fe167fbd4e15b8 100644 (file)
@@ -27,6 +27,7 @@
 #include "assert.h"
 #include "hier.h"
 
+int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,float *R,float *G,float *B);
 static double dist(double x1, double y1, double x2, double y2)
 {
     return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
@@ -221,12 +222,13 @@ void prepare_topological_fisheye(topview* t)
     v_data *graph = makeGraph(t, &ne);
 
 //     t->animate=1;   //turn the animation on
-       for (i = 0, np = t->Nodes; i < t->Nodecount; i++, np++) {
-       x_coords[i] = np->x;
-       y_coords[i] = np->y;
+       for (i = 0, np = t->Nodes; i < t->Nodecount; i++, np++)
+       {
+               x_coords[i] = np->x;
+               y_coords[i] = np->y;
     }
     hp = t->h = 
-       makeHier(t->Nodecount, ne, graph, x_coords, y_coords, &(t->parms.hier));
+               makeHier(t->Nodecount, ne, graph, x_coords, y_coords, &(t->parms.hier));
     freeGraph(graph);
     free(x_coords);
     free(y_coords);
@@ -254,7 +256,7 @@ void prepare_topological_fisheye(topview* t)
        draws all level 0 nodes and edges, during animation
 */
 
-int drawtopologicalfisheye2(topview * t)
+void drawtopologicalfisheye2(topview * t)
 {
     int level, v, i, n;
     Hierarchy *hp = t->h;
@@ -272,13 +274,11 @@ int drawtopologicalfisheye2(topview * t)
                for (v = 0; v < hp->nvtxs[level]; v++)
                {
                        {
-                               /* ex_vtx_data *gg = hp->geom_graphs[level]; */
+                               ex_vtx_data *gg = hp->geom_graphs[level];
                                        double x0,y0;
                                        if(get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B))
                                        {
                                                glColor3f((GLfloat)R,(GLfloat)G,(GLfloat)B);
-//                                             glColor3f((GLfloat) (hp->nlevels - level) /(GLfloat) hp->nlevels,(GLfloat) level / (GLfloat) hp->nlevels, 0);
-
                                                glVertex3f((GLfloat) x0, (GLfloat) y0, (GLfloat) 0);
                                        }
                        }
@@ -290,7 +290,6 @@ int drawtopologicalfisheye2(topview * t)
 
 
        //draw edges
-       glLineWidth(2);
        glBegin(GL_LINES);
     for (level = 0; level < hp->nlevels; level++)
        {
@@ -304,20 +303,17 @@ int drawtopologicalfisheye2(topview * t)
                                        for (i = 1; i < g[v].nedges; i++) 
                                        {
                                                double x, y;
-                                               float RR,GG,BB;
-                                               RR=0;GG=0;BB=0;
                                                n = g[v].edges[i];
-
-                                               if(get_temp_coords(t,level,n,&x,&y,&RR,&GG,&BB))
+                                               if(get_temp_coords(t,level,n,&x,&y,&R,&G,&B))
                                                {
                                                                if (((x0==0)||(x==0) || (y0==0) || (y==0)) &&(debug_mode))
                                                                {
+                                                                       /*printf ("(%f,%f)->(%f,%f)\n",x0,y0,x,y);*/
                                                                }
                                                                else
                                                                {
                                                                        glColor3f((GLfloat)R,(GLfloat)G,(GLfloat)B);
-//                                                                     glColor3f(0,1,0);
-
+//                                                                     glColor3f((GLfloat) (hp->nlevels - level) /     (GLfloat) hp->nlevels,(GLfloat) level / (GLfloat) hp->nlevels, 0);
                                                                        glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
                                                                        glVertex3f((GLfloat) x, (GLfloat) y,(GLfloat) 0);
                                                                }
@@ -331,27 +327,25 @@ int drawtopologicalfisheye2(topview * t)
                        
                }
     }
-    glEnd(); 
-       return 1;
+    glEnd();
 
 }
 int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,float *R,float *G,float *B)
 {
-    Hierarchy *hp = t->h;
+       static int recorded =0;
+       Hierarchy *hp = t->h;
        ex_vtx_data *gg = hp->geom_graphs[level];
-       /* v_data *g = hp->graphs[level]; */
+       v_data *g = hp->graphs[level];
        int OAL,AL;
-       double x0,y0,x1,y1;     
-       float R0,R1,G0,G1,B0,B1;
-
        OAL=gg[v].old_active_level;
        AL=gg[v].active_level;
        /*if ((OAL > level) && (AL>level))
                return 0;*/
+       
        if ((OAL < level) && (AL<level))
                return 0;
 
-       /*if (!t->animate)
+       if (!t->animate)
        {
                if (AL == level)
                {
@@ -363,16 +357,14 @@ int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,f
                        return 0;
        }
        else
-       {*/
+       {
 
+               double x0,y0,x1,y1;     
                x0=0;
                y0=0;
                x1=0;
                y1=0;
-               R0=1;R1=0;
-               G0=0;G1=1;
-               B0=0;B1=0;
-       
+
                get_active_frame(t);
                if ((OAL == level) && (AL==level))
                {
@@ -380,9 +372,8 @@ int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,f
                        y0=(double)gg[v].old_physical_y_coord;
                        x1=(double)gg[v].physical_x_coord;
                        y1=(double)gg[v].physical_y_coord;
-                       R0=1;R1=1;
-                       G0=0;G1=0;
-                       B0=0;B1=0;
+                       *G=0;
+                       *R=1;
 
                }
                if ((OAL == level) && (AL>level))
@@ -391,9 +382,8 @@ int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,f
                        y0=(double)gg[v].old_physical_y_coord;
                        find_physical_coords(t->h,level,v,&x1,&y1);
                        *G=view->active_frame/view->total_frames;
-                       R0=1;R1=0;
-                       G0=0;G1=1;
-                       B0=0;B1=0;
+                               *R=0;
+
 
                }
                if ((OAL > level) && (AL==level))
@@ -403,103 +393,35 @@ int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,f
                        y1=(double)gg[v].physical_y_coord;
                        *R=view->active_frame/view->total_frames;
                        *G=1/(view->active_frame/view->total_frames+0.0000001);
-                       R0=1;R1=1;
-                       G0=0;G1=0;
-                       B0=0;B1=0;
-
 
                }
                if ((OAL > level) && (AL>level))
                {
                        find_old_physical_coords(t->h,level,v,&x0,&y0);
                        find_physical_coords(t->h,level,v,&x1,&y1);
-                       R0=0;R1=0;
-                       G0=1;G1=1;
-                       B0=0;B1=0;
+                       *G=1;
+                       *R=0;
 
                }
-               *R=R0+(R1-R0)/(double)view->total_frames*(double)(view->active_frame+1);
-               *G=     G0+(G1-G0)/(double)view->total_frames*(double)(view->active_frame+1);
-               *B=     B0+(B1-B0)/(double)view->total_frames*(double)(view->active_frame+1);
 
                get_interpolated_coords(x0,y0,x1,y1,view->active_frame,view->total_frames,coord_x,coord_y);
-               
-       //}
-       return 1;
-}
+               if (recorded < 100)
+               {
+                       printf ("OAL  AL  (x0,y0)-(x1,y1) current \n");
+                       printf ("%i   %i  (%f,%f)-(%f,%f) (%f,%f)\n",OAL,AL,x0,y0,x1,y1,coord_x,coord_y);
+                       recorded ++;
+               }
 
 
+               return 1;
+       }
+       return 0;
+}
 
 
-void drawtopologicalfisheye(topview * t)
-{
-    int level, v, i, n;
-       float R,G,B;    
-       Hierarchy *hp = t->h;
 
-       //draw only nodes and super nodes
-       glPointSize(5);
-    glBegin(GL_POINTS);
-    for (level = 0; level < hp->nlevels; level++)
-       {
-               for (v = 0; v < hp->nvtxs[level]; v++)
-               {
-                   ex_vtx_data *gg = hp->geom_graphs[level];
-                   if (gg[v].active_level == level)    
-                       {
-                               double x0,y0;
-                               t->animate=0;
-                               get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B);
-                               glColor3f((GLfloat) (hp->nlevels - level) /
-                                       (GLfloat) hp->nlevels,
-                                       (GLfloat) level / (GLfloat) hp->nlevels, 0);
-                               glVertex3f((GLfloat) x0, (GLfloat) y0, (GLfloat) 0);
-                               t->animate=1;
-                       }
-               }
-       }
-    glEnd();
 
-       //draw edges
-       glBegin(GL_LINES);
-    for (level = 0; level < hp->nlevels; level++)
-       {
-               for (v = 0; v < hp->nvtxs[level]; v++) 
-               {
-                       ex_vtx_data *gg = hp->geom_graphs[level];
-                       v_data *g = hp->graphs[level];
-                       if (gg[v].active_level == level) 
-                       {
-                               double x0,y0;
-                               get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B);
-                               for (i = 1; i < g[v].nedges; i++) 
-                               {
-                                       double x, y;
-                                       n = g[v].edges[i];
-                                       glColor3f((GLfloat) (hp->nlevels - level) /
-                                               (GLfloat) hp->nlevels,
-                                               (GLfloat) level / (GLfloat) hp->nlevels, 0);
-                                   if (gg[n].active_level == level)
-                                       {
-                                               if (v < n)
-                                               {
-                                                       get_temp_coords(t,level,n,&x,&y,&R,&G,&B);
-                                                       glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
-                                                       glVertex3f((GLfloat) x, (GLfloat) y,(GLfloat) 0);
-                                               }
-                                       }
-                                       else if (gg[n].active_level > level) 
-                                       {
-                                               find_physical_coords(hp, level, n, &x, &y);
-                                               glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
-                                               glVertex3f((GLfloat) x, (GLfloat) y, (GLfloat) 0);
-                                       }
-                               }
-                       }
-               }
-    }
-    glEnd();
-}
+`2
 /*  In loop,
  *  update fs.
  *    For example, if user clicks mouse at (p.x,p.y) to pick a single new focus,
@@ -555,8 +477,8 @@ void refresh_old_values(topview* t)
                for (v = 0; v < hp->nvtxs[level]; v++)
                {
                    ex_vtx_data *gg = hp->geom_graphs[level];
-                   /* v_data *g = hp->graphs[level]; */
-                       /* double x0,y0; */
+                   v_data *g = hp->graphs[level];
+                       double x0,y0;
                        gg[v].old_physical_x_coord=gg[v].physical_x_coord;
                        gg[v].old_physical_y_coord=gg[v].physical_y_coord;
                        gg[v].old_active_level=gg[v].active_level;
@@ -566,18 +488,8 @@ void refresh_old_values(topview* t)
 }
 void get_interpolated_coords(double x0,double y0,double x1,double y1,int fr,int total_fr, double* x,double* y)
 {
-       if (view->Topview->animate)
-       {
-               *x=x0+(x1-x0)/(double)total_fr*(double)(fr+1);
-               *y=     y0+(y1-y0)/(double)total_fr*(double)(fr+1);
-       }
-       else
-       {
-               *x=x1;
-               *y=     y1;
-       }
-
-
+       *x=x0+(x1-x0)/(double)total_fr*(double)(fr+1);
+       *y=     y0+(y1-y0)/(double)total_fr*(double)(fr+1);
 }
 int get_active_frame(topview* t)
 {
@@ -600,7 +512,7 @@ int get_active_frame(topview* t)
        else
        {
                g_timer_stop(view->timer); 
-               view->Topview->animate=0;
+//             view->Topview->animate=0;
                return 0;
        }
 
index 3e09b26781a114b72c9d8526bffff4c93371bf84..a7f26a2555543c0a94272d2ad8328622e3300b97 100644 (file)
@@ -23,7 +23,7 @@ void fisheye_spherical(double x_focus, double y_focus, double z_focus,
                       topview * t);
 void prepare_topological_fisheye(topview*);
 void drawtopologicalfisheye(topview * t);
-int drawtopologicalfisheye2(topview * t);
+void drawtopologicalfisheye2(topview * t);
 void changetopfishfocus(topview * t, float *x, float *y,
                                   float *z, int num_foci);
 void refresh_old_values(topview* t);
index 4d8591fb92a56cad769b0a55fd82b76b209c8c8f..cb4e1c612bb5840ce940c021cba7f32cfbffc12d 100755 (executable)
@@ -570,15 +570,26 @@ static int select_topview_node(topview_node * n)
 /* FIX
  * Why is Selected being set to 1 in both cases?
  */
-           if (OD_Selected(n->Node) == 0) {
-               OD_Selected(n->Node) = 1;
-               select_object(view->g[view->activeGraph], n->Node);
+           if (OD_Selected(n->Node) == 0)
+               {
+                       OD_Selected(n->Node) = 1;
+                       select_object(view->g[view->activeGraph], n->Node);
            } else {
-               OD_Selected(n->Node) = 1;
-               deselect_object(view->g[view->activeGraph], n->Node);
+                       OD_Selected(n->Node) = 1;
+                       deselect_object(view->g[view->activeGraph], n->Node);
            }
            break;
 
+/*
+       int Active;                     //0 there is no selection need to be applied
+    char Type;                 //0     single selection , 1 rectangle , 2 rectangleX 
+    float X, Y, W, H;          //selection boundries
+    int Anti;                  //subtract selections if 1
+    int AlreadySelected;       //for single selections to avoid selecting more than one object
+    RGBColor SelectionColor;
+*/
+
+
        case 1:
        case 2:
            if (view->Selection.Anti == 0) {
index 2907f911826585440996e803e085f818b817fe2e..6c9e9912f878be08b87725d6d0ed31b6235e4264 100644 (file)
@@ -17,7 +17,7 @@
 #define TOPVIEWDATA_H
 
 #include <gtk/gtk.h>
-#include "cgraph.h"
+#include "agraph.h"
 #include "smyrnadefs.h"
 #include "tvnodes.h"
 
index b3acd33f069a9cfa41232de2e878dc095d62781a..197e81afadabef5e6c13b5999f6e176a2b715b8b 100755 (executable)
@@ -157,6 +157,8 @@ set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g)
                                                      g));
 
        view->defaultnodeshape=atoi(buf=get_attribute_value("defaultnodeshape", view,g));
+       view->Selection.PickingType=atoi(buf=get_attribute_value("defaultselectionmethod", view,g));
+
 
        
        view->gridVisible = atoi(get_attribute_value("gridvisible", view, g));
index 3cc542171029fc2a59da0aeb7d74867152a34526..53ac4dc86c22ed6b6c1ca0cb809a31e20bf739e0 100755 (executable)
@@ -21,7 +21,7 @@
 #include "smyrnadefs.h"
 #include <gtk/gtk.h>
 #include "xdot.h"
-#include "cgraph.h"
+#include "agraph.h"
 
 void init_viewport(ViewInfo * view);
 void set_viewport_settings_from_template(ViewInfo * view, Agraph_t *);
index e1c0ec05f36cecfe584352ac61c0b097522ba3cc..4a5c1aebe28c250ecb6fc63e1ea30e4eda54742e 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
 #include <agraph.h>
+#endif
+#undef WITH_CGRAPH
+
 #include <agutil.h>
 #include <stdlib.h>
 
index 73d2b4a74df98abce4195d70f84c39dc0bebb75b..f7a7e00bc3be42727776779a21f3966301cfe523 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
+
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
 #include <agraph.h>
+#endif
+#undef WITH_CGRAPH
+
 #include <agutil.h>
 
 /* node Nqueue maintenance */
index c0394423c41c1280ac4dba83d7c7f500f3dd9bb3..cd8b75512febd6171650c43d9b0ae375522e83b9 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #endif
 
-#include <cgraph.h>
+#include <agraph.h>
 
 #include               <ctype.h>
 
index 43bc0b6b300f9b80dac451050dee1ac259f4a5a6..7b13c02d55b540641fe5477a9e89595d97f2f4c9 100644 (file)
@@ -545,6 +545,10 @@ static void setRatio(graph_t * g)
     }
 }
 
+/*
+       cgraph requires 
+
+*/
 void graph_init(graph_t * g, boolean use_rankdir)
 {
     char *p;
index d8ed56b145435293fc1da55e2318b39ca9460357..97a4c35f05c08ca5bd93ffa34af3503271412d9e 100644 (file)
@@ -49,7 +49,11 @@ extern "C" {
 #include "colorprocs.h"                /* must collow color.h (in types.h) */
 #include "geomprocs.h"         /* must follow geom.h (in types.h) */
 #include "agxbuf.h"
-#include "graph.h"             /* must follow types.h */
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
 #include "utils.h"             /* must follow types.h and agxbuf.h */
 #include "gvplugin.h"          /* must follow gvcext.h (in types.h) */
 #include "gvcjob.h"            /* must follow gvcext.h (in types.h) */
index 2ee2b4f61e5b4338d7b3019ae44de0aad1fbd2af..1163e6992355a173fd1558531fb7b362407cad2a 100644 (file)
@@ -45,9 +45,16 @@ extern "C" {
     typedef int (*bsearch_cmpf) (const void *, const void *);
 
     typedef struct Agraph_t graph_t;
-    typedef struct Agnode_t node_t;
+
+#ifdef WITH_CGRAPH
+       typedef struct Agnode_s node_t;
+    typedef struct Agedge_s edge_t;
+#else
+       typedef struct Agnode_t node_t;
     typedef struct Agedge_t edge_t;
-    typedef struct Agsym_t attrsym_t;
+#endif
+
+       typedef struct Agsym_t attrsym_t;
 
     typedef struct htmllabel_t htmllabel_t;
 
@@ -379,21 +386,44 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 
     } Agraphinfo_t;
 
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing)
+#define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb)
+#define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc)
+#define GD_cleanup(g) (((Agraphinfo_t*)AGDATA(g))->cleanup)
+#define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id)
+#define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist)
+#define GD_dist(g) (((Agraphinfo_t*)AGDATA(e))->dist)
+#define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg)
+#define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight)
+//#define ED_weight(e) (e)->u.weight
+#else
+#include <graph.h>
+#endif
+
+
+
+
+
+
+
+
 #define GD_alg(g) (g)->u.alg
-#define GD_bb(g) (g)->u.bb
+//#define GD_bb(g) (g)->u.bb
 #define GD_border(g) (g)->u.border
 #define GD_cl_cnt(g) (g)->u.cl_cnt
-#define GD_cleanup(g) (g)->u.cleanup
+//#define GD_cleanup(g) (g)->u.cleanup
 #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_dist(g) (g)->u.dist
-#define GD_drawing(g) (g)->u.drawing
+//#define GD_dist(g) (g)->u.dist
+//#define GD_drawing(g) (g)->u.drawing
 #define GD_exact_ranksep(g) (g)->u.exact_ranksep
 #define GD_expanded(g) (g)->u.expanded
 #define GD_flags(g) (g)->u.flags
 #define GD_gui_state(g) (g)->u.gui_state
-#define GD_gvc(g) (g)->u.gvc
+//#define GD_gvc(g) (g)->u.gvc
 #define GD_charset(g) (g)->u.charset
 #define GD_has_labels(g) (g)->u.has_labels
 #define GD_has_images(g) (g)->u.has_images
@@ -487,7 +517,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 
 #define ND_UF_parent(n) (n)->u.UF_parent
 #define ND_UF_size(n) (n)->u.UF_size
-#define ND_alg(n) (n)->u.alg
+//#define ND_alg(n) (n)->u.alg
 #define ND_bb(n) (n)->u.bb
 #define ND_clust(n) (n)->u.clust
 #define ND_coord_i(n) (n)->u.coord
@@ -500,7 +530,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #define ND_height(n) (n)->u.height
 #define ND_hops(n) (n)->u.hops
 #define ND_ht_i(n) (n)->u.ht
-#define ND_id(n) (n)->u.id
+//#define ND_id(n) (n)->u.id
 #define ND_in(n) (n)->u.in
 #define ND_inleaf(n) (n)->u.inleaf
 #define ND_label(n) (n)->u.label
@@ -572,7 +602,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #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_dist(e) (e)->u.dist
+//#define ED_dist(e) (e)->u.dist
 #define ED_edge_type(e) (e)->u.edge_type
 #define ED_adjacent(e) (e)->u.adjacent
 #define ED_factor(e) (e)->u.factor
@@ -590,7 +620,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #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_weight(e) (e)->u.weight
+//#define ED_weight(e) (e)->u.weight
 #define ED_xpenalty(e) (e)->u.xpenalty
 
     typedef struct {
index a79578d0a9cdf6241ee6046c62b5d95f73df6584..9b6a491eb9ec9be9fe25c9de265939d2ab243131 100644 (file)
 *        Information and Software Systems Research        *
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include "builddate.h"
 #include "types.h"
-#include "graph.h"
+/*This code block should be replaced with only one onclude to cgraph*/
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+/********************/
+
 #include "const.h"
 #include "gvplugin.h"
 #include "gvcjob.h"
@@ -42,7 +48,10 @@ GVC_t *gvContext(void)
 {
     GVC_t *gvc;
 
-    aginit();
+//     void aginit(Agraph_t * g, int kind, char *rec_name, int rec_size, int move_to_front);    
+//#define aginit()                     aginitlib(sizeof(Agraph_t),sizeof(Agnode_t),sizeof(Agedge_t))   
+//void aginit(Agraph_t * g, int kind, char *rec_name, int rec_size, int move_to_front);    
+//     aginit();
     agnodeattr(NULL, "label", NODENAME_ESC);
     gvc = gvNEWcontext(LibInfo, gvUsername());
     gvconfig(gvc, FALSE); /* configure for available plugins and codegens */
@@ -71,7 +80,8 @@ int gvLayout(GVC_t *gvc, graph_t *g, char *engine)
 /* set bb attribute for basic layout.
  * doesn't yet include margins, scaling or page sizes because
  * those depend on the renderer being used. */
-    if (GD_drawing(g)->landscape)
+       
+       if (GD_drawing(g)->landscape)
         sprintf(buf, "%d %d %d %d",
                 ROUND(GD_bb(g).LL.y), ROUND(GD_bb(g).LL.x),
                 ROUND(GD_bb(g).UR.y), ROUND(GD_bb(g).UR.x));
@@ -89,8 +99,14 @@ int gvRender(GVC_t *gvc, graph_t *g, char *format, FILE *out)
 {
     int rc;
     GVJ_t *job;
+#ifdef WITH_CGRAPH
+       g=agroot(g);
+#else
+       g = g->root;
+#endif
+
+
 
-    g = g->root;
 
     /* create a job for the required format */
     rc = gvjobs_output_langname(gvc, format);
@@ -124,7 +140,11 @@ int gvRenderFilename(GVC_t *gvc, graph_t *g, char *format, char *filename)
     int rc;
     GVJ_t *job;
 
-    g = g->root;
+#ifdef WITH_CGRAPH
+       g=agroot(g);
+#else
+       g = g->root;
+#endif
 
     /* create a job for the required format */
     rc = gvjobs_output_langname(gvc, format);
@@ -156,7 +176,11 @@ int gvRenderData(GVC_t *gvc, graph_t *g, char *format, char **result, unsigned i
     int rc;
     GVJ_t *job;
 
-    g = g->root;
+#ifdef WITH_CGRAPH
+       g=agroot(g);
+#else
+       g = g->root;
+#endif
 
     /* create a job for the required format */
     rc = gvjobs_output_langname(gvc, format);
index 1040fbda7ac8e3df97f330abbd9f6f346bd02644..e0b77a44a327935174297dc0b7ff62e0abe31716 100644 (file)
 #define                        GVC_H
 
 #include "types.h"
-#include "graph.h"
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
 
 #ifdef __cplusplus
 extern "C" {
index 868a3e555c5f6c87e9a176228deb1415988e2bef..6b019f89d2c2dcd327b5cd90918067d50d76c636 100644 (file)
@@ -52,7 +52,13 @@ static int glob (char*, int, int (*errfunc)(const char *, int), glob_t*);
 #include        "memory.h"
 #include        "const.h"
 #include        "types.h"
-#include        "graph.h"
+/*This code block should be replaced with only one onclude to cgraph*/
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+/********************/
 
 #include       "gvplugin.h"
 #include       "gvcjob.h"
index a892dab9aeedbb4312ee0e8381d4989db2c55cd1..9391c05fdae99b9f0eaf06bb194ed2c800ff1f2f 100644 (file)
 #endif
 
 #include       "types.h"
-#include       "graph.h"
+/*This code block should be replaced with only one onclude to cgraph*/
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+/********************/
 #include        "gvplugin.h"
 #include        "gvcjob.h"
 #include        "gvcint.h"
index dace390525e9d5ae08791b04c1d2c2f91cd2e170..b3f101da6c56a783a0f9b05166be5b7fd135db62 100644 (file)
 #include <string.h>
 
 #include "gvplugin_layout.h"
-#include "graph.h"
+
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+
 #include "gvcint.h"
 #include "gvcproc.h"
 
@@ -52,39 +58,91 @@ static char *s_key = "key";
 static void gv_graph_state(GVJ_t *job, graph_t *g)
 {
     int i, j;
-    Agsym_t *a;
+    Agsym_t *a=NULL;
     gv_argvlist_t *list;
-
-    list = &(job->selected_obj_type_name);
+       list = &(job->selected_obj_type_name);
     j = 0;
-    if (g == g->root) {
+
+       
+#ifdef WITH_CGRAPH
+       if (g == agroot(g)) {
+#else
+       if (g == g->root) {
+#endif
+
+#ifdef WITH_CGRAPH
+       if (AGTYPE(g) && agisdirected(g)) 
+#else
        if (g->kind && AGFLAG_DIRECTED) 
-            gv_argvlist_set_item(list, j++, s_digraph);
+#endif
+
+
+               gv_argvlist_set_item(list, j++, s_digraph);
        else
             gv_argvlist_set_item(list, j++, s_graph);
     }
     else {
         gv_argvlist_set_item(list, j++, s_subgraph);
     }
-    gv_argvlist_set_item(list, j++, g->name);
+
+#ifdef WITH_CGRAPH
+       gv_argvlist_set_item(list, j++, agname(g));
+#else
+       gv_argvlist_set_item(list, j++, g->name);
+#endif
+       
     list->argc = j;
 
     list = &(job->selected_obj_attributes);
-    for (i = 0, j = 0; i < dtsize(g->univ->globattr->dict); i++) {
+       
+
+#ifdef WITH_CGRAPH
+       j=0;
+       while (a = agnxtattr(g, AGRAPH, a)) {
+        gv_argvlist_set_item(list, j++, a->name);
+        gv_argvlist_set_item(list, j++, a->defval);  /* For graphs, defval and the graph's value are the same */
+        gv_argvlist_set_item(list, j++, (char*)GVATTR_STRING);
+    }
+#else
+       for (i = 0, j = 0; i < dtsize(g->univ->globattr->dict); i++) {
         a = g->univ->globattr->list[i];
         gv_argvlist_set_item(list, j++, a->name);
         gv_argvlist_set_item(list, j++, agxget(g, a->index));
         gv_argvlist_set_item(list, j++, (char*)GVATTR_STRING);
     }
-    list->argc = j;
+#endif
+
+       list->argc = j;
+
+
+#ifdef WITH_CGRAPH
+       a = agfindattr(agroot(g), s_href);
+    if (!a)
+       a = agfindattr(agroot(g), s_URL);
 
-    a = agfindattr(g->root, s_href);
+#else
+       a = agfindattr(g->root, s_href);
     if (!a)
        a = agfindattr(g->root, s_URL);
+#endif
+       
+       
     if (a)
-       job->selected_href = strdup_and_subst_obj(agxget(g, a->index), (void*)g);
+
+#ifdef WITH_CGRAPH
+               job->selected_href = strdup_and_subst_obj(agxget(g, a), (void*)g);
+#else
+               job->selected_href = strdup_and_subst_obj(agxget(g, a->index), (void*)g);
+#endif
+               
+               
 }
 
+/*
+ * Summary   :      
+ * Parameters: *GVJ_s,*Agnode_s 
+ * Return    : no return value
+ */
 static void gv_node_state(GVJ_t *job, node_t *n)
 {
     int i, j;
@@ -95,9 +153,31 @@ static void gv_node_state(GVJ_t *job, node_t *n)
     list = &(job->selected_obj_type_name);
     j = 0;
     gv_argvlist_set_item(list, j++, s_node);
-    gv_argvlist_set_item(list, j++, n->name);
+
+#ifdef WITH_CGRAPH
+       gv_argvlist_set_item(list, j++, agnameof(n));
+    list->argc = j;
+    list = &(job->selected_obj_attributes);
+
+       g= agroot(agraphof(n));
+       j=0;
+       while (a = agnxtattr(g, AGNODE, a)) {
+        gv_argvlist_set_item(list, j++, a->name);
+        gv_argvlist_set_item(list, j++, a->defval);  /* For graphs, defval and the graph's value are the same */
+        gv_argvlist_set_item(list, j++, (char*)GVATTR_STRING);
+    }
     list->argc = j;
 
+       /*ASK ERG!!!!!!!!!!!!!!!!!!!!!!
+       /*Agproto_t *proto;
+       a = agfindattr(agraphof(n)->proto->n, s_href);
+    if (!a)
+        a = agfindattr(n->graph->proto->n, s_URL);
+    if (a)
+       job->selected_href = strdup_and_subst_obj(agxget(n, a), (void*)n);*/
+#else
+       gv_argvlist_set_item(list, j++, n->name);
+    list->argc = j;
     list = &(job->selected_obj_attributes);
     g = n -> graph -> root;
     for (i = 0, j = 0; i < dtsize(g->univ->nodeattr->dict); i++) {
@@ -112,11 +192,68 @@ static void gv_node_state(GVJ_t *job, node_t *n)
         a = agfindattr(n->graph->proto->n, s_URL);
     if (a)
        job->selected_href = strdup_and_subst_obj(agxget(n, a->index), (void*)n);
+
+#endif
+
 }
 
 static void gv_edge_state(GVJ_t *job, edge_t *e)
 {
-    int i, j;
+#ifdef WITH_CGRAPH
+       int i, j;
+    Agsym_t *a;
+    Agraph_t *g;
+    gv_argvlist_t *nlist, *alist;
+
+    nlist = &(job->selected_obj_type_name);
+
+    /* only tail, head, and key are strictly identifying properties,
+     * but we commonly alse use edge kind (e.g. "->") and tailport,headport
+     * in edge names */
+    j = 0;
+    gv_argvlist_set_item(nlist, j++, s_edge);
+    gv_argvlist_set_item(nlist, j++, e->tail->name);
+    j++; /* skip tailport slot for now */
+    gv_argvlist_set_item(nlist, j++, (e->tail->graph->kind && AGFLAG_DIRECTED)?"->":"--");
+    gv_argvlist_set_item(nlist, j++, e->head->name);
+    j++; /* skip headport slot for now */
+    j++; /* skip key slot for now */
+    nlist->argc = j;
+
+    alist = &(job->selected_obj_attributes);
+    g = e -> head -> graph -> root;
+    for (i = 0, j = 0; i < dtsize(g->univ->edgeattr->dict); i++) {
+        a = g->univ->edgeattr->list[i];
+
+       /* tailport and headport can be shown as part of the name, but they
+        * are not identifying properties of the edge so we 
+        * also list them as modifyable attributes. */
+        if (strcmp(a->name,s_tailport) == 0)
+           gv_argvlist_set_item(nlist, 2, agxget(e, a->index));
+       else if (strcmp(a->name,s_headport) == 0)
+           gv_argvlist_set_item(nlist, 5, agxget(e, a->index));
+
+       /* key is strictly an identifying property to distinguish multiple
+        * edges between the same node pair.   Its non-writable, so
+        * no need to list it as an attribute as well. */
+       else if (strcmp(a->name,s_key) == 0) {
+           gv_argvlist_set_item(nlist, 6, agxget(e, a->index));
+           continue;
+       }
+
+        gv_argvlist_set_item(alist, j++, a->name);
+        gv_argvlist_set_item(alist, j++, agxget(e, a->index));
+    }
+    alist->argc = j;
+
+    a = agfindattr(e->head->graph->proto->e, s_href);
+    if (!a)
+       a = agfindattr(e->head->graph->proto->e, s_URL);
+    if (a)
+       job->selected_href = strdup_and_subst_obj(agxget(e, a->index), (void*)e);
+
+#else
+       int i, j;
     Agsym_t *a;
     Agraph_t *g;
     gv_argvlist_t *nlist, *alist;
@@ -167,6 +304,7 @@ static void gv_edge_state(GVJ_t *job, edge_t *e)
        a = agfindattr(e->head->graph->proto->e, s_URL);
     if (a)
        job->selected_href = strdup_and_subst_obj(agxget(e, a->index), (void*)e);
+#endif
 }
 
 static void gvevent_refresh(GVJ_t * job)
index 2051baae9f58797acd1d0da551f27a07a5ea4aed..276a234fef06c78bcb873d11f2207da8dad247e6 100644 (file)
 #include "const.h"
 #include "gvplugin_layout.h"
 #include "gvcint.h"
-#include "graph.h"
+
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+
 #include "gvcproc.h"
 
 extern void graph_init(graph_t *g, boolean use_rankdir);
@@ -62,9 +68,9 @@ int gvLayoutJobs(GVC_t * gvc, graph_t * g)
        return -1;
 
     GD_gvc(g) = gvc;
-    if (g != g->root) GD_gvc(g->root) = gvc;
+    if (g != agroot(g)) GD_gvc(agroot(g)) = gvc;
     graph_init(g, gvc->layout.features->flags & LAYOUT_USES_RANKDIR);
-    GD_drawing(g->root) = GD_drawing(g);
+    GD_drawing(agroot(g)) = GD_drawing(g);
     if (gvle && gvle->layout) {
        gvle->layout(g);
        if (gvle->cleanup)
@@ -90,7 +96,7 @@ int gvFreeLayout(GVC_t * gvc, graph_t * g)
     if (GD_drawing(g)) {
        graph_cleanup(g);
        GD_drawing(g) = NULL;
-       GD_drawing(g->root) = NULL;
+       GD_drawing(agroot(g)) = NULL;
     }
     return 0;
 }
index 42b64d07f0925a211a39f3124347d82d72378192..b476168f5573769e271830167abc74d7c2f07307 100644 (file)
 #include "gvcproc.h"
 
 /* for agerr() */
-#include "graph.h"
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
 
 static int gvloadimage_select(GVJ_t * job, char *str)
 {
index f137ee025a4f2287579270845063590eda11b443..c8a55368247c2587714c96d6d4fcdf40c61913f6 100644 (file)
 
 #include        "memory.h"
 #include        "types.h"
-#include        "graph.h"
+
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+
 #include        "gvplugin.h"
 #include        "gvcjob.h"
 #include        "gvcint.h"
index cdb5e5f2554b56c058e8a8e91e58fd9ff59ca7f9..222e25d16b790dbb41e915743a32644c67650cf9 100644 (file)
 #include "macros.h"
 #include "colorprocs.h"
 #include "gvplugin_render.h"
-#include "graph.h"
+
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
+
+
 #include "gvcint.h"
 #include "geom.h"
 #include "geomprocs.h"
index 38a956093c17536e6107447f34b35798cdd60b1b..2027f37de00c64d24496ac50cc7d5c9d6916045e 100644 (file)
 #include "types.h"
 #include "logic.h"
 #include "memory.h"
-#include "graph.h"
+
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
+
 #include "agxbuf.h"
 #include "utils.h"