home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume10 / xdvi / patch10.2 < prev    next >
Encoding:
Internet Message Format  |  1990-10-18  |  58.5 KB

  1. Path: uunet!wuarchive!cs.utexas.edu!sun-barr!newstop!sun!math.Berkeley.EDU
  2. From: vojta@math.Berkeley.EDU (Paul Vojta)
  3. Newsgroups: comp.sources.x
  4. Subject: v10i010: xdvi, Patch10, Part02/02
  5. Message-ID: <143916@sun.Eng.Sun.COM>
  6. Date: 18 Oct 90 22:36:23 GMT
  7. References: <csx-10i009:xdvi@uunet.UU.NET>
  8. Sender: news@sun.Eng.Sun.COM
  9. Lines: 1867
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: vojta@math.berkeley.edu (Paul A Vojta)
  13. Posting-number: Volume 10, Issue 10
  14. Archive-name: xdvi/patch10.2
  15. Patch-To: xdvi: Volume 3, Issues 37-39
  16. Patch-To: xdvi: Volume 4, Issue 44 (xdvi, Patch4)
  17. Patch-To: xdvi: Volume 4, Issue 96 (xdvi, dvi previewer, Patch5)
  18. Patch-To: xdvi: Volume 5, Issue 35 (xdvi, dvi previewer, patch 6, part 1/2)
  19. Patch-To: xdvi: Volume 5, Issue 36 (xdvi, dvi previewer, patch 6, part 2/2)
  20. Patch-To: xdvi: Volume 6, Issue  5 (xdvi, Patch7)
  21. Patch-To: xdvi: Volume 6, Issue 49 (xdvi, dvi previewer, patch 8)
  22. Patch-To: xdvi: Volume 7, Issue 52 (xdvi, dvi previewer, patch 9, part 1/2)
  23. Patch-To: xdvi: Volume 7, Issue 53 (xdvi, dvi previewer, patch 9, part 2/2)
  24.  
  25. diff -cr xdvi_old/pxl_open.c xdvi_new/pxl_open.c
  26. *** xdvi_old/pxl_open.c    Mon Sep 17 17:35:58 1990
  27. --- xdvi_new/pxl_open.c    Wed Oct 10 12:00:50 1990
  28. ***************
  29. *** 1,5 ****
  30.   /*
  31. !  *    pxl_open.c(font, font_ret, mag, mag_ret, factor, name, read_font_index)
  32.    *    Find and open gf, pk, or pxl files in the given path, having the given
  33.    *    name and magnification.  It tries gf files first, followed by pk and pxl
  34.    *    files.  The path variable should be of the form path1:path2:...:pathn,
  35. --- 1,5 ----
  36.   /*
  37. !  *    pxl_open.c(font, font_ret, mag, mag_ret, factor, name)
  38.    *    Find and open gf, pk, or pxl files in the given path, having the given
  39.    *    name and magnification.  It tries gf files first, followed by pk and pxl
  40.    *    files.  The path variable should be of the form path1:path2:...:pathn,
  41. ***************
  42. *** 19,26 ****
  43.    *        *factor    the ratio of the point sizes of the requested font
  44.    *            and the font actually found (or 1.0 if altfont is used).
  45.    *        *name    a pointer to a string containing the file name
  46. -  *        *read_font_index  a pointer to the read_index procedure to be
  47. -  *            used for the given font format.
  48.    *
  49.    *    If the file is not found, then the return value is NULL.
  50.    *
  51. --- 19,24 ----
  52. ***************
  53. *** 33,53 ****
  54.    */
  55.   
  56.   #include <stdio.h>
  57. - #ifndef X10
  58. - #include <X11/Xos.h>    /* same as below */
  59. - #else    /* X10 */
  60. - #ifdef    SYSV
  61. - #include <string.h>
  62. - #define index strchr
  63. - #define rindex strrchr
  64. - #else /* SYSV */
  65. - #include <strings.h>
  66. - #endif /* SYSV */
  67. - #endif    /* X10 */
  68.   #include <errno.h>
  69. ! extern    int    errno;
  70.   
  71.   /*
  72.    *    If you think you have to change DEFAULT_TAIL, then you haven't read the
  73. --- 31,39 ----
  74.    */
  75.   
  76.   #include <stdio.h>
  77.   #include <errno.h>
  78. ! int    errno;
  79. ! #include "xdvi.h"
  80.   
  81.   /*
  82.    *    If you think you have to change DEFAULT_TAIL, then you haven't read the
  83. ***************
  84. *** 57,91 ****
  85.   #define    PATH_SEP    ':'
  86.   #define    DEFAULT_TAIL    "/%f.%d%p"
  87.   #else    /* VMS */
  88. - #include <string.h>
  89. - #define    index    strchr
  90. - #define    rindex    strrchr
  91.   #define    PATH_SEP    '/'
  92.   #define    DEFAULT_TAIL    ":%f.%d%p"
  93.   #endif    /* VMS */
  94.   
  95. - #ifndef    OPEN_MODE
  96. - #ifndef    VMS
  97. - #define    OPEN_MODE    "r"
  98. - #else
  99. - #define    OPEN_MODE    "r", "ctx=stm"
  100. - #endif
  101. - #endif    /* OPEN_MODE */
  102. - extern    int    n_fonts_left;
  103. - extern    char    *alt_font;
  104.   static    char    *font_path;
  105. ! static    char    default_font_path[]    = DEFAULT_FONT_PATH;
  106.   static    int    *sizes, *sizend;
  107.   static    char    default_size_list[]    = DEFAULT_FONT_SIZES;
  108.   
  109. -     /* the corresponding read_char procedures are handled in xdvi.h */
  110. - typedef    void (*read_font_index_proc)();
  111. -     /* struct font *fontp; */
  112. - read_font_index_proc read_GF_index, read_PK_index, read_PXL_index;
  113.   #ifdef    sun
  114.   char    *sprintf();
  115.   #endif
  116. --- 43,57 ----
  117.   #define    PATH_SEP    ':'
  118.   #define    DEFAULT_TAIL    "/%f.%d%p"
  119.   #else    /* VMS */
  120.   #define    PATH_SEP    '/'
  121.   #define    DEFAULT_TAIL    ":%f.%d%p"
  122.   #endif    /* VMS */
  123.   
  124.   static    char    *font_path;
  125. ! static    char    *default_font_path    = DEFAULT_FONT_PATH;
  126.   static    int    *sizes, *sizend;
  127.   static    char    default_size_list[]    = DEFAULT_FONT_SIZES;
  128.   
  129.   #ifdef    sun
  130.   char    *sprintf();
  131.   #endif
  132. ***************
  133. *** 93,101 ****
  134.   char    *malloc(), *getenv();
  135.   double    atof();
  136.   
  137. - #define    Strcpy    (void) strcpy
  138. - #define    Sprintf    (void) sprintf
  139.   static    void
  140.   get_sizes(size_list, spp)
  141.       char    *size_list;
  142. --- 59,64 ----
  143. ***************
  144. *** 117,129 ****
  145.       unsigned int n;
  146.       char    *p;
  147.   
  148. !     if ((font_path = getenv("XDVIFONTS")) == NULL)
  149.           font_path = default_font_path;
  150. !     else if (*font_path == PATH_SEP)
  151. !         /*concatenate default_font_path before font_path */
  152. !         font_path = strcat(strcpy(malloc((unsigned)
  153. !         strlen(default_font_path) + strlen(font_path) + 1),
  154. !         default_font_path), font_path);
  155.   
  156.       size_list = getenv("XDVISIZES");
  157.       n = 1;    /* count number of sizes */
  158. --- 80,89 ----
  159.       unsigned int n;
  160.       char    *p;
  161.   
  162. !     if ((font_path = getenv("XDVIFONTS")) == NULL) {
  163.           font_path = default_font_path;
  164. !         default_font_path = NULL;
  165. !     }
  166.   
  167.       size_list = getenv("XDVISIZES");
  168.       n = 1;    /* count number of sizes */
  169. ***************
  170. *** 155,170 ****
  171.   }
  172.   
  173.   static    FILE *
  174. ! formatted_open(path, font, pxl, mag, name)
  175.       char    *path, *font, *pxl;
  176.       int    mag;
  177.       char    **name;
  178.   {
  179.       char    *p = path,
  180.           nm[128],
  181.           *n = nm,
  182.           c;
  183. !     int    f_used = 0;
  184.       FILE    *f;
  185.   
  186.       for (;;) {
  187. --- 115,132 ----
  188.   }
  189.   
  190.   static    FILE *
  191. ! formatted_open(path, font, pxl, mag, name, count)
  192.       char    *path, *font, *pxl;
  193.       int    mag;
  194.       char    **name;
  195. +     int    count;
  196.   {
  197.       char    *p = path,
  198.           nm[128],
  199.           *n = nm,
  200.           c;
  201. !     Boolean    f_used = False;
  202. !     Boolean    p_used = False;
  203.       FILE    *f;
  204.   
  205.       for (;;) {
  206. ***************
  207. *** 178,187 ****
  208.           c = *p++;
  209.           switch (c) {
  210.               case 'f':
  211. !             f_used=1;
  212.               Strcpy(n, font);
  213.               break;
  214.               case 'p':
  215.               Strcpy(n, pxl);
  216.               break;
  217.               case 'd':
  218. --- 140,150 ----
  219.           c = *p++;
  220.           switch (c) {
  221.               case 'f':
  222. !             f_used = True;
  223.               Strcpy(n, font);
  224.               break;
  225.               case 'p':
  226. +             p_used = True;
  227.               Strcpy(n, pxl);
  228.               break;
  229.               case 'd':
  230. ***************
  231. *** 195,201 ****
  232. --- 158,166 ----
  233.           }
  234.           else *n++ = c;
  235.       }
  236. +     if (!p_used && count > 0) return NULL;
  237.       *n = '\0';
  238. +     if (debug & DBG_OPEN) Printf("Trying font file %s\n", nm);
  239.       f = fopen(nm, OPEN_MODE);
  240.       if (f == NULL && errno == EMFILE) {
  241.           n_fonts_left = 0;
  242. ***************
  243. *** 209,272 ****
  244.       return f;
  245.   }
  246.   
  247.   static    FILE *
  248. ! pre_pxl_open(font, mag, mag_ret, name, read_font_index)
  249.       char    *font;
  250. !     int    mag, *mag_ret;
  251.       char    **name;
  252. !     read_font_index_proc *read_font_index;
  253.   {
  254.       char    *p;
  255.       FILE    *f;
  256. !     int    *p1, *p2, pxlmag, pkmag;
  257.   
  258.       /*
  259. !      * Loop over sizes.  Try closest sizes first.
  260.        */
  261.       for (p2 = sizes; p2 < sizend; ++p2) if (*p2 >= mag) break;
  262.       p1 = p2;
  263.       for (;;) {
  264.           if (p1 <= sizes)
  265.           if (p2 >= sizend) return NULL;
  266.           else pxlmag = *p2++;
  267. !         else if (p2 >= sizend || mag * mag <= p1[-1] * *p2) pxlmag = *--p1;
  268.           else pxlmag = *p2++;
  269. !         *mag_ret = pxlmag;
  270. !         pkmag = (pxlmag + 2) / 5;
  271. !         /*
  272. !          * loop over paths
  273. !          */
  274. !         for (p = font_path;;) {
  275. !         if (read_GF_index &&
  276. !             (f = formatted_open(p, font, "gf", pkmag, name)) != NULL) {
  277. !             *read_font_index = read_GF_index;
  278. !             return f;
  279. !         }
  280. !         if (read_PK_index &&
  281. !             (f = formatted_open(p, font, "pk", pkmag, name)) != NULL) {
  282. !             *read_font_index = read_PK_index;
  283. !             return f;
  284. !         }
  285. !         if (read_PXL_index &&
  286. !             (f = formatted_open(p, font, "pxl", pxlmag, name)) != NULL)
  287. !         {
  288. !             *read_font_index = read_PXL_index;
  289. !             return f;
  290. !         }
  291. !         p = index(p, PATH_SEP);
  292. !         if (p == NULL) break;
  293. !         ++p;
  294. !         }
  295.       }
  296.   }
  297.   
  298.   FILE *
  299. ! pxl_open(font, font_ret, mag, mag_ret, factor, name, read_font_index)
  300.       char    *font, **font_ret;
  301. !     int    mag, *mag_ret;
  302.       float    *factor;
  303.       char    **name;
  304. -     read_font_index_proc *read_font_index;
  305.   {
  306.       FILE    *f;
  307.       int    actual_pt, low_pt, high_pt, trial_pt;
  308. --- 174,274 ----
  309.       return f;
  310.   }
  311.   
  312. + /*
  313. +  *    Try a given size
  314. +  */
  315.   static    FILE *
  316. ! try_size(font, pxlmag, name, font_path, default_font_path)
  317.       char    *font;
  318. !     int    pxlmag;
  319.       char    **name;
  320. !     char    *font_path, *default_font_path;
  321.   {
  322.       char    *p;
  323.       FILE    *f;
  324. !     int    pkmag    = (pxlmag + 2) / 5;
  325.   
  326.       /*
  327. !      * loop over paths
  328.        */
  329. +     for (p = font_path;; ++p) {
  330. +         int count = 0;
  331. +         if (*p == ':' || *p == '\0') {
  332. +         if (default_font_path != NULL &&
  333. +             (f = try_size(font, pxlmag, name, default_font_path,
  334. +             (char *) NULL)) != NULL)
  335. +             return f;
  336. +         if (*p == '\0') break;
  337. +         continue;
  338. +         }
  339. +         if (read_GF_index &&
  340. +         (f = formatted_open(p, font, "gf", pkmag, name, count++))
  341. +             != NULL)
  342. +             return f;
  343. +         if (read_PK_index &&
  344. +         (f = formatted_open(p, font, "pk", pkmag, name, count++))
  345. +             != NULL)
  346. +             return f;
  347. +         if (read_PXL_index &&
  348. +         (f = formatted_open(p, font, "pxl", pxlmag, name, count++))
  349. +             != NULL)
  350. +             return f;
  351. +         p = index(p, PATH_SEP);
  352. +         if (p == NULL) break;
  353. +     }
  354. +     return NULL;
  355. + }
  356. + /*
  357. +  *    Try a given font name
  358. +  */
  359. + static    FILE *
  360. + pre_pxl_open(font, mag, mag_ret, name)
  361. +     char    *font;
  362. +     float    mag;
  363. +     int    *mag_ret;
  364. +     char    **name;
  365. + {
  366. +     FILE    *f;
  367. +     int    *p1, *p2, pxlmag;
  368. +     /*
  369. +      * Loop over sizes.  Try actual size first, then closest sizes.
  370. +      */
  371. +     pxlmag = mag + 0.5;
  372. +     if ((f = try_size(font, *mag_ret = pxlmag, name, font_path,
  373. +         default_font_path)) != NULL)
  374. +         return f;
  375. +     if (pxlmag < mag) ++pxlmag; else --pxlmag;
  376. +     if ((f = try_size(font, *mag_ret = pxlmag, name, font_path,
  377. +         default_font_path)) != NULL)
  378. +         return f;
  379.       for (p2 = sizes; p2 < sizend; ++p2) if (*p2 >= mag) break;
  380.       p1 = p2;
  381.       for (;;) {
  382. +         /* find another magnification */
  383.           if (p1 <= sizes)
  384.           if (p2 >= sizend) return NULL;
  385.           else pxlmag = *p2++;
  386. !         else if (p2 >= sizend || mag * mag <= p1[-1] * *p2)
  387. !             pxlmag = *--p1;
  388.           else pxlmag = *p2++;
  389. !         if ((f = try_size(font, *mag_ret = pxlmag, name, font_path,
  390. !             default_font_path)) != NULL)
  391. !         return f;
  392.       }
  393.   }
  394.   
  395.   FILE *
  396. ! pxl_open(font, font_ret, mag, mag_ret, factor, name)
  397.       char    *font, **font_ret;
  398. !     float    mag;
  399. !     int    *mag_ret;
  400.       float    *factor;
  401.       char    **name;
  402.   {
  403.       FILE    *f;
  404.       int    actual_pt, low_pt, high_pt, trial_pt;
  405. ***************
  406. *** 273,279 ****
  407.       char    fn[50], *fnend;
  408.   
  409.       *factor = 1.0;
  410. !     f = pre_pxl_open(font, mag, mag_ret, name, read_font_index);
  411.       if (f != NULL) {
  412.           *font_ret = NULL;
  413.           return f;
  414. --- 275,281 ----
  415.       char    fn[50], *fnend;
  416.   
  417.       *factor = 1.0;
  418. !     f = pre_pxl_open(font, mag, mag_ret, name);
  419.       if (f != NULL) {
  420.           *font_ret = NULL;
  421.           return f;
  422. ***************
  423. *** 293,300 ****
  424.           else if (high_pt > actual_pt + 5) break;
  425.           else trial_pt = high_pt++;
  426.           Sprintf(fnend, "%d", trial_pt);
  427. !         f = pre_pxl_open(fn, mag * actual_pt / trial_pt, mag_ret, name,
  428. !             read_font_index);
  429.           if (f != NULL) {
  430.               *font_ret = strcpy(malloc((unsigned) strlen(fn) + 1), fn);
  431.               *factor = (float) actual_pt / trial_pt;
  432. --- 295,301 ----
  433.           else if (high_pt > actual_pt + 5) break;
  434.           else trial_pt = high_pt++;
  435.           Sprintf(fnend, "%d", trial_pt);
  436. !         f = pre_pxl_open(fn, mag * actual_pt / trial_pt, mag_ret, name);
  437.           if (f != NULL) {
  438.               *font_ret = strcpy(malloc((unsigned) strlen(fn) + 1), fn);
  439.               *factor = (float) actual_pt / trial_pt;
  440. ***************
  441. *** 304,310 ****
  442.       }
  443.       if (alt_font != NULL) {
  444.           *font_ret = alt_font;
  445. !         f = pre_pxl_open(alt_font, mag, mag_ret, name, read_font_index);
  446.           if (f != NULL)
  447.           *font_ret = strcpy(malloc((unsigned) strlen(alt_font) + 1),
  448.               alt_font);
  449. --- 305,311 ----
  450.       }
  451.       if (alt_font != NULL) {
  452.           *font_ret = alt_font;
  453. !         f = pre_pxl_open(alt_font, mag, mag_ret, name);
  454.           if (f != NULL)
  455.           *font_ret = strcpy(malloc((unsigned) strlen(alt_font) + 1),
  456.               alt_font);
  457. diff -cr xdvi_old/tpic.c xdvi_new/tpic.c
  458. *** xdvi_old/tpic.c    Mon Sep 17 17:36:09 1990
  459. --- xdvi_new/tpic.c    Wed Sep 26 11:17:01 1990
  460. ***************
  461. *** 410,415 ****
  462.       else if (strcmp(command, "sh") == 0) shade_last();
  463.       else if (strcmp(command, "wh") == 0) whiten_last();
  464.       else if (strcmp(command, "bk") == 0) blacken_last();
  465. !     else if (spec_warn)
  466.       Fprintf(stderr, "%s:  special \"%s\" not implemented\n", prog, orig_cp);
  467.   }
  468. --- 410,415 ----
  469.       else if (strcmp(command, "sh") == 0) shade_last();
  470.       else if (strcmp(command, "wh") == 0) whiten_last();
  471.       else if (strcmp(command, "bk") == 0) blacken_last();
  472. !     else if (spec_warn_now)
  473.       Fprintf(stderr, "%s:  special \"%s\" not implemented\n", prog, orig_cp);
  474.   }
  475. diff -cr xdvi_old/xdvi.c xdvi_new/xdvi.c
  476. *** xdvi_old/xdvi.c    Mon Sep 17 17:36:42 1990
  477. --- xdvi_new/xdvi.c    Wed Oct 10 13:35:20 1990
  478. ***************
  479. *** 28,38 ****
  480.    */
  481.   #ifndef lint
  482.   #include "patchlevel.h"
  483. ! static    struct {char    a[36], b, c;}
  484.   #ifndef X10
  485. !     dv_c = {"$Header: xdvi.c (X11), patchlevel = ", '0' + PATCHLEVEL, 0};
  486.   #else
  487. !     dv_c = {"$Header: xdvi.c (X10), patchlevel = ", '0' + PATCHLEVEL, 0};
  488.   #endif
  489.   #endif    /* lint */
  490.   
  491. --- 28,40 ----
  492.    */
  493.   #ifndef lint
  494.   #include "patchlevel.h"
  495. ! static    struct {char    a[36], b, c, d;}
  496.   #ifndef X10
  497. !     dv_c = {"$Header: xdvi.c (X11), patchlevel = ", '0' + PATCHLEVEL / 10,
  498. !         '0' + PATCHLEVEL % 10, 0};
  499.   #else
  500. !     dv_c = {"$Header: xdvi.c (X10), patchlevel = ", '0' + PATCHLEVEL / 10,
  501. !         '0' + PATCHLEVEL % 10, 0};
  502.   #endif
  503.   #endif    /* lint */
  504.   
  505. ***************
  506. *** 58,63 ****
  507. --- 60,66 ----
  508.   #include <X11/Xlib.h>
  509.   #include <X11/Xutil.h>
  510.   #include <X11/cursorfont.h>
  511. + #include <X11/keysym.h>
  512.   #include "xdvi.icon"
  513.   #else /* X10 */
  514.   #include <X/Xlib.h>
  515. ***************
  516. *** 154,163 ****
  517.   
  518.   int    density = 40;
  519.   int    pixels_per_inch = 300;
  520.   int    unshrunk_paper_w, unshrunk_paper_h;
  521.   int    unshrunk_page_w, unshrunk_page_h;
  522.   static    char    *paper        = DEFAULT_PAPER;
  523. ! static    char    *margins, *sidemargin, *topmargin;
  524.   static    Boolean    reverse;
  525.   static    Dimension    bwidth    = 2;
  526.   static    int    bak_shrink;
  527. --- 157,169 ----
  528.   
  529.   int    density = 40;
  530.   int    pixels_per_inch = 300;
  531. + int    offset_x, offset_y;
  532.   int    unshrunk_paper_w, unshrunk_paper_h;
  533.   int    unshrunk_page_w, unshrunk_page_h;
  534. + Boolean    spec_warn    = True;
  535.   static    char    *paper        = DEFAULT_PAPER;
  536. ! static    char    *sidemargin, *topmargin;
  537. ! static    char    *xoffset, *yoffset;
  538.   static    Boolean    reverse;
  539.   static    Dimension    bwidth    = 2;
  540.   static    int    bak_shrink;
  541. ***************
  542. *** 172,177 ****
  543. --- 178,186 ----
  544.   int    pageno_correct    = 1;
  545.   Boolean    keep_flag    = False;
  546.   static    double    specialConv;
  547. + #ifdef    BUTTONS
  548. + Boolean    expert        = False;
  549. + #endif
  550.   
  551.   #ifndef X10
  552.   #ifdef    TOOLKIT
  553. ***************
  554. *** 230,235 ****
  555. --- 239,247 ----
  556.   
  557.   #ifdef    TOOLKIT
  558.   static    Widget    top_level, vport_widget, draw_widget, clip_widget;
  559. + #ifdef    BUTTONS
  560. + static    Widget    form_widget, line_widget, right_widget;
  561. + #endif
  562.   static    Widget    x_bar, y_bar;    /* horizontal and vertical scroll bars */
  563.   
  564.   static    Arg    vport_args[] = {
  565. ***************
  566. *** 320,325 ****
  567. --- 332,363 ----
  568.       {XtNheight,    (XtArgVal) 30},
  569.       {XtNcallback,    (XtArgVal) command_call},
  570.   };
  571. + static    void
  572. + create_buttons(h)
  573. +     XtArgVal    h;
  574. + {
  575. +     int i;
  576. +     line_args[2].value = h;
  577. +     line_args[3].value = (XtArgVal) vport_widget;
  578. +     line_widget = XtCreateManagedWidget("line", widgetClass, form_widget,
  579. +         line_args, XtNumber(line_args));
  580. +     right_args[0].value = (XtArgVal) line_widget;
  581. +     right_args[2].value = h;
  582. +     right_widget = XtCreateManagedWidget("right", compositeWidgetClass,
  583. +         form_widget, right_args, XtNumber(right_args));
  584. +     command_args[2].value = (XtArgVal) vport_widget;
  585. +     for (i = 0; i < XtNumber(command_table); ++i) {
  586. +         command_args[0].value = (XtArgVal) command_table[i].label;
  587. +         command_args[2].value = (XtArgVal) command_table[i].y_pos;
  588. +         command_call[0].closure = (caddr_t) command_table[i].closure;
  589. +         (void) XtCreateManagedWidget(command_table[i].name,
  590. +         commandWidgetClass, right_widget,
  591. +         command_args, XtNumber(command_args));
  592. +     }
  593. + }
  594.   #endif    /* BUTTONS */
  595.   
  596.   #else    /* !TOOLKIT */
  597. ***************
  598. *** 379,384 ****
  599. --- 417,423 ----
  600.   
  601.   char    *malloc();
  602.   double    atof();
  603. + void    exit();
  604.   
  605.   /********************************
  606.    *      tpic routines        *
  607. ***************
  608. *** 614,625 ****
  609.   #define    mane_base_x    0
  610.   #define    mane_base_y    0
  611.   
  612. ! #define    home(x)    Xtk_home()
  613. ! static
  614. ! Xtk_home()
  615.   {
  616.       register int coord;
  617.   
  618.       get_xy();
  619.       if (x_bar) {
  620.           coord = 0;
  621. --- 653,665 ----
  622.   #define    mane_base_x    0
  623.   #define    mane_base_y    0
  624.   
  625. ! static    void
  626. ! home(scrl)
  627. !     Boolean    scrl;
  628.   {
  629.       register int coord;
  630.   
  631. +     if (!scrl) XUnmapWindow(DISP, WINDOW(mane));
  632.       get_xy();
  633.       if (x_bar) {
  634.           coord = 0;
  635. ***************
  636. *** 639,644 ****
  637. --- 679,689 ----
  638.           }
  639.           XtCallCallbacks(y_bar, XtNscrollProc, window_y + coord);
  640.       }
  641. +     if (!scrl) {
  642. +         XMapWindow(DISP, WINDOW(mane));
  643. +         /* Wait for the server to catch up---this eliminates flicker. */
  644. +         XSync(DISP, False);
  645. +     }
  646.   }
  647.   
  648.   static    Boolean    resized    = False;
  649. ***************
  650. *** 793,798 ****
  651. --- 838,849 ----
  652.   {
  653.       int    x_thick = 0;
  654.       int    y_thick = 0;
  655. + #ifdef    X10
  656. +     int    old_clip_w = clip_w;
  657. +     int    old_clip_h = clip_h;
  658. +     int    old_x_thick = x_thick;
  659. +     int    old_y_thick = y_thick;
  660. + #endif
  661.   
  662.           /* determine existence of scrollbars */
  663.       if (window_w < page_w) x_thick = BAR_THICK;
  664. ***************
  665. *** 821,828 ****
  666. --- 872,887 ----
  667.           XMapWindow(DPY WINDOW(mane));
  668.       }
  669.       else
  670. + #ifdef    X10
  671. +     if (clip_w != old_clip_w || clip_h != old_clip_h ||
  672. +         x_thick != old_x_thick || y_thick != old_y_thick) {
  673. + #endif
  674.           XMoveResizeWindow(DPY WINDOW(mane),
  675.           y_thick, x_thick, clip_w, clip_h);
  676. + #ifdef    X10
  677. +         XSync(False);
  678. +     }
  679. + #endif
  680.   
  681.           /* process scroll bars */
  682.       if (x_thick) {
  683. ***************
  684. *** 1124,1130 ****
  685.       XEvent    *eventp;
  686.   {
  687.       int    next_page;
  688. ! #ifndef X10
  689.       Window    ww;
  690.   #endif
  691.   
  692. --- 1183,1189 ----
  693.       XEvent    *eventp;
  694.   {
  695.       int    next_page;
  696. ! #ifdef    TOOLKIT
  697.       Window    ww;
  698.   #endif
  699.   
  700. ***************
  701. *** 1190,1195 ****
  702. --- 1249,1279 ----
  703.           case 'c':
  704.           center(eventp->xkey.x, eventp->xkey.y);
  705.           return;
  706. +         case 'M':
  707. +         XTranslateCoordinates(DISP, eventp->xkey.window,
  708. +             WINDOW(mane), eventp->xkey.x, eventp->xkey.y,
  709. +             &home_x, &home_y, &ww);    /* throw away last argument */
  710. +         home_x *= mane.shrinkfactor;
  711. +         home_y *= mane.shrinkfactor;
  712. +         return;
  713. + #ifdef    BUTTONS
  714. +         case 'x':
  715. +         if (arg0 && expert == (number0 != 0)) return;
  716. +         if (expert) {    /* create buttons */
  717. +             XtResizeWidget(vport_widget, window_w -= XTRA_WID, window_h,
  718. +             0);
  719. +             create_buttons((XtArgVal) window_h);
  720. +             expert = False;
  721. +         }
  722. +         else {        /* destroy buttons */
  723. +             XtResizeWidget(vport_widget, window_w += XTRA_WID, window_h,
  724. +             0);
  725. +             XtDestroyWidget(right_widget);
  726. +             XtDestroyWidget(line_widget);
  727. +             expert = True;
  728. +         }
  729. +         return;
  730. + #endif    /* BUTTONS */
  731.   #else    /* !TOOLKIT */
  732.           case 'l':
  733.           if (mane.base_x <= 0) goto bad;
  734. ***************
  735. *** 1219,1246 ****
  736.           XWarpMouse(WINDOW(mane), clip_w/2, clip_h/2, GXcopy);
  737.   #endif
  738.           return;
  739.   #endif    /* TOOLKIT */
  740.   
  741.   #ifndef X10
  742. -         case 'M':
  743. -         XTranslateCoordinates(DISP, eventp->xkey.window,
  744. -             WINDOW(mane), eventp->xkey.x, eventp->xkey.y,
  745. -             &home_x, &home_y, &ww);    /* throw away last argument */
  746. -         home_x *= mane.shrinkfactor;
  747. -         home_y *= mane.shrinkfactor;
  748. -         return;
  749.           case '\020':    /* Control P */
  750.           Printf("Unit = %d, bitord = %d, byteord = %d\n",
  751.               BitmapUnit(DISP), BitmapBitOrder(DISP),
  752.               ImageByteOrder(DISP));
  753.           return;
  754. - #else
  755. -         case 'M':
  756. -         home_x = (XKEY(*eventp).x - (y_bar ? BAR_THICK : 0)
  757. -             + mane.base_x) * mane.shrinkfactor;
  758. -         home_y = (XKEY(*eventp).y - (x_bar ? BAR_THICK : 0)
  759. -             + mane.base_y) * mane.shrinkfactor;
  760. -         return;
  761.   #endif
  762.           case 's':
  763.           if (!arg0) {
  764. --- 1303,1322 ----
  765.           XWarpMouse(WINDOW(mane), clip_w/2, clip_h/2, GXcopy);
  766.   #endif
  767.           return;
  768. +         case 'M':
  769. +         home_x = (XKEY(*eventp).x - (y_bar ? BAR_THICK : 0)
  770. +             + mane.base_x) * mane.shrinkfactor;
  771. +         home_y = (XKEY(*eventp).y - (x_bar ? BAR_THICK : 0)
  772. +             + mane.base_y) * mane.shrinkfactor;
  773. +         return;
  774.   #endif    /* TOOLKIT */
  775.   
  776.   #ifndef X10
  777.           case '\020':    /* Control P */
  778.           Printf("Unit = %d, bitord = %d, byteord = %d\n",
  779.               BitmapUnit(DISP), BitmapBitOrder(DISP),
  780.               ImageByteOrder(DISP));
  781.           return;
  782.   #endif
  783.           case 's':
  784.           if (!arg0) {
  785. ***************
  786. *** 1258,1281 ****
  787.               reset_fonts();
  788.           }
  789.   #ifdef    TOOLKIT
  790. !         XUnmapWindow(DISP, WINDOW(mane));
  791. !         {
  792. !             Dimension replyW, replyH;
  793. !             if (XtMakeResizeRequest(draw_widget, (Dimension) page_w,
  794. !                 (Dimension) page_h, &replyW, &replyH)
  795. !                 == XtGeometryAlmost)
  796. !             (void) XtMakeResizeRequest(draw_widget, replyW, replyH,
  797. !                 (Dimension *) NULL, (Dimension *) NULL);
  798. !         }
  799.           get_geom();
  800.           home(False);
  801. -         XMapWindow(DISP, WINDOW(mane));
  802. -         /* Wait for next event; this will likely be an expose event,
  803. -            so we don't redraw the window twice. */
  804. -         {
  805. -             XEvent event;
  806. -             XPeekEvent(DISP, &event);
  807. -         }
  808.   #else    /* TOOLKIT */
  809.           reconfig();
  810.           home(False);
  811. --- 1334,1344 ----
  812.               reset_fonts();
  813.           }
  814.   #ifdef    TOOLKIT
  815. !         draw_args[0].value = (XtArgVal) page_w;
  816. !         draw_args[1].value = (XtArgVal) page_h;
  817. !         XtSetValues(draw_widget, draw_args, (Cardinal) 2);
  818.           get_geom();
  819.           home(False);
  820.   #else    /* TOOLKIT */
  821.           reconfig();
  822.           home(False);
  823. ***************
  824. *** 1299,1305 ****
  825.       if (0 <= next_page && next_page < total_pages) {
  826.           if (current_page != next_page) {
  827.           current_page = next_page;
  828. !         spec_warn = True;
  829.           if (!keep_flag) home(False);
  830.           }
  831.           canit = True;
  832. --- 1362,1368 ----
  833.       if (0 <= next_page && next_page < total_pages) {
  834.           if (current_page != next_page) {
  835.           current_page = next_page;
  836. !         spec_warn_now = spec_warn;
  837.           if (!keep_flag) home(False);
  838.           }
  839.           canit = True;
  840. ***************
  841. *** 1566,1578 ****
  842.       }
  843.       else {
  844.           draw_page();
  845. !         spec_warn = False;
  846.       }
  847.   }
  848.   
  849.   redraw_page()
  850.   {
  851. !     if (debug & DBG_EVENT) fputs("Redraw page:  ", stdout);
  852.       get_xy();
  853.       ClearPage(mane);
  854.       mane.min_x = -window_x;
  855. --- 1629,1641 ----
  856.       }
  857.       else {
  858.           draw_page();
  859. !         spec_warn_now = False;
  860.       }
  861.   }
  862.   
  863.   redraw_page()
  864.   {
  865. !     if (debug & DBG_EVENT) Fputs("Redraw page:  ", stdout);
  866.       get_xy();
  867.       ClearPage(mane);
  868.       mane.min_x = -window_x;
  869. ***************
  870. *** 1610,1616 ****
  871.       windowrec->max_x = windowrec->max_y = 0;
  872.   }
  873.   
  874. ! static    int
  875.   handle_intr() {
  876.       event_counter = 1;
  877.       event_freq = -1;    /* forget Plan B */
  878. --- 1673,1679 ----
  879.       windowrec->max_x = windowrec->max_y = 0;
  880.   }
  881.   
  882. ! static    void
  883.   handle_intr() {
  884.       event_counter = 1;
  885.       event_freq = -1;    /* forget Plan B */
  886. ***************
  887. *** 1681,1703 ****
  888.   usage() {
  889.   #ifndef X10
  890.   #ifndef    VMS
  891. !     fputs("\
  892. ! Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l]\n\
  893.       [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
  894. !     [-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>] [-rv]\
  895.   \n\
  896.       [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
  897.   [-cr <color>]\n\
  898.       [-bw <width>] [-geometry <geometry>] [-icongeometry <geometry>]\n\
  899.       [-iconic] [-display <host:display>] [-copy] [-thorough] dvi_file\n",
  900.       stderr);
  901.   #else    /* VMS */
  902. !     fputs("\
  903. ! Usage: xdvi [+[<page>]] [-s <shrink>] [-density <%>] [-p <pixels>] [-l]\n\
  904.       [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
  905. !     [-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>] [-rv]\
  906.   \n", stderr);
  907. !     fputs("\
  908.       [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
  909.   [-cr <color>]\n\
  910.       [-bw <width>] [-geometry <geometry>] [-icongeometry <geometry>]\n\
  911. --- 1744,1782 ----
  912.   usage() {
  913.   #ifndef X10
  914.   #ifndef    VMS
  915. ! #ifdef    BUTTONS
  916. !     Fputs("\
  917. ! Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-sw]\n\
  918. !     [-expert] [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
  919. !     [-margins <dimen>] [-sidemargin <dimen>] [-topmargin <dimen>] [-rv]\
  920. ! \n\
  921. !     [-offsets <dimen>] [-xoffset <dimen>] [-yoffset <dimen>]\n\
  922. !     [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
  923. ! [-cr <color>]\n\
  924. !     [-bw <width>] [-geometry <geometry>] [-icongeometry <geometry>]\n\
  925. !     [-iconic] [-display <host:display>] [-copy] [-thorough] dvi_file\n",
  926. !     stderr);
  927. ! #else    /* !BUTTONS */
  928. !     Fputs("\
  929. ! Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-sw]\n\
  930.       [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
  931. !     [-margins <dimen>] [-sidemargin <dimen>] [-topmargin <dimen>] [-rv]\
  932.   \n\
  933. +     [-offsets <dimen>] [-xoffset <dimen>] [-yoffset <dimen>]\n\
  934.       [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
  935.   [-cr <color>]\n\
  936.       [-bw <width>] [-geometry <geometry>] [-icongeometry <geometry>]\n\
  937.       [-iconic] [-display <host:display>] [-copy] [-thorough] dvi_file\n",
  938.       stderr);
  939. + #endif    /* BUTTONS */
  940.   #else    /* VMS */
  941. !     Fputs("\
  942. ! Usage: xdvi [+[<page>]] [-s <shrink>] [-density <%>] [-p <pixels>] [-l] [-sw]\n\
  943.       [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
  944. !     [-margins <dimen>] [-sidemargin <dimen>] [-topmargin <dimen>] [-rv]\
  945.   \n", stderr);
  946. !     Fputs("\
  947. !     [-offsets <dimen>] [-xoffset <dimen>] [-yoffset <dimen>]\n\
  948.       [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
  949.   [-cr <color>]\n\
  950.       [-bw <width>] [-geometry <geometry>] [-icongeometry <geometry>]\n\
  951. ***************
  952. *** 1705,1715 ****
  953.       stderr);
  954.   #endif    /* VMS */
  955.   #else    /* X10 */
  956. !     fputs("\
  957. ! Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l]\n\
  958.       [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
  959. !     [-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>] [-rv]\
  960.   \n\
  961.       [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
  962.   [-cr <color>]\n\
  963.       [-bw <width>] [-geometry <geometry> | =<geometry>]\n\
  964. --- 1784,1795 ----
  965.       stderr);
  966.   #endif    /* VMS */
  967.   #else    /* X10 */
  968. !     Fputs("\
  969. ! Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-sw]\n\
  970.       [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
  971. !     [-margins <dimen>] [-sidemargin <dimen>] [-topmargin <dimen>] [-rv]\
  972.   \n\
  973. +     [-offsets <dimen>] [-xoffset <dimen>] [-yoffset <dimen>]\n\
  974.       [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
  975.   [-cr <color>]\n\
  976.       [-bw <width>] [-geometry <geometry> | =<geometry>]\n\
  977. ***************
  978. *** 1718,1723 ****
  979. --- 1798,1813 ----
  980.       exit(1);
  981.   }
  982.   
  983. + static    int
  984. + atopix(arg)
  985. +     char    *arg;
  986. + {
  987. +     int    len    = strlen(arg);
  988. +     return (len > 2 && arg[len - 2] == 'c' && arg[len - 1] == 'm' ?
  989. +         1.0 / 2.54 : 1.0) * atof(arg) * pixels_per_inch + 0.5;
  990. + }
  991.   /**
  992.    **    Main programs start here.
  993.    **/
  994. ***************
  995. *** 1738,1750 ****
  996.   #endif
  997.   {"-density",    ".densityPercent", XrmoptionSepArg,    (caddr_t) NULL},
  998.   {"-p",        ".pixelsPerInch", XrmoptionSepArg,    (caddr_t) NULL},
  999. ! {"-margins",    ".margins",    XrmoptionSepArg,    (caddr_t) NULL},
  1000.   {"-sidemargin",    ".sideMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1001.   {"-topmargin",    ".topMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1002.   {"-paper",    ".paper",    XrmoptionSepArg,    (caddr_t) NULL},
  1003.   {"-altfont",    ".altFont",    XrmoptionSepArg,    (caddr_t) NULL},
  1004.   {"-l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "on"},
  1005.   {"+l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "off"},
  1006.   {"-fg",        ".foreground",    XrmoptionSepArg,    (caddr_t) NULL},
  1007.   {"-foreground",    ".foreground",    XrmoptionSepArg,    (caddr_t) NULL},
  1008.   {"-bg",        ".background",    XrmoptionSepArg,    (caddr_t) NULL},
  1009. --- 1828,1845 ----
  1010.   #endif
  1011.   {"-density",    ".densityPercent", XrmoptionSepArg,    (caddr_t) NULL},
  1012.   {"-p",        ".pixelsPerInch", XrmoptionSepArg,    (caddr_t) NULL},
  1013. ! {"-margins",    ".Margin",    XrmoptionSepArg,    (caddr_t) NULL},
  1014.   {"-sidemargin",    ".sideMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1015.   {"-topmargin",    ".topMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1016. + {"-offsets",    ".Offset",    XrmoptionSepArg,    (caddr_t) NULL},
  1017. + {"-xoffset",    ".xOffset",    XrmoptionSepArg,    (caddr_t) NULL},
  1018. + {"-yoffset",    ".yOffset",    XrmoptionSepArg,    (caddr_t) NULL},
  1019.   {"-paper",    ".paper",    XrmoptionSepArg,    (caddr_t) NULL},
  1020.   {"-altfont",    ".altFont",    XrmoptionSepArg,    (caddr_t) NULL},
  1021.   {"-l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "on"},
  1022.   {"+l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "off"},
  1023. + {"-sw",        ".specialWarn",    XrmoptionNoArg,        (caddr_t) "on"},
  1024. + {"+sw",        ".specialWarn",    XrmoptionNoArg,        (caddr_t) "off"},
  1025.   {"-fg",        ".foreground",    XrmoptionSepArg,    (caddr_t) NULL},
  1026.   {"-foreground",    ".foreground",    XrmoptionSepArg,    (caddr_t) NULL},
  1027.   {"-bg",        ".background",    XrmoptionSepArg,    (caddr_t) NULL},
  1028. ***************
  1029. *** 1756,1761 ****
  1030. --- 1851,1860 ----
  1031.   {"+copy",    ".copy",    XrmoptionNoArg,        (caddr_t) "off"},
  1032.   {"-thorough",    ".thorough",    XrmoptionNoArg,        (caddr_t) "on"},
  1033.   {"+thorough",    ".thorough",    XrmoptionNoArg,        (caddr_t) "off"},
  1034. + #ifdef    BUTTONS
  1035. + {"-expert",    ".expert",    XrmoptionNoArg,        (caddr_t) "on"},
  1036. + {"+expert",    ".expert",    XrmoptionNoArg,        (caddr_t) "off"},
  1037. + #endif
  1038.   {"-mgs",    ".magnifierSize1",XrmoptionSepArg,    (caddr_t) NULL},
  1039.   {"-mgs1",    ".magnifierSize1",XrmoptionSepArg,    (caddr_t) NULL},
  1040.   {"-mgs2",    ".magnifierSize2",XrmoptionSepArg,    (caddr_t) NULL},
  1041. ***************
  1042. *** 1773,1784 ****
  1043.     (Cardinal) &density, XtRInt, (caddr_t) &density},
  1044.   {"pixelsPerInch", "PixelsPerInch", XtRInt, sizeof(int),
  1045.     (Cardinal) &pixels_per_inch, XtRInt, (caddr_t) &pixels_per_inch},
  1046. - {"margins", "Margin", XtRString, sizeof(char *),
  1047. -   (Cardinal) &margins, XtRString, NULL},
  1048.   {"sideMargin", "Margin", XtRString, sizeof(char *),
  1049.     (Cardinal) &sidemargin, XtRString, NULL},
  1050.   {"topMargin", "Margin", XtRString, sizeof(char *),
  1051.     (Cardinal) &topmargin, XtRString, NULL},
  1052.   {"paper", "Paper", XtRString, sizeof(char *),
  1053.     (Cardinal) &paper, XtRString, (caddr_t) DEFAULT_PAPER},
  1054.   {"altFont", "AltFont", XtRString, sizeof(char *),
  1055. --- 1872,1885 ----
  1056.     (Cardinal) &density, XtRInt, (caddr_t) &density},
  1057.   {"pixelsPerInch", "PixelsPerInch", XtRInt, sizeof(int),
  1058.     (Cardinal) &pixels_per_inch, XtRInt, (caddr_t) &pixels_per_inch},
  1059.   {"sideMargin", "Margin", XtRString, sizeof(char *),
  1060.     (Cardinal) &sidemargin, XtRString, NULL},
  1061.   {"topMargin", "Margin", XtRString, sizeof(char *),
  1062.     (Cardinal) &topmargin, XtRString, NULL},
  1063. + {"xOffset", "Offset", XtRString, sizeof(char *),
  1064. +   (Cardinal) &xoffset, XtRString, NULL},
  1065. + {"yOffset", "Offset", XtRString, sizeof(char *),
  1066. +   (Cardinal) &yoffset, XtRString, NULL},
  1067.   {"paper", "Paper", XtRString, sizeof(char *),
  1068.     (Cardinal) &paper, XtRString, (caddr_t) DEFAULT_PAPER},
  1069.   {"altFont", "AltFont", XtRString, sizeof(char *),
  1070. ***************
  1071. *** 1787,1792 ****
  1072. --- 1888,1895 ----
  1073.     (Cardinal) &list_fonts, XtRBoolean, (caddr_t) &list_fonts},
  1074.   {"reverseVideo", "ReverseVideo", XtRBoolean, sizeof(Boolean),
  1075.     (Cardinal) &reverse, XtRBoolean, (caddr_t) &reverse},
  1076. + {"specialWarn", "SpecialWarn", XtRBoolean, sizeof(Boolean),
  1077. +   (Cardinal) &spec_warn, XtRBoolean, (caddr_t) &spec_warn},
  1078.   {"foreground", "Foreground", XtRPixel, sizeof(Pixel),
  1079.     (Cardinal)&fore_Pixel, XtRPixel, (caddr_t) &fore_Pixel},
  1080.   {"foreground", "Foreground", XtRString, sizeof(char *),
  1081. ***************
  1082. *** 1813,1818 ****
  1083. --- 1916,1925 ----
  1084.     (Cardinal)©, XtRBoolean, (caddr_t) ©},
  1085.   {"thorough", "Thorough", XtRBoolean, sizeof(Boolean),
  1086.     (Cardinal)&thorough, XtRBoolean, (caddr_t) &thorough},
  1087. + #ifdef    BUTTONS
  1088. + {"expert", "Expert", XtRBoolean, sizeof(Boolean),
  1089. +   (Cardinal)&expert, XtRBoolean, (caddr_t) &expert},
  1090. + #endif
  1091.   {"magnifierSize1", "MagnifierSize", XtRInt, sizeof(int),
  1092.     (Cardinal) &mg_size[0], XtRInt, (caddr_t) &mg_size[0]},
  1093.   {"magnifierSize2", "MagnifierSize", XtRInt, sizeof(int),
  1094. ***************
  1095. *** 1837,1842 ****
  1096. --- 1944,1950 ----
  1097.       {XtNheight,    (XtArgVal) 0},
  1098.       {XtNiconPixmap,    (XtArgVal) 0},
  1099.       {XtNinput,    (XtArgVal) True},
  1100. +     {XtNtitle,    (XtArgVal) 0},
  1101.   };
  1102.   
  1103.   #else    /* !TOOLKIT */
  1104. ***************
  1105. *** 1843,1848 ****
  1106. --- 1951,1958 ----
  1107.   
  1108.   static    char    *display;
  1109.   static    char    *geometry;
  1110. + static    char    *margins;
  1111. + static    char    *offsets;
  1112.   
  1113.   #ifndef X10
  1114.   static    Boolean    iconic    = False;
  1115. ***************
  1116. *** 1879,1933 ****
  1117.       char    *resource;
  1118.       enum    {FalseArg, TrueArg, StickyArg, SepArg} argclass;
  1119.       enum    {BooleanArg, StringArg, NumberArg} argtype;
  1120.       caddr_t    address;
  1121.   }    options[] = {
  1122.           /* the display option MUST be first */
  1123. ! {"-display",    NULL,        SepArg,    StringArg,    (caddr_t) &display},
  1124. ! {"-d",        "debugLevel",    SepArg,    StringArg,    (caddr_t) &debug_arg},
  1125. ! {"+",        NULL,        StickyArg, StringArg,    (caddr_t) &curr_page},
  1126. ! {"-s",        "shrinkFactor", SepArg, NumberArg,    (caddr_t) &shrink_factor},
  1127. ! {"-S",        "densityPercent", SepArg, NumberArg,    (caddr_t) &density},
  1128. ! {"-density",    NULL,        SepArg, NumberArg,    (caddr_t) &density},
  1129. ! {"-p",        "pixelsPerInch", SepArg, NumberArg,    (caddr_t) &pixels_per_inch},
  1130. ! {"-margins",    "margins",    SepArg,    StringArg,    (caddr_t) &margins},
  1131. ! {"-sidemargin",    "sideMargin",    SepArg,    StringArg,    (caddr_t) &sidemargin},
  1132. ! {"-topmargin",    "topMargin",    SepArg,    StringArg,    (caddr_t) &topmargin},
  1133. ! {"-paper",    "paper",    SepArg,    StringArg,    (caddr_t) &paper},
  1134. ! {"-altfont",    "altFont",    SepArg,    StringArg,    (caddr_t) &alt_font},
  1135. ! {"-l",        "listFonts",    TrueArg, BooleanArg,    (caddr_t) &list_fonts},
  1136. ! {"+l",        NULL,        FalseArg, BooleanArg,    (caddr_t) &list_fonts},
  1137. ! {"-rv",        "reverseVideo",    TrueArg, BooleanArg,    (caddr_t) &reverse},
  1138. ! {"+rv",        NULL,        FalseArg, BooleanArg,    (caddr_t) &reverse},
  1139. ! {"-bw",        "borderWidth",    SepArg,    NumberArg,    (caddr_t) &bwidth},
  1140. ! {"-borderwidth", NULL,        SepArg,    NumberArg,    (caddr_t) &bwidth},
  1141. ! {"-fg",        "foreground",    SepArg,    StringArg,    (caddr_t) &fore_color},
  1142. ! {"-foreground",    NULL,        SepArg,    StringArg,    (caddr_t) &fore_color},
  1143. ! {"-bg",        "background",    SepArg,    StringArg,    (caddr_t) &back_color},
  1144. ! {"-background",    NULL,        SepArg,    StringArg,    (caddr_t) &back_color},
  1145. ! {"-bd",        "borderColor",    SepArg,    StringArg,    (caddr_t) &brdr_color},
  1146. ! {"-bordercolor",NULL,        SepArg,    StringArg,    (caddr_t) &brdr_color},
  1147. ! {"-hl",        "highlight",    SepArg,    StringArg,    (caddr_t) &high_color},
  1148. ! {"-cr",        "cursorColor",    SepArg,    StringArg,    (caddr_t) &curs_color},
  1149. ! {"-geometry",    "geometry",    SepArg,    StringArg,    (caddr_t) &geometry},
  1150.   #ifdef    X10
  1151. ! {"=",        NULL,        StickyArg, StringArg,    (caddr_t) &geometry},
  1152.   #endif
  1153.   #ifndef    X10
  1154. ! {"-icongeometry","iconGeometry",StickyArg, StringArg,    (caddr_t) &icon_geometry},
  1155. ! {"-iconic",    "iconic",    TrueArg, BooleanArg,    (caddr_t) &iconic},
  1156. ! {"+iconic",    NULL,        FalseArg, BooleanArg,    (caddr_t) &iconic},
  1157. ! {"-copy",    "copy",        TrueArg, BooleanArg,    (caddr_t) ©},
  1158. ! {"+copy",    NULL,        FalseArg, BooleanArg,    (caddr_t) ©},
  1159. ! {"-thorough",    "thorough",    TrueArg, BooleanArg,    (caddr_t) &thorough},
  1160. ! {"+thorough",    NULL,        FalseArg, BooleanArg,    (caddr_t) &thorough},
  1161.   #endif    /* X10 */
  1162. ! {"-mgs",    NULL,        SepArg, NumberArg,    (caddr_t) &mg_size[0]},
  1163. ! {"-mgs1",    "magnifierSize1",SepArg, NumberArg,    (caddr_t) &mg_size[0]},
  1164. ! {"-mgs2",    "magnifierSize2",SepArg, NumberArg,    (caddr_t) &mg_size[1]},
  1165. ! {"-mgs3",    "magnifierSize3",SepArg, NumberArg,    (caddr_t) &mg_size[2]},
  1166.   #ifndef X10
  1167. ! {"-mgs4",    "magnifierSize3",SepArg, NumberArg,    (caddr_t) &mg_size[3]},
  1168. ! {"-mgs5",    "magnifierSize3",SepArg, NumberArg,    (caddr_t) &mg_size[4]},
  1169.   #endif
  1170.   };
  1171.   
  1172. --- 1989,2049 ----
  1173.       char    *resource;
  1174.       enum    {FalseArg, TrueArg, StickyArg, SepArg} argclass;
  1175.       enum    {BooleanArg, StringArg, NumberArg} argtype;
  1176. +     int    classcount;
  1177.       caddr_t    address;
  1178.   }    options[] = {
  1179.           /* the display option MUST be first */
  1180. ! {"-display",    NULL,        SepArg,    StringArg, 1,    (caddr_t) &display},
  1181. ! {"-d",        "debugLevel",    SepArg,    StringArg, 1,    (caddr_t) &debug_arg},
  1182. ! {"+",        NULL,        StickyArg, StringArg, 1,(caddr_t) &curr_page},
  1183. ! {"-s",        "shrinkFactor", SepArg, NumberArg, 1,    (caddr_t) &shrink_factor},
  1184. ! {"-S",        NULL,        SepArg, NumberArg, 2,    (caddr_t) &density},
  1185. ! {"-density",    "densityPercent", SepArg, NumberArg, 1,    (caddr_t) &density},
  1186. ! {"-p",        "pixelsPerInch", SepArg, NumberArg, 1,    (caddr_t) &pixels_per_inch},
  1187. ! {"-margins",    "Margin",    SepArg,    StringArg, 3,    (caddr_t) &margins},
  1188. ! {"-sidemargin",    "sideMargin",    SepArg,    StringArg, 1,    (caddr_t) &sidemargin},
  1189. ! {"-topmargin",    "topMargin",    SepArg,    StringArg, 1,    (caddr_t) &topmargin},
  1190. ! {"-offsets",    "Offset",    SepArg,    StringArg, 3,    (caddr_t) &offsets},
  1191. ! {"-xoffset",    "xOffset",    SepArg,    StringArg, 1,    (caddr_t) &xoffset},
  1192. ! {"-yoffset",    "yOffset",    SepArg,    StringArg, 1,    (caddr_t) &yoffset},
  1193. ! {"-paper",    "paper",    SepArg,    StringArg, 1,    (caddr_t) &paper},
  1194. ! {"-altfont",    "altFont",    SepArg,    StringArg, 1,    (caddr_t) &alt_font},
  1195. ! {"-l",        NULL,        TrueArg, BooleanArg, 2,    (caddr_t) &list_fonts},
  1196. ! {"+l",        "listFonts",    FalseArg, BooleanArg, 1,(caddr_t) &list_fonts},
  1197. ! {"-rv",        NULL,        TrueArg, BooleanArg, 2,    (caddr_t) &reverse},
  1198. ! {"+rv",        "reverseVideo",    FalseArg, BooleanArg, 1,(caddr_t) &reverse},
  1199. ! {"-sw",        NULL,        TrueArg, BooleanArg, 2,    (caddr_t) &spec_warn},
  1200. ! {"+sw",        "specialWarn",    FalseArg, BooleanArg, 1,(caddr_t) &spec_warn},
  1201. ! {"-bw",        NULL,        SepArg,    NumberArg, 2,    (caddr_t) &bwidth},
  1202. ! {"-borderwidth", "borderWidth",    SepArg,    NumberArg, 1,    (caddr_t) &bwidth},
  1203. ! {"-fg",        NULL,        SepArg,    StringArg, 2,    (caddr_t) &fore_color},
  1204. ! {"-foreground",    "foreground",    SepArg,    StringArg, 1,    (caddr_t) &fore_color},
  1205. ! {"-bg",        NULL,        SepArg,    StringArg, 2,    (caddr_t) &back_color},
  1206. ! {"-background",    "background",    SepArg,    StringArg, 1,    (caddr_t) &back_color},
  1207. ! {"-bd",        NULL,        SepArg,    StringArg, 2,    (caddr_t) &brdr_color},
  1208. ! {"-bordercolor","borderColor",    SepArg,    StringArg, 1,    (caddr_t) &brdr_color},
  1209. ! {"-hl",        "highlight",    SepArg,    StringArg, 1,    (caddr_t) &high_color},
  1210. ! {"-cr",        "cursorColor",    SepArg,    StringArg, 1,    (caddr_t) &curs_color},
  1211.   #ifdef    X10
  1212. ! {"=",        NULL,        StickyArg, StringArg, 2,(caddr_t) &geometry},
  1213.   #endif
  1214. + {"-geometry",    "geometry",    SepArg,    StringArg, 1,    (caddr_t) &geometry},
  1215.   #ifndef    X10
  1216. ! {"-icongeometry","iconGeometry",StickyArg, StringArg, 1,(caddr_t) &icon_geometry},
  1217. ! {"-iconic",    NULL,        TrueArg, BooleanArg, 2,    (caddr_t) &iconic},
  1218. ! {"+iconic",    "iconic",    FalseArg, BooleanArg, 1,(caddr_t) &iconic},
  1219. ! {"-copy",    NULL,        TrueArg, BooleanArg, 2,    (caddr_t) ©},
  1220. ! {"+copy",    "copy",        FalseArg, BooleanArg, 1,(caddr_t) ©},
  1221. ! {"-thorough",    NULL,        TrueArg, BooleanArg, 2,    (caddr_t) &thorough},
  1222. ! {"+thorough",    "thorough",    FalseArg, BooleanArg, 1,(caddr_t) &thorough},
  1223.   #endif    /* X10 */
  1224. ! {"-mgs",    NULL,        SepArg, NumberArg, 2,    (caddr_t) &mg_size[0]},
  1225. ! {"-mgs1",    "magnifierSize1",SepArg, NumberArg, 1,    (caddr_t) &mg_size[0]},
  1226. ! {"-mgs2",    "magnifierSize2",SepArg, NumberArg, 1,    (caddr_t) &mg_size[1]},
  1227. ! {"-mgs3",    "magnifierSize3",SepArg, NumberArg, 1,    (caddr_t) &mg_size[2]},
  1228.   #ifndef X10
  1229. ! {"-mgs4",    "magnifierSize4",SepArg, NumberArg, 1,    (caddr_t) &mg_size[3]},
  1230. ! {"-mgs5",    "magnifierSize5",SepArg, NumberArg, 1,    (caddr_t) &mg_size[4]},
  1231.   #endif
  1232.   };
  1233.   
  1234. ***************
  1235. *** 1946,1952 ****
  1236.       char    *optstring;
  1237.       caddr_t    addr;
  1238.       struct option *opt, *candidate;
  1239. !     int    len1, len2, matchlen;
  1240.   
  1241.       for (arg = argv + 1; arg < argvend; ++arg) {
  1242.           len1 = strlen(*arg);
  1243. --- 2062,2068 ----
  1244.       char    *optstring;
  1245.       caddr_t    addr;
  1246.       struct option *opt, *candidate;
  1247. !     int    len1, len2, matchlen, i;
  1248.   
  1249.       for (arg = argv + 1; arg < argvend; ++arg) {
  1250.           len1 = strlen(*arg);
  1251. ***************
  1252. *** 1989,1996 ****
  1253.           }
  1254.           }
  1255.           addr = candidate->address;
  1256. -         for (opt = options; opt < options + XtNumber(options); ++opt)
  1257. -         if (opt->address == addr) opt->resource = NULL;
  1258.           switch (candidate->argclass) {
  1259.           case FalseArg:    *((Boolean *) addr) = False; break;
  1260.           case TrueArg:    *((Boolean *) addr) = True; break;
  1261. --- 2105,2110 ----
  1262. ***************
  1263. *** 2006,2011 ****
  1264. --- 2120,2127 ----
  1265.           case StringArg:    *((char **) addr) = optstring; break;
  1266.           case NumberArg:    *((int *) addr) = atoi(optstring); break;
  1267.           }
  1268. +         for (i = candidate->classcount; i > 0; --i)
  1269. +         (candidate++)->resource = NULL;
  1270.       }
  1271.   
  1272.   #ifndef X10
  1273. ***************
  1274. *** 2035,2040 ****
  1275. --- 2151,2161 ----
  1276.               *((Boolean *) opt->address) =
  1277.                   (strcmp(optstring, "on") == 0);
  1278.           }
  1279. +     if (!sidemargin) sidemargin = margins;
  1280. +     if (!topmargin) topmargin = margins;
  1281. +     if (!xoffset) xoffset = offsets;
  1282. +     if (!yoffset) yoffset = offsets;
  1283.   }
  1284.   
  1285.   #endif    /* TOOLKIT */
  1286. ***************
  1287. *** 2102,2140 ****
  1288.   
  1289.   static    Boolean
  1290.   set_paper_type() {
  1291.       char    temp[21];
  1292. -     int    i;
  1293. -     double    factor    = 1.0;
  1294. -     char    c;
  1295.       char    **p;
  1296.       char    *q;
  1297.   
  1298.       if (strlen(paper) > sizeof(temp) - 1) return False;
  1299. !     i = 0;
  1300.       for (;;) {    /* convert to lower case */
  1301. !         c = paper[i];
  1302.           if (c >= 'A' && c <= 'Z') c ^= ('a' ^ 'A');
  1303. !         temp[i] = c;
  1304.           if (c == '\0') break;
  1305. -         ++i;
  1306.       }
  1307.       /* perform substitutions */
  1308.       for (p = paper_types; p < paper_types + XtNumber(paper_types); p += 2)
  1309.           if (strcmp(temp, *p) == 0) {
  1310. !         (void) strcpy(temp, p[1]);
  1311. !         i = strlen(temp);
  1312.           break;
  1313.           }
  1314. !     if (i > 2 && strcmp(temp + i - 2, "cm") == 0) {
  1315. !         factor = 1.0 / 2.54;
  1316. !         temp[i - 2] = '\0';
  1317. !     }
  1318. !     q = index(temp, 'x');
  1319.       if (q == NULL) return False;
  1320. !     *q = '\0';
  1321. !     factor *= pixels_per_inch;
  1322. !     unshrunk_paper_w = atof(temp) * factor + 0.5;
  1323. !     unshrunk_paper_h = atof(q + 1) * factor + 0.5;
  1324.       return (unshrunk_paper_w != 0 && unshrunk_paper_h != 0);
  1325.   }
  1326.   
  1327. --- 2223,2253 ----
  1328.   
  1329.   static    Boolean
  1330.   set_paper_type() {
  1331. +     char    *arg;
  1332.       char    temp[21];
  1333.       char    **p;
  1334.       char    *q;
  1335.   
  1336.       if (strlen(paper) > sizeof(temp) - 1) return False;
  1337. !     arg = paper;
  1338. !     q = temp;
  1339.       for (;;) {    /* convert to lower case */
  1340. !         char c = *arg++;
  1341.           if (c >= 'A' && c <= 'Z') c ^= ('a' ^ 'A');
  1342. !         *q++ = c;
  1343.           if (c == '\0') break;
  1344.       }
  1345. +     arg = temp;
  1346.       /* perform substitutions */
  1347.       for (p = paper_types; p < paper_types + XtNumber(paper_types); p += 2)
  1348.           if (strcmp(temp, *p) == 0) {
  1349. !         arg = p[1];
  1350.           break;
  1351.           }
  1352. !     q = index(arg, 'x');
  1353.       if (q == NULL) return False;
  1354. !     unshrunk_paper_w = atopix(arg);
  1355. !     unshrunk_paper_h = atopix(q + 1);
  1356.       return (unshrunk_paper_w != 0 && unshrunk_paper_h != 0);
  1357.   }
  1358.   
  1359. ***************
  1360. *** 2149,2156 ****
  1361.   
  1362.   #ifdef    TOOLKIT
  1363.   #ifdef    BUTTONS
  1364. !     Widget    form_widget;
  1365. !     Widget    right_widget;
  1366.   #endif
  1367.   #else    /* !TOOLKIT */
  1368.   #ifndef X10
  1369. --- 2262,2268 ----
  1370.   
  1371.   #ifdef    TOOLKIT
  1372.   #ifdef    BUTTONS
  1373. !     int        xtra_wid;
  1374.   #endif
  1375.   #else    /* !TOOLKIT */
  1376.   #ifndef X10
  1377. ***************
  1378. *** 2190,2196 ****
  1379.   
  1380.       XtGetApplicationResources(top_level, (caddr_t) NULL, resources,
  1381.           XtNumber(resources), NULL, 0);
  1382. -     if (shrink_factor <= 0 || density <= 0 || pixels_per_inch <= 0) usage();
  1383.       DISP = XtDisplay(top_level);
  1384.       SCRN = XtScreen(top_level);
  1385.   
  1386. --- 2302,2307 ----
  1387. ***************
  1388. *** 2204,2222 ****
  1389.       if (high_color) hl_Pixel = string_to_pixel(&high_color);
  1390.       if (curs_color) cr_Pixel = string_to_pixel(&curs_color);
  1391.   #endif
  1392. -     if (shrink_factor <= 0 || density <= 0 || pixels_per_inch <= 0 ||
  1393. -         dvi_name == NULL) usage();
  1394.   
  1395.   #endif    /* TOOLKIT */
  1396.   
  1397.       if (shrink_factor != 1) bak_shrink = shrink_factor;
  1398.       mane.shrinkfactor = shrink_factor;
  1399.       specialConv = pixels_per_inch / 1000.0;
  1400.       if (debug_arg != NULL)
  1401.           debug = isdigit(*debug_arg) ? atoi(debug_arg) : DBG_ALL;
  1402. !     if (margins) home_x = home_y = atof(margins) * pixels_per_inch;
  1403. !     if (sidemargin) home_x = atof(sidemargin) * pixels_per_inch;
  1404. !     if (topmargin) home_y = atof(topmargin) * pixels_per_inch;
  1405.       if (!set_paper_type()) oops("Don't recognize paper type %s", paper);
  1406.   
  1407.       init_pxl_open();
  1408. --- 2315,2334 ----
  1409.       if (high_color) hl_Pixel = string_to_pixel(&high_color);
  1410.       if (curs_color) cr_Pixel = string_to_pixel(&curs_color);
  1411.   #endif
  1412.   
  1413.   #endif    /* TOOLKIT */
  1414.   
  1415. +     if (shrink_factor <= 0 || density <= 0 || pixels_per_inch <= 0 ||
  1416. +         dvi_name == NULL) usage();
  1417.       if (shrink_factor != 1) bak_shrink = shrink_factor;
  1418.       mane.shrinkfactor = shrink_factor;
  1419.       specialConv = pixels_per_inch / 1000.0;
  1420.       if (debug_arg != NULL)
  1421.           debug = isdigit(*debug_arg) ? atoi(debug_arg) : DBG_ALL;
  1422. !     if (sidemargin) home_x = atopix(sidemargin);
  1423. !     if (topmargin) home_y = atopix(topmargin);
  1424. !     offset_x = xoffset ? atopix(xoffset) : pixels_per_inch;
  1425. !     offset_y = yoffset ? atopix(yoffset) : pixels_per_inch;
  1426.       if (!set_paper_type()) oops("Don't recognize paper type %s", paper);
  1427.   
  1428.       init_pxl_open();
  1429. ***************
  1430. *** 2309,2323 ****
  1431.       screen_w = WidthOfScreen(SCRN) - 2*bwidth;
  1432.       screen_h = HeightOfScreen(SCRN) - 2*bwidth;
  1433.   #ifdef    BUTTONS
  1434. !     temp_args3[0].value = (XtArgVal) (page_w + XTRA_WID < screen_w ?
  1435. !                       page_w + XTRA_WID : screen_w);
  1436.   #else
  1437. !     temp_args3[0].value = (XtArgVal) (page_w<screen_w ? page_w : screen_w);
  1438.   #endif
  1439.       temp_args3[1].value = (XtArgVal) (page_h<screen_h ? page_h : screen_h);
  1440.       temp_args3[2].value = (XtArgVal) (XCreateBitmapFromData(DISP,
  1441.                   RootWindowOfScreen(SCRN),
  1442.                   xdvi_bits, xdvi_width, xdvi_height));
  1443.       XtSetValues(top_level, temp_args3, XtNumber(temp_args3));
  1444.   
  1445.   #ifdef    BUTTONS
  1446. --- 2421,2437 ----
  1447.       screen_w = WidthOfScreen(SCRN) - 2*bwidth;
  1448.       screen_h = HeightOfScreen(SCRN) - 2*bwidth;
  1449.   #ifdef    BUTTONS
  1450. !     xtra_wid = expert ? 0 : XTRA_WID;
  1451.   #else
  1452. ! #define    xtra_wid    0
  1453.   #endif
  1454. +     temp_args3[0].value = (XtArgVal) (page_w + xtra_wid < screen_w ?
  1455. +                       page_w + xtra_wid : screen_w);
  1456.       temp_args3[1].value = (XtArgVal) (page_h<screen_h ? page_h : screen_h);
  1457.       temp_args3[2].value = (XtArgVal) (XCreateBitmapFromData(DISP,
  1458.                   RootWindowOfScreen(SCRN),
  1459.                   xdvi_bits, xdvi_width, xdvi_height));
  1460. +     temp_args3[4].value = (XtArgVal) dvi_name;
  1461.       XtSetValues(top_level, temp_args3, XtNumber(temp_args3));
  1462.   
  1463.   #ifdef    BUTTONS
  1464. ***************
  1465. *** 2324,2358 ****
  1466.       form_widget = XtCreateManagedWidget("form", formWidgetClass,
  1467.           top_level, form_args, XtNumber(form_args));
  1468.   
  1469. !     vport_args[0].value = temp_args3[0].value - XTRA_WID;
  1470.       vport_args[1].value = temp_args3[1].value;
  1471.       vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
  1472.           form_widget, vport_args, XtNumber(vport_args));
  1473.   
  1474.       line_args[0].value = (XtArgVal) high_color ? hl_Pixel : fore_Pixel;
  1475. !     line_args[2].value = temp_args3[1].value;
  1476. !     line_args[3].value = (XtArgVal) vport_widget;
  1477. !     right_args[0].value = (XtArgVal) XtCreateManagedWidget("line",
  1478. !         widgetClass, form_widget, line_args, XtNumber(line_args));
  1479. !     right_args[2].value = temp_args3[1].value;
  1480. !     right_widget = XtCreateManagedWidget("right", compositeWidgetClass,
  1481. !         form_widget, right_args, XtNumber(right_args));
  1482. !     command_args[2].value = (XtArgVal) vport_widget;
  1483. !     {
  1484. !         int i;
  1485. !         for (i = 0; i < XtNumber(command_table); ++i) {
  1486. !         command_args[0].value = (XtArgVal) command_table[i].label;
  1487. !         command_args[2].value = (XtArgVal) command_table[i].y_pos;
  1488. !         command_call[0].closure = (caddr_t) command_table[i].closure;
  1489. !         (void) XtCreateManagedWidget(command_table[i].name,
  1490. !             commandWidgetClass, right_widget,
  1491. !             command_args, XtNumber(command_args));
  1492. !         }
  1493. !     }
  1494.   #else    /* !BUTTONS */
  1495.       vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
  1496.           top_level, vport_args, XtNumber(vport_args));
  1497.   #endif    /* BUTTONS */
  1498.       clip_widget = XtNameToWidget(vport_widget, "clip");
  1499.       draw_args[0].value = (XtArgVal) page_w;
  1500. --- 2438,2454 ----
  1501.       form_widget = XtCreateManagedWidget("form", formWidgetClass,
  1502.           top_level, form_args, XtNumber(form_args));
  1503.   
  1504. !     vport_args[0].value = temp_args3[0].value - xtra_wid;
  1505.       vport_args[1].value = temp_args3[1].value;
  1506.       vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
  1507.           form_widget, vport_args, XtNumber(vport_args));
  1508.   
  1509.       line_args[0].value = (XtArgVal) high_color ? hl_Pixel : fore_Pixel;
  1510. !     if (!expert) create_buttons(temp_args3[1].value);
  1511.   #else    /* !BUTTONS */
  1512.       vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
  1513.           top_level, vport_args, XtNumber(vport_args));
  1514. + #define    form_widget    vport_widget    /* for calls to XtAddEventHandler */
  1515.   #endif    /* BUTTONS */
  1516.       clip_widget = XtNameToWidget(vport_widget, "clip");
  1517.       draw_args[0].value = (XtArgVal) page_w;
  1518. ***************
  1519. *** 2364,2370 ****
  1520.           XtSetValues(draw_widget, &back_args, 1);
  1521.           XtSetValues(clip_widget, &back_args, 1);
  1522.       }
  1523. !     XtAddEventHandler(vport_widget, KeyPressMask, False, handle_key,
  1524.           (caddr_t) NULL);
  1525.       XtAddEventHandler(vport_widget, StructureNotifyMask, False,
  1526.           handle_resize, (caddr_t) NULL);
  1527. --- 2460,2466 ----
  1528.           XtSetValues(draw_widget, &back_args, 1);
  1529.           XtSetValues(clip_widget, &back_args, 1);
  1530.       }
  1531. !     XtAddEventHandler(form_widget, KeyPressMask, False, handle_key,
  1532.           (caddr_t) NULL);
  1533.       XtAddEventHandler(vport_widget, StructureNotifyMask, False,
  1534.           handle_resize, (caddr_t) NULL);
  1535. ***************
  1536. *** 2445,2450 ****
  1537. --- 2541,2554 ----
  1538.   
  1539.   #endif    /* TOOLKIT */
  1540.   
  1541. +     XRebindKeysym(DISP, XK_Home, NULL, 0, (ubyte *) "^", 1);
  1542. +     XRebindKeysym(DISP, XK_Left, NULL, 0, (ubyte *) "l", 1);
  1543. +     XRebindKeysym(DISP, XK_Up, NULL, 0, (ubyte *) "u", 1);
  1544. +     XRebindKeysym(DISP, XK_Right, NULL, 0, (ubyte *) "r", 1);
  1545. +     XRebindKeysym(DISP, XK_Down, NULL, 0, (ubyte *) "d", 1);
  1546. +     XRebindKeysym(DISP, XK_Prior, NULL, 0, (ubyte *) "b", 1);
  1547. +     XRebindKeysym(DISP, XK_Next, NULL, 0, (ubyte *) "f", 1);
  1548.       image = XCreateImage(DISP, DefaultVisualOfScreen(SCRN), 1, XYBitmap, 0,
  1549.                    (char *)NULL, 0, 0, BITS_PER_BMUNIT, 0);
  1550.       image->bitmap_unit = BITS_PER_BMUNIT;
  1551. ***************
  1552. *** 2533,2536 ****
  1553. --- 2637,2643 ----
  1554.   #endif    /* X10 */
  1555.   
  1556.       do_pages();
  1557. + #ifdef    lint
  1558. +     return 0;
  1559. + #endif
  1560.   }
  1561. diff -cr xdvi_old/xdvi.h xdvi_new/xdvi.h
  1562. *** xdvi_old/xdvi.h    Mon Sep 17 17:36:48 1990
  1563. --- xdvi_new/xdvi.h    Wed Oct 10 11:26:37 1990
  1564. ***************
  1565. *** 40,46 ****
  1566. --- 40,50 ----
  1567.   #define    Sprintf    (void) sprintf
  1568.   #define    Fseek    (void) fseek
  1569.   #define    Fread    (void) fread
  1570. + #define    Fputs    (void) fputs
  1571. + #define    Putc    (void) putc
  1572. + #define    Putchar    (void) putchar
  1573.   #define    Fclose    (void) fclose
  1574. + #define    Strcpy    (void) strcpy
  1575.   
  1576.   unsigned long num();
  1577.   long snum();
  1578. ***************
  1579. *** 143,149 ****
  1580.   /*
  1581.    * Mechanism for reducing repeated warning about specials.
  1582.    */
  1583. ! extern    Boolean    spec_warn;
  1584.   
  1585.   
  1586.   /*
  1587. --- 147,153 ----
  1588.   /*
  1589.    * Mechanism for reducing repeated warning about specials.
  1590.    */
  1591. ! extern    Boolean    spec_warn, spec_warn_now;
  1592.   
  1593.   
  1594.   /*
  1595. ***************
  1596. *** 189,197 ****
  1597.       /* struct font *fp; */
  1598.       /* ubyte ch; */
  1599.   
  1600. !     /* the corresponding read_font_index procedures occur in pxl_open.c */
  1601.   typedef    void (*read_font_index_proc)();
  1602.       /* struct font *fontp; */
  1603.   
  1604.   struct font {
  1605.       struct font *next;        /* link to next font info block */
  1606. --- 193,202 ----
  1607.       /* struct font *fp; */
  1608.       /* ubyte ch; */
  1609.   
  1610. !     /* the corresponding read_font_index procedures occur in dvi_init.c */
  1611.   typedef    void (*read_font_index_proc)();
  1612.       /* struct font *fontp; */
  1613. + extern    read_font_index_proc read_GF_index, read_PK_index, read_PXL_index;
  1614.   
  1615.   struct font {
  1616.       struct font *next;        /* link to next font info block */
  1617. ***************
  1618. *** 221,231 ****
  1619.   #define DBG_PK          0x4
  1620.   #define DBG_BATCH       0x8
  1621.   #define    DBG_EVENT    0x10
  1622. ! #define DBG_ALL        (DBG_BITMAP|DBG_DVI|DBG_PK|DBG_EVENT)
  1623.   
  1624.   extern    Boolean    list_fonts;
  1625.   
  1626.   extern    int    pixels_per_inch;
  1627.   extern    int    unshrunk_paper_w, unshrunk_paper_h;
  1628.   extern    int    unshrunk_page_w, unshrunk_page_h;
  1629.   extern    int    density;
  1630. --- 226,238 ----
  1631.   #define DBG_PK          0x4
  1632.   #define DBG_BATCH       0x8
  1633.   #define    DBG_EVENT    0x10
  1634. ! #define    DBG_OPEN    0x20
  1635. ! #define DBG_ALL        (DBG_BITMAP|DBG_DVI|DBG_PK|DBG_EVENT|DBG_OPEN)
  1636.   
  1637.   extern    Boolean    list_fonts;
  1638.   
  1639.   extern    int    pixels_per_inch;
  1640. + extern    int    offset_x, offset_y;
  1641.   extern    int    unshrunk_paper_w, unshrunk_paper_h;
  1642.   extern    int    unshrunk_page_w, unshrunk_page_h;
  1643.   extern    int    density;
  1644. ***************
  1645. *** 232,237 ****
  1646. --- 239,245 ----
  1647.   
  1648.   extern    char    *dvi_name;
  1649.   extern    FILE    *dvi_file;                /* user's file */
  1650. + extern    char    *alt_font;
  1651.   extern    char    *prog;
  1652.   
  1653.   extern    struct    WindowRec {
  1654. diff -cr xdvi_old/xdvi_man.sed xdvi_new/xdvi_man.sed
  1655. *** xdvi_old/xdvi_man.sed    Mon Sep 17 17:36:59 1990
  1656. --- xdvi_new/xdvi_man.sed    Wed Sep 26 16:42:39 1990
  1657. ***************
  1658. *** 9,21 ****
  1659.   .B xdvi
  1660.   .nh
  1661.   [+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP] [\-l]
  1662. ! [\-paper \fIpapertype\fP] [\-mgs[\fIn\fP] \fIsize\fP] [\-altfont \fIfont\fP]
  1663. ! [\-margins \fIinches\fP] [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
  1664.   [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
  1665.   [\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP] [\-bw \fIwidth\fP]
  1666.   #ifx11
  1667. ! [\-geometry \fIgeometry\fP] [-icongeometry \fIgeometry\fP] [-iconic]
  1668. ! [\-display \fIdisplay\fP] [-copy] [-thorough]
  1669.   #ifx10
  1670.   [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
  1671.   [\-display \fIhost\fP:\fIdisplay\fP | \fIhost\fP:\fIdisplay\fP]
  1672. --- 9,25 ----
  1673.   .B xdvi
  1674.   .nh
  1675.   [+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP] [\-l]
  1676. ! [\-sw] [\-paper \fIpapertype\fP] [\-mgs[\fIn\fP] \fIsize\fP]
  1677. ! [\-altfont \fIfont\fP]
  1678. ! [\-margins \fIdimen\fP] [\-sidemargin \fIdimen\fP] [\-topmargin \fIdimen\fP]
  1679. ! [\-offsets \fIdimen\fP] [\-xoffset \fIdimen\fP] [\-yoffset \fIdimen\fP]
  1680.   [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
  1681.   [\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP] [\-bw \fIwidth\fP]
  1682.   #ifx11
  1683. ! [\-geometry \fIgeometry\fP] [\-icongeometry \fIgeometry\fP] [\-iconic]
  1684. ! [\-display \fIdisplay\fP] [\-copy] [\-thorough]
  1685. ! #ifbuttons
  1686. ! [\-expert]
  1687.   #ifx10
  1688.   [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
  1689.   [\-display \fIhost\fP:\fIdisplay\fP | \fIhost\fP:\fIdisplay\fP]
  1690. ***************
  1691. *** 90,95 ****
  1692. --- 94,105 ----
  1693.   (%%dot%%listFonts)
  1694.   Causes the names of the fonts used to be listed.
  1695.   .TP
  1696. + .B \-sw
  1697. + (%%dot%%specialWarn)
  1698. + Causes \fIxdvi\fR to warn the user when it encounters a \\special string
  1699. + which it cannot process.  This option is on by default; to turn it off,
  1700. + use \fB+sw\fR.
  1701. + .TP
  1702.   .B \-rv
  1703.   (%%dot%%reverseVideo)
  1704.   Causes the page to be displayed with white characters on a
  1705. ***************
  1706. *** 149,160 ****
  1707.   Always use the \fIcopy\fR operation when writing characters to the display.
  1708.   This option may be necessary for correct operation on a color display, but
  1709.   overstrike characters will be incorrect.
  1710.   #endif
  1711.   .TP
  1712. ! .BI \-margins " inches"
  1713. ! (%%dot%%margins)
  1714. ! Specifies the size of both the top margin and side margin.  This
  1715. ! can be a decimal number, \fIe.g.\fR, 1.5.  It determines
  1716.   the ``home'' position of the page within the window as follows.  If the entire
  1717.   page fits in the window, then the margin settings are ignored.  If, even
  1718.   after removing the margins from the left, right, top, and bottom, the page
  1719. --- 159,176 ----
  1720.   Always use the \fIcopy\fR operation when writing characters to the display.
  1721.   This option may be necessary for correct operation on a color display, but
  1722.   overstrike characters will be incorrect.
  1723. + #ifbuttons
  1724. + .TP
  1725. + .B \-expert
  1726. + (.expert)
  1727. + Prevent the buttons from appearing.
  1728.   #endif
  1729.   .TP
  1730. ! .BI \-margins " dimen"
  1731. ! (%%dot%%Margin)
  1732. ! Specifies the size of both the top margin and side margin.
  1733. ! This should be a decimal number optionally followed by "cm", e.g., 1.5 or 3cm,
  1734. ! giving a measurement in inches or centimeters.  It determines
  1735.   the ``home'' position of the page within the window as follows.  If the entire
  1736.   page fits in the window, then the margin settings are ignored.  If, even
  1737.   after removing the margins from the left, right, top, and bottom, the page
  1738. ***************
  1739. *** 164,177 ****
  1740.   Otherwise, the text is centered in the window.  See also `\fBM\fR' under
  1741.   the KEY\%STROKES section.
  1742.   .TP
  1743. ! .BI \-sidemargin " inches"
  1744.   (%%dot%%sideMargin)
  1745.   Specifies the side margin (see above).
  1746.   .TP
  1747. ! .BI \-topmargin " inches"
  1748.   (%%dot%%topMargin)
  1749.   Specifies the top and bottom margins (see above).
  1750.   .TP
  1751.   .BI \-paper " papertype"
  1752.   (%%dot%%paper)
  1753.   Specifies the size of the printed page.  This may be of the form
  1754. --- 180,213 ----
  1755.   Otherwise, the text is centered in the window.  See also `\fBM\fR' under
  1756.   the KEY\%STROKES section.
  1757.   .TP
  1758. ! .BI \-sidemargin " dimen"
  1759.   (%%dot%%sideMargin)
  1760.   Specifies the side margin (see above).
  1761.   .TP
  1762. ! .BI \-topmargin " dimen"
  1763.   (%%dot%%topMargin)
  1764.   Specifies the top and bottom margins (see above).
  1765.   .TP
  1766. + .BI \-offsets " dimen"
  1767. + (%%dot%%Offset)
  1768. + Specifies the size of both the horizontal and vertical offsets of the
  1769. + output on the page.  This should be a decimal number optionally followed by
  1770. + "cm", e.g., 1.5 or 3cm, giving a measurement in inches or centimeters.
  1771. + By decree
  1772. + of the Stanford TeX Project, the default TeX page origin is always 1 inch
  1773. + over and down from the top-left page corner, even when non-American paper
  1774. + sizes are used.  Therefore, the default offsets are 1.0 inch.
  1775. + .TP
  1776. + .BI \-xoffset " dimen"
  1777. + (%%dot%%xOffset)
  1778. + Specifies the size of the horizontal offset of the output on the page
  1779. + (see above).
  1780. + .TP
  1781. + .BI \-yoffset " dimen"
  1782. + (%%dot%%yOffset)
  1783. + Specifies the size of the vertical offset of the output on the page
  1784. + (see above).
  1785. + .TP
  1786.   .BI \-paper " papertype"
  1787.   (%%dot%%paper)
  1788.   Specifies the size of the printed page.  This may be of the form
  1789. ***************
  1790. *** 240,245 ****
  1791. --- 276,285 ----
  1792.   \fBXdvi\fR recognizes the following keystrokes when typed in its window.
  1793.   Each may optionally be preceded by a (positive or negative) number, whose
  1794.   interpretation will depend on the particular keystroke.
  1795. + #ifx11
  1796. + Also, the "Home", "Prior", "Next", and arrow cursor keys are synonyms for
  1797. + `^', `b', `f', `l', `r', `u', and `d' keys, respectively.
  1798. + #endif
  1799.   .TP
  1800.   .B q
  1801.   Quits the program.  Control-C and control-D will do this, too.
  1802. ***************
  1803. *** 309,314 ****
  1804. --- 349,360 ----
  1805.   The `k' keystroke toggles a `keep-position' flag which, when set, will keep
  1806.   the same position when moving between pages.  Also `0k' and `1k' clear and
  1807.   set this flag, respectively.
  1808. + #ifbuttons
  1809. + .TP
  1810. + .B x
  1811. + Toggles expert mode (in which the buttons do not appear).  Also `0x' and `1x'
  1812. + clear and reset this mode, respectively.
  1813. + #endif
  1814.   .SH MOUSE ACTIONS
  1815.   If the shrink factor is set to any number other than one, then clicking
  1816.   any mouse button will pop up a ``magnifying glass'' which shows the unshrunk
  1817. ***************
  1818. *** 336,343 ****
  1819.   the end.  For example, if the string is ``/usr/local/tex/fonts'' and the font is
  1820.   cmr10 at 300dpi, then it searches for /usr/local/tex/fonts/cmr10.300gf,
  1821.   /usr/local/tex/fonts/cmr10.300pk, and /usr/local/tex/fonts/cmr10.1500pxl,
  1822. ! in that order.  If the first character of the ``XDVIFONTS'' variable
  1823. ! is a colon, then the system default paths are tried first.  If the font is not
  1824.   found in the desired size, then \fIxdvi\fR will try to find the nearest size.
  1825.   If the font cannot be found at all, then \fIxdvi\fR will try to vary the point
  1826.   size of the font (within a certain range), and if this fails, then it will
  1827. --- 382,389 ----
  1828.   the end.  For example, if the string is ``/usr/local/tex/fonts'' and the font is
  1829.   cmr10 at 300dpi, then it searches for /usr/local/tex/fonts/cmr10.300gf,
  1830.   /usr/local/tex/fonts/cmr10.300pk, and /usr/local/tex/fonts/cmr10.1500pxl,
  1831. ! in that order.  An extra colon anywhere in the ``XDVIFONTS'' variable
  1832. ! causes the system default paths to be tried at that point.  If the font is not
  1833.   found in the desired size, then \fIxdvi\fR will try to find the nearest size.
  1834.   If the font cannot be found at all, then \fIxdvi\fR will try to vary the point
  1835.   size of the font (within a certain range), and if this fails, then it will
  1836. ***************
  1837. *** 349,355 ****
  1838.   Sizes are expressed in dots per inch; decimals may be used for ``pxl'' files:
  1839.   for example, a 300 dots per inch file magnified by half a step comes out to
  1840.   1643 dots per five inches, which should be encoded as 328.6.  The current
  1841. ! default set of sizes is %%DEFAULT_FONT_SIZES%%.
  1842.   .SH FILES
  1843.   .br
  1844.   %%DEFAULT_FONT_PATH%%   Font pixel files.
  1845. --- 395,402 ----
  1846.   Sizes are expressed in dots per inch; decimals may be used for ``pxl'' files:
  1847.   for example, a 300 dots per inch file magnified by half a step comes out to
  1848.   1643 dots per five inches, which should be encoded as 328.6.  The current
  1849. ! default set of sizes is %%DEFAULT_FONT_SIZES%%.  \fIxdvi\fR will also try the
  1850. ! actual size of the font before trying any of the given sizes.
  1851.   .SH FILES
  1852.   .br
  1853.   %%DEFAULT_FONT_PATH%%   Font pixel files.
  1854.  
  1855. dan
  1856. ----------------------------------------------------
  1857. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1858. Opinions expressed reflect those of the author only.
  1859.