]> granicus.if.org Git - graphviz/commitdiff
gvpr bug fix
authorarif <devnull@localhost>
Wed, 18 Nov 2009 22:05:48 +0000 (22:05 +0000)
committerarif <devnull@localhost>
Wed, 18 Nov 2009 22:05:48 +0000 (22:05 +0000)
cmd/smyrna/glexpose.c
cmd/smyrna/gvprpipe.c
cmd/smyrna/gvprpipe.h
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topview.c

index e40196a618da112c4463e299621f948d86074919..55be9fde3b9e47b224256a968a92811cf6a14f98 100644 (file)
@@ -126,7 +126,12 @@ int glupdatecamera(ViewInfo * view)
        glTranslatef(-view->cameras[view->active_camera]->targetx,
                     -view->cameras[view->active_camera]->targety, 0);
     }
-
+    view->clipX1=0;
+    view->clipX2=0;
+    view->clipY1=0;
+    view->clipY2=0;
+    view->clipZ1=0;
+    view->clipZ2=0;
     GetOGLPosRef(1, view->h - 5, &(view->clipX1), &(view->clipY1),
                 &(view->clipZ1));
     GetOGLPosRef(view->w - 1, 1, &(view->clipX2), &(view->clipY2),
index d27497915695ca493ad62890060719e3b95d1f8a..a79e5735a01dd8548b994b077ed1a720c61a4a10 100644 (file)
@@ -14,6 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
+#include "smyrnadefs.h"
 #include "gvprpipe.h"
 #include "const.h"
 #include <stdio.h>
 
 #include <gvpr.h>
 extern GladeXML *xml;          //global libglade vars
+
+/*    typedef struct {
+       char* def;
+       char *script;
+       char *args;
+       char *attr_name;        
+       void* obj;
+       gvpr_arg_type arg_type;
+    } gvprscript;*/
+    //_on_click="(gvpr_no_arg)N{node.color="red"){N.color="blue"}";
+
+
+/*arg_type get_arg_type(char* str)
+{
+    
+
+
+}*/
+
+gvprscript* scr_from_string(char* str,void* obj)
+{
+
+
+}
+
+
+
 static ssize_t outfn(void *sp, const char *buf, size_t nbyte, void *dp)
 {
 
@@ -46,6 +74,19 @@ static ssize_t errfn(void *sp, const char *buf, size_t nbyte, void *dp)
     return 0;
 }
 #endif
+static void set_refresh(ViewInfo* v,char* script)
+{
+    if(strstr(script,"pos"))
+       v->refresh.pos=1;
+    if(strstr(script,"color"))
+       v->refresh.color=1;
+    if(strstr(script,"visible"))
+       v->refresh.visibility=1;
+    if(strstr(script,"size"))
+       v->refresh.nodesize=1;
+    if(strstr(script,"selected"))
+       v->refresh.selection=1;
+}
 
 int run_gvpr(Agraph_t * srcGraph, int argc, char *argv[])
 {
@@ -66,7 +107,8 @@ int run_gvpr(Agraph_t * srcGraph, int argc, char *argv[])
 
     if (rv) {                  /* error */
        fprintf(stderr, "Error in gvpr\n");
-    } else if (opts.n_outgraphs) {
+    } else if (opts.n_outgraphs) 
+    {
        refreshViewport(0);
        sprintf(buf, "<%d>", ++count);
        if (opts.outgraphs[0] != view->g[view->activeGraph])
@@ -76,8 +118,11 @@ int run_gvpr(Agraph_t * srcGraph, int argc, char *argv[])
        for (i = 1; i < opts.n_outgraphs; i++) {
            agclose(opts.outgraphs[i]);
        }
-    } else {
-       refreshViewport(0);
+    } else 
+    { 
+       set_refresh(view,argv[1]);
+        update_graph_from_settings(srcGraph);
+       update_topview(srcGraph, view->Topview, 0);
     }
     return rv;
 }
index 38c52b88accbae82b7b878b61e0f29fc14b4063a..91e7f58bc9c42642362bb0b471580f233dc36dac 100644 (file)
@@ -22,8 +22,8 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+    extern int run_gvpr(Agraph_t * srcGraph, int argc, char *argv[]);
 
-    extern int run_gvpr(Agraph_t * srcGraph, int, char **);
 
 #ifdef __cplusplus
 }                              /* end extern "C" */
index be1b1451e50f6faf4d4868cd1e71a60d94845231..3cd4bdc35daed2d237b701f0c0e6c5ed9d24c776 100644 (file)
@@ -164,11 +164,18 @@ typedef struct
 
     } colorschema;
 
+    typedef enum { gvpr_no_arg,gvpr_obj_arg,gvpr_string_arg,gvpr_sel_node_arg,gvpr_sel_edge_arg} gvpr_arg_type;
+
     typedef struct {
+       char* def;
        char *script;
        char *args;
        char *attr_name;        /*attribute name to identify script in the graph */
+       void* obj;
+       gvpr_arg_type arg_type;
     } gvprscript;
+    //_on_click="(gvpr_no_arg)N{node.color="red"){N.color="blue"}";
+
 
     typedef struct {
        int schemacount;
index e79af1e1eae00f3a80fc40e196895255d90033f2..91ba53a936253b00c8aeea6361db6fdb3f233f1e 100755 (executable)
@@ -255,23 +255,6 @@ void settvcolorinfo(Agraph_t * g, topview * t)
     for (ind = 0; ind < t->Edgecount; ind++) 
     {
        ep = t->Edges + ind;
-       if(view->refresh.color)
-       {
-               if (ecolor && (color_string = agxget(ep->Edge, ecolor))
-                   && (*color_string != '\0')&& (strlen(color_string)>0))
-                       setglCompColor(&color, color_string);
-               else {                  /*use color theme */
-                   getcolorfromschema(view->colschms, ep->length, t->maxedgelen,&color);
-                   color.tag = 0;}
-               ep->Color = color;
-
-       }
-       ep->data.edgeid = boolAttr(ep->Edge, edgeid, 0);
-       if(view->refresh.selection)
-           ep->data.Selected = boolAttr(ep->Edge, sel, 0);
-       if(view->refresh.visibility)
-           ep->data.Visible = visible(ep->Edge, vis, sty);
-
        if(view->refresh.pos)
        {
            ep->x1 = ep->Node1->x;
@@ -288,6 +271,24 @@ void settvcolorinfo(Agraph_t * g, topview * t)
                minedgelen = len;
            ep->length = len;
        }
+
+       if(view->refresh.color)
+       {
+               if (ecolor && (color_string = agxget(ep->Edge, ecolor))
+                   && (*color_string != '\0')&& (strlen(color_string)>0))
+                       setglCompColor(&color, color_string);
+               else {                  /*use color theme */
+                   getcolorfromschema(view->colschms, ep->length, t->maxedgelen,&color);
+                   color.tag = 0;}
+               ep->Color = color;
+
+       }
+       ep->data.edgeid = boolAttr(ep->Edge, edgeid, 0);
+       if(view->refresh.selection)
+           ep->data.Selected = boolAttr(ep->Edge, sel, 0);
+       if(view->refresh.visibility)
+           ep->data.Visible = visible(ep->Edge, vis, sty);
+
     }
        if(view->refresh.pos)
        {
@@ -344,12 +345,12 @@ void init_node_size(Agraph_t * g, topview * t)
        0.05 * sqrt((view->bdxRight - view->bdxLeft) *
                    (view->bdyTop - view->bdyBottom));
     t->init_node_size =
-       vsize * 2 / GetOGLDistance(2) * percent / 100.0 /
+       vsize * 2 / percent / 100.0 /
        sqrt(t->Nodecount);
     if (t->init_node_size < 1)
        t->init_node_size=1;
-    t->init_zoom = view->zoom;
-
+//    t->init_zoom = view->zoom;
+    t->init_zoom=-20;
 }
 
 static void reset_refresh(ViewInfo* v)
@@ -375,14 +376,17 @@ void update_topview(Agraph_t * g, topview * t, int init)
     settvcolorinfo(g, t);
     set_boundaries(t);
     settvxdot(view->g[view->activeGraph], view->Topview);
-    init_node_size(g, t);
     reset_refresh(view);
     if (init)/*one time call to calculate right colors*/
     {
        view->refresh.color=1;
+       view->refresh.pos=1;
        settvcolorinfo(g, t);
         reset_refresh(view);
+        set_boundaries(t);
     }
+       init_node_size(g, t);
+
 
     /*This is a temp code , need to be removed after Xue's demo */
 #if UNUSED