]> granicus.if.org Git - graphviz/commitdiff
debug codes (printfs) have been removed
authorarif <devnull@localhost>
Mon, 20 Jul 2009 14:10:43 +0000 (14:10 +0000)
committerarif <devnull@localhost>
Mon, 20 Jul 2009 14:10:43 +0000 (14:10 +0000)
14 files changed:
cmd/smyrna/draw.c
cmd/smyrna/draw.h
cmd/smyrna/gui/beacon.c
cmd/smyrna/gui/beacon.h
cmd/smyrna/gui/menucallbacks.c
cmd/smyrna/main.c
cmd/smyrna/smyrna.vcproj
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topview.c
cmd/smyrna/viewport.c
lib/glcomp/glcomptext.h
lib/glcomp/glutils.c
lib/xdot/xdot.c
lib/xdot/xdot.h

index 8e5e230b6cbcc5dc82d70785d4b727d4366e055c..e11af6ed529be563872a562a7e8a4ee2e0b43eea 100755 (executable)
@@ -40,8 +40,7 @@ GLubyte rasters[24] = {
     0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xff, 0xc0, 0xff, 0xc0
 };
 
-static void
-DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param)
+void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param)
 {
     /*copied from NEHE */
     /*Written by: David Nikdel ( ogapo@ithink.net ) */
@@ -290,7 +289,7 @@ load_raw_texture(char *file_name, int width, int height, int depth,
 
 //Draws a ellpise made out of points.
 //void DrawEllipse(xdot_point* xpoint,GLfloat xradius, GLfloat yradius,int filled)
-static void DrawEllipse(xdot_op * op, int param)
+void DrawEllipse(xdot_op * op, int param)
 {
     //to draw a circle set xradius and yradius same values
     GLfloat x, y, xradius, yradius;
@@ -381,7 +380,7 @@ static void DrawPolygon(xdot_op * op, int param)
     glEnd();
 }
 
-static void DrawPolyline(xdot_op * op, int param)
+void DrawPolyline(xdot_op * op, int param)
 {
     int i = 0;
     if (param == 0)
@@ -426,7 +425,7 @@ DrawBitmap(GLfloat bmpX, GLfloat bmpY, GLfloat bmpW, GLfloat bmpH)
 }
 #endif
 
-static void SetFillColor(xdot_op * op, int param)
+void SetFillColor(xdot_op * op, int param)
 {
     RGBColor c;
     c = GetRGBColor(op->u.color);
@@ -435,7 +434,7 @@ static void SetFillColor(xdot_op * op, int param)
     view->fillColor.B = c.B;
     view->fillColor.A = c.A;
 }
-static void SetPenColor(xdot_op * op, int param)
+void SetPenColor(xdot_op * op, int param)
 {
     RGBColor c;
     c = GetRGBColor(op->u.color);
@@ -445,7 +444,7 @@ static void SetPenColor(xdot_op * op, int param)
     view->penColor.A = c.A;
 }
 
-static void SetStyle(xdot_op * op, int param)
+void SetStyle(xdot_op * op, int param)
 {
 
 
@@ -458,12 +457,12 @@ static void SetFont(xdot_op * op, int param)
        view->FontSize =  op->u.font.size;*/
 }
 
-static void InsertImage(xdot_op * op, int param)
+void InsertImage(xdot_op * op, int param)
 {
  //   SelectImage((sdot_op *) op);
 
 }
-static void EmbedText(xdot_op * op, int param)
+void EmbedText(xdot_op * op, int param)
 {
     GLfloat x;
 //    SelectText((sdot_op *) op);
@@ -562,7 +561,7 @@ void draw_magnifier(ViewInfo * view)
 
 }
 
-static void draw_circle(float originX, float originY, float radius)
+void draw_circle(float originX, float originY, float radius)
 {
 /* draw a circle from a bunch of short lines */
     float vectorX1, vectorY1, vectorX, vectorY, angle;
@@ -583,7 +582,7 @@ static void draw_circle(float originX, float originY, float radius)
 
 }
 
-static GLUquadric* fisheyesphere;
+GLUquadric* fisheyesphere;
 void draw_fisheye_magnifier(ViewInfo * view)
 {
     if ((view->mouse.mouse_mode == 21) && (view->mouse.mouse_down)) {
index 83b317ba89341fafed03c8dcb8a664a983e3bdd8..e57f7b945a0da97b600960d5d4d6c8a3007c8f35 100755 (executable)
@@ -46,6 +46,7 @@ extern RGBColor GetRGBColor(char *color);
 extern void drawBorders(ViewInfo * view);
 void drawEllipse(float xradius, float yradius,int angle1,int angle2);
 int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text);
+void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param);
 
 
 void draw_sphere(float x,float y,float z,float r);
index f3e797196b0e69cc8e9404b04d23cc10a8e9c7a7..eca98c44c3417a40a101943d6b810c688404f50b 100644 (file)
@@ -133,7 +133,6 @@ int remove_from_pick_list(topview_node * n)
 {
     int ind = 0;
     int found = 0;
-       printf("removed\n");
        for (; ind < view->Topview->picked_node_count; ind++) {
        if ((view->Topview->picked_nodes[ind] == n) && (!found))
            found = 1;
@@ -158,7 +157,6 @@ int add_to_pick_list(topview_node * n)
     view->Topview->picked_node_count++;
     view->Topview->picked_nodes =realloc(view->Topview->picked_nodes,sizeof(topview_node *) * view->Topview->picked_node_count);
     view->Topview->picked_nodes[view->Topview->picked_node_count - 1] = n;
-       printf("picked count:%d\n",view->Topview->picked_node_count);
     return 1;
 }
 
@@ -177,7 +175,6 @@ int remove_edge_from_pick_list(topview_edge * e)
 {
     int ind = 0;
     int found = 0;
-       printf("removed\n");
        for (; ind < view->Topview->picked_edge_count; ind++) 
        {
                if ((view->Topview->picked_edges[ind] == e) && (!found))
@@ -201,7 +198,6 @@ int add_edge_to_pick_list(topview_edge * e)
     view->Topview->picked_edge_count++;
     view->Topview->picked_edges =realloc(view->Topview->picked_edges,sizeof(topview_edge *) * view->Topview->picked_edge_count);
     view->Topview->picked_edges[view->Topview->picked_edge_count - 1] = e;
-       printf("picked edge count:%d\n",view->Topview->picked_edge_count);
     return 1;
 }
 
@@ -270,8 +266,8 @@ int draw_node_hint_boxes(void)
 
        for (ind = 0; ind < view->Topview->picked_edge_count; ind++) 
        {
-               buf[0]=(char*)0;
                float x1,x2,x3,y1,y2,y3,z1,z2,z3l;
+               buf[0]=(char*)0;
                glColor4f(0, 1, 0, 0.5);
                e = view->Topview->picked_edges[ind];
                        x1=e->Node1->distorted_x;
index 7ddf05ae7748e983a5427e04d88a95b49b81978a..07cf6018258a99d66a6e71929f7d2ccf2397341e 100644 (file)
@@ -2,9 +2,10 @@
 #define BEACON_H
 #include "smyrnadefs.h"
 
-int pick_node(topview_node * n);
-int is_node_picked(topview_node * n);
-int remove_from_pick_list(topview_node * n);
-int add_to_pick_list(topview_node * n);
+extern int pick_node(topview_node * n);
+extern int is_node_picked(topview_node * n);
+extern int remove_from_pick_list(topview_node * n);
+extern int add_to_pick_list(topview_node * n);
+extern int draw_node_hint_boxes(void);
 
 #endif
index 85ec9d3230f9f2370bd52b6904919886fd828147..7e1d9a23b20a91c32bbfcec31ed2b6892992dfdf 100755 (executable)
@@ -77,7 +77,6 @@ void mSaveAsSlot(GtkWidget * widget, gpointer user_data)
 }
 void mCloseSlot(GtkWidget * widget, gpointer user_data)
 {
-       printf("mCloseSlot clicked\n");
        if (view->activeGraph == 0)
                close_graph(view,0);
 }
index 29f37c137a0e1507cd21e9e166176efb1043a198..63025981571307b49f084f55cd562995b269a871 100755 (executable)
@@ -54,59 +54,6 @@ static char* smyrnaDir;    /* path to directory containin smyrna data files */
 char* smyrnaGlade;
 unsigned char SmyrnaVerbose;
 
-#if 0
-infixtoposfic(char* infix,char* posfix,int bfsize)
-{
-       char a=NULL;
-       int ind=0;
-       int ind2=0; /*points to empty cell*/
-       int st[512];
-       int ptr=0;
-       for (ind=0;ind < strlen(infix); ind ++)
-       {
-               printf ("stack:%s\n",st);
-               printf ("posix:%s\n",posfix);
-               a=infix[ind];
-               if ((a != '(') && (a != ')') &&(a != '+') && (a != '-') && (a != '/')  &&(a != '*'))
-               {
-                       posfix[ind2]=a;
-                       ind2++;
-                       continue;
-               }
-               if(a=='(')
-               {
-                       st[ptr]=a;
-                       ptr++;
-                       continue;
-               }
-               if((a == '+') || (a == '-') || (a == '/')  ||(a == '*'))
-               {
-                       ptr --;
-                       while ((st[ptr]=='+') || (st[ptr]=='-')|| (st[ptr]=='/')|| (st[ptr]=='*'))
-                       {
-                               posfix[ind2]=st[ptr];
-                               ind2++;
-                               ptr --;
-                       }
-                       ptr++;
-                       st[ptr]=a;
-                       ptr++;
-                       continue;
-               }
-               if(a==')')
-               {
-                       while ((st[ptr]!= '(') )
-                       {
-                               posfix[ind2]=st[ptr];
-                               ind2++;
-                               ptr --;
-                       }
-                       ptr--;
-               }
-       }
-       posfix[ind2]='\0';
-}
-#endif
 
 /* smyrnaPath:
  * Construct pathname for smyrna data file.
index ada34581b655e964f8121ef6f8f3047c524a0088..e16fc2110a0aaf0d29f915c26ba2804f8f04f029 100644 (file)
                                RelativePath=".\draw.c"
                                >
                        </File>
+                       <File
+                               RelativePath=".\drawxdot.c"
+                               >
+                       </File>
                        <File
                                RelativePath=".\filter.c"
                                >
index d7246346126bb74dc0ab0dfc68db1e65a5b3ee04..a62dea2b547e233a42aebaa181b8cea72ca4def3 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef NO_WIN_HEADER
 #include "windows.h"
 #endif
-//#include "gltexfont.h"
+#include "xdot.h"
 //#define       SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade"
 #define        SMYRNA_ATTRS "c:/graphviz-ms/graphviz2/share/gui/attrs.txt"
 #endif
@@ -248,6 +248,7 @@ typedef struct _viewport_camera{
 } viewport_camera;
 
 
+
 typedef struct {
     Agnode_t *Node;
     /*original coordinates */
@@ -288,6 +289,7 @@ typedef struct {
     RGBColor Color;
     int update_required;
        element_data data;
+
 } topview_edge;
 typedef struct _graph_data {
     Agrec_t h;
@@ -331,6 +333,8 @@ typedef struct {
        float init_node_size;   //raster size of node
        float init_zoom;
        float fitin_zoom;
+       xdot_set* xdot_list;/*xdot attached to whole graph*/
+
 } topview;
 
 
index 07ca467347bc0fd9e53231ecb8770540bcff4186..eddee0d72a2c7aa24c6a770bb8f85439740e58f9 100755 (executable)
@@ -32,6 +32,7 @@
 #include "hier.h"
 #include "arith.h"
 #include "topfisheyeview.h"
+#include "beacon.h"
 #ifdef WIN32
 #include "regex_win32.h"
 #else
@@ -80,7 +81,8 @@ void cleartopview(topview * t)
        /*clear nodes */
        free (t->Nodes);
        free (t->Edges);
-//    free(t);
+       free_xdotset(t->xdot_list);
+
 }
 static void init_element_data(element_data* d)
 {
@@ -275,6 +277,57 @@ void settvcolorinfo(Agraph_t* g,topview* t)
 
 }
 
+static xdot* parseXdotwithattr(void *p, char *attr)
+{
+    xdot *xDot;
+    if ((xDot = parseXDotF(agget(p, attr), OpFns, sizeof(sdot_op))))
+               return xDot;
+       else
+               return NULL;
+}
+
+static void parseXdotwithattrs(void *e, xdot_set* s)
+{
+       xdot *xd,*xd2;
+       int ind;
+//     xd=parseXdotwithattr(e, "_draw_");
+       xd=parseXDotF("e 54 102 27 18 c 9 -#000000ff c 9 -#000020ff ", OpFns, sizeof(sdot_op));
+       xd2=parseXdotwithattr(e, "_draw_");
+       if (xd2)
+       {
+               add_to_xdot_set(s,xd);
+               for (ind=0;ind < xd->cnt ;ind++)
+               {
+                               xdot_op *op2,*op3;
+                               op2=&xd->ops[ind];
+                               op3=&xd2->ops[ind];
+               }
+       }
+       add_to_xdot_set(s,parseXdotwithattr(e, "_ldraw_"));
+       add_to_xdot_set(s,parseXdotwithattr(e, "_hdraw_"));
+       add_to_xdot_set(s,parseXdotwithattr(e, "_tdraw_"));
+       add_to_xdot_set(s,parseXdotwithattr(e, "_hldraw_"));
+       add_to_xdot_set(s,parseXdotwithattr(e, "_tldraw_"));
+}
+void settvxdot(Agraph_t* g,topview* t)
+{
+       /*look for xdot attributes and parse them if there is any*/
+       
+       topview_node* np;
+    topview_edge* ep;
+       int ind;
+    for (ind=0;ind < t->Nodecount ; ind ++) 
+       {
+               np=&t->Nodes[ind];
+               parseXdotwithattrs(np->Node, t->xdot_list);
+    }
+    for (ind=0;ind < t->Edgecount ; ind ++) 
+       {
+               ep=&t->Edges[ind];
+               parseXdotwithattrs(ep->Edge, t->xdot_list);
+    }
+}
+
 void update_topview(Agraph_t * g, topview * t,int init)
 {
 
@@ -288,11 +341,15 @@ void update_topview(Agraph_t * g, topview * t,int init)
        vsize = 0.05*sqrt((view->bdxRight - view->bdxLeft)*(view->bdyTop - view->bdyBottom));
        t->init_node_size = vsize*2/GetOGLDistance(2)*percent/100.0/sqrt(t->Nodecount);
        t->init_zoom = view->zoom;
+               free_xdotset(view->Topview->xdot_list);
+               t->xdot_list=init_xdot_set();
     }
     settvposinfo(g,t);
     settvcolorinfo(g,t);
     set_boundaries(t);
     set_update_required(t);
+       settvxdot(view->g[view->activeGraph],view->Topview);
+       print_xdot_set(view->Topview->xdot_list);
     btnToolZoomFit_clicked(NULL,NULL);
 }
 
@@ -705,8 +762,7 @@ void drawTopViewGraph(Agraph_t * g)
     drawtopviewedges(g);
        drawtopviewedgelabels(g);
        enddrawcycle(g);
-
-
+       draw_xdot_set(view->Topview->xdot_list);
        draw_node_hint_boxes();
     if ((view->Selection.Active > 0) && (!view->SignalBlock)) {
        view->Selection.Active = 0;
@@ -937,7 +993,6 @@ static int draw_topview_label(topview_node * v, float zdepth)
     float ddx = 0;
     float ddy = 0;
        char* buf;
-       char bf[256];
        if (((v->distorted_x / view->zoom * -1 > view->clipX1)
        && (v->distorted_x / view->zoom * -1 < view->clipX2)
        && (v->distorted_y / view->zoom * -1 > view->clipY1)
@@ -1827,9 +1882,5 @@ void select_with_regex(char* exp)
                        }
                }
        }
-
-
 }
 
-
-
index e56f0722e25cd4401f652a6d343fab4d6bea9d2a..cd314c69801d56622401ba3be38f27cc60d49c59 100755 (executable)
@@ -436,6 +436,7 @@ void init_viewport(ViewInfo * view)
     view->Selection.Anti = 0;
     view->Topview = GNEW(topview);
     view->Topview->fs = 0;
+       view->Topview->xdot_list=NULL;
 
     /* init topfish parameters */
     view->Topview->parms.level.num_fine_nodes = 10;
index 31002cf416ef8a559a64c429c9545d9882f0270c..785f63709eb25eb8f136fc0b7aa0ce4cd12c0361 100644 (file)
@@ -11,7 +11,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 #ifndef GLCOMPTEXT_H
-#define GLTEXFONTH_H
+#define GLCOMPTEXT_H
 
 #include <stdlib.h>
 #include <string.h>
index 6686ec7158f2a221bbbe16c1c567eafb8e76f3fa..544e8f3672e8a4514868e0e54c7e95b21a57bc3f 100644 (file)
@@ -179,7 +179,6 @@ void to3D(int x, int y, GLfloat *X, GLfloat *Y,GLfloat *Z)
        {
                if ((winZ[idx] > comp) && (winZ[idx] < 1))
                                comp = winZ[idx];
-               printf ("%f\n",winZ[idx]);
        }
        gluUnProject(winX,winY, comp,modelview, projection, viewport, &posX,
               &posY, &posZ);
index 0e550fa746497c6560d5226d41b5cc2a70c03285..61543113e17f13adf388d1683b16a7f708463445 100755 (executable)
@@ -311,19 +311,22 @@ parseXDotF (char* s, drawfunc_t fns[], int sz)
 
     x->cnt = 0;
     x->sz = sz;
-    while ((s = parseOp (&op, s, fns))) {
-       if (x->cnt == bufsz) {
-           bufsz += XDBSIZE;
-           ops = (char*)grealloc (ops, bufsz*sz);
-       } 
-       *(xdot_op*)(ops + (x->cnt*sz)) = op;
-       x->cnt++;
+    while ((s = parseOp (&op, s, fns))) 
+       {
+               if (x->cnt == bufsz) 
+               {
+                       bufsz += XDBSIZE;
+                       ops = (char*)grealloc (ops, bufsz*sz);
+               } 
+               *(xdot_op*)(ops + (x->cnt*sz)) = op;
+               x->cnt++;
     }
     if (x->cnt)
-       x->ops = (xdot_op*)grealloc (ops, x->cnt*sz);
-    else {
-       free (x);
-       x = 0;
+               x->ops = (xdot_op*)grealloc (ops, x->cnt*sz);
+    else
+       {
+               free (x);
+               x = 0;
     }
     return x;
 }
@@ -626,6 +629,95 @@ freeXDot (xdot* x)
     free (base);
     free (x);
 }
+static void fix_capacity(xdot_set* s)
+{
+       if (s->cnt == s->capacity)
+               s->capacity=s->capacity +       INITIAL_XDOT_CAPACITY;
+       s->obj=realloc(s->obj,(sizeof(void*))* s->capacity);
+       s->xdots=realloc (s->xdots,sizeof(xdot*)* s->capacity);
+}
+void add_to_xdot_set(xdot_set* s,xdot *x)
+{
+       int ind=0;
+       if (!x)
+               return ;
+       fix_capacity(s);
+       s->xdots[s->cnt]=x;
+       for (ind=0;ind < s->xdots[s->cnt]->cnt;ind++)
+       {
+                       xdot_op* op,*op2,*op3;
+                       op=&(s->xdots[s->cnt]->ops[ind]);
+                       op2=&(x->ops[ind]);
+                       op3=NULL;
+
+       }
+       s->cnt ++;
+
+}
+void free_xdotset(xdot_set* s)
+{
+       int idx;
+       if (!s)
+               return ;
+
+       for (idx=0;idx < s->cnt ; idx ++)
+       {
+               if (s->obj[idx])
+                       free(s->obj[idx]);
+               if (s->xdots[idx])
+                       freeXDot(s->xdots[idx]);
+       }
+       free (s);
+}
+
+xdot_set* init_xdot_set()
+{
+       xdot_set* rv;
+       rv=malloc(sizeof(xdot_set));
+       rv->cnt=0;
+       rv->capacity=INITIAL_XDOT_CAPACITY;
+       rv->obj=malloc (sizeof(void*)* INITIAL_XDOT_CAPACITY);
+       rv->xdots=malloc (sizeof(xdot*)* INITIAL_XDOT_CAPACITY);
+       rv->obj=NULL;
+       rv->xdots=NULL;
+
+       return rv;
+}
+void print_xdot_set(xdot_set* s)
+{
+       int ind=0;
+       printf("------------------------------------------\n");
+       printf ("# of xdots in set:%d\n",s->cnt);
+
+       for (ind=0;ind < s->cnt ; ind ++)
+       {
+               printf ("xdot id: %d count: %d",ind,s->xdots[ind]->cnt);
+
+       }
+}
+
+void draw_xdot_set(xdot_set* s)
+{
+       int ind=0;
+       int ind2=0;
+       for (ind=0;ind < s->cnt ; ind ++)
+       {
+               for (ind2=0;ind2 < s->xdots[ind]->cnt ; ind2 ++)
+               {
+                       xdot_op* op;
+                       op=&s->xdots[ind]->ops[ind2];
+                       if(op->drawfunc)
+                               op->drawfunc(op,0);
+               }
+       }
+}
+
+
+
+
+
+
+
 
 #if 0
 static void 
index 9350da8df87e28d3c27de98d019f4699b17eb327..c34408f50110dec27bee26851a968498ee5cca8c 100755 (executable)
@@ -20,6 +20,7 @@
 #include <windows.h>
 #endif
 #include "cgraph.h"
+#define INITIAL_XDOT_CAPACITY 512
 
 typedef enum {
     xd_left, xd_center, xd_right
@@ -95,6 +96,14 @@ typedef struct {
     int sz;
     xdot_op* ops;
 } xdot;
+/*xdot collection*/
+typedef struct _xdot_set
+{
+       int cnt;        /*number of xdots*/
+       int capacity;
+       void** obj; /*a pointer to the original object (node edge graph) can be stored here*/
+       xdot** xdots;   /*xdot collection*/
+}xdot_set;
 
 /* ops are indexed by xop_kind */
 extern xdot* parseXDotF (char*, drawfunc_t ops[], int sz);
@@ -102,4 +111,10 @@ extern xdot* parseXDot (char*);
 extern char* sprintXDot (xdot*);
 extern void fprintXDot (FILE*, xdot*);
 extern void freeXDot (xdot*);
+extern void free_xdotset(xdot_set* s);
+extern xdot_set* init_xdot_set();
+extern void add_to_xdot_set(xdot_set* s,xdot *x);
+extern void print_xdot_set(xdot_set* s);
+
+
 #endif