]> granicus.if.org Git - graphviz/commitdiff
*** empty log message ***
authorarif <devnull@localhost>
Fri, 10 Oct 2008 19:41:33 +0000 (19:41 +0000)
committerarif <devnull@localhost>
Fri, 10 Oct 2008 19:41:33 +0000 (19:41 +0000)
cmd/smyrna/gui/toolboxcallbacks.c
cmd/smyrna/main.c
cmd/smyrna/topview.c

index ccd794d613a74cd680b23dab34718952ce89ea96..d7a5cdb19d57fb1a92b61f6215d1dfd827587a79 100755 (executable)
@@ -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)
 {
index d0078bd3f2a965ba7cd41d646c1934763c04f13b..3c0de828e4e15dbf51325965efefdc7cd8be18b9 100755 (executable)
@@ -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);
index cb4e1c612bb5840ce940c021cba7f32cfbffc12d..1155dc0fb3d28cc03d271fe8b1a6a4c682da6d33 100755 (executable)
@@ -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