]> granicus.if.org Git - graphviz/commitdiff
Use a fixed initial geometry for -Txlib, and scale graph to fit.
authorellson <devnull@localhost>
Sat, 13 Sep 2008 21:23:06 +0000 (21:23 +0000)
committerellson <devnull@localhost>
Sat, 13 Sep 2008 21:23:06 +0000 (21:23 +0000)
plugin/xlib/gvdevice_xlib.c

index 0126295ffea465dcaf30863b3c5dff689fcbbc9a..4e03c0772b3b4d092a0280fab5d172196b34c1a2 100644 (file)
@@ -291,12 +291,26 @@ static void init_window(GVJ_t *job, Display *dpy, int scr)
     unsigned long attributemask = 0;
     char *name;
     window_t *window;
+    int w, h;
+    double zoom_to_fit;
 
     window = (window_t *)malloc(sizeof(window_t));
     if (window == NULL) {
        fprintf(stderr, "Failed to malloc window_t\n");
        return;
     }
+
+    w = 480;    /* FIXME - w,h should be set by a --geometry commandline option */
+    h = 325;
+    
+    zoom_to_fit = MIN((double) w / (double) job->width,
+                       (double) h / (double) job->height);
+    if (zoom_to_fit < 1.0) /* don't make bigger */
+       job->zoom *= zoom_to_fit;
+
+    job->width  = w;    /* use window geometry */
+    job->height = h;
+
     job->window = (void *)window;
     job->fit_mode = 0;
     job->needs_refresh = 1;