home *** CD-ROM | disk | FTP | other *** search
- From: kent@ssbell.IMD.Sterling.COM (Kent Landfield)
- Newsgroups: comp.sources.x
- Subject: v05i071: xdvi: dvi previewer, Patch7
- Message-ID: <653@ssbell.IMD.Sterling.COM>
- Date: 5 Feb 90 05:00:58 GMT
- Approved: kent@ssbell.IMD.Sterling.COM (Kent Landfield)
-
- Submitted-by: vojta@guinness.ias.edu (Paul A Vojta)
- Posting-number: Volume 5, Issue 71
- Archive-name: xdvi/patch7
- Patch-To: xdvi: Volume 3, Issue 37-39,46,57
- Patch-To: xdvi: Volume 4, Issue 44,96
- Patch-To: xdvi: Volume 5, Issue 35-36
-
-
- This is patch 7 for xdvi. It replaces the -pagewidth and -pageheight
- options with a -paper option which is more convenient to use.
-
- Thanks to iis!prl, bingle@cs.purdue.edu, boaz@neutron.lcs.mit.edu, and
- others for fixes and bug reports.
-
- --Paul Vojta, vojta@guinness.ias.edu
-
- -- cut here --
- diff -cr old/README new/README
- *** old/README Sun Feb 4 13:09:22 1990
- --- new/README Sun Feb 4 12:50:09 1990
- ***************
- *** 42,48 ****
- the left. For performance reasons, it would be best
- to set this to coincide with what your server uses.
- Use the keystroke '^P' to find information in this
- ! regard.
- BMSHORT (X11 only; xdvi.c dvi_draw.c gf.c pk.c pxl.c) Store
- bitmaps in short integers instead of bytes. See
- MSBITFIRST for other relevant comments. To check
- --- 42,52 ----
- the left. For performance reasons, it would be best
- to set this to coincide with what your server uses.
- Use the keystroke '^P' to find information in this
- ! regard. Generally, you should use MSBITFIRST if and
- ! only if '^P' reports bitord = 1, and BMSHORT/BMLONG
- ! (below) should be set to match whatever '^P' reports
- ! under "Unit =". But, if bitord = byteord, then the
- ! latter setting should not matter much.
- BMSHORT (X11 only; xdvi.c dvi_draw.c gf.c pk.c pxl.c) Store
- bitmaps in short integers instead of bytes. See
- MSBITFIRST for other relevant comments. To check
- ***************
- *** 50,58 ****
- time xdvi -d 8 file.dvi
- BMLONG (X11 only; xdvi.c dvi_draw.c gf.c pk.c pxl.c) Store
- bitmaps in long integers instead of bytes.
- ! ALTFONT Default font to use if the font named in the dvi file
- ! cannot be found. Can be set to NULL. By default, it
- ! is "cmr10".
- NOTOOL (X11 only; xdvi.c) Compile using raw X calls.
- BUTTONS (xdvi.c) Put radio buttons on the right side of the
- window for commonly used commands.
- --- 54,62 ----
- time xdvi -d 8 file.dvi
- BMLONG (X11 only; xdvi.c dvi_draw.c gf.c pk.c pxl.c) Store
- bitmaps in long integers instead of bytes.
- ! ALTFONT (xdvi.c) Default font to use if the font named in the
- ! dvi file cannot be found. Can be set to NULL. By
- ! default, it is "cmr10".
- NOTOOL (X11 only; xdvi.c) Compile using raw X calls.
- BUTTONS (xdvi.c) Put radio buttons on the right side of the
- window for commonly used commands.
- ***************
- *** 168,172 ****
- --- 172,178 ----
- 19. Added -pagewidth and -pageheight command line options and A4
- compilation option.
- 20. Added a yet more robust font finding algorithm.
- + -- Patchlevel 7: --
- + 21. Replaced -pagewidth and -pageheight options with -paper.
-
- Paul Vojta, vojta@math.berkeley.edu
- diff -cr old/dvi_draw.c new/dvi_draw.c
- *** old/dvi_draw.c Sun Feb 4 13:09:25 1990
- --- new/dvi_draw.c Mon Jan 29 22:48:24 1990
- ***************
- *** 303,309 ****
- if (ch > maxchar ||
- (g = ¤t_font->glyph[ch])->bitmap.bits == NULL) {
- if (ch > maxchar || g->addr == 0)
- ! oops("Character %d not defined in font %s\n", ch,
- current_font->fontname);
- open_pxl_file(current_font);
- Fseek(current_font->file, g->addr, 0);
- --- 303,309 ----
- if (ch > maxchar ||
- (g = ¤t_font->glyph[ch])->bitmap.bits == NULL) {
- if (ch > maxchar || g->addr == 0)
- ! oops("Character %d not defined in font %s", ch,
- current_font->fontname);
- open_pxl_file(current_font);
- Fseek(current_font->file, g->addr, 0);
- ***************
- *** 361,367 ****
- close_a_file();
- fontp->file = fopen(fontp->filename, OPEN_MODE);
- if (fontp->file == NULL)
- ! oops("Font file disappeared: %s\n", fontp->filename);
- --n_fonts_left;
- }
- }
- --- 361,367 ----
- close_a_file();
- fontp->file = fopen(fontp->filename, OPEN_MODE);
- if (fontp->file == NULL)
- ! oops("Font file disappeared: %s", fontp->filename);
- --n_fonts_left;
- }
- }
- diff -cr old/dvi_init.c new/dvi_init.c
- *** old/dvi_init.c Sun Feb 4 13:09:27 1990
- --- new/dvi_init.c Sun Dec 10 20:50:19 1989
- ***************
- *** 69,78 ****
- */
- static long last_page_offset;
-
- ! #ifndef ANSI_LIB
- char *sprintf();
- ! #endif
- ! char *malloc(), *strcpy();
- FILE *pxl_open();
-
- /*
- --- 69,79 ----
- */
- static long last_page_offset;
-
- ! #ifdef sun
- char *sprintf();
- ! #endif sun
- !
- ! char *malloc();
- FILE *pxl_open();
-
- /*
- diff -cr old/mksedscript new/mksedscript
- *** old/mksedscript Sun Feb 4 13:09:30 1990
- --- new/mksedscript Sun Feb 4 13:01:47 1990
- ***************
- *** 1,4 ****
- ! #! /bin/csh
- unset x10 buttons a4
- set noglob
- foreach x ($argv[3-])
- --- 1,4 ----
- ! #! /bin/csh -f
- unset x10 buttons a4
- set noglob
- foreach x ($argv[3-])
- ***************
- *** 16,22 ****
- if (! $?buttons) echo /^\#ifbuttons/,/^\#/d
- echo /^\#/d
- if ($?a4) then
- ! echo s/%%defaultpagesize%%/8.3 x 11.7 inches (A4 size)/
- else
- echo s/%%defaultpagesize%%/8.5 x 11 inches/
- endif
- --- 16,22 ----
- if (! $?buttons) echo /^\#ifbuttons/,/^\#/d
- echo /^\#/d
- if ($?a4) then
- ! echo 's/%%defaultpagesize%%/21 x 29.7 cm (A4 size)/'
- else
- echo s/%%defaultpagesize%%/8.5 x 11 inches/
- endif
- diff -cr old/patchlevel.h new/patchlevel.h
- *** old/patchlevel.h Sun Feb 4 13:09:31 1990
- --- new/patchlevel.h Sun Dec 10 21:52:09 1989
- ***************
- *** 1 ****
- ! #define PATCHLEVEL 6
- --- 1 ----
- ! #define PATCHLEVEL 7
- diff -cr old/pk.c new/pk.c
- *** old/pk.c Sun Feb 4 13:09:33 1990
- --- new/pk.c Mon Jan 29 22:49:58 1990
- ***************
- *** 105,111 ****
- case PK_NOOP :
- break;
- default :
- ! oops("Unexpected %d in PK file %s\n", PK_flag_byte,
- fontp->fontname);
- break;
- }
- --- 105,111 ----
- case PK_NOOP :
- break;
- default :
- ! oops("Unexpected %d in PK file %s", PK_flag_byte,
- fontp->fontname);
- break;
- }
- ***************
- *** 131,140 ****
- Printf("Reading header for PK pixel file %s\n", fontp->filename);
-
- if (one(fontp->file) != PK_PRE)
- ! oops("File %s lacks preamble command\n", fontp->fontname);
-
- if (one(fontp->file) != PK_ID)
- ! oops("File %s has wrong PK id\n", fontp->fontname);
-
- Fseek(fontp->file, (long) one(fontp->file), 1); /* skip comment */
-
- --- 131,140 ----
- Printf("Reading header for PK pixel file %s\n", fontp->filename);
-
- if (one(fontp->file) != PK_PRE)
- ! oops("File %s lacks preamble command", fontp->fontname);
-
- if (one(fontp->file) != PK_ID)
- ! oops("File %s has wrong PK id", fontp->fontname);
-
- Fseek(fontp->file, (long) one(fontp->file), 1); /* skip comment */
-
- ***************
- *** 143,149 ****
- hppp = sfour(fontp->file);
- vppp = sfour(fontp->file);
- if( debug && hppp != vppp )
- ! oops("Warning: aspect ratio not 1:1 for font %s\n", fontp->fontname);
- /*fontp->f_scale = (int)((((float) hppp * 72.27) / (float) 65536) + 0.5);*/
-
- /*if (fontp->f_scale == 0) fontp->f_scale = 1000;*/
- --- 143,149 ----
- hppp = sfour(fontp->file);
- vppp = sfour(fontp->file);
- if( debug && hppp != vppp )
- ! oops("Warning: aspect ratio not 1:1 for font %s", fontp->fontname);
- /*fontp->f_scale = (int)((((float) hppp * 72.27) / (float) 65536) + 0.5);*/
-
- /*if (fontp->f_scale == 0) fontp->f_scale = 1000;*/
- ***************
- *** 224,230 ****
- w = num(fp, n);
- h = num(fp, n);
- if (w > 0x7fff || h > 0x7fff)
- ! oops("Too large character (%d) in file %s\n", ch, fontp->fontname);
- g->bitmap.w = w;
- g->bitmap.h = h;
- }
- --- 224,230 ----
- w = num(fp, n);
- h = num(fp, n);
- if (w > 0x7fff || h > 0x7fff)
- ! oops("Too large character (%d) in file %s", ch, fontp->fontname);
- g->bitmap.w = w;
- g->bitmap.h = h;
- }
- ***************
- *** 354,362 ****
- paint_switch = 1 - paint_switch;
- }
- if (cp != ((BMUNIT *) (g->bitmap.bits + bytes_wide * g->bitmap.h)))
- ! oops("Wrong number of bits stored: char. %d, font %s\n", ch,
- fontp->fontname);
- if (rows_left != 0 || h_bit != g->bitmap.w)
- ! oops("Bad pk file (%s), too many bits\n", fontp->fontname);
- }
- }
- --- 354,362 ----
- paint_switch = 1 - paint_switch;
- }
- if (cp != ((BMUNIT *) (g->bitmap.bits + bytes_wide * g->bitmap.h)))
- ! oops("Wrong number of bits stored: char. %d, font %s", ch,
- fontp->fontname);
- if (rows_left != 0 || h_bit != g->bitmap.w)
- ! oops("Bad pk file (%s), too many bits", fontp->fontname);
- }
- }
- diff -cr old/pxl.c new/pxl.c
- *** old/pxl.c Sun Feb 4 13:09:34 1990
- --- new/pxl.c Mon Jan 29 22:50:14 1990
- ***************
- *** 63,69 ****
- Printf("Reading header for PXL file %s\n", fontp->filename);
- fontp->read_char = read_char;
- if (four(fp = fontp->file) != 1001)
- ! oops("File %s has wrong PXL magic number.\n", fontp->filename);
- /* seek to trailer info */
- Fseek(fp, (long) -5 * 4, 2);
- (void) four(fp); /* checksum */
- --- 63,69 ----
- Printf("Reading header for PXL file %s\n", fontp->filename);
- fontp->read_char = read_char;
- if (four(fp = fontp->file) != 1001)
- ! oops("File %s has wrong PXL magic number.", fontp->filename);
- /* seek to trailer info */
- Fseek(fp, (long) -5 * 4, 2);
- (void) four(fp); /* checksum */
- diff -cr old/pxl_open.c new/pxl_open.c
- *** old/pxl_open.c Sun Feb 4 13:09:36 1990
- --- new/pxl_open.c Sun Dec 10 20:50:59 1989
- ***************
- *** 33,40 ****
- --- 33,53 ----
- */
-
- #include <stdio.h>
- +
- + #ifndef X10
- + #include <X11/Xos.h> /* same as below */
- + #else X10
- + #ifdef SYSV
- #include <string.h>
- + #define index strchr
- + #define rindex strrchr
- + #else /* SYSV */
- + #include <strings.h>
- + #endif /* SYSV */
- + #endif X10
- +
- #include <errno.h>
- + extern int errno;
-
- #define PATH_SEP ':'
- #define DEFAULT_TAIL "/%f.%d%p"
- ***************
- *** 57,67 ****
-
- read_font_index_proc read_GF_index, read_PK_index, read_PXL_index;
-
- ! #ifndef ANSI_LIB
- char *sprintf();
- ! #endif
- ! char *malloc(), *index(), *getenv();
-
- double atof();
-
- #define Strcpy (void) strcpy
- --- 70,80 ----
-
- read_font_index_proc read_GF_index, read_PK_index, read_PXL_index;
-
- ! #ifdef sun
- char *sprintf();
- ! #endif sun
-
- + char *malloc(), *getenv();
- double atof();
-
- #define Strcpy (void) strcpy
- diff -cr old/xdvi.c new/xdvi.c
- *** old/xdvi.c Sun Feb 4 13:09:45 1990
- --- new/xdvi.c Sat Feb 3 18:51:25 1990
- ***************
- *** 39,49 ****
- #endif ALTFONT
-
- #ifndef A4
- ! #define DEFAULT_PAGE_WIDTH "8.5"
- ! #define DEFAULT_PAGE_HEIGHT "11"
- #else A4
- ! #define DEFAULT_PAGE_WIDTH "8.3"
- ! #define DEFAULT_PAGE_HEIGHT "11.7"
- #endif A4
-
- #if !defined(X10) && !defined(NOTOOL)
- --- 39,47 ----
- #endif ALTFONT
-
- #ifndef A4
- ! #define DEFAULT_PAPER "us"
- #else A4
- ! #define DEFAULT_PAPER "a4"
- #endif A4
-
- #if !defined(X10) && !defined(NOTOOL)
- ***************
- *** 143,150 ****
- int density = 40;
- int pixels_per_inch = 300;
- int unshrunk_page_w, unshrunk_page_h;
- ! static char *arg_page_w = DEFAULT_PAGE_WIDTH;
- ! static char *arg_page_h = DEFAULT_PAGE_HEIGHT;
- static char *margins, *sidemargin, *topmargin;
- static Boolean reverse;
- static Dimension bwidth = 2;
- --- 141,147 ----
- int density = 40;
- int pixels_per_inch = 300;
- int unshrunk_page_w, unshrunk_page_h;
- ! static char *paper = DEFAULT_PAPER;
- static char *margins, *sidemargin, *topmargin;
- static Boolean reverse;
- static Dimension bwidth = 2;
- ***************
- *** 187,193 ****
- #endif X10
-
- int page_w, page_h;
- - static int screen_w, screen_h;
- #define clip_w mane.width
- #define clip_h mane.height
- static Dimension window_w, window_h;
- --- 184,189 ----
- ***************
- *** 229,235 ****
- {XtNbottom, (XtArgVal) XtChainBottom},
- {XtNleft, (XtArgVal) XtChainLeft},
- {XtNright, (XtArgVal) XtChainRight},
- - {XtNresizable, (XtArgVal) True},
- #endif BUTTONS
- {XtNallowHoriz, (XtArgVal) True},
- {XtNallowVert, (XtArgVal) True},
- --- 225,230 ----
- ***************
- *** 262,271 ****
- }
- command_table[] = {
- {"Quit", "quit", 'q', 50},
- ! {"X1 Mag", "sh1", 1 << 8 | 's', 150},
- ! {"X2 Mag", "sh2", 2 << 8 | 's', 200},
- ! {"X3 Mag", "sh3", 3 << 8 | 's', 250},
- ! {"X4 Mag", "sh4", 4 << 8 | 's', 300},
- {"Next", "next", 'n', 400},
- {"Page+5", "next5", 5 << 8 | 'n', 450},
- {"Page+10", "next10", 10 << 8 | 'n', 500},
- --- 257,266 ----
- }
- command_table[] = {
- {"Quit", "quit", 'q', 50},
- ! {"Shrink1", "sh1", 1 << 8 | 's', 150},
- ! {"Shrink2", "sh2", 2 << 8 | 's', 200},
- ! {"Shrink3", "sh3", 3 << 8 | 's', 250},
- ! {"Shrink4", "sh4", 4 << 8 | 's', 300},
- {"Next", "next", 'n', 400},
- {"Page+5", "next5", 5 << 8 | 'n', 450},
- {"Page+10", "next10", 10 << 8 | 'n', 500},
- ***************
- *** 287,294 ****
- {XtNlabel, NULL},
- {XtNvertDistance, (XtArgVal) 0},
- {XtNfromHoriz, (XtArgVal) NULL},
- ! {XtNhorizDistance, (XtArgVal) 9},
- ! {XtNwidth, (XtArgVal) 60},
- {XtNheight, (XtArgVal) 30},
- {XtNtop, (XtArgVal) XtChainTop},
- {XtNbottom, (XtArgVal) XtChainTop},
- --- 282,289 ----
- {XtNlabel, NULL},
- {XtNvertDistance, (XtArgVal) 0},
- {XtNfromHoriz, (XtArgVal) NULL},
- ! {XtNhorizDistance, (XtArgVal) 7},
- ! {XtNwidth, (XtArgVal) 64},
- {XtNheight, (XtArgVal) 30},
- {XtNtop, (XtArgVal) XtChainTop},
- {XtNbottom, (XtArgVal) XtChainTop},
- ***************
- *** 307,318 ****
- {XtNbottom, (XtArgVal) XtChainBottom},
- {XtNleft, (XtArgVal) XtChainRight},
- {XtNright, (XtArgVal) XtChainRight},
- - {XtNresizable, (XtArgVal) True},
- };
-
- static Arg strut_args[] = {
- {XtNfromHoriz, (XtArgVal) NULL},
- {XtNwidth, (XtArgVal) 78},
- {XtNmappedWhenManaged, (XtArgVal) False},
- {XtNborderWidth, (XtArgVal) 0},
- {XtNtop, (XtArgVal) XtChainTop},
- --- 302,313 ----
- {XtNbottom, (XtArgVal) XtChainBottom},
- {XtNleft, (XtArgVal) XtChainRight},
- {XtNright, (XtArgVal) XtChainRight},
- };
-
- static Arg strut_args[] = {
- {XtNfromHoriz, (XtArgVal) NULL},
- {XtNwidth, (XtArgVal) 78},
- + {XtNheight, (XtArgVal) 2},
- {XtNmappedWhenManaged, (XtArgVal) False},
- {XtNborderWidth, (XtArgVal) 0},
- {XtNtop, (XtArgVal) XtChainTop},
- ***************
- *** 373,383 ****
- #endif X10
- #endif lint
-
- ! #ifndef ANSI_LIB
- char *sprintf();
- ! #endif
- ! char *malloc(), *index(), *rindex(), *strcpy(), *strcat();
-
- double atof();
-
- /********************************
- --- 368,378 ----
- #endif X10
- #endif lint
-
- ! #ifdef sun
- char *sprintf();
- ! #endif sun
-
- + char *malloc();
- double atof();
-
- /********************************
- ***************
- *** 733,745 ****
- DarkenArea(x_bar, new_x_bgn, 1, new_x_end - new_x_bgn, BAR_WID);
- }
- else { /* this stuff avoids flicker */
- ! if (x_bgn <= new_x_bgn)
- ClearArea(x_bar, x_bgn, 1, new_x_bgn - x_bgn, BAR_WID);
- ! else
- DarkenArea(x_bar, new_x_bgn, 1, x_bgn - new_x_bgn, BAR_WID);
- ! if (new_x_end <= x_end)
- ClearArea(x_bar, new_x_end, 1, x_end - new_x_end, BAR_WID);
- ! else
- DarkenArea(x_bar, x_end, 1, new_x_end - x_end, BAR_WID);
- }
- x_bgn = new_x_bgn;
- --- 728,740 ----
- DarkenArea(x_bar, new_x_bgn, 1, new_x_end - new_x_bgn, BAR_WID);
- }
- else { /* this stuff avoids flicker */
- ! if (x_bgn < new_x_bgn)
- ClearArea(x_bar, x_bgn, 1, new_x_bgn - x_bgn, BAR_WID);
- ! else if (x_bgn > new_x_bgn)
- DarkenArea(x_bar, new_x_bgn, 1, x_bgn - new_x_bgn, BAR_WID);
- ! if (new_x_end < x_end)
- ClearArea(x_bar, new_x_end, 1, x_end - new_x_end, BAR_WID);
- ! else if (new_x_end > x_end)
- DarkenArea(x_bar, x_end, 1, new_x_end - x_end, BAR_WID);
- }
- x_bgn = new_x_bgn;
- ***************
- *** 757,769 ****
- DarkenArea(y_bar, 1, new_y_bgn, BAR_WID, new_y_end - new_y_bgn);
- }
- else { /* this stuff avoids flicker */
- ! if (y_bgn <= new_y_bgn)
- ClearArea(y_bar, 1, y_bgn, BAR_WID, new_y_bgn - y_bgn);
- ! else
- DarkenArea(y_bar, 1, new_y_bgn, BAR_WID, y_bgn - new_y_bgn);
- ! if (new_y_end <= y_end)
- ClearArea(y_bar, 1, new_y_end, BAR_WID, y_end - new_y_end);
- ! else
- DarkenArea(y_bar, 1, y_end, BAR_WID, new_y_end - y_end);
- }
- y_bgn = new_y_bgn;
- --- 752,764 ----
- DarkenArea(y_bar, 1, new_y_bgn, BAR_WID, new_y_end - new_y_bgn);
- }
- else { /* this stuff avoids flicker */
- ! if (y_bgn < new_y_bgn)
- ClearArea(y_bar, 1, y_bgn, BAR_WID, new_y_bgn - y_bgn);
- ! else if (y_bgn > new_y_bgn)
- DarkenArea(y_bar, 1, new_y_bgn, BAR_WID, y_bgn - new_y_bgn);
- ! if (new_y_end < y_end)
- ClearArea(y_bar, 1, new_y_end, BAR_WID, y_end - new_y_end);
- ! else if (new_y_end > y_end)
- DarkenArea(y_bar, 1, y_end, BAR_WID, new_y_end - y_end);
- }
- y_bgn = new_y_bgn;
- ***************
- *** 1140,1146 ****
- case '\b':
- case '\177': /* Del */
- /* scroll backward */
- ! next_page = current_page - 1;
- break;
- case 'g':
- /* go to absolute page */
- --- 1135,1141 ----
- case '\b':
- case '\177': /* Del */
- /* scroll backward */
- ! next_page = current_page - (arg0 ? number0 : 1);
- break;
- case 'g':
- /* go to absolute page */
- ***************
- *** 1259,1270 ****
- get_geom();
- home(False);
- XMapWindow(DISP, (Window) mane.win);
- ! return;
- #else TOOLKIT
- reconfig();
- home(False);
- - break;
- #endif TOOLKIT
- case 'S':
- if (!arg0) goto bad;
- if (number0 < 0) goto bad;
- --- 1254,1270 ----
- get_geom();
- home(False);
- XMapWindow(DISP, (Window) mane.win);
- ! /* Wait for next event; this will likely be an expose event,
- ! so we don't redraw the window twice. */
- ! {
- ! XEvent event;
- ! XPeekEvent(DISP, &event);
- ! }
- #else TOOLKIT
- reconfig();
- home(False);
- #endif TOOLKIT
- + break;
- case 'S':
- if (!arg0) goto bad;
- if (number0 < 0) goto bad;
- ***************
- *** 1459,1473 ****
- if (XANY(event).window == top_level &&
- (XCONFIG(event).width != window_w ||
- XCONFIG(event).height != window_h)) {
- ! register Dimension old_window_w = window_w;
-
- window_w = XCONFIG(event).width;
- window_h = XCONFIG(event).height;
- reconfig();
- ! if (old_window_w == 0) home(False);
- }
- break;
-
- case KeyPress:
- #ifndef X10
- string = trbuf;
- --- 1459,1482 ----
- if (XANY(event).window == top_level &&
- (XCONFIG(event).width != window_w ||
- XCONFIG(event).height != window_h)) {
- ! register caddr_t old_mane_win = mane.win;
-
- window_w = XCONFIG(event).width;
- window_h = XCONFIG(event).height;
- reconfig();
- ! if (old_mane_win == NULL) home(False);
- }
- break;
-
- + #ifndef X10
- + case MapNotify: /* if running w/o WM */
- + if (mane.win == NULL) {
- + reconfig();
- + home(False);
- + }
- + break;
- + #endif X10
- +
- case KeyPress:
- #ifndef X10
- string = trbuf;
- ***************
- *** 1657,1665 ****
- [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
- [-cr <color>]\n\
- [-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
- ! [-pagewidth <inches>] [-pageheight <inches>] [-mgs[n] <size>]\n\
- ! [-altfont <font>] [#<geometry>] [-geometry <geometry>]\n\
- ! [-display <host:display>] [-copy] [-thorough] dvi_file\n", stderr);
- #else X10
- fputs("\
- Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-rv]\n\
- --- 1666,1674 ----
- [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
- [-cr <color>]\n\
- [-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
- ! [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
- ! [#<geometry>] [-geometry <geometry>] [-display <host:display>]\n\
- ! [-copy] [-thorough] dvi_file\n", stderr);
- #else X10
- fputs("\
- Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-rv]\n\
- ***************
- *** 1666,1673 ****
- [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
- [-cr <color>]\n\
- [-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
- ! [-pagewidth <inches>] [-pageheight <inches>] [-mgs[n] <size>]\n\
- ! [-altfont <font>] [-geometry <geometry> | =<geometry>]\n\
- [-display <host:display> | <host:display>] dvi_file\n", stderr);
- #endif X10
- exit(1);
- --- 1675,1682 ----
- [-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
- [-cr <color>]\n\
- [-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
- ! [-paper <papertype>] [-mgs[n] <size>] [-altfont <font>]\n\
- ! [-geometry <geometry> | =<geometry>]\n\
- [-display <host:display> | <host:display>] dvi_file\n", stderr);
- #endif X10
- exit(1);
- ***************
- *** 1735,1744 ****
- (Cardinal) &sidemargin, XtRString, NULL},
- {"topMargin", "Margin", XtRString, sizeof(char *),
- (Cardinal) &topmargin, XtRString, NULL},
- ! {"pageWidth", "PageWidth", XtRString, sizeof(char *),
- ! (Cardinal) &arg_page_w, XtRString, (caddr_t) DEFAULT_PAGE_WIDTH},
- ! {"pageHeight", "PageHeight", XtRString, sizeof(char *),
- ! (Cardinal) &arg_page_h, XtRString, (caddr_t) DEFAULT_PAGE_HEIGHT},
- {"altFont", "AltFont", XtRString, sizeof(char *),
- (Cardinal) &alt_font, XtRString, (caddr_t) ALTFONT},
- {"listFonts", "ListFonts", XtRBoolean, sizeof(Boolean),
- --- 1744,1751 ----
- (Cardinal) &sidemargin, XtRString, NULL},
- {"topMargin", "Margin", XtRString, sizeof(char *),
- (Cardinal) &topmargin, XtRString, NULL},
- ! {"paper", "Paper", XtRString, sizeof(char *),
- ! (Cardinal) &paper, XtRString, (caddr_t) DEFAULT_PAPER},
- {"altFont", "AltFont", XtRString, sizeof(char *),
- (Cardinal) &alt_font, XtRString, (caddr_t) ALTFONT},
- {"listFonts", "ListFonts", XtRBoolean, sizeof(Boolean),
- ***************
- *** 1855,1862 ****
- {"-sidemargin", "sideMargin", SepArg, StringArg, (caddr_t) &sidemargin},
- {"-topmargin", "topMargin", SepArg, StringArg, (caddr_t) &topmargin},
- {"-altfont", "altFont", SepArg, StringArg, (caddr_t) &alt_font},
- ! {"-pagewidth", "pageWidth", SepArg, StringArg, (caddr_t) &arg_page_w},
- ! {"-pageheight", "pageHeight", SepArg, StringArg, (caddr_t) &arg_page_h},
- {"-l", "listFonts", TrueArg, BooleanArg, (caddr_t) &list_fonts},
- {"+l", NULL, FalseArg, BooleanArg, (caddr_t) &list_fonts},
- {"-rv", "reverseVideo", TrueArg, BooleanArg, (caddr_t) &reverse},
- --- 1862,1868 ----
- {"-sidemargin", "sideMargin", SepArg, StringArg, (caddr_t) &sidemargin},
- {"-topmargin", "topMargin", SepArg, StringArg, (caddr_t) &topmargin},
- {"-altfont", "altFont", SepArg, StringArg, (caddr_t) &alt_font},
- ! {"-paper", "paper", SepArg, StringArg, (caddr_t) &paper},
- {"-l", "listFonts", TrueArg, BooleanArg, (caddr_t) &list_fonts},
- {"+l", NULL, FalseArg, BooleanArg, (caddr_t) &list_fonts},
- {"-rv", "reverseVideo", TrueArg, BooleanArg, (caddr_t) &reverse},
- ***************
- *** 1968,1978 ****
-
- #ifndef X10
- if ((DISP = XOpenDisplay(display)) == NULL)
- ! oops("Can't open display\n");
- SCRN = DefaultScreenOfDisplay(DISP);
- #else X10
- if (XOpenDisplay(display) == NULL)
- ! oops("Can't open display\n");
- #endif X10
- for (opt = options; opt < options + XtNumber(options); ++opt)
- if (opt->resource &&
- --- 1974,1984 ----
-
- #ifndef X10
- if ((DISP = XOpenDisplay(display)) == NULL)
- ! oops("Can't open display");
- SCRN = DefaultScreenOfDisplay(DISP);
- #else X10
- if (XOpenDisplay(display) == NULL)
- ! oops("Can't open display");
- #endif X10
- for (opt = options; opt < options + XtNumber(options); ++opt)
- if (opt->resource &&
- ***************
- *** 1997,2002 ****
- --- 2003,2106 ----
-
- #endif TOOLKIT
-
- + static char *paper_types[] = {
- + "us", "8.5x11",
- + "usr", "11x8.5",
- + "legal", "8.5x14",
- + "foolscap", "13.5x17.0", /* ??? */
- +
- + /* ISO `A' formats, Portrait */
- + "a1", "59.4x84.0cm",
- + "a2", "42.0x59.4cm",
- + "a3", "29.7x42.0cm",
- + "a4", "21.0x29.7cm",
- + "a5", "14.85x21.0cm",
- + "a6", "10.5x14.85cm",
- + "a7", "7.42x10.5cm",
- +
- + /* ISO `A' formats, Landscape */
- + "a1r", "84.0x59.4cm",
- + "a2r", "59.4x42.0cm",
- + "a3r", "42.0x29.7cm",
- + "a4r", "29.7x21.0cm",
- + "a5r", "21.0x14.85cm",
- + "a6r", "14.85x10.5cm",
- + "a7r", "10.5x7.42cm",
- +
- + /* ISO `B' formats, Portrait */
- + "b1", "70.6x100.0cm",
- + "b2", "50.0x70.6cm",
- + "b3", "35.3x50.0cm",
- + "b4", "25.0x35.3cm",
- + "b5", "17.6x25.0cm",
- + "b6", "13.5x17.6cm",
- + "b7", "8.8x13.5cm",
- +
- + /* ISO `B' formats, Landscape */
- + "b1r", "100.0x70.6cm",
- + "b2r", "70.6x50.0cm",
- + "b3r", "50.0x35.3cm",
- + "b4r", "35.3x25.0cm",
- + "b5r", "25.0x17.6cm",
- + "b6r", "17.6x13.5cm",
- + "b7r", "13.5x8.8cm",
- +
- + /* ISO `C' formats, Portrait */
- + "c1", "64.8x91.6cm",
- + "c2", "45.8x64.8cm",
- + "c3", "32.4x45.8cm",
- + "c4", "22.9x32.4cm",
- + "c5", "16.2x22.9cm",
- + "c6", "11.46x16.2cm",
- + "c7", "8.1x11.46cm",
- +
- + /* ISO `C' formats, Landscape */
- + "c1r", "91.6x64.8cm",
- + "c2r", "64.8x45.8cm",
- + "c3r", "45.8x32.4cm",
- + "c4r", "32.4x22.9cm",
- + "c5r", "22.9x16.2cm",
- + "c6r", "16.2x11.46cm",
- + "c7r", "11.46x8.1cm",
- + };
- +
- + static Boolean
- + set_paper_type() {
- + char temp[21];
- + int i;
- + double factor = 1.0;
- + char c;
- + char **p;
- + char *q;
- +
- + if (strlen(paper) > 20) return False;
- + i = 0;
- + for (;;) { /* convert to lower case */
- + c = paper[i];
- + if (c >= 'A' && c <= 'Z') c ^= ('a' ^ 'A');
- + temp[i] = c;
- + if (c == '\0') break;
- + ++i;
- + }
- + /* perform substitutions */
- + for (p = paper_types; p < paper_types + XtNumber(paper_types); p += 2)
- + if (strcmp(temp, *p) == 0) {
- + (void) strcpy(temp, p[1]);
- + break;
- + }
- + if (i > 2 && strcmp(temp + i - 2, "cm") == 0) {
- + factor = 1.0 / 2.54;
- + temp[i - 2] = '\0';
- + }
- + q = index(temp, 'x');
- + if (q == NULL) return False;
- + *q = '\0';
- + factor *= pixels_per_inch;
- + unshrunk_page_w = atof(temp) * factor + 0.5;
- + unshrunk_page_h = atof(q + 1) * factor + 0.5;
- + return (unshrunk_page_w != 0 && unshrunk_page_h != 0);
- + }
- +
- /*
- * main program
- */
- ***************
- *** 2015,2022 ****
- --- 2119,2128 ----
- char def[32];
- int mouspix;
- Color cdef;
- + int x_thick, y_thick;
- #endif X10
- #endif TOOLKIT
- + int screen_w, screen_h;
-
- prog = rindex(*argv, '/');
- if (prog != NULL) ++prog; else prog = *argv;
- ***************
- *** 2055,2062 ****
- if (margins) home_x = home_y = atof(margins) * pixels_per_inch;
- if (sidemargin) home_x = atof(sidemargin) * pixels_per_inch;
- if (topmargin) home_y = atof(topmargin) * pixels_per_inch;
- ! unshrunk_page_w = atof(arg_page_w) * pixels_per_inch + 0.5;
- ! unshrunk_page_h = atof(arg_page_h) * pixels_per_inch + 0.5;
-
- init_pxl_open();
- open_dvi_file();
- --- 2161,2167 ----
- if (margins) home_x = home_y = atof(margins) * pixels_per_inch;
- if (sidemargin) home_x = atof(sidemargin) * pixels_per_inch;
- if (topmargin) home_y = atof(topmargin) * pixels_per_inch;
- ! if (!set_paper_type()) oops("Don't recognize paper type %s", paper);
-
- init_pxl_open();
- open_dvi_file();
- ***************
- *** 2228,2250 ****
- size_hints.x = size_hints.y = 0;
- if (geometry != NULL) {
- int flag = XParseGeometry(geometry, &size_hints.x, &size_hints.y,
- ! &size_hints.width, &size_hints.height);
-
- if (flag & (XValue | YValue))
- ! size_hints.flags |= USSize | USPosition;
- if (flag & (WidthValue | HeightValue))
- size_hints.flags |= USSize;
- ! if (flag & XNegative) size_hints.x += screen_w - size_hints.width;
- ! if (flag & YNegative) size_hints.y += screen_h - size_hints.height;
- }
- if (!(size_hints.flags & USSize)) {
- size_hints.flags |= PSize;
- - size_hints.width = page_w < screen_w ? page_w : screen_w;
- - size_hints.height = page_h < screen_h ? page_h : screen_h;
- }
- top_level = XCreateSimpleWindow(DISP, RootWindowOfScreen(SCRN),
- ! size_hints.x, size_hints.y, size_hints.width, size_hints.height,
- ! bwidth, fore_Pixel, back_Pixel);
- XSetStandardProperties(DISP, top_level, dvi_name, prog, NULL,
- argv, argc, &size_hints);
-
- --- 2333,2366 ----
- size_hints.x = size_hints.y = 0;
- if (geometry != NULL) {
- int flag = XParseGeometry(geometry, &size_hints.x, &size_hints.y,
- ! &window_w, &window_h);
-
- if (flag & (XValue | YValue))
- ! size_hints.flags |= USPosition;
- if (flag & (WidthValue | HeightValue))
- size_hints.flags |= USSize;
- ! if (flag & XNegative) size_hints.x += screen_w - window_w;
- ! if (flag & YNegative) size_hints.y += screen_h - window_h;
- }
- if (!(size_hints.flags & USSize)) {
- + int x_thick = 0;
- + int y_thick = 0;
- + if (screen_w < page_w) x_thick = BAR_THICK;
- + if (screen_h < page_h + x_thick) y_thick = BAR_THICK;
- + window_w = page_w + y_thick;
- + if (window_w > screen_w) {
- + x_thick = BAR_THICK;
- + window_w = screen_w;
- + }
- + window_h = page_h + x_thick;
- + if (window_h > screen_h) window_h = screen_h;
- size_hints.flags |= PSize;
- }
- + size_hints.width = window_w;
- + size_hints.height = window_h;
- top_level = XCreateSimpleWindow(DISP, RootWindowOfScreen(SCRN),
- ! size_hints.x, size_hints.y, window_w, window_h, bwidth,
- ! fore_Pixel, back_Pixel);
- XSetStandardProperties(DISP, top_level, dvi_name, prog, NULL,
- argv, argc, &size_hints);
-
- ***************
- *** 2331,2338 ****
- frame.bdrwidth = bwidth;
- screen_w = DisplayWidth() - 2*bwidth;
- screen_h = DisplayHeight() - 2*bwidth;
- ! frame.width = (page_w < screen_w ? page_w : screen_w);
- ! frame.height = (page_h < screen_h ? page_h : screen_h);
- frame.border = bdrmap;
- frame.background = backmap;
- frame.x = 0;
- --- 2447,2462 ----
- frame.bdrwidth = bwidth;
- screen_w = DisplayWidth() - 2*bwidth;
- screen_h = DisplayHeight() - 2*bwidth;
- ! x_thick = y_thick = 0;
- ! if (screen_w < page_w) x_thick = BAR_THICK;
- ! if (screen_h < page_h + x_thick) y_thick = BAR_THICK;
- ! frame.width = page_w + y_thick;
- ! if (frame.width > screen_w) {
- ! x_thick = BAR_THICK;
- ! frame.width = screen_w;
- ! }
- ! frame.height = page_h + x_thick;
- ! if (frame.height > screen_h) frame.height = screen_h;
- frame.border = bdrmap;
- frame.background = backmap;
- frame.x = 0;
- diff -cr old/xdvi.h new/xdvi.h
- *** old/xdvi.h Sun Feb 4 13:09:47 1990
- --- new/xdvi.h Sun Dec 10 20:29:55 1989
- ***************
- *** 7,13 ****
- --- 7,23 ----
- #include <X11/Xos.h> /* same as below */
- #else X10
- #include <sys/types.h> /* for sites without X11 */
- + #ifdef SYSV
- + #include <string.h>
- + #define index strchr
- + #define rindex strrchr
- + #include <fcntl.h>
- + #else /* SYSV */
- + #include <strings.h>
- + #endif /* SYSV */
- + #include <sys/file.h>
- #endif X10
- +
- #include <setjmp.h>
-
- #define OPEN_MODE "r"
- diff -cr old/xdvi.man.sed new/xdvi.man.sed
- *** old/xdvi.man.sed Sun Feb 4 13:09:50 1990
- --- new/xdvi.man.sed Sun Feb 4 13:28:33 1990
- ***************
- *** 12,19 ****
- [\-l] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
- [\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP]
- [\-margins \fIinches\fP] [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
- ! [\-pagewidth \fIinches\fP] [\-pageheight \fIinches\fP]
- ! [\-mgs[\fIn\fP] \fIsize\fP] [\-altfont \fIfont\fP]
- #ifx11
- [#\fIgeometry\fP] [\-geometry \fIgeometry\fP] [\-display \fIdisplay\fP]
- [-copy] [-thorough]
- --- 12,18 ----
- [\-l] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
- [\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP]
- [\-margins \fIinches\fP] [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
- ! [\-paper \fIpapertype\fP] [\-mgs[\fIn\fP] \fIsize\fP] [\-altfont \fIfont\fP]
- #ifx11
- [#\fIgeometry\fP] [\-geometry \fIgeometry\fP] [\-display \fIdisplay\fP]
- [-copy] [-thorough]
- ***************
- *** 156,162 ****
- still cannot fit in the window, then the page is put in the window such that
- the top and left margins are hidden, and presumably the upper left-hand corner
- of the text on the page will be in the upper left-hand corner of the window.
- ! Otherwise, the text is centered in the window. See also `\fBH\fR' under
- the KEY\%STROKES section.
- .TP
- .BI \-sidemargin " inches"
- --- 155,161 ----
- still cannot fit in the window, then the page is put in the window such that
- the top and left margins are hidden, and presumably the upper left-hand corner
- of the text on the page will be in the upper left-hand corner of the window.
- ! Otherwise, the text is centered in the window. See also `\fBM\fR' under
- the KEY\%STROKES section.
- .TP
- .BI \-sidemargin " inches"
- ***************
- *** 167,180 ****
- (%%dot%%topMargin)
- Specifies the top and bottom margins (see above).
- .TP
- ! .BI \-pagewidth " inches"
- ! (%%dot%%pageWidth)
- ! Specifies the width of the printed page.
- ! .TP
- ! .BI \-pageheight " inches"
- ! (%%dot%%pageHeight)
- ! Specifies the height of the printed page. By default, the page size
- ! is %%defaultpagesize%%.
- .TP
- #ifx11
- .BI "\-mgs[n]" " size"
- --- 166,180 ----
- (%%dot%%topMargin)
- Specifies the top and bottom margins (see above).
- .TP
- ! .BI \-paper " papertype"
- ! (%%dot%%paper)
- ! Specifies the size of the printed page. This may be of the form
- ! \fIw\fRx\fIh\fR (or \fIw\fRx\fIh\fRcm), where \fIw\fR is the width in
- ! inches (or cm) and \fIh\fR is the height in inches (or cm), respectively.
- ! There are also synonyms which may be used: us (8.5x11), usr (11x8.5),
- ! legal (8.5x14), foolscap (13.5x17), as well as the ISO sizes a1-a7,
- ! b1-b7, c1-c7, a1r-a7r (a1-a7 rotated), etc. The default size is
- ! %%defaultpagesize%%.
- .TP
- #ifx11
- .BI "\-mgs[n]" " size"
-
-