]> granicus.if.org Git - graphviz/commitdiff
*** empty log message ***
authorarif <devnull@localhost>
Tue, 26 Feb 2008 16:43:51 +0000 (16:43 +0000)
committerarif <devnull@localhost>
Tue, 26 Feb 2008 16:43:51 +0000 (16:43 +0000)
lib/utilities/selection.c
lib/utilities/selection.h
lib/xdot/Makefile.am
lib/xdot/xdot.c
lib/xdot/xdot.h

index 671273ecdf4c7c0186335de03961574d7111a455..633f2a610c4f447045d91cf4ce9e1b40b699a61f 100755 (executable)
@@ -22,11 +22,11 @@ int rectintersects(float x,float y,float W,float H)
        //-1 if completely out
 
        int s[4];
-       s[0]=( ((x >=view.Selection.X)&& (x <= (view.Selection.X + view.Selection.W) ))) ? 1:0;
-       s[1]=( (((x+W) >=view.Selection.X)&& ((x+W) <= (view.Selection.X + view.Selection.W) ))) ? 1:0;
+       s[0]=( ((x >=view->Selection.X)&& (x <= (view->Selection.X + view->Selection.W) ))) ? 1:0;
+       s[1]=( (((x+W) >=view->Selection.X)&& ((x+W) <= (view->Selection.X + view->Selection.W) ))) ? 1:0;
 
-       s[2]=( ((y >=view.Selection.Y)&& (y <= (view.Selection.Y + view.Selection.H) ))) ? 1:0;
-       s[3]=( (((y+H) >=view.Selection.Y)&& ((y+H) <= (view.Selection.Y + view.Selection.H) ))) ? 1:0;
+       s[2]=( ((y >=view->Selection.Y)&& (y <= (view->Selection.Y + view->Selection.H) ))) ? 1:0;
+       s[3]=( (((y+H) >=view->Selection.Y)&& ((y+H) <= (view->Selection.Y + view->Selection.H) ))) ? 1:0;
 
        
        if (s[0] && s[1] && s[2] && s[3])
@@ -51,10 +51,10 @@ int lineintersects(float X1,float X2,float Y1,float Y2)
        float x,y,m,iter;
        float RX,RY,RW,RH;
        int intersects,in;
-       RX=view.Selection.X;
-       RY=view.Selection.Y;
-       RW=view.Selection.W;
-       RH=view.Selection.H;
+       RX=view->Selection.X;
+       RY=view->Selection.Y;
+       RW=view->Selection.W;
+       RH=view->Selection.H;
        if((is_point_in_rectangle(X1,Y1,RX,RY,RW,RH)) && (is_point_in_rectangle(X2,Y2,RX,RY,RW,RH)))
                return 1;
        if((is_point_in_rectangle(X1,Y1,RX,RY,RW,RH)) || (is_point_in_rectangle(X2,Y2,RX,RY,RW,RH)))
@@ -104,26 +104,26 @@ int is_point_in_rectangle(float X,float Y,float RX,float RY,float RW,float RH)
 
 int SelectBeziers(xdot_op* op)
 {
-       if(!view.Selection.Active)
+       if(!view->Selection.Active)
                return 0;
-       switch (view.Selection.Type)
+       switch (view->Selection.Type)
        {
        case 0:
-               if (view.Selection.AlreadySelected)
+               if (view->Selection.AlreadySelected)
                        return 0;
                if( spline_x_rect(op))
                {
                        if ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected==0)
                        {
                                ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                               select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                               view.Selection.AlreadySelected=1;
+                               select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                               view->Selection.AlreadySelected=1;
                        }
                        else
                        {
                                ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=0;
-                               deselect_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                               view.Selection.AlreadySelected=1;
+                               deselect_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                               view->Selection.AlreadySelected=1;
                        }
                }
                        break;
@@ -133,14 +133,14 @@ int SelectBeziers(xdot_op* op)
                if(  ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->selectionflag  != -1 )  &&       (spline_in_rect(op)) )
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Preselected=1;
-//                       select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+//                       select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
                }
                else
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Preselected=0;
-//                       deselect_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+//                       deselect_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->selectionflag = -1;                      
                }
                break;
@@ -150,8 +150,8 @@ int SelectBeziers(xdot_op* op)
                if(spline_x_rect(op))
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                 select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+                 select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
                }
                break;
        default:
@@ -163,12 +163,12 @@ int SelectBeziers(xdot_op* op)
 int SelectPolygon(xdot_op* op)
 {
 
-       if(!view.Selection.Active)
+       if(!view->Selection.Active)
                return 0;
-       switch (view.Selection.Type)
+       switch (view->Selection.Type)
        {
        case 0:
-               if (view.Selection.AlreadySelected)
+               if (view->Selection.AlreadySelected)
                        return 0;
 
                
@@ -178,15 +178,15 @@ int SelectPolygon(xdot_op* op)
                                if ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected==0)
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                                         select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                                else
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=0;
-                                         deselect_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         deselect_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                        }
@@ -197,15 +197,15 @@ int SelectPolygon(xdot_op* op)
                if(  ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->selectionflag  != -1 )  &&       (polygon_in_rect(op)) )
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Preselected=1;
-//                       select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-//                       view.Selection.AlreadySelected=1;
+//                       select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+//                       view->Selection.AlreadySelected=1;
 
                }
                else
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Preselected=0;
-//                     deselect_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                       view.Selection.AlreadySelected=1;
+//                     deselect_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                       view->Selection.AlreadySelected=1;
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->selectionflag = -1;                      
                }
        
@@ -217,8 +217,8 @@ int SelectPolygon(xdot_op* op)
                if(polygon_x_rect(op))
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                 select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+                 select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
 
                }
                break;
@@ -229,12 +229,12 @@ int SelectPolygon(xdot_op* op)
 
 int SelectPolyline(xdot_op* op)
 {
-       if(!view.Selection.Active)
+       if(!view->Selection.Active)
                return 0;
-       switch (view.Selection.Type)
+       switch (view->Selection.Type)
        {
        case 0:
-               if (view.Selection.AlreadySelected)
+               if (view->Selection.AlreadySelected)
                        return 0;
 
                
@@ -244,15 +244,15 @@ int SelectPolyline(xdot_op* op)
                                if ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected==0)
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                                         select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                                else
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=0;
-                                         deselect_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         deselect_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                        }
@@ -268,7 +268,7 @@ int SelectPolyline(xdot_op* op)
                else
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Preselected=0;
-                       view.Selection.AlreadySelected=1;
+                       view->Selection.AlreadySelected=1;
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->selectionflag = -1;                      
                }
        
@@ -280,8 +280,8 @@ int SelectPolyline(xdot_op* op)
                if(polyline_x_rect(op))
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                 select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+                 select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
 
                }
                break;
@@ -294,12 +294,12 @@ int SelectPolyline(xdot_op* op)
 }
 int SelectEllipse(xdot_op* op)
 {
-       if(!view.Selection.Active)
+       if(!view->Selection.Active)
                return 0;
-       switch (view.Selection.Type)
+       switch (view->Selection.Type)
        {
        case 0:
-               if (view.Selection.AlreadySelected)
+               if (view->Selection.AlreadySelected)
                        return 0;
 
                        if( point_within_ellipse(op))           
@@ -307,15 +307,15 @@ int SelectEllipse(xdot_op* op)
                                if ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected==0)
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                                         select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                                else
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=0;
-                                         deselect_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         deselect_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                        }
@@ -325,15 +325,15 @@ int SelectEllipse(xdot_op* op)
                                if ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected==0)
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                                         select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                                else
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=0;
-                                         deselect_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                         view.Selection.AlreadySelected=1;
+                                         deselect_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                         view->Selection.AlreadySelected=1;
 
                                }
                        }
@@ -344,13 +344,13 @@ int SelectEllipse(xdot_op* op)
                if(  ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->selectionflag  != -1 )  &&  (ellipse_in_rect(op)) )
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Preselected=1;
-                         view.Selection.AlreadySelected=1;
+                         view->Selection.AlreadySelected=1;
 
                }
                else
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Preselected=0;
-                       view.Selection.AlreadySelected=1;
+                       view->Selection.AlreadySelected=1;
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->selectionflag = -1;                      
                }
 
@@ -361,8 +361,8 @@ int SelectEllipse(xdot_op* op)
                if(ellipse_x_rect(op))
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                 select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+                 select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
 
                }
                break;
@@ -374,12 +374,12 @@ int SelectEllipse(xdot_op* op)
 
 int SelectText(xdot_op* op)
 {
-       if(!view.Selection.Active)
+       if(!view->Selection.Active)
                return 0;
-       switch (view.Selection.Type)
+       switch (view->Selection.Type)
        {
        case 0:
-               if (view.Selection.AlreadySelected)
+               if (view->Selection.AlreadySelected)
                        return 0;
                        if( text_x_rect(op))
                        {
@@ -396,8 +396,8 @@ int SelectText(xdot_op* op)
                if(text_in_rect(op))
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                 select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+                 select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
 
                }
                break;
@@ -407,8 +407,8 @@ int SelectText(xdot_op* op)
                if(text_x_rect(op))
                {
                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                 select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                         view.Selection.AlreadySelected=1;
+                 select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                         view->Selection.AlreadySelected=1;
                }
                break;
        default:
@@ -420,12 +420,12 @@ int SelectText(xdot_op* op)
 
 int SelectImage(xdot_op* op)
 {
-       if(!view.Selection.Active)
+       if(!view->Selection.Active)
                return 0;
-       switch (view.Selection.Type)
+       switch (view->Selection.Type)
        {
        case 0:
-               if (view.Selection.AlreadySelected)
+               if (view->Selection.AlreadySelected)
                        return 0;
                        if( image_x_rect(op))
                        {
@@ -433,8 +433,8 @@ int SelectImage(xdot_op* op)
                                if ( ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected==0)
                                {
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=1;
-                         select_object (view.g[view.activeGraph],((xdot*)(op->parentxdot))->obj);
-                                       view.Selection.AlreadySelected=1;
+                         select_object (view->g[view->activeGraph],((xdot*)(op->parentxdot))->obj);
+                                       view->Selection.AlreadySelected=1;
                                }
                                else
                                        ((custom_object_data*)AGDATA(((xdot*)(op->parentxdot))->obj))->Selected=0;
@@ -723,8 +723,8 @@ int point_within_ellipse( xdot_op* op)
        ey=op->u.ellipse.y;
        ea=op->u.ellipse.w;
        eb=op->u.ellipse.h;
-       px=view.Selection.X+SINGLE_SELECTION_WIDTH/2;
-       py=view.Selection.Y+SINGLE_SELECTION_WIDTH/2;
+       px=view->Selection.X+SINGLE_SELECTION_WIDTH/2;
+       py=view->Selection.Y+SINGLE_SELECTION_WIDTH/2;
        dx = px - ex;
        dy = py - ey;
        a=(dx*dx)/(ea*ea) + (dy*dy)/(eb*eb);
@@ -739,8 +739,8 @@ int point_within_polygon(xdot_op* op)
        float x,y;
        op->u.polygon.pts[i].y;
        op->u.polygon.pts[i].x;
-       x=view.Selection.X+SINGLE_SELECTION_WIDTH/2;
-       y=view.Selection.Y+SINGLE_SELECTION_WIDTH/2;
+       x=view->Selection.X+SINGLE_SELECTION_WIDTH/2;
+       y=view->Selection.Y+SINGLE_SELECTION_WIDTH/2;
 
        for (i = 0, j = npol-1; i < npol; j = i++) {
                
@@ -998,7 +998,44 @@ int deselect_all(Agraph_t* g)
        deselect_all_graphs(g);
        return 1;
 }
+int line_intersects (float* x,float* y,float* X,float* Y)
+{
+       //x,y are arrayf of float for two lines parameters theyt hold 4 points with x and y
+       //limitx and limity are float arrays with two points, thse points are the end points of the second line
+       //X,Y are the variables to put intersection point coordinates in
+       pointf pA,pB,pC,pD,pX;
+       pA.x=x[0];pA.y=y[0];
+       pB.x=x[1];pB.y=y[1];
+       pC.x=x[2];pC.y=y[2];
+       pD.x=x[3];pD.y=y[3];
+
+       if(intersect (pA, pB, pC, pD, &pX))
+       {
+               *X=pX.x;
+               *Y=pX.y;
+               if ( (pX.x >=x[2]-0.01) &&      (pX.x <x[3]+0.01) &&
+                       (pX.y >=y[2]-0.01)      &&      (pX.x <y[3]+0.01))
+               {
+                       return 1;
+
+               }
+               return 0;
+
+       }
+       else
+               return 0;
 
+}
 
+int point_within_ellips_with_coords(float ex,float ey,float ea,float eb,float px,float py)
+{
+
+       float dx,dy;
+       float a;
+       dx = px - ex;
+       dy = py - ey;
+       a=(dx*dx)/(ea*ea) + (dy*dy)/(eb*eb);
+       return (a <= 1);
+}
 
 
index 24c2434ab92b947bf407518778831f2195caa09e..41562e3fdaea0e15be98648b08482773fcb647ce 100755 (executable)
 #define        SELECTION_SEGMENT_DIVIDER       5.0     //control points count to check if a line segment is withing clipping rect
 #define SINGLE_SELECTION_WIDTH 10      //width of the rect clip for single selections , higher values more catches less sensitivity
 
+typedef struct {
+    double x, y;
+} pointf;
+extern int intersect (pointf a, pointf b, pointf c, pointf d, pointf* x);
+
 int lineintersects(float X1,float X2,float Y1,float Y2);
 int rectintersects(float x,float y,float W,float H);
 int point_within_ellipse( xdot_op* op);
 int point_within_ellips_with_coords(float ex,float ey,float ea,float eb,float px,float py);
 int point_within_polygon(xdot_op* op);
+int line_intersects (float* x,float* y,float* X,float* Y);
 
 int is_point_in_rectangle(float X,float Y,float RX,float RY,float RW,float RH);
 int within_bezier(GLfloat* xp,GLfloat* yp,GLfloat* zp,int isx);
index 974603e04627b3f36c19d63f2a9008437283818e..edd975ab77b6ed9c2f791c54ee6bea38f8691843 100644 (file)
@@ -6,12 +6,10 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/lib/cgraph \
        -I$(top_srcdir)/lib/cdt \
        -I$(top_srcdir)/lib/utilities \
-       -I$(top_srcdir)/cmd/smyrna \
+       -I$(top_srcdir)/cmd/gtktopview \
        $(GTK_CFLAGS) $(GTKGL_CFLAGS) $(GTKGLEXT_CFLAGS) $(GLADE_CFLAGS) $(FREETYPE2_CFLAGS)
 
-if WITH_SMYRNA
 noinst_HEADERS = xdot.h
 noinst_LTLIBRARIES = libxdot_C.la
-endif
 
 libxdot_C_la_SOURCES = xdot.c
index 6c766d2985da261327821331fa3009b3bf3ebe0b..a2732ac62d4c019cb734200444470b81a181b6ae 100755 (executable)
@@ -23,6 +23,8 @@
 #include <assert.h>
 #include <sys/types.h>
 #include <time.h>
+#include "draw.h"
+
 
 
 #define NEW(t)           (t*)malloc(sizeof(t))
@@ -172,7 +174,6 @@ parseOp (xdot_op* op, char* s)
        s = parseAlign (s, &op->u.text.align);
        s = parseInt (s, &op->u.text.width);
        s = parseString (s, &op->u.text.text);
-       op->u.text.texture=NULL;
        op->drawfunc=EmbedText;
        break;
     
@@ -523,7 +524,7 @@ extern char* move_xdot(void* obj,xdot* x,int dx,int dy,int dz)
        int j=0;
        int a=0;
        char* pch;
-       int pos[100];   //maximum pos count hopefully does not exceed 100
+       int pos[MAXIMUM_POS_COUNT];     //maximum pos count hopefully does not exceed 100
        if (!x)
                return "\0";
        
@@ -561,8 +562,8 @@ extern char* move_xdot(void* obj,xdot* x,int dx,int dy,int dz)
                        break;
                }
        }
-       view.GLx=view.GLx2;
-       view.GLy=view.GLy2;
+       view->GLx=view->GLx2;
+       view->GLy=view->GLy2;
        return sprintXDot (x);
 
 
@@ -603,7 +604,6 @@ extern char* offset_spline(xdot* x,float dx,float dy,float headx,float heady)
 
 
 
-//OpenGL extension
 void drawXdot (xdot* xDot,int param)
 {
        int id=0;
@@ -616,7 +616,7 @@ void drawXdot (xdot* xDot,int param)
        
        }
        if ( ((custom_object_data*)AGDATA(xDot->obj))->Preselected == 1)
-               select_object (view.g[view.activeGraph],xDot->obj);
+               select_object (view->g[view->activeGraph],xDot->obj);
        ((custom_object_data*)AGDATA(xDot->obj))->Preselected =0;
 }
 void execOp (xdot_op* op,int param)
@@ -637,175 +637,10 @@ void drawXdotwithattr(void* p,char* attr,int param)
 }
 void drawXdotwithattrs(void* e,int param)
 {
-
-
        drawXdotwithattr(e,"_draw_",param);
        drawXdotwithattr(e,"_ldraw_",param);
        drawXdotwithattr(e,"_hdraw_",param);
        drawXdotwithattr(e,"_tdraw_",param);
        drawXdotwithattr(e,"_hldraw_",param);
        drawXdotwithattr(e,"_tldraw_",param);
-
-}
-void drawGraph(Agraph_t *g)
-{
-       Agnode_t *v;
-       Agedge_t *e;
-       Agraph_t *s;
-       int param=0;
-
-       for (s = agfstsubg(g); s; s = agnxtsubg(s))
-       {
-
-                       ((custom_object_data*)AGDATA(s))->selectionflag=0;
-                       if( ((custom_object_data*)AGDATA(s))->Selected==1)
-                               param=1;
-                       else
-                               param=0;
-                       drawXdotwithattrs(s,param);
-       }
-               
-       for (v = agfstnode(g); v; v = agnxtnode(g, v))
-       {
-               if( ((custom_object_data*)AGDATA(v))->Selected==1)
-                       param=1;
-               else
-                       param=0;
-               ((custom_object_data*)AGDATA(v))->selectionflag=0;
-               drawXdotwithattr(v,"_draw_",param);
-               drawXdotwithattr(v,"_ldraw_",param);
-               for (e = agfstout(g,v) ; e ; e = agnxtout (g,e))
-               {
-                       ((custom_object_data*)AGDATA(e))->selectionflag=0;
-                       if( ((custom_object_data*)AGDATA(e))->Selected==1)
-                               param=1;
-                       else
-                               param=0;
-
-                       drawXdotwithattrs(e,param);
-
-               }
-       }
-       if((view.Selection.Active>0) && (!SignalBlock))
-       {
-               view.Selection.Active=0;
-               drawGraph(g);
-               SignalBlock=1;
-                       expose_event (drawing_area,NULL,NULL);
-               SignalBlock=0;
-       }
-
-}
-void drawTopViewGraph3(Agraph_t *g)
-{
-//     DWORD t1,t2;
-       char* pch;
-       Agnode_t *v;
-       Agedge_t *e;
-       Agraph_t *s;
-       char buf [100];
-       GLfloat a,b;
-       glPointSize(2);
-//     t1=GetTickCount();
-//     glBegin(GL_POINTS);
-       for (v = agfstnode(g); v; v = agnxtnode(g, v))
-       {
-               //use pos to put dots
-/*             if( ((custom_object_data*)AGDATA(v))->Selected==1)
-                       glColor4f(view.selectColor.R,view.selectColor.G,view.selectColor.B,view.selectColor.A);
-               else
-                       glColor4f(view.penColor.R,view.penColor.G,view.penColor.B,view.penColor.A);
-               strcpy(buf,agget(v, "pos"));
-               a=atof(strtok (buf,"," ));
-               b=atof(strtok (NULL,"," ));
-               glVertex3f(a ,b,0.0); */
-
-       }
-//     glEnd();
-//     t2=GetTickCount();
-//     printf("recorded tickcounts  %d-%d \n", t1,t2);
-//     printf("iterating time (NODES):%d \n", t2-t1);
-
-
-       //draw edges
-/*     glBegin(GL_LINES);
-       for (v = agfstnode(g); v; v = agnxtnode(g, v))
-       {
-               for (e = agfstout(g,v) ; e ; e = agnxtout (g,e))
-               {
-                       if( ((custom_object_data*)AGDATA(e))->Selected==1)
-                               glColor4f(view.selectColor.R,view.selectColor.G,view.selectColor.B,view.selectColor.A);
-                       else
-                               glColor4f(view.penColor.R,view.penColor.G,view.penColor.B,view.penColor.A);
-                       strcpy(buf,agget(aghead(e), "pos"));
-                               a=atof(strtok (buf,"," ));
-                               b=atof(strtok (NULL,"," ));
-                               glVertex3f(a ,b,0.0);
-                       strcpy(buf,agget(agtail(e), "pos"));
-                               a=atof(strtok (buf,"," ));
-                               b=atof(strtok (NULL,"," ));
-                               glVertex3f(a ,b,0.0);
-               }
-       }
-       glEnd(); */
-}
-void PrepareTopview2(Agraph_t *g)
-{
-       float a,b;
-       char* pch;
-       Agnode_t *v;
-       Agedge_t *e;
-       int ind,ind2;
-       char buf[100];
-       ind=0;ind2=0;
-       for (v = agfstnode(g); v; v = agnxtnode(g, v))
-       {
-               
-               strcpy(buf,agget(v, "pos"));
-               a=atof(strtok (buf,"," ));
-               b=atof(strtok (NULL,"," ));
-
-               TopViewPointsX[ind]=a;
-               TopViewPointsY[ind]=b;
-
-
-               for (e = agfstout(g,v) ; e ; e = agnxtout (g,e))
-               {
-                       strcpy(buf,agget(aghead(e), "pos"));
-                               a=atof(strtok (buf,"," ));
-                               b=atof(strtok (NULL,"," ));
-                               TopViewEdgesHeadX[ind2]=a;
-                               TopViewEdgesHeadY[ind2]=b;
-                       strcpy(buf,agget(agtail(e), "pos"));
-                               a=atof(strtok (buf,"," ));
-                               b=atof(strtok (NULL,"," ));
-                               TopViewEdgesTailX[ind2]=a;
-                               TopViewEdgesTailY[ind2]=b;
-                       ind2++;
-               }
-               ind++;
-       }
-       TopViewNodeCount=ind;
-       TopViewEdgeCount=ind2;
-}
-void drawTopViewGraph2(Agraph_t *g)
-{
-//     DWORD t1,t2;
-       int ind=0;
-       glPointSize(3);
-       glBegin(GL_POINTS);
-       for (ind=0;ind < TopViewNodeCount;ind ++)
-       {
-               glVertex3f(TopViewPointsX[ind] ,TopViewPointsY[ind],0.0);
-       }
-       glEnd();
-       glBegin(GL_LINES);
-       for (ind=0;ind < TopViewEdgeCount;ind ++)
-       {
-//     glColor4f(view.selectColor.R,view.selectColor.G,view.selectColor.B,view.selectColor.A);
-               glVertex3f(TopViewEdgesHeadX[ind],TopViewEdgesHeadY[ind],0.0);
-               glVertex3f(TopViewEdgesTailX[ind],TopViewEdgesTailY[ind],0.0);
-                       
-       }
-       glEnd(); 
 }
index e234f306a3be68eaca7320ae11cd2d2ea70c0a68..f832066daa9034e229dfde1fce4c5f3e7bfd5dd1 100755 (executable)
 #include <windows.h>
 #include <strcasecmp.h>
 #endif
-//#include "draw.h"
 #include <GL/gl.h>
 
-//#include <viewport.h>
 #include "cgraph.h"
-
+#define MAXIMUM_POS_COUNT      100     
 typedef struct _TextTexture {
   GLuint  name;
   GLsizei size;
@@ -51,7 +49,6 @@ typedef struct {
 
 
 typedef struct {
-  TextTexture* texture;
   int x, y;
   xdot_align align;
   int width;
@@ -113,10 +110,7 @@ extern char* sprintXDot (xdot*);
 extern void fprintXDot (FILE*, xdot*);
 extern void freeXDot (xdot*);
 extern void drawXdot (xdot*,int param);
-extern void drawGraph(Agraph_t *g);
-extern void drawTopViewGraph3(Agraph_t *g);
 extern Agnode_t* createNode(char* label,xdot_point);
-extern void PrepareTopview2(Agraph_t *g);
 extern char* move_xdot(void* obj,xdot* x,int dx,int dy,int dz);
 extern char* offset_spline(xdot* x,float dx,float dy,float headx,float heady);
 #endif