From: arif Date: Thu, 19 Nov 2009 18:15:49 +0000 (+0000) Subject: bug fixes: X-Git-Tag: LAST_LIBGRAPH~32^2~1556 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=883062f1f83eb9b99b05d6f30a66757498974098;p=graphviz bug fixes: 1-node size 2-node alpha 3-selection --- diff --git a/cmd/smyrna/gui/appmouse.c b/cmd/smyrna/gui/appmouse.c index c64fbd8b0..f0153b9eb 100644 --- a/cmd/smyrna/gui/appmouse.c +++ b/cmd/smyrna/gui/appmouse.c @@ -100,9 +100,9 @@ static void appmouse_down(ViewInfo* v,int x,int y) v->mouse.initPos.y=y; v->mouse.pos.x=x; v->mouse.pos.y=y; - - GetFixedOGLPos((float) x,y, v->GLDepth,&v->mouse.GLinitPos.x,&v->mouse.GLinitPos.y,&v->mouse.GLinitPos.z); - GetFixedOGLPos((float) x,y,v->GLDepth, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z); + + to3D(x,y,&v->mouse.GLinitPos.x,&v->mouse.GLinitPos.y,&v->mouse.GLinitPos.z); + to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z); prevX=0; prevY=0; @@ -118,7 +118,7 @@ static void appmouse_up(ViewInfo* v,int x,int y) v->mouse.finalPos.x=x; v->mouse.finalPos.y=y; a=get_mode(v); - GetFixedOGLPos((float) x,y,v->GLDepth, &v->mouse.GLfinalPos.x,&v->mouse.GLfinalPos.y,&v->mouse.GLfinalPos.z); + to3D(x,y, &v->mouse.GLfinalPos.x,&v->mouse.GLfinalPos.y,&v->mouse.GLfinalPos.z); if(singleclick(v)) { if (v->mouse.t==glMouseLeftButton) @@ -138,7 +138,7 @@ static void appmouse_drag(ViewInfo* v,int x,int y) static float x2,y2; v->mouse.pos.x=x; v->mouse.pos.y=y; - GetFixedOGLPos((float) x,y,v->GLDepth, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z); + to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z); x2=v->mouse.GLpos.x; y2=v->mouse.GLpos.y; prevX=x2; diff --git a/cmd/smyrna/gui/beacon.c b/cmd/smyrna/gui/beacon.c index e0579b59d..7fed35bb7 100644 --- a/cmd/smyrna/gui/beacon.c +++ b/cmd/smyrna/gui/beacon.c @@ -85,6 +85,10 @@ void pick_node_from_coords(float x, float y, float z) sn = (topview_node *) 0; se = (topview_edge *) 0; + + + + for (ind = 0; ind < view->Topview->Nodecount; ind++) { n = &view->Topview->Nodes[ind]; if (!n->data.Visible) diff --git a/cmd/smyrna/gui/topviewsettings.c b/cmd/smyrna/gui/topviewsettings.c index 3f421d23f..b4efef8d8 100644 --- a/cmd/smyrna/gui/topviewsettings.c +++ b/cmd/smyrna/gui/topviewsettings.c @@ -26,6 +26,10 @@ void color_change_request(GtkWidget * widget, gpointer user_data) { view->refresh.color=1; } +void size_change_request(GtkWidget * widget, gpointer user_data) +{ + view->refresh.nodesize=1; +} void on_settingsOKBtn_clicked(GtkWidget * widget, gpointer user_data) { diff --git a/cmd/smyrna/gui/topviewsettings.h b/cmd/smyrna/gui/topviewsettings.h index abf0154f0..bc4abcd9b 100644 --- a/cmd/smyrna/gui/topviewsettings.h +++ b/cmd/smyrna/gui/topviewsettings.h @@ -29,6 +29,7 @@ extern "C" { _BB void on_settingsApplyBtn_clicked(GtkWidget * widget, gpointer user_data); _BB void color_change_request(GtkWidget * widget, gpointer user_data); + _BB void size_change_request(GtkWidget * widget, gpointer user_data); extern int load_settings_from_graph(Agraph_t * g); extern int update_graph_from_settings(Agraph_t * g); diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 91ba53a93..d8a4079e5 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -119,7 +119,7 @@ static void setglCompColor(glCompColor * c, char *colorstr) c->R = (float) cl.u.RGBA[0]; c->G = (float) cl.u.RGBA[1]; c->B = (float) cl.u.RGBA[2]; - c->A = (float) cl.u.RGBA[3]*A; + c->A = (float) cl.u.RGBA[3]*view->defaultnodealpha; } @@ -220,12 +220,14 @@ void settvcolorinfo(Agraph_t * g, topview * t) np->data.Visible = visible(np->Node, vis, sty); if(view->refresh.nodesize) { - tempStr=agget(t->Nodes[ind].Node, "size"); + t->Nodes[ind].size = 0; + tempStr=agget(t->Nodes[ind].Node, "size"); if(tempStr) { if (strlen(tempStr) > 0) /*set node size */ t->Nodes[ind].size = atof(tempStr); } + } if (t->Nodes[ind].degree > t->maxnodedegree) t->maxnodedegree = t->Nodes[ind].degree; @@ -335,6 +337,25 @@ void settvxdot(Agraph_t * g, topview * t) } } void init_node_size(Agraph_t * g, topview * t) +{ + float vsize; + int percent; + percent = atoi(agget(g, "nodesize")); + if (percent == 0) + percent = 0.000001; + vsize = + 0.05 * sqrt((view->bdxRight - view->bdxLeft) * + (view->bdyTop - view->bdyBottom)); + t->init_node_size = 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 = -20; + +} + +void _init_node_size(Agraph_t * g, topview * t) { float vsize; int percent; @@ -345,14 +366,14 @@ 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 / percent / 100.0 / + vsize * 2 / GetOGLDistance(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=-20; + t->init_zoom = view->zoom; } + static void reset_refresh(ViewInfo* v) { v->refresh.color=0; @@ -680,7 +701,7 @@ static int drawtopviewnodes(Agraph_t * g) view->selectedNodeColor.A); } else { //get the color from node glColor4f(v->Color.R, v->Color.G, v->Color.B, - v->node_alpha); + v->Color.A); ddx = 0; ddy = 0; ddz = 0; diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 9651f4b08..344df235b 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -634,7 +634,11 @@ int add_graph_to_viewport_from_file(char *fileName) void refreshViewport(int doClear) { Agraph_t *graph = view->g[view->activeGraph]; - + view->refresh.color=1; + view->refresh.nodesize=1; + view->refresh.pos=1; + view->refresh.selection=1; + view->refresh.visibility=1; load_settings_from_graph(graph); update_graph_from_settings(graph); set_viewport_settings_from_template(view, graph); diff --git a/lib/gvpr/compile.c b/lib/gvpr/compile.c index 613480862..7d239e7e9 100644 --- a/lib/gvpr/compile.c +++ b/lib/gvpr/compile.c @@ -77,7 +77,7 @@ static int ioflush(void *chan) static Agiodisc_t gprIoDisc = { iofread, ioputstr, ioflush }; -#ifdef GVDLL +#ifdef WIN32 static Agdisc_t gprDisc = { 0, 0, &gprIoDisc }; #else static Agdisc_t gprDisc = { &AgMemDisc, &AgIdDisc, &gprIoDisc }; @@ -2457,7 +2457,7 @@ Agraph_t *readG(Sfio_t * fp) { Agraph_t *g; -#ifdef GVDLL +#ifdef WIN32 gprDisc.mem = &AgMemDisc; gprDisc.id = &AgIdDisc; #endif @@ -2477,7 +2477,7 @@ Agraph_t *openG(char *name, Agdesc_t desc) { Agraph_t *g; -#ifdef GVDLL +#ifdef WIN32 gprDisc.mem = &AgMemDisc; gprDisc.id = &AgIdDisc; #endif