From: arif Date: Wed, 18 Nov 2009 22:05:48 +0000 (+0000) Subject: gvpr bug fix X-Git-Tag: LAST_LIBGRAPH~32^2~1557 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18e10baa895ed9781940069fcaf4a9377c60d734;p=graphviz gvpr bug fix --- diff --git a/cmd/smyrna/glexpose.c b/cmd/smyrna/glexpose.c index e40196a61..55be9fde3 100644 --- a/cmd/smyrna/glexpose.c +++ b/cmd/smyrna/glexpose.c @@ -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), diff --git a/cmd/smyrna/gvprpipe.c b/cmd/smyrna/gvprpipe.c index d27497915..a79e5735a 100644 --- a/cmd/smyrna/gvprpipe.c +++ b/cmd/smyrna/gvprpipe.c @@ -14,6 +14,7 @@ * AT&T Research, Florham Park NJ * **********************************************************/ +#include "smyrnadefs.h" #include "gvprpipe.h" #include "const.h" #include @@ -29,6 +30,33 @@ #include 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; } diff --git a/cmd/smyrna/gvprpipe.h b/cmd/smyrna/gvprpipe.h index 38c52b88a..91e7f58bc 100644 --- a/cmd/smyrna/gvprpipe.h +++ b/cmd/smyrna/gvprpipe.h @@ -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" */ diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index be1b1451e..3cd4bdc35 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -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; diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index e79af1e1e..91ba53a93 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -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