From: arif Date: Fri, 10 Oct 2008 19:41:33 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: LAST_LIBGRAPH~32^2~3184 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65de0c1ec2da615f6a6d87432dd54b8cfcb8b056;p=graphviz *** empty log message *** --- diff --git a/cmd/smyrna/gui/toolboxcallbacks.c b/cmd/smyrna/gui/toolboxcallbacks.c index ccd794d61..d7a5cdb19 100755 --- a/cmd/smyrna/gui/toolboxcallbacks.c +++ b/cmd/smyrna/gui/toolboxcallbacks.c @@ -83,8 +83,85 @@ void btnToolZoomOut_clicked(GtkWidget * widget, gpointer user_data) expose_event(view->drawing_area, NULL, NULL); } +void btnToolZoomFit_clicked(GtkWidget * widget, gpointer user_data) +{ + + float scx,scy,gcx,gcy,z,GDX,SDX; + + (view->active_camera >=0) + ? (z=view->cameras[view->active_camera]->r):(z=view->zoom*-1); + + GDX=(view->bdxRight/z-view->bdxLeft/z); + SDX=(view->clipX2 -view->clipX1); + GDY=(view->bdxTop/z-view->bdxBottom/z); + SDY=(view->clipY2 -view->clipY1); + + if ((SDX / GDX) <= (SDY / GDY)) + { + (view->active_camera >=0) ? + (view->cameras[view->active_camera]->r=view->cameras[view->active_camera]->r/ (SDX/GDX) ): + (view->zoom = view->zoom /(SDX/GDX)); + } + else + { + (view->active_camera >=0) ? + (view->cameras[view->active_camera]->r=view->cameras[view->active_camera]->r/ (SDY/GDY) ): + (view->zoom = view->zoom /(SDY/GDY)); + + } + +} + void btnToolFit_clicked(GtkWidget * widget, gpointer user_data) { + float scx,scy,gcx,gcy,z,GDX,SDX; + printf ("graph boundry summary\n"); + printf ("---------------------\n"); + printf ("G (%f,%f) - (%f,%f)\n",view->bdxLeft/view->zoom*-1,view->bdyBottom/view->zoom + *-1,view->bdxRight/view->zoom*-1,view->bdyTop/view->zoom*-1); + printf ("Scr (%f,%f) - (%f,%f)\n",view->clipX1 ,view->clipY1 ,view->clipX2 ,view->clipY2); + printf ("Old Panx:%f\n",view->panx); + + + (view->active_camera >=0) + ? (z=view->cameras[view->active_camera]->r):(z=view->zoom*-1); + + + + printf ("Z:%f BDX:%f zoom * BDX :%f\n",z,(view->bdxRight/z-view->bdxLeft/z),z*(view->bdxRight/z-view->bdxLeft/z)); + + + + + + gcx=view->bdxLeft/z+(view->bdxRight/z-view->bdxLeft/z)/(float)(2.0); + scx=view->clipX1+(view->clipX2 -view->clipX1)/(float)(2.0); + gcy=view->bdyBottom/z+(view->bdyTop/z-view->bdyBottom/z)/(float)(2.0); + scy=view->clipY1+(view->clipY2 -view->clipY1)/(float)(2.0); + + + + if (view->active_camera >=0) + { + + view->cameras[view->active_camera]->targetx +=(gcx-scx); + view->cameras[view->active_camera]->targety +=(gcx-scy); + } + else + { + float GDX=(view->bdxRight/z-view->bdxLeft/z); + float SDX=(view->clipX2 -view->clipX1); + printf ("GDX:%f SDX:%f \n",GDX,SDX); + view->panx += (gcx-scx); + view->pany += (gcy-scy); + view->zoom = view->zoom /(SDX/GDX); + } + + printf ("scx:%f\n",scx); + printf ("gcx:%f\n",gcx); + printf ("New Panx:%f\n",view->panx); + + glexpose(); } void btnToolMove_clicked(GtkWidget * widget, gpointer user_data) { diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index d0078bd3f..3c0de828e 100755 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -123,6 +123,7 @@ int main(int argc, char *argv[]) package_data_dir = g_build_filename(package_prefix, "share", NULL); package_locale_dir = g_build_filename(package_prefix, "share", "locale", NULL); + add_pixmap_directory("C:/"); #else if (smyrnaDir) package_locale_dir = g_build_filename(smyrnaDir, "locale", NULL); @@ -136,7 +137,6 @@ int main(int argc, char *argv[]) #endif view = NEW(ViewInfo); init_viewport(view); - gtk_set_locale(); gtk_init(&argc, &argv); initFileName = parseArgs (argc, argv, view); diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index cb4e1c612..1155dc0fb 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -237,7 +237,7 @@ static float set_gl_dot_size(topview * t) dotsize=dotsize * DOT_SIZE_CORRECTION_FAC; if (dotsize <=1) - dotsize=1; + dotsize=4; glPointSize(dotsize); return dotsize; @@ -303,7 +303,7 @@ static int drawtopviewnodes(Agraph_t * g) view->clipY1) && (-view->Topview->Nodes[ind].y / view->zoom < view->clipY2)) - || (view->active_camera >= 0)) { + || (view->active_camera >= 0) ) { float zdepth; v = &view->Topview->Nodes[ind]; if (!node_visible(v->Node)) @@ -335,7 +335,7 @@ static int drawtopviewnodes(Agraph_t * g) else zdepth = (float) Z_BACK_PLANE; - if ((view->defaultnodeshape==0) || dotsize == 1) + if ((view->defaultnodeshape==0)) { glVertex3f(v->distorted_x - ddx, v->distorted_y - ddy, v->distorted_z - ddz); @@ -716,7 +716,7 @@ static int draw_topview_label(topview_node * v, float zdepth) 1) * (double) 3) : (float) (log((double) v->degree + (double) 0.5) * - (double) 3); + (double) 3)*15; fs = fs * v->zoom_factor; if (OD_Selected(v->Node) == 1) { ddx = dx; @@ -735,7 +735,7 @@ static int draw_topview_label(topview_node * v, float zdepth) fontDrawString((int) (v->distorted_x - ddx), (int) (v->distorted_y - ddy), v->Label, - (int) (fs * 5)); + (int) (fs * strlen(v->Label))); return 1; } else