home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume21 / xfig / patch02f / xfig.07
Encoding:
Text File  |  1993-10-21  |  30.5 KB  |  1,001 lines

  1. !     for (i = 1; i < NUM_PS_FONTS + 1; i++)
  2. !     if (ps_fontinfo[i].xfontnum == f)
  3. !         {
  4. !         sprintf(fn, "%s-%d", ps_fontinfo[i].name, s);
  5. !         break;
  6. !         }
  7. !     for (i = strlen(fn) - 1; i >= 0; i--)
  8. !     if (isupper(fn[i]))
  9. !         fn[i] = tolower(fn[i]);
  10. !     if (appres.DEBUG)
  11. !     fprintf(stderr, "Loading font %s\n", fn);
  12. !     set_temp_cursor(wait_cursor);
  13. !     app_flush();
  14. !     fontst = XRotLoadFont(tool_d, fn, angle);
  15. !     if (fontst == NULL) {
  16. !     fprintf(stderr, "xfig: Can't load font %s ?!, using %s\n",
  17. !         fn, appres.normalFont);
  18. !     fontst = XRotLoadFont(tool_d, appres.normalFont, angle);
  19. !     }
  20. !     reset_cursor();
  21. !     return (fontst);
  22. !   }
  23. ! #else
  24. !   {
  25.       char        fn[128];
  26.       char        template[200];
  27.       Boolean        found;
  28.       struct xfont   *newfont, *nf, *oldnf;
  29. -     struct flist   *lp, *nlp, *oldlp;
  30.   
  31. !     /* see if we've already loaded that font size 's' at angle 'angle' 
  32.          from the font family 'f' */
  33. !     /* actually, we've reduced the number of angles to four - 0, 90, 180 and 270 */
  34. !     if (angle < 0.0)
  35. !         angle += 2.0*M_PI;
  36. !     dir = (int)(angle/M_PI_2+0.0001);
  37. !     if (dir > 3)
  38. !         dir -= 4;
  39.       found = False;
  40. !     /* start with the basic font name (e.g. adobe-times-medium-r-normal-...) */
  41.       nf = x_fontinfo[f].xfontlist;
  42.       oldnf = nf;
  43.       if (nf != NULL) {
  44. --- 199,232 ----
  45.   }
  46.   
  47.   /*
  48. !  * Lookup an X font, "f" corresponding to a Postscript font style that is 
  49. !  * close in size to "s"
  50.    */
  51.   
  52. ! PIX_FONT
  53. ! lookfont(f, s)
  54.       int            f, s;
  55.   {
  56. !     PIX_FONT        fontst;
  57.       char        fn[128];
  58.       char        template[200];
  59.       Boolean        found;
  60.       struct xfont   *newfont, *nf, *oldnf;
  61.   
  62. !     if (f == DEFAULT)
  63. !         f = 0;        /* pass back the -normal font font */
  64. !     if (s < 0)
  65. !         s = DEF_FONTSIZE;    /* default font size */
  66. !     /* see if we've already loaded that font size 's' 
  67.          from the font family 'f' */
  68.       found = False;
  69. !     /* start with the basic font name (e.g. adobe-times-medium-r-normal-... 
  70. !         OR times-roman for OpenWindows fonts) */
  71.       nf = x_fontinfo[f].xfontlist;
  72.       oldnf = nf;
  73.       if (nf != NULL) {
  74. ***************
  75. *** 268,278 ****
  76.           strcpy(fn,nf->fname);  /* put the name in fn */
  77.           if (s < nf->size)
  78.           put_msg("Font size %d not found, using larger %d point",s,nf->size);
  79.       } else if (!appres.SCALABLEFONTS) {    /* not found, use largest available */
  80.           nf = oldnf;
  81. !         strcpy(fn,nf->fname);  /* put the name in fn */
  82.           if (s > nf->size)
  83.           put_msg("Font size %d not found, using smaller %d point",s,nf->size);
  84.       } else { /* SCALABLE; none yet of that size, alloc one and put it in the list */
  85.           newfont = (struct xfont *) malloc(sizeof(struct xfont));
  86.           /* add it on to the end of the list */
  87. --- 246,260 ----
  88.           strcpy(fn,nf->fname);  /* put the name in fn */
  89.           if (s < nf->size)
  90.           put_msg("Font size %d not found, using larger %d point",s,nf->size);
  91. +         if (appres.DEBUG)
  92. +         fprintf(stderr, "Located font %s\n", fn);
  93.       } else if (!appres.SCALABLEFONTS) {    /* not found, use largest available */
  94.           nf = oldnf;
  95. !         strcpy(fn,nf->fname);          /* put the name in fn */
  96.           if (s > nf->size)
  97.           put_msg("Font size %d not found, using smaller %d point",s,nf->size);
  98. +         if (appres.DEBUG)
  99. +         fprintf(stderr, "Using font %s for size %d\n", fn, s);
  100.       } else { /* SCALABLE; none yet of that size, alloc one and put it in the list */
  101.           newfont = (struct xfont *) malloc(sizeof(struct xfont));
  102.           /* add it on to the end of the list */
  103. ***************
  104. *** 282,369 ****
  105.               oldnf->next = newfont;
  106.           nf = newfont;        /* keep current ptr */
  107.           nf->size = s;        /* store the size here */
  108. !         nf->list = NULL;
  109.           nf->next = NULL;
  110.   
  111. !         /* create a full XLFD font name */
  112. !         strcpy(template,x_fontinfo[f].template);
  113. !         /* attach pointsize to font name */
  114. !         strcat(template,"%d-*-*-*-*-*-");
  115. !         /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
  116. !         if (strstr(template,"symbol") == NULL && 
  117.           strstr(template,"zapfdingbats") == NULL)
  118.               strcat(template,"ISO8859-*");
  119. !         else
  120.           strcat(template,"*-*");
  121. !         /* use the pixel field instead of points in the fontname so that the
  122.           font scales with screen size */
  123. !         sprintf(fn, template, s);
  124.           /* allocate space for the name and put it in the structure */
  125. !         nf->fname = (char *) malloc(strlen(fn));
  126.           strcpy(nf->fname, fn);
  127. !     } /* if (!found) */
  128. !     if (appres.DEBUG)
  129. !         fprintf(stderr, "Loading font %s at angle %f (%f)\n", 
  130. !             fn, (float) dir*90.0, angle);
  131. !     lp = nf->list;
  132. !     oldlp = lp;
  133. !     found = False;
  134. !     while (lp) {
  135. !         if (lp->dir == dir) {
  136. !             found = True;
  137. !             break;
  138. !         }
  139. !         oldlp = lp;
  140. !         lp = lp->next;
  141. !     } /* while (lp) */
  142. !     if (!found) {
  143. !         nlp = (struct flist *) malloc(sizeof(struct flist));
  144. !         nlp->next = NULL;
  145. !         if (oldlp)
  146. !             oldlp->next = nlp;    /* add this to the list */
  147. !         else
  148. !             nf->list = nlp;        /* first on the list */
  149. !         nlp->dir = dir;
  150. !         set_temp_cursor(wait_cursor);
  151. !         app_flush();
  152. !         fontst = XRotLoadFont(tool_d, fn, (float) dir*90.0);
  153. !         reset_cursor();
  154. !         if (fontst == NULL) {
  155. !             fprintf(stderr, "xfig: Can't load font %s ?!, using %s\n",
  156.               fn, appres.normalFont);
  157. !             fontst = XRotLoadFont(tool_d, appres.normalFont, (float) dir*90.0);
  158. !             nf->fname = fn;    /* keep actual name */
  159. !         }
  160. !         /* put the structure in the list */
  161. !         nlp->fstruct = fontst;
  162. !         lp = nlp;
  163. !     } /* if (!found) */
  164. !     fontst = lp->fstruct;
  165. !     return (fontst);
  166. !   }
  167.   
  168. ! #endif                /* !OPENWIN */
  169.   }
  170.   
  171. ! /* print "string" in window "w" using font specified in fstruct at (x,y) */
  172.   
  173. ! pw_text(w, x, y, op, fstruct, string, color)
  174.       Window        w;
  175.       int            x, y, op;
  176. !     PIX_ROT_FONT    fstruct;
  177.       char       *string;
  178.       Color        color;
  179.   {
  180.       if (fstruct == NULL)
  181.       fprintf(stderr,"Error, in pw_text, fstruct==NULL\n");
  182. !     pwx_text(w, x, y, op, fstruct, string, color);
  183.   }
  184.   
  185. ! pwx_text(w, x, y, op, fstruct, string, color)
  186.       Window        w;
  187.       int            x, y, op;
  188. !     PIX_ROT_FONT    fstruct;
  189.       char       *string;
  190.       Color        color;
  191.   {
  192. --- 264,335 ----
  193.               oldnf->next = newfont;
  194.           nf = newfont;        /* keep current ptr */
  195.           nf->size = s;        /* store the size here */
  196. !         nf->fstruct = NULL;
  197.           nf->next = NULL;
  198.   
  199. !         if (openwinfonts) {
  200. !         /* OpenWindows fonts, create font name like times-roman-13 */
  201. !         sprintf(fn, "%s-%d", x_fontinfo[f].template, s);
  202. !         } else {
  203. !         /* X11 fonts, create a full XLFD font name */
  204. !         strcpy(template,x_fontinfo[f].template);
  205. !         /* attach pointsize to font name */
  206. !         strcat(template,"%d-*-*-*-*-*-");
  207. !         /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
  208. !         if (strstr(template,"symbol") == NULL && 
  209.           strstr(template,"zapfdingbats") == NULL)
  210.               strcat(template,"ISO8859-*");
  211. !         else
  212.           strcat(template,"*-*");
  213. !         /* use the pixel field instead of points in the fontname so that the
  214.           font scales with screen size */
  215. !         sprintf(fn, template, s);
  216. !         }
  217.           /* allocate space for the name and put it in the structure */
  218. !         nf->fname = (char *) malloc(strlen(fn)+1);
  219.           strcpy(nf->fname, fn);
  220. !     } /* scalable */
  221. !     if (nf->fstruct == NULL) {
  222. !         if (appres.DEBUG)
  223. !         fprintf(stderr, "Loading font %s\n", fn);
  224. !         set_temp_cursor(wait_cursor);
  225. !         app_flush();
  226. !         fontst = XLoadQueryFont(tool_d, fn);
  227. !         reset_cursor();
  228. !         if (fontst == NULL) {
  229. !         fprintf(stderr, "xfig: Can't load font %s ?!, using %s\n",
  230.               fn, appres.normalFont);
  231. !         fontst = XLoadQueryFont(tool_d, appres.normalFont);
  232. !         nf->fname = fn;    /* keep actual name */
  233. !         }
  234. !         /* put the structure in the list */
  235. !         nf->fstruct = fontst;
  236. !     } /* if (nf->fstruct == NULL) */
  237.   
  238. !     return (nf->fstruct);
  239.   }
  240.   
  241. ! /* print "string" in window "w" using font specified in fstruct at angle
  242. !     "angle" (radians) at (x,y) */
  243.   
  244. ! pw_text(w, x, y, op, fstruct, angle, string, color)
  245.       Window        w;
  246.       int            x, y, op;
  247. !     PIX_FONT        fstruct;
  248. !     float        angle;
  249.       char       *string;
  250.       Color        color;
  251.   {
  252.       if (fstruct == NULL)
  253.       fprintf(stderr,"Error, in pw_text, fstruct==NULL\n");
  254. !     pwx_text(w, x, y, op, fstruct, angle, string, color);
  255.   }
  256.   
  257. ! pwx_text(w, x, y, op, fstruct, angle, string, color)
  258.       Window        w;
  259.       int            x, y, op;
  260. !     PIX_FONT        fstruct;
  261. !     float        angle;
  262.       char       *string;
  263.       Color        color;
  264.   {
  265. ***************
  266. *** 385,404 ****
  267.           gc_color[op] = writing_bitmap? color : x_color(color);
  268.           }
  269.       }
  270. !     zXRotDrawString(tool_d, w, fstruct, gccache[op], x, y, 
  271. !             string, strlen(string));
  272.   }
  273.   
  274.   pr_size
  275.   pf_textwidth(fstruct, n, s)
  276. !     PIX_ROT_FONT    fstruct;
  277.       int            n;
  278.       char       *s;
  279.   {
  280.       pr_size        ret;
  281.   
  282. !     ret.x = XRotTextWidth(fstruct, s, n);
  283. !     ret.y = XRotTextHeight(fstruct, s, n);
  284.       return (ret);
  285.   }
  286.   
  287. --- 351,370 ----
  288.           gc_color[op] = writing_bitmap? color : x_color(color);
  289.           }
  290.       }
  291. !     zXRotDrawString(tool_d, fstruct, angle, w, gccache[op], 
  292. !             x, y, string);
  293.   }
  294.   
  295.   pr_size
  296.   pf_textwidth(fstruct, n, s)
  297. !     PIX_FONT        fstruct;
  298.       int            n;
  299.       char       *s;
  300.   {
  301.       pr_size        ret;
  302.   
  303. !     ret.x = XTextWidth(fstruct, s, n);
  304. !     ret.y = char_height(fstruct);
  305.       return (ret);
  306.   }
  307.   
  308. ***************
  309. *** 476,487 ****
  310.       gcv.arc_mode = ArcPieSlice; /* fill mode for arcs */
  311.       gcv.fill_rule = EvenOddRule /* WindingRule */ ;
  312.       for (i = 0; i < NUMFILLPATS; i++) {
  313. !     /* make color fill pattern with black bg (fg is set later in set_x_color() */
  314.       fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_color(BLACK));
  315. !     un_fill_gc[i] = makegc(ERASE, x_fg_color.pixel, x_color(BLACK));
  316.       /* make black fill pattern with default background */
  317.       black_fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_bg_color.pixel);
  318. !     black_un_fill_gc[i] = makegc(ERASE, x_fg_color.pixel, x_bg_color.pixel);
  319.       gcv.stipple = fill_pm[i];
  320.       XChangeGC(tool_d, fill_gc[i],
  321.             GCStipple | GCFillStyle | GCFillRule | GCArcMode, &gcv);
  322. --- 442,454 ----
  323.       gcv.arc_mode = ArcPieSlice; /* fill mode for arcs */
  324.       gcv.fill_rule = EvenOddRule /* WindingRule */ ;
  325.       for (i = 0; i < NUMFILLPATS; i++) {
  326. !     /* make color fill pattern with black bg - fg is set later in set_fillgc() */
  327.       fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_color(BLACK));
  328. !     /* make un-fill gc's with canvas background color as foreground */
  329. !     un_fill_gc[i] = makegc(PAINT, x_bg_color.pixel, x_color(BLACK));
  330.       /* make black fill pattern with default background */
  331.       black_fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_bg_color.pixel);
  332. !     black_un_fill_gc[i] = makegc(PAINT, x_bg_color.pixel, x_fg_color.pixel);
  333.       gcv.stipple = fill_pm[i];
  334.       XChangeGC(tool_d, fill_gc[i],
  335.             GCStipple | GCFillStyle | GCFillRule | GCArcMode, &gcv);
  336. ***************
  337. *** 744,755 ****
  338.       Color        color;
  339.   {
  340.       short        xmin, ymin;
  341. !     unsigned short  wd, ht;
  342.   
  343. !     xmin = (short) min2(xstart, xend);
  344. !     ymin = (short) min2(ystart, yend);
  345. !     wd = (unsigned short) abs(xstart - xend);
  346. !     ht = (unsigned short) abs(ystart - yend);
  347.   
  348.       /* if it's a fill pat we know about */
  349.       if (fill_style >= 1 && fill_style <= NUMFILLPATS) {
  350. --- 711,722 ----
  351.       Color        color;
  352.   {
  353.       short        xmin, ymin;
  354. !     unsigned int    wd, ht;
  355.   
  356. !     xmin = min2(xstart, xend);
  357. !     ymin = min2(ystart, yend);
  358. !     wd = (unsigned int) abs(xstart - xend);
  359. !     ht = (unsigned int) abs(ystart - yend);
  360.   
  361.       /* if it's a fill pat we know about */
  362.       if (fill_style >= 1 && fill_style <= NUMFILLPATS) {
  363. ***************
  364. *** 891,899 ****
  365.       Color        color;
  366.   {
  367.       if (op == PAINT) {
  368. !     fillgc = ((color==BLACK || 
  369. !          (color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK]) ||
  370. !          (!all_colors_available && color!=WHITE))? 
  371.           black_fill_gc[fill_style - 1]: fill_gc[fill_style - 1]);
  372.       if (writing_bitmap)
  373.           {
  374. --- 858,865 ----
  375.       Color        color;
  376.   {
  377.       if (op == PAINT) {
  378. !     fillgc = (color==BLACK || 
  379. !          (color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK])?
  380.           black_fill_gc[fill_style - 1]: fill_gc[fill_style - 1]);
  381.       if (writing_bitmap)
  382.           {
  383. ***************
  384. *** 904,915 ****
  385.           XSetForeground(tool_d,fillgc,color);
  386.           }
  387.       else
  388. !         set_x_color(fillgc, color);
  389.       } else
  390. !     fillgc = ((color==BLACK || 
  391. !          (color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK]) ||
  392. !          (!all_colors_available && color!=WHITE))? 
  393. !         black_un_fill_gc[fill_style - 1]: un_fill_gc[fill_style - 1]);
  394.       XSetClipRectangles(tool_d, fillgc, 0, 0, clip, 1, YXBanded);
  395.   }
  396.   
  397. --- 870,880 ----
  398.           XSetForeground(tool_d,fillgc,color);
  399.           }
  400.       else
  401. !         set_fill_color(fillgc, color);
  402.       } else
  403. !     fillgc = (color==BLACK || 
  404. !          (color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK])?
  405. !         black_un_fill_gc[NUMFILLPATS-1]: un_fill_gc[NUMFILLPATS-1]);
  406.       XSetClipRectangles(tool_d, fillgc, 0, 0, clip, 1, YXBanded);
  407.   }
  408.   
  409. ***************
  410. *** 920,926 ****
  411.   {
  412.       XGCValues        gcv;
  413.       unsigned long   mask;
  414. !     static unsigned char dash_list[2] = {-1, -1};
  415.   
  416.       switch (style) {
  417.       case RUBBER_LINE:
  418. --- 885,891 ----
  419.   {
  420.       XGCValues        gcv;
  421.       unsigned long   mask;
  422. !     static unsigned char dash_list[2] = {255, 255};
  423.   
  424.       switch (style) {
  425.       case RUBBER_LINE:
  426. ***************
  427. *** 952,958 ****
  428.   
  429.       if (width == gc_thickness[op] && style == gc_line_style[op] &&
  430.       (writing_bitmap? color == gc_color[op] : x_color(color) == gc_color[op]) &&
  431. !     (style != DASH_LINE && style != DOTTED_LINE ||
  432.        dash_list[1] == (char) round(style_val * zoomscale)))
  433.       return;            /* no need to change anything */
  434.   
  435. --- 917,923 ----
  436.   
  437.       if (width == gc_thickness[op] && style == gc_line_style[op] &&
  438.       (writing_bitmap? color == gc_color[op] : x_color(color) == gc_color[op]) &&
  439. !     ((style != DASH_LINE && style != DOTTED_LINE) ||
  440.        dash_list[1] == (char) round(style_val * zoomscale)))
  441.       return;            /* no need to change anything */
  442.   
  443. diff -rc xfig.2.1.7a/w_drawprim.h xfig.2.1.8/w_drawprim.h
  444. *** xfig.2.1.7a/w_drawprim.h    Wed Jan  6 11:26:39 1993
  445. --- xfig.2.1.8/w_drawprim.h    Fri Sep  3 11:14:29 1993
  446. ***************
  447. *** 14,20 ****
  448.   extern PIX_FONT bold_font;
  449.   extern PIX_FONT roman_font;
  450.   extern PIX_FONT button_font;
  451. ! extern PIX_ROT_FONT canvas_font;
  452.   
  453.   /* Maximum number of points for polygons etc */
  454.   #define        MAXNUMPTS    10000
  455. --- 14,20 ----
  456.   extern PIX_FONT bold_font;
  457.   extern PIX_FONT roman_font;
  458.   extern PIX_FONT button_font;
  459. ! extern PIX_FONT canvas_font;
  460.   
  461.   /* Maximum number of points for polygons etc */
  462.   #define        MAXNUMPTS    10000
  463. ***************
  464. *** 26,44 ****
  465.   #define        char_height(font) \
  466.           ((font)->max_bounds.ascent + (font)->max_bounds.descent)
  467.   
  468. ! #define        rot_char_width(rotfont)    ((rotfont)->width)
  469. ! #define        rot_char_height(rotfont) \
  470. !         ((rotfont)->max_ascent + (rotfont)->max_descent)
  471.   
  472. ! #define        rot_char_advance(font,char) \
  473.               (((font)->per_char)?\
  474. !             ((font)->per_char[(char)-(font)->min_char].width):\
  475. !             ((font)->width))
  476.   
  477.   #define set_x_color(gc,col) XSetForeground(tool_d,gc,\
  478.       (!all_colors_available? (col==WHITE?x_bg_color.pixel:x_fg_color.pixel): \
  479. !     (col<0||col>=NUMCOLORS)? x_fg_color.pixel:appres.color[col]))
  480.   
  481.   #define x_color(col)\
  482.       (!all_colors_available? (col==WHITE?x_bg_color.pixel:x_fg_color.pixel): \
  483. !     (col<0||col>=NUMCOLORS)? x_fg_color.pixel:appres.color[col])
  484. --- 26,46 ----
  485.   #define        char_height(font) \
  486.           ((font)->max_bounds.ascent + (font)->max_bounds.descent)
  487.   
  488. ! #define        char_width(font) ((font)->max_bounds.width)
  489.   
  490. ! #define        char_advance(font,char) \
  491.               (((font)->per_char)?\
  492. !             ((font)->per_char[(char)-(font)->min_char_or_byte2].width):\
  493. !             ((font)->max_bounds.width))
  494.   
  495.   #define set_x_color(gc,col) XSetForeground(tool_d,gc,\
  496.       (!all_colors_available? (col==WHITE?x_bg_color.pixel:x_fg_color.pixel): \
  497. !         (col<0||col>=NUMCOLORS)? x_fg_color.pixel:appres.color[col]))
  498.   
  499. + #define set_fill_color(gc,col) XSetForeground(tool_d,gc,\
  500. +     (!all_colors_available? (col==BLACK?x_fg_color.pixel:x_bg_color.pixel): \
  501. +         (col<0||col>=NUMCOLORS)? x_fg_color.pixel:appres.color[col]))
  502.   #define x_color(col)\
  503.       (!all_colors_available? (col==WHITE?x_bg_color.pixel:x_fg_color.pixel): \
  504. !         (col<0||col>=NUMCOLORS)? x_fg_color.pixel:appres.color[col])
  505. diff -rc xfig.2.1.7a/w_export.c xfig.2.1.8/w_export.c
  506. *** xfig.2.1.7a/w_export.c    Fri Apr 16 10:35:46 1993
  507. --- xfig.2.1.8/w_export.c    Tue Aug 24 14:21:33 1993
  508. ***************
  509. *** 22,27 ****
  510. --- 22,28 ----
  511.   extern String    text_translations;
  512.   extern Widget    make_popup_menu();
  513.   extern char    *panel_get_value();
  514. + extern Boolean    query_save();
  515.   extern Widget    file_popup;
  516.   extern Widget    file_dir;
  517.   
  518. ***************
  519. *** 31,36 ****
  520. --- 32,41 ----
  521.   
  522.   /* LOCAL */
  523.   
  524. + static String    file_list_translations =
  525. +     "<Btn1Down>,<Btn1Up>: Set()Notify()\n\
  526. +     <Btn1Down>(2): export()\n\
  527. +     <Key>Return: ExportFile()\n";
  528.   static String    file_name_translations =
  529.       "<Key>Return: ExportFile()\n";
  530.   void        do_export();
  531. ***************
  532. *** 104,109 ****
  533. --- 109,115 ----
  534.   }
  535.   
  536.   static char    export_msg[] = "EXPORT";
  537. + static char    exp_msg[] = "The current figure is modified.\nDo you want to save it before exporting?";
  538.   
  539.   void
  540.   do_export(w)
  541. ***************
  542. *** 116,121 ****
  543. --- 122,131 ----
  544.       if (emptyfigure_msg(export_msg))
  545.           return;
  546.   
  547. +     /* if modified (and non-empty) ask to save first */
  548. +     if (!query_save(exp_msg))
  549. +         return;        /* cancel, do not export */
  550.       if (!export_popup) 
  551.           create_export_panel(w);
  552.       FirstArg(XtNstring, &fval);
  553. ***************
  554. *** 123,130 ****
  555.       if (emptyname(fval)) {        /* output filename is empty, use default */
  556.           fval = default_export_file;
  557.           warnexist = False;        /* don't warn if this file exists */
  558. !     } else {
  559. !         warnexist = True;        /* otherwise warn if the file exists */
  560.       }
  561.   
  562.       /* if not absolute path, change directory */
  563. --- 133,140 ----
  564.       if (emptyname(fval)) {        /* output filename is empty, use default */
  565.           fval = default_export_file;
  566.           warnexist = False;        /* don't warn if this file exists */
  567. !     } else if (strcmp(fval,default_export_file) != 0) {
  568. !         warnexist = True;        /* warn if the file exists and is diff. from default */
  569.       }
  570.   
  571.       /* if not absolute path, change directory */
  572. ***************
  573. *** 394,402 ****
  574.   
  575.       create_dirinfo(export_panel, exp_selfile, &beside, &below,
  576.                  &exp_mask, &exp_dir, &exp_flist, &exp_dlist);
  577. !     /* make <return> in the file list window export the file */
  578.       XtOverrideTranslations(exp_flist,
  579. !                XtParseTranslationTable(file_name_translations));
  580.   
  581.       FirstArg(XtNlabel, "Cancel");
  582.       NextArg(XtNfromHoriz, beside);
  583. --- 404,412 ----
  584.   
  585.       create_dirinfo(export_panel, exp_selfile, &beside, &below,
  586.                  &exp_mask, &exp_dir, &exp_flist, &exp_dlist);
  587. !     /* make <return> or double click in the file list window export the file */
  588.       XtOverrideTranslations(exp_flist,
  589. !                XtParseTranslationTable(file_list_translations));
  590.   
  591.       FirstArg(XtNlabel, "Cancel");
  592.       NextArg(XtNfromHoriz, beside);
  593. ***************
  594. *** 463,467 ****
  595. --- 473,479 ----
  596.       FirstArg(XtNstring, &dval);
  597.       GetValues(file_dir);
  598.       strcpy(export_dir,dval);
  599. +     } else {
  600. +     strcpy(export_dir,cur_dir);
  601.       }
  602.   }
  603. diff -rc xfig.2.1.7a/w_file.c xfig.2.1.8/w_file.c
  604. *** xfig.2.1.7a/w_file.c    Mon Mar 22 14:41:00 1993
  605. --- xfig.2.1.8/w_file.c    Tue Aug 31 13:40:00 1993
  606. ***************
  607. *** 33,38 ****
  608. --- 33,42 ----
  609.   static Widget    cancel, save, merge, load;
  610.   static Widget    file_w;
  611.   static Position xposn, yposn;
  612. + static String    file_list_translations =
  613. +     "<Btn1Down>,<Btn1Up>: Set()Notify()\n\
  614. +     <Btn1Down>(2): load()\n\
  615. +     <Key>Return: load()\n";
  616.   static String    file_name_translations =
  617.       "<Key>Return: load()\n";
  618.   static void    file_panel_cancel(), do_merge();
  619. ***************
  620. *** 79,85 ****
  621.       Widget        w;
  622.       XButtonEvent   *ev;
  623.   {
  624. !     char        filename[100];
  625.       char       *fval, *dval;
  626.   
  627.       FirstArg(XtNstring, &fval);
  628. --- 83,89 ----
  629.       Widget        w;
  630.       XButtonEvent   *ev;
  631.   {
  632. !     char        filename[200];
  633.       char       *fval, *dval;
  634.   
  635.       FirstArg(XtNstring, &fval);
  636. ***************
  637. *** 107,112 ****
  638. --- 111,126 ----
  639.   {
  640.       char       *fval, *dval;
  641.   
  642. +     /* first check if the figure was modified before reloading it */
  643. +     if (!emptyfigure() && figure_modified) {
  644. +     if (file_popup)
  645. +         XtSetSensitive(load, False);
  646. +     if (!popup_query(QUERY_YESCAN, load_msg)) {
  647. +         if (file_popup)
  648. +         XtSetSensitive(load, True);
  649. +         return;
  650. +     }
  651. +     }
  652.       if (file_popup) {
  653.       FirstArg(XtNstring, &dval);
  654.       GetValues(file_dir);
  655. ***************
  656. *** 113,131 ****
  657.       FirstArg(XtNstring, &fval);
  658.       GetValues(file_selfile);    /* check the ascii widget for a filename */
  659.       if (emptyname(fval))
  660. !         fval = cur_filename;    /* "Filename" widget empty, use current filename */
  661.       if (emptyname_msg(fval, "LOAD"))
  662.           return;
  663. -     if (!emptyfigure() && figure_modified) {
  664. -         XtSetSensitive(load, False);
  665. -         if (!popup_query(QUERY_YES, load_msg)) {
  666. -         XtSetSensitive(load, True);
  667. -         return;
  668. -         }
  669. -         XtSetSensitive(load, True);
  670. -     }
  671.       if (change_directory(dval) == 0) {
  672.           if (load_file(fval) == 0) {
  673.           FirstArg(XtNlabel, fval);
  674. --- 127,135 ----
  675.       FirstArg(XtNstring, &fval);
  676.       GetValues(file_selfile);    /* check the ascii widget for a filename */
  677.       if (emptyname(fval))
  678. !         fval = cur_filename;    /* Filename widget empty, use current filename */
  679.       if (emptyname_msg(fval, "LOAD"))
  680.           return;
  681.       if (change_directory(dval) == 0) {
  682.           if (load_file(fval) == 0) {
  683.           FirstArg(XtNlabel, fval);
  684. ***************
  685. *** 133,138 ****
  686. --- 137,143 ----
  687.           if (fval != cur_filename)
  688.               update_cur_filename(fval);    /* and update cur_filename */
  689.           update_def_filename();        /* and the default export filename */
  690. +         XtSetSensitive(load, True);
  691.           file_panel_dismiss();
  692.           }
  693.       }
  694. ***************
  695. *** 191,196 ****
  696. --- 196,223 ----
  697.       }
  698.   }
  699.   
  700. + Boolean
  701. + query_save(msg)
  702. +     char       *msg;
  703. + {
  704. +     int            qresult;
  705. +     if (!emptyfigure() && figure_modified && !aborting) {
  706. +     if ((qresult = popup_query(QUERY_YESNOCAN, msg)) == RESULT_CANCEL) 
  707. +         return False;
  708. +     else if (qresult == RESULT_YES) {
  709. +         do_save((Widget) 0);
  710. +         /*
  711. +          * if saving was not successful, figure_modified is still true:
  712. +          * do not quit!
  713. +          */
  714. +         if (figure_modified)
  715. +         return False;
  716. +     }
  717. +     }
  718. +     /* ok */
  719. +     return True;
  720. + }
  721.   static void
  722.   file_panel_cancel(w, ev)
  723.       Widget        w;
  724. ***************
  725. *** 230,236 ****
  726.   create_file_panel(w)
  727.       Widget           w;
  728.   {
  729. !     Widget           file, dir, beside, below;
  730.       PIX_FONT       temp_font;
  731.       static int       actions_added=0;
  732.       file_w = w;
  733. --- 257,263 ----
  734.   create_file_panel(w)
  735.       Widget           w;
  736.   {
  737. !     Widget           file, beside, below;
  738.       PIX_FONT       temp_font;
  739.       static int       actions_added=0;
  740.       file_w = w;
  741. ***************
  742. *** 314,328 ****
  743.           XtAppAddActions(tool_app, file_name_actions, XtNumber(file_name_actions));
  744.       }
  745.   
  746.       /* make <return> in the filename window load the file */
  747.       XtOverrideTranslations(file_selfile,
  748.                  XtParseTranslationTable(file_name_translations));
  749.   
  750. !     create_dirinfo(file_panel, file_selfile, &beside, &below,
  751. !                &file_mask, &file_dir, &file_flist, &file_dlist);
  752. !     /* make <return> in the file list window load the file */
  753. !     XtOverrideTranslations(file_flist,
  754. !                XtParseTranslationTable(file_name_translations));
  755.       FirstArg(XtNlabel, "Cancel");
  756.       NextArg(XtNvertDistance, 15);
  757.       NextArg(XtNhorizDistance, 25);
  758. --- 341,356 ----
  759.           XtAppAddActions(tool_app, file_name_actions, XtNumber(file_name_actions));
  760.       }
  761.   
  762. +     create_dirinfo(file_panel, file_selfile, &beside, &below,
  763. +                &file_mask, &file_dir, &file_flist, &file_dlist);
  764.       /* make <return> in the filename window load the file */
  765.       XtOverrideTranslations(file_selfile,
  766.                  XtParseTranslationTable(file_name_translations));
  767.   
  768. !     /* make <return> and a double click in the file list window load the file */
  769. !     XtAugmentTranslations(file_flist,
  770. !                XtParseTranslationTable(file_list_translations));
  771.       FirstArg(XtNlabel, "Cancel");
  772.       NextArg(XtNvertDistance, 15);
  773.       NextArg(XtNhorizDistance, 25);
  774. diff -rc xfig.2.1.7a/w_fontbits3.c xfig.2.1.8/w_fontbits3.c
  775. *** xfig.2.1.7a/w_fontbits3.c    Wed Dec  9 17:26:05 1992
  776. --- xfig.2.1.8/w_fontbits3.c    Mon Aug 23 15:26:38 1993
  777. ***************
  778. *** 771,780 ****
  779.       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  780.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  781.   
  782. ! Pixmap        psfont_menu_bitmaps[NUM_PS_FONTS + 1];
  783.   Pixmap        latexfont_menu_bitmaps[NUM_LATEX_FONTS];
  784.   
  785. ! unsigned char           *psfont_menu_bits[NUM_PS_FONTS + 1] = {
  786.       PS_Default_bits,
  787.       Times_Roman_bits,
  788.       Times_Italic_bits,
  789. --- 771,780 ----
  790.       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  791.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  792.   
  793. ! Pixmap        psfont_menu_bitmaps[NUM_FONTS + 1];
  794.   Pixmap        latexfont_menu_bitmaps[NUM_LATEX_FONTS];
  795.   
  796. ! unsigned char           *psfont_menu_bits[NUM_FONTS + 1] = {
  797.       PS_Default_bits,
  798.       Times_Roman_bits,
  799.       Times_Italic_bits,
  800. diff -rc xfig.2.1.7a/w_fontpanel.c xfig.2.1.8/w_fontpanel.c
  801. *** xfig.2.1.7a/w_fontpanel.c    Sat Jan  2 18:42:19 1993
  802. --- xfig.2.1.8/w_fontpanel.c    Mon Aug 23 16:22:59 1993
  803. ***************
  804. *** 24,31 ****
  805.   extern Pixmap    psfont_menu_bitmaps[];
  806.   extern Pixmap    latexfont_menu_bitmaps[];
  807.   extern Atom    wm_delete_window;
  808. ! extern struct _fstruct ps_fontinfo[];    /* font names */
  809. ! extern struct _fstruct latex_fontinfo[];    /* font names */
  810.   
  811.   /* LOCAL VARIABLES */
  812.   
  813. --- 24,31 ----
  814.   extern Pixmap    psfont_menu_bitmaps[];
  815.   extern Pixmap    latexfont_menu_bitmaps[];
  816.   extern Atom    wm_delete_window;
  817. ! extern struct _fstruct ps_fontinfo[];      /* PostScript/OpenWindows font names */
  818. ! extern struct _fstruct latex_fontinfo[];  /* LaTeX font names */
  819.   
  820.   /* LOCAL VARIABLES */
  821.   
  822. ***************
  823. *** 37,43 ****
  824.   
  825.   /********************  local variables    ***************************/
  826.   
  827. ! static MenuItemRec ps_fontmenu_items[NUM_PS_FONTS + 1];
  828.   static MenuItemRec latex_fontmenu_items[NUM_LATEX_FONTS];
  829.   
  830.   static void    fontpane_select();
  831. --- 37,43 ----
  832.   
  833.   /********************  local variables    ***************************/
  834.   
  835. ! static MenuItemRec ps_fontmenu_items[NUM_FONTS + 1];
  836.   static MenuItemRec latex_fontmenu_items[NUM_LATEX_FONTS];
  837.   
  838.   static void    fontpane_select();
  839. ***************
  840. *** 59,65 ****
  841.   
  842.   static TOOL    ps_fontpanes, ps_buttons;
  843.   static TOOL    latex_fontpanes, latex_buttons;
  844. ! static TOOL    ps_fontpane[NUM_PS_FONTS + 1];
  845.   static TOOL    latex_fontpane[NUM_LATEX_FONTS];
  846.   
  847.   init_fontmenu(tool)
  848. --- 59,65 ----
  849.   
  850.   static TOOL    ps_fontpanes, ps_buttons;
  851.   static TOOL    latex_fontpanes, latex_buttons;
  852. ! static TOOL    ps_fontpane[NUM_FONTS+1];
  853.   static TOOL    latex_fontpane[NUM_LATEX_FONTS];
  854.   
  855.   init_fontmenu(tool)
  856. ***************
  857. *** 96,102 ****
  858.       latex_fontpanes = XtCreateManagedWidget("menu", boxWidgetClass,
  859.                           latex_fontmenu, Args, ArgCount);
  860.   
  861. !     for (i = 0; i < NUM_PS_FONTS + 1; i++) {
  862.       ps_fontmenu_items[i].type = MENU_IMAGESTRING;    /* put the fontnames in
  863.                                * menu */
  864.       ps_fontmenu_items[i].label = ps_fontinfo[i].name;
  865. --- 96,102 ----
  866.       latex_fontpanes = XtCreateManagedWidget("menu", boxWidgetClass,
  867.                           latex_fontmenu, Args, ArgCount);
  868.   
  869. !     for (i = 0; i < NUM_FONTS + 1; i++) {
  870.       ps_fontmenu_items[i].type = MENU_IMAGESTRING;    /* put the fontnames in
  871.                                * menu */
  872.       ps_fontmenu_items[i].label = ps_fontinfo[i].name;
  873. ***************
  874. *** 161,167 ****
  875.       NextArg(XtNborderWidth, INTERNAL_BW);
  876.       NextArg(XtNresize, False);    /* don't allow resize */
  877.   
  878. !     for (i = 0; i < NUM_PS_FONTS + 1; ++i) {
  879.       mi = &ps_fontmenu_items[i];
  880.       pane_callbacks[0].closure = (caddr_t) mi;
  881.       ps_fontpane[i] = XtCreateManagedWidget("pane", commandWidgetClass,
  882. --- 161,167 ----
  883.       NextArg(XtNborderWidth, INTERNAL_BW);
  884.       NextArg(XtNresize, False);    /* don't allow resize */
  885.   
  886. !     for (i = 0; i < NUM_FONTS + 1; ++i) {
  887.       mi = &ps_fontmenu_items[i];
  888.       pane_callbacks[0].closure = (caddr_t) mi;
  889.       ps_fontpane[i] = XtCreateManagedWidget("pane", commandWidgetClass,
  890. ***************
  891. *** 197,203 ****
  892.   
  893.       /* Create the bitmaps */
  894.   
  895. !     for (i = 0; i < NUM_PS_FONTS + 1; i++)
  896.       psfont_menu_bitmaps[i] = XCreatePixmapFromBitmapData(tool_d,
  897.                      XtWindow(ind_panel), (char *) psfont_menu_bits[i],
  898.                        PS_FONTPANE_WD, PS_FONTPANE_HT, fg, bg,
  899. --- 197,203 ----
  900.   
  901.       /* Create the bitmaps */
  902.   
  903. !     for (i = 0; i < NUM_FONTS + 1; i++)
  904.       psfont_menu_bitmaps[i] = XCreatePixmapFromBitmapData(tool_d,
  905.                      XtWindow(ind_panel), (char *) psfont_menu_bits[i],
  906.                        PS_FONTPANE_WD, PS_FONTPANE_HT, fg, bg,
  907. ***************
  908. *** 210,216 ****
  909.                          XDefaultDepthOfScreen(tool_s));
  910.   
  911.       /* Store the bitmaps in the menu panes */
  912. !     for (i = 0; i < NUM_PS_FONTS + 1; i++) {
  913.       FirstArg(XtNbitmap, psfont_menu_bitmaps[i]);
  914.       SetValues(ps_fontpane[i]);
  915.       }
  916. --- 210,216 ----
  917.                          XDefaultDepthOfScreen(tool_s));
  918.   
  919.       /* Store the bitmaps in the menu panes */
  920. !     for (i = 0; i < NUM_FONTS + 1; i++) {
  921.       FirstArg(XtNbitmap, psfont_menu_bitmaps[i]);
  922.       SetValues(ps_fontpane[i]);
  923.       }
  924. diff -rc xfig.2.1.7a/w_indpanel.c xfig.2.1.8/w_indpanel.c
  925. *** xfig.2.1.7a/w_indpanel.c    Thu Oct 21 10:23:00 1993
  926. --- xfig.2.1.8/w_indpanel.c    Tue Sep 14 09:14:06 1993
  927. ***************
  928. *** 25,30 ****
  929. --- 25,31 ----
  930.   #include "w_util.h"
  931.   #include "w_zoom.h"
  932.   
  933. + #define MAX_SCROLL_WD 50
  934.   extern Pixmap    psfont_menu_bitmaps[], latexfont_menu_bitmaps[];
  935.   extern Atom    wm_delete_window;
  936.   extern struct    _fstruct ps_fontinfo[], latex_fontinfo[];
  937. ***************
  938. *** 88,93 ****
  939. --- 89,95 ----
  940.   
  941.   static int    popup_fonts();
  942.   static void    note_state();
  943. + static void    set_all_update(), clr_all_update(), tog_all_update();
  944.   
  945.   static char    indbuf[12];
  946.   static float    old_zoomscale = -1.0;
  947. ***************
  948. *** 94,99 ****
  949. --- 96,103 ----
  950.   static int    old_rotnangle = -1;
  951.   static float    old_elltextangle = -1.0;
  952.   
  953. + Widget        upd_ctrl, set_upd, upd_tog,
  954. +         clr_upd, tog_upd, upd_ctrl_lab, upd_ctrl_btns;
  955.   #define        DEF_IND_SW_HT        32
  956.   #define        DEF_IND_SW_WD        64
  957.   #define        FONT_IND_SW_WD        (40+PS_FONTPANE_WD)
  958. ***************
  959. *** 115,133 ****
  960.   #define NUM_ANGLEGEOM_CHOICES (sizeof(anglegeom_choices)/sizeof(choice_info))
  961.   
  962.   static choice_info valign_choices[] = {
  963. !     {NONE, &none_ic,},
  964. !     {TOP, &valignt_ic,},
  965. !     {CENTER, &valignc_ic,},
  966. !     {BOTTOM, &valignb_ic,},
  967.   };
  968.   
  969.   #define NUM_VALIGN_CHOICES (sizeof(valign_choices)/sizeof(choice_info))
  970.   
  971.   static choice_info halign_choices[] = {
  972. !     {NONE, &none_ic,},
  973. !     {LEFT, &halignl_ic,},
  974. !     {CENTER, &halignc_ic,},
  975. !     {RIGHT, &halignr_ic,},
  976.   };
  977.   
  978.   #define NUM_HALIGN_CHOICES (sizeof(halign_choices)/sizeof(choice_info))
  979. --- 119,137 ----
  980.   #define NUM_ANGLEGEOM_CHOICES (sizeof(anglegeom_choices)/sizeof(choice_info))
  981.   
  982.   static choice_info valign_choices[] = {
  983. !     {ALIGN_NONE, &none_ic,},
  984. !     {ALIGN_TOP, &valignt_ic,},
  985. !     {ALIGN_CENTER, &valignc_ic,},
  986. !     {ALIGN_BOTTOM, &valignb_ic,},
  987.