v05i036: xdvi, dvi previewer, patch 6, part 2/2
Paul A Vojta
vojta at guinness.ias.edu
Wed Dec 6 05:45:42 AEST 1989
Submitted-by: vojta at guinness.ias.edu (Paul A Vojta)
Posting-number: Volume 5, Issue 36
Archive-name: xdvi/patch6
Patch-To: xdvi: Volume 3, Issue 37-39,46,67
Patch-To: xdvi: Volume 4, Issue 44,96
diff -cr old/xdvi.c new/xdvi.c
*** old/xdvi.c Fri Nov 17 21:23:15 1989
--- new/xdvi.c Fri Nov 17 21:51:55 1989
***************
*** 17,26 ****
* SYSV compile for System V
* X10 compile for X10
* NOTOOL compile without toolkit (X11 only)
! * MSBITFIRST store bitmaps internally in with significant bit first
* BMSHORT store bitmaps in shorts instead of bytes
* BMLONG store bitmaps in longs instead of bytes
! * ALTFONT default for -altfont option.
*/
#ifndef lint
#include "patchlevel.h"
--- 17,28 ----
* SYSV compile for System V
* X10 compile for X10
* NOTOOL compile without toolkit (X11 only)
! * BUTTONS compile with buttons on the side of the window (needs toolkit)
! * MSBITFIRST store bitmaps internally with most significant bit first
* BMSHORT store bitmaps in shorts instead of bytes
* BMLONG store bitmaps in longs instead of bytes
! * ALTFONT default for -altfont option
! * A4 use European size paper
*/
#ifndef lint
#include "patchlevel.h"
***************
*** 36,45 ****
--- 38,56 ----
#define ALTFONT "cmr10"
#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)
#define TOOLKIT
#else
#undef TOOLKIT
+ #undef BUTTONS
#endif
#ifndef X10
***************
*** 62,67 ****
--- 73,82 ----
#endif not OLD_X11_TOOLKIT
#include <X11/Shell.h> /* needed for def. of XtNiconX */
#include <X11/Viewport.h>
+ #ifdef BUTTONS
+ #include <X11/Form.h>
+ #include <X11/Command.h>
+ #endif BUTTONS
#else TOOLKIT
#define XtNumber(arr) (sizeof(arr)/sizeof(arr[0]))
typedef int Position;
***************
*** 117,124 ****
#endif X10
#define MAGBORD 1 /* border size for magnifier */
- char *font_path;
- char default_font_path[] = DEFAULT_FONT_PATH;
char *alt_font = ALTFONT;
/*
--- 132,137 ----
***************
*** 129,134 ****
--- 142,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;
***************
*** 205,210 ****
--- 221,236 ----
static Widget x_bar, y_bar; /* horizontal and vertical scroll bars */
static Arg vport_args[] = {
+ #ifdef BUTTONS
+ {XtNwidth, (XtArgVal) 0},
+ {XtNheight, (XtArgVal) 0},
+ {XtNborderWidth, (XtArgVal) 0},
+ {XtNtop, (XtArgVal) XtChainTop},
+ {XtNbottom, (XtArgVal) XtChainBottom},
+ {XtNleft, (XtArgVal) XtChainLeft},
+ {XtNright, (XtArgVal) XtChainRight},
+ {XtNresizable, (XtArgVal) True},
+ #endif BUTTONS
{XtNallowHoriz, (XtArgVal) True},
{XtNallowVert, (XtArgVal) True},
};
***************
*** 220,225 ****
--- 246,327 ----
};
static void set_draw_args();
+
+ #ifdef BUTTONS
+ static Widget form_widget;
+
+ static Arg form_args[] = {
+ {XtNdefaultDistance, (XtArgVal) 0},
+ };
+
+ static struct {
+ char *label;
+ char *name;
+ int closure;
+ int y_pos;
+ }
+ 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},
+ {"Prev", "prev", 'p', 600},
+ {"Page-5", "prev5", 5 << 8 | 'p', 650},
+ {"Page-10", "prev10", 10 << 8 | 'p', 700},
+ };
+
+ static Widget command_wid[XtNumber(command_table)];
+
+ static void handle_command();
+
+ static XtCallbackRec command_call[] = {
+ {handle_command, NULL},
+ {NULL, NULL},
+ };
+
+ static Arg command_args[] = {
+ {XtNlabel, NULL},
+ {XtNvertDistance, (XtArgVal) 0},
+ {XtNfromHoriz, (XtArgVal) NULL},
+ {XtNhorizDistance, (XtArgVal) 9},
+ {XtNwidth, (XtArgVal) 60},
+ {XtNheight, (XtArgVal) 30},
+ {XtNtop, (XtArgVal) XtChainTop},
+ {XtNbottom, (XtArgVal) XtChainTop},
+ {XtNleft, (XtArgVal) XtChainRight},
+ {XtNright, (XtArgVal) XtChainRight},
+ {XtNcallback, (XtArgVal) command_call},
+ };
+
+ static Arg line_args[] = {
+ {XtNbackground, (XtArgVal) 0},
+ {XtNwidth, (XtArgVal) 1},
+ {XtNheight, (XtArgVal) 0},
+ {XtNfromHoriz, (XtArgVal) NULL},
+ {XtNborderWidth, (XtArgVal) 0},
+ {XtNtop, (XtArgVal) XtChainTop},
+ {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},
+ {XtNbottom, (XtArgVal) XtChainTop},
+ {XtNleft, (XtArgVal) XtChainRight},
+ {XtNright, (XtArgVal) XtChainRight},
+ };
+ #endif BUTTONS
+
#else TOOLKIT
#define BAR_WID 12 /* width of darkened area */
#define BAR_THICK 15 /* gross amount removed */
***************
*** 229,246 ****
static int x_bgn, x_end, y_bgn, y_end; /* scrollbar positions */
#endif TOOLKIT
- #ifdef lint
- #ifndef X10
- char xdvi_bits[288];
- #ifdef TOOLKIT
- WidgetClass viewportWidgetClass, widgetClass;
- #endif TOOLKIT
- #else X10
- short xdvi_bits[15], xdvi_mask_bits[15];
- Display *_XlibCurrentDisplay;
- #endif X10
- #endif lint
-
/*
* Mechanism to keep track of the magnifier window. The problems are,
* (a) if the button is released while the window is being drawn, this
--- 331,336 ----
***************
*** 266,277 ****
sign = 1;
static jmp_buf canit_env;
! static void can_exposures(), read_events();
#ifndef ANSI_LIB
char *sprintf();
#endif
! char *malloc(), *index(), *rindex(), *getenv(), *strcpy(), *strcat();
double atof();
--- 356,382 ----
sign = 1;
static jmp_buf canit_env;
! static void can_exposures(), read_events(), keystroke();
+ #ifdef lint
+ #ifndef X10
+ char xdvi_bits[288];
+ #ifdef TOOLKIT
+ WidgetClass viewportWidgetClass, widgetClass;
+ #ifdef BUTTONS
+ WidgetClass formWidgetClass, commandWidgetClass;
+ #endif BUTTONS
+ #endif TOOLKIT
+ #else X10
+ short xdvi_bits[15], xdvi_mask_bits[15];
+ Display *_XlibCurrentDisplay;
+ #endif X10
+ #endif lint
+
#ifndef ANSI_LIB
char *sprintf();
#endif
! char *malloc(), *index(), *rindex(), *strcpy(), *strcat();
double atof();
***************
*** 504,510 ****
{XtNy, (XtArgVal) &window_y},
};
! #define get_xy() XtGetValues(draw_widget, arg_xy, 2)
#define mane_base_x 0
#define mane_base_y 0
--- 609,615 ----
{XtNy, (XtArgVal) &window_y},
};
! #define get_xy() XtGetValues(draw_widget, arg_xy, XtNumber(arg_xy))
#define mane_base_x 0
#define mane_base_y 0
***************
*** 548,555 ****
};
register int old_clip_w;
! XtGetValues(vport_widget, arg_wh, 2);
! XtGetValues(clip_widget, arg_wh_clip, 2);
x_bar = XtNameToWidget(vport_widget, "horizontal");
y_bar = XtNameToWidget(vport_widget, "vertical");
old_clip_w = clip_w;
--- 653,660 ----
};
register int old_clip_w;
! XtGetValues(vport_widget, arg_wh, XtNumber(arg_wh));
! XtGetValues(clip_widget, arg_wh_clip, XtNumber(arg_wh_clip));
x_bar = XtNameToWidget(vport_widget, "horizontal");
y_bar = XtNameToWidget(vport_widget, "vertical");
old_clip_w = clip_w;
***************
*** 598,603 ****
--- 703,721 ----
resized = True;
}
+ #ifdef BUTTONS
+ /*ARGSUSED*/
+ static void
+ handle_command(widget, client_data, call_data)
+ Widget widget;
+ caddr_t client_data;
+ caddr_t call_data;
+ {
+ keystroke(((int) client_data) & 0xff, ((int) client_data) >> 8,
+ (((int) client_data) >> 8) != 0, (XEvent *) NULL);
+ }
+ #endif BUTTONS
+
#else TOOLKIT
/*
***************
*** 683,695 ****
/* process drawing (clip) window */
if (mane.win == NULL) { /* initial creation */
#ifndef X10
! mane.win = (void *) XCreateSimpleWindow(DISP, top_level,
y_thick, x_thick, clip_w, clip_h, 0,
fore_Pixel, back_Pixel);
XSelectInput(DPY (Window) mane.win, ExposureMask |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask);
#else X10
! mane.win = (void *) XCreateWindow(top_level,
y_thick, x_thick, clip_w, clip_h, 0,
bdrmap, backmap);
XSelectInput((Window) mane.win, ExposeRegion | ExposeCopy |
--- 801,813 ----
/* process drawing (clip) window */
if (mane.win == NULL) { /* initial creation */
#ifndef X10
! mane.win = (caddr_t) XCreateSimpleWindow(DISP, top_level,
y_thick, x_thick, clip_w, clip_h, 0,
fore_Pixel, back_Pixel);
XSelectInput(DPY (Window) mane.win, ExposureMask |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask);
#else X10
! mane.win = (caddr_t) XCreateWindow(top_level,
y_thick, x_thick, clip_w, clip_h, 0,
bdrmap, backmap);
XSelectInput((Window) mane.win, ExposeRegion | ExposeCopy |
***************
*** 870,876 ****
attr.border_pixel = fore_Pixel;
attr.background_pixel = back_Pixel;
attr.override_redirect = True;
! alt.win = (void *) XCreateWindow(DISP, RootWindowOfScreen(SCRN),
x, y, alt.width, alt.height, MAGBORD,
0, /* depth from parent */
InputOutput, CopyFromParent,
--- 988,994 ----
attr.border_pixel = fore_Pixel;
attr.background_pixel = back_Pixel;
attr.override_redirect = True;
! alt.win = (caddr_t) XCreateWindow(DISP, RootWindowOfScreen(SCRN),
x, y, alt.width, alt.height, MAGBORD,
0, /* depth from parent */
InputOutput, CopyFromParent,
***************
*** 878,884 ****
CWOverrideRedirect, &attr);
XSelectInput(DISP, (Window) alt.win, ExposureMask);
#else X10
! alt.win = (void *) XCreateWindow((Window) mane.win,
x, y, alt.width, alt.height, MAGBORD,
bdrmap, backmap);
XSelectInput((Window) alt.win, ExposeRegion);
--- 996,1002 ----
CWOverrideRedirect, &attr);
XSelectInput(DISP, (Window) alt.win, ExposureMask);
#else X10
! alt.win = (caddr_t) XCreateWindow((Window) mane.win,
x, y, alt.width, alt.height, MAGBORD,
bdrmap, backmap);
XSelectInput((Window) alt.win, ExposeRegion);
***************
*** 962,968 ****
--- 1080,1301 ----
}
#endif TOOLKIT
+ /* |||
+ * Currently the event handler does not coordinate XCopyArea requests
+ * with GraphicsExpose events. This can lead to problems if the window
+ * is partially obscured and one, for example, drags a scrollbar.
+ */
+
#ifndef X10
+ #define XKEY(ev) (ev).xkey
+ #ifndef TOOLKIT
+ #define XANY(ev) (ev).xany
+ #define XCONFIG(ev) (ev).xconfigure
+ #define XEXPOSE(ev) (ev).xexpose
+ #define XMOTION(ev) (ev).xmotion
+ #define XBUTTON(ev) (ev).xbutton
+ #define ISEXPOSE(ev) ((ev).type == Expose)
+ #endif TOOLKIT
+ #else X10
+ #define XANY(ev) (ev)
+ #define XCONFIG(ev) (*((XExposeEvent *) &(ev)))
+ #define XEXPOSE(ev) (*((XExposeEvent *) &(ev)))
+ #define XMOTION(ev) (*((XMouseMovedEvent *) &(ev)))
+ #define XBUTTON(ev) (*((XButtonEvent *) &(ev)))
+ #define XKEY(ev) (*((XKeyEvent *) &(ev)))
+ #define ConfigureNotify ExposeWindow
+ #define Expose ExposeRegion
+ #define ISEXPOSE(ev) ((ev).type == ExposeWindow || (ev).type == ExposeRegion)
+ #define MotionNotify MouseMoved
+ #define ButtonPress ButtonPressed
+ #define ButtonRelease ButtonReleased
+ #define KeyPress KeyPressed
+ #endif X10
+
+ static void
+ keystroke(ch, number0, arg0, eventp)
+ char ch;
+ int number0;
+ Boolean arg0;
+ XEvent *eventp;
+ {
+ int next_page;
+
+ next_page = current_page;
+ switch (ch) {
+ case 'q':
+ case '\003': /* control-C */
+ case '\004': /* control-D */
+ exit(0);
+ case 'n':
+ case 'f':
+ case ' ':
+ case '\r':
+ case '\n':
+ /* scroll forward; i.e. go to relative page */
+ next_page = current_page + (arg0 ? number0 : 1);
+ break;
+ case 'p':
+ case 'b':
+ case '\b':
+ case '\177': /* Del */
+ /* scroll backward */
+ next_page = current_page - 1;
+ break;
+ case 'g':
+ /* go to absolute page */
+ next_page = (arg0 ? number0 - pageno_correct :
+ total_pages - 1);
+ break;
+ case 'P': /* declare current page */
+ pageno_correct = arg0 * number0 - current_page;
+ return;
+ case 'k': /* toggle keep-position flag */
+ keep_flag = (arg0 ? number0 : !keep_flag);
+ return;
+ case '\f':
+ /* redisplay current page */
+ break;
+ case '^':
+ home(True);
+ return;
+ #ifdef TOOLKIT
+ case 'l':
+ if (!x_bar) goto bad;
+ XtCallCallbacks(x_bar, XtNscrollProc,
+ -2 * (int) clip_w / 3);
+ return;
+ case 'r':
+ if (!x_bar) goto bad;
+ XtCallCallbacks(x_bar, XtNscrollProc,
+ 2 * (int) clip_w / 3);
+ return;
+ case 'u':
+ if (!y_bar) goto bad;
+ XtCallCallbacks(y_bar, XtNscrollProc,
+ -2 * (int) clip_h / 3);
+ return;
+ case 'd':
+ if (!y_bar) goto bad;
+ XtCallCallbacks(y_bar, XtNscrollProc,
+ 2 * (int) clip_h / 3);
+ return;
+ case 'c':
+ center(eventp->xkey.x, eventp->xkey.y);
+ return;
+ #else TOOLKIT
+ case 'l':
+ if (mane.base_x <= 0) goto bad;
+ scrollmane(mane.base_x - 2 * clip_w / 3, mane.base_y);
+ return;
+ case 'r':
+ if (mane.base_x >= page_w - clip_w) goto bad;
+ scrollmane(mane.base_x + 2 * clip_w / 3, mane.base_y);
+ return;
+ case 'u':
+ if (mane.base_y <= 0) goto bad;
+ scrollmane(mane.base_x, mane.base_y - 2 * clip_h / 3);
+ return;
+ case 'd':
+ if (mane.base_y >= page_h - clip_h) goto bad;
+ scrollmane(mane.base_x, mane.base_y + 2 * clip_h / 3);
+ return;
+ case 'c': /* unchecked scrollmane() */
+ scrollwindow(&mane, mane.base_x + XKEY(*eventp).x - clip_w/2,
+ mane.base_y + XKEY(*eventp).y - clip_h/2);
+ paint_x_bar();
+ paint_y_bar();
+ #ifndef X10
+ XWarpPointer(DISP, None, None, 0, 0, 0, 0,
+ clip_w/2 - XKEY(*eventp).x, clip_h/2 - XKEY(*eventp).y);
+ #else X10
+ XWarpMouse(mane.win, clip_w/2, clip_h/2, GXcopy);
+ #endif X10
+ return;
+ #endif TOOLKIT
+
+ #ifndef X10
+ case 'M':
+ XTranslateCoordinates(DISP, eventp->xkey.window, mane.win,
+ eventp->xkey.x, eventp->xkey.y, &home_x, &home_y,
+ &number0); /* throw away last argument */
+ home_x *= mane.shrinkfactor;
+ home_y *= mane.shrinkfactor;
+ return;
+ case '\020': /* Control P */
+ Printf("Unit = %d, bitord = %d, byteord = %d\n",
+ BitmapUnit(DISP), BitmapBitOrder(DISP),
+ ImageByteOrder(DISP));
+ return;
+ #else X10
+ case 'M':
+ home_x = (XKEY(*eventp).x + mane.base_x) * mane.shrinkfactor;
+ home_y = (XKEY(*eventp).y + mane.base_y) * mane.shrinkfactor;
+ return;
+ #endif X10
+ case 's':
+ if (!arg0) {
+ long fac1, fac2;
+ shrink_factor = 1;
+ fac1 = ROUNDUP(PAPER_WIDTH, window_w);
+ fac2 = ROUNDUP(PAPER_HEIGHT, window_h);
+ if (fac1 < fac2)
+ number0 = fac2;
+ else
+ number0 = fac1;
+ }
+ if (number0 <= 0) goto bad;
+ if (number0 == mane.shrinkfactor) return;
+ shrink_factor = mane.shrinkfactor = number0;
+ init_page();
+ if (number0 != 1 && number0 != bak_shrink) {
+ bak_shrink = number0;
+ reset_fonts();
+ }
+ #ifdef TOOLKIT
+ XUnmapWindow(DISP, mane.win);
+ set_draw_args();
+ XtSetValues(draw_widget, draw_args, (Cardinal) 2);
+ 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;
+ if (number0 == density) return;
+ density = number0;
+ reset_fonts();
+ if (mane.shrinkfactor == 1) return;
+ break;
+ case 'R':
+ /* reread DVI file */
+ --dvi_time; /* then it will notice a change */
+ break;
+ default:
+ goto bad;
+ }
+ if (0 <= next_page && next_page < total_pages) {
+ if (current_page != next_page) {
+ current_page = next_page;
+ spec_warn = True;
+ if (!keep_flag) home(False);
+ }
+ canit = True;
+ Flush();
+ return; /* don't use longjmp here: it might be called from
+ * within the toolkit, and we don't want to longjmp out
+ * of Xt routines. */
+ }
+ bad: XBell(DISP, 10);
+ }
+
+ #ifndef X10
#define TRSIZE 100
#endif X10
static void
***************
*** 978,984 ****
#endif X10
char *string;
int nbytes;
- int next_page;
alt_canit = False;
for (;;) {
--- 1311,1316 ----
***************
*** 985,998 ****
ch = '\0';
event_counter = event_freq;
/*
! * If we get a hit at this point, then we'll just end up making
! * an extra call.
* Also, watch out, if we destroy the magnifying glass while
* writing it.
*/
if (!XtPending() && (!wait || canit || mane.min_x < MAXDIM ||
alt.min_x < MAXDIM || mag_moved))
! if (alt_canit) longjmp(canit_env, 1);
else return;
#ifdef TOOLKIT
XtNextEvent(&event);
--- 1317,1331 ----
ch = '\0';
event_counter = event_freq;
/*
! * The above line clears the flag indicating that an event is
! * pending. So if an event comes in right now, the flag will be
! * set again needlessly, but we just end up making an extra call.
* Also, watch out, if we destroy the magnifying glass while
* writing it.
*/
if (!XtPending() && (!wait || canit || mane.min_x < MAXDIM ||
alt.min_x < MAXDIM || mag_moved))
! if (!wait && (canit || alt_canit)) longjmp(canit_env, 1);
else return;
#ifdef TOOLKIT
XtNextEvent(&event);
***************
*** 1008,1047 ****
}
string = trbuf;
nbytes = XLookupString(&event, string, TRSIZE, NULL, NULL);
! if (nbytes > 1) goto bad;
if (nbytes != 0) ch = *string;
#else TOOLKIT
- /* |||
- * Currently the event handler does not coordinate XCopyArea requests
- * with GraphicsExpose events. This can lead to problems if the window
- * is partially obscured and one, for example, drags a scrollbar.
- */
-
- #ifndef X10
- #define XANY(ev) ev.xany
- #define XCONFIG(ev) ev.xconfigure
- #define XEXPOSE(ev) ev.xexpose
- #define XMOTION(ev) ev.xmotion
- #define XBUTTON(ev) ev.xbutton
- #define XKEY(ev) ev.xkey
- #define ISEXPOSE(ev) ((ev).type == Expose)
- #else X10
- #define XANY(ev) ev
- #define XCONFIG(ev) (*((XExposeEvent *) &(ev)))
- #define XEXPOSE(ev) (*((XExposeEvent *) &(ev)))
- #define XMOTION(ev) (*((XMouseMovedEvent *) &(ev)))
- #define XBUTTON(ev) (*((XButtonEvent *) &(ev)))
- #define XKEY(ev) (*((XKeyEvent *) &(ev)))
- #define ConfigureNotify ExposeWindow
- #define Expose ExposeRegion
- #define ISEXPOSE(ev) ((ev).type == ExposeWindow || (ev).type == ExposeRegion)
- #define MotionNotify MouseMoved
- #define ButtonPress ButtonPressed
- #define ButtonRelease ButtonReleased
- #define KeyPress KeyPressed
- #endif X10
-
XNextEvent(DPY &event);
if (XANY(event).window == (Window) mane.win ||
XANY(event).window == (Window) alt.win) {
--- 1341,1350 ----
}
string = trbuf;
nbytes = XLookupString(&event, string, TRSIZE, NULL, NULL);
! if (nbytes > 1) ch = '?';
if (nbytes != 0) ch = *string;
#else TOOLKIT
XNextEvent(DPY &event);
if (XANY(event).window == (Window) mane.win ||
XANY(event).window == (Window) alt.win) {
***************
*** 1172,1178 ****
#else X10
string = XLookupMapping(&event, &nbytes);
#endif X10
! if (nbytes > 1) goto bad;
if (nbytes != 0) ch = *string;
break;
}
--- 1475,1481 ----
#else X10
string = XLookupMapping(&event, &nbytes);
#endif X10
! if (nbytes > 1) ch = '?';
if (nbytes != 0) ch = *string;
break;
}
***************
*** 1189,1370 ****
number = 0;
continue;
}
- arg0 = arg;
- arg = False;
number0 = number;
number = 0;
sign = 1;
! next_page = current_page;
!
! switch (ch) {
! case 'q':
! case '\003': /* control-C */
! case '\004': /* control-D */
! exit(0);
! case 'n':
! case 'f':
! case ' ':
! case '\r':
! case '\n':
! /* scroll forward; i.e. go to relative page */
! next_page = current_page + (arg0 ? number0 : 1);
! break;
! case 'p':
! case 'b':
! case '\b':
! case '\177': /* Del */
! /* scroll backward */
! next_page = current_page - 1;
! break;
! case 'g':
! /* go to absolute page */
! next_page = (arg0 ? number0 - pageno_correct :
! total_pages - 1);
! break;
! case 'P': /* declare current page */
! pageno_correct = arg0 * number0 - current_page;
! continue;
! case 'k': /* toggle keep-position flag */
! keep_flag = (arg0 ? number0 : !keep_flag);
! continue;
! case '\f':
! /* redisplay current page */
! break;
! case '^':
! home(True);
! continue;
! #ifdef TOOLKIT
! case 'l':
! if (!x_bar) goto bad;
! XtCallCallbacks(x_bar, XtNscrollProc,
! -2 * (int) clip_w / 3);
! continue;
! case 'r':
! if (!x_bar) goto bad;
! XtCallCallbacks(x_bar, XtNscrollProc,
! 2 * (int) clip_w / 3);
! continue;
! case 'u':
! if (!y_bar) goto bad;
! XtCallCallbacks(y_bar, XtNscrollProc,
! -2 * (int) clip_h / 3);
! continue;
! case 'd':
! if (!y_bar) goto bad;
! XtCallCallbacks(y_bar, XtNscrollProc,
! 2 * (int) clip_h / 3);
! continue;
! case 'c':
! center(event.xkey.x, event.xkey.y);
! continue;
! #else TOOLKIT
! case 'l':
! if (mane.base_x <= 0) goto bad;
! scrollmane(mane.base_x - 2 * clip_w / 3, mane.base_y);
! continue;
! case 'r':
! if (mane.base_x >= page_w - clip_w) goto bad;
! scrollmane(mane.base_x + 2 * clip_w / 3, mane.base_y);
! continue;
! case 'u':
! if (mane.base_y <= 0) goto bad;
! scrollmane(mane.base_x, mane.base_y - 2 * clip_h / 3);
! continue;
! case 'd':
! if (mane.base_y >= page_h - clip_h) goto bad;
! scrollmane(mane.base_x, mane.base_y + 2 * clip_h / 3);
! continue;
! case 'c': /* unchecked scrollmane() */
! scrollwindow(&mane, mane.base_x + XKEY(event).x - clip_w/2,
! mane.base_y + XKEY(event).y - clip_h/2);
! paint_x_bar();
! paint_y_bar();
! #ifndef X10
! XWarpPointer(DISP, None, None, 0, 0, 0, 0,
! clip_w/2 - XKEY(event).x, clip_h/2 - XKEY(event).y);
! #else X10
! XWarpMouse(mane.win, clip_w/2, clip_h/2, GXcopy);
! #endif X10
! continue;
! #endif TOOLKIT
!
! #ifndef X10
! case 'M':
! XTranslateCoordinates(DISP, event.xkey.window, mane.win,
! event.xkey.x, event.xkey.y, &home_x, &home_y,
! &number0); /* throw away last argument */
! home_x *= mane.shrinkfactor;
! home_y *= mane.shrinkfactor;
! continue;
! case '\020': /* Control P */
! Printf("Unit = %d, bitord = %d, byteord = %d\n",
! BitmapUnit(DISP), BitmapBitOrder(DISP),
! ImageByteOrder(DISP));
! continue;
! #else X10
! case 'M':
! home_x = (XKEY(event).x + mane.base_x) * mane.shrinkfactor;
! home_y = (XKEY(event).y + mane.base_y) * mane.shrinkfactor;
! continue;
! #endif X10
! case 's':
! if (!arg0) {
! long fac1, fac2;
! shrink_factor = 1;
! fac1 = ROUNDUP(PAPER_WIDTH, window_w);
! fac2 = ROUNDUP(PAPER_HEIGHT, window_h);
! if (fac1 < fac2)
! number0 = fac2;
! else
! number0 = fac1;
! }
! if (number0 <= 0) goto bad;
! if (number0 == mane.shrinkfactor) continue;
! shrink_factor = mane.shrinkfactor = number0;
! init_page();
! if (number0 != 1 && number0 != bak_shrink) {
! bak_shrink = number0;
! reset_fonts();
! }
! #ifdef TOOLKIT
! XUnmapWindow(DISP, mane.win);
! set_draw_args();
! XtSetValues(draw_widget, draw_args, 2);
! get_geom();
! home(False);
! XMapWindow(DISP, (Window) mane.win);
! continue;
! #else TOOLKIT
! reconfig();
! home(False);
! break;
! #endif TOOLKIT
! case 'S':
! if (!arg0) goto bad;
! if (number0 < 0) goto bad;
! if (number0 == density) continue;
! density = number0;
! reset_fonts();
! if (mane.shrinkfactor == 1) continue;
! break;
! case 'R':
! /* reread DVI file */
! --dvi_time; /* then it will notice a change */
! break;
! default:
! goto bad;
! }
! if (0 <= next_page && next_page < total_pages) {
! if (current_page != next_page) {
! current_page = next_page;
! spec_warn = True;
! if (!keep_flag) home(False);
! }
! canit = True;
! Flush();
! longjmp(canit_env, 1);
! }
! bad: XBell(DISP, 10);
}
}
--- 1492,1503 ----
number = 0;
continue;
}
number0 = number;
number = 0;
sign = 1;
! arg0 = arg;
! arg = False;
! keystroke(ch, number0, arg0, &event);
}
}
***************
*** 1469,1475 ****
(void) signal(SIGIO, handle_intr);
(void) fcntl(socket, F_SETOWN, getpid());
(void) fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) | FASYNC);
! #endif
}
static
--- 1602,1608 ----
(void) signal(SIGIO, handle_intr);
(void) fcntl(socket, F_SETOWN, getpid());
(void) fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) | FASYNC);
! #endif HAS_SIGIO
}
static
***************
*** 1487,1493 ****
redraw_page();
exit(0);
}
! else {
enable_intr();
(void) setjmp(canit_env);
for (;;) {
--- 1620,1626 ----
redraw_page();
exit(0);
}
! else { /* normal operation */
enable_intr();
(void) setjmp(canit_env);
for (;;) {
***************
*** 1524,1532 ****
[-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
[-cr <color>]\n\
[-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
! [-mgs[n] <size>] [-geometry <geometry>] [#<geometry>]\n\
! [-altfont <font>] [-thorough] [-copy] [-display <host:display>] \
! dvi_file\n", stderr);
#else X10
fputs("\
Usage: xdvi [+[<page>]] [-s <shrink>] [-S <density>] [-p <pixels>] [-l] [-rv]\n\
--- 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\
***************
*** 1533,1541 ****
[-fg <color>] [-bg <color>] [-hl <color>] [-bd <color>] \
[-cr <color>]\n\
[-margins <inches>] [-sidemargin <inches>] [-topmargin <inches>]\n\
! [-mgs[n] <size>] [-geometry <geometry> | =<geometry>]\n\
! [-altfont <font>] [-display <host:display> | host:display] dvi_file\n",
! stderr);
#endif X10
exit(1);
}
--- 1666,1674 ----
[-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);
}
***************
*** 1551,1556 ****
--- 1684,1690 ----
#endif X10
#ifdef TOOLKIT
+
static XrmOptionDescRec options[] = {
{"-d", ".debugLevel", XrmoptionSepArg, (caddr_t) NULL},
{"+", ".gotoPage", XrmoptionStickyArg, (caddr_t) NULL},
***************
*** 1560,1565 ****
--- 1694,1701 ----
{"-margins", ".margins", XrmoptionSepArg, (caddr_t) NULL},
{"-sidemargin", ".sideMargin", XrmoptionSepArg, (caddr_t) NULL},
{"-topmargin", ".topMargin", XrmoptionSepArg, (caddr_t) NULL},
+ {"-pagewidth", ".pageWidth", XrmoptionSepArg, (caddr_t) NULL},
+ {"-pageheight", ".pageHeight", XrmoptionSepArg, (caddr_t) NULL},
{"-altfont", ".altFont", XrmoptionSepArg, (caddr_t) NULL},
{"-l", ".listFonts", XrmoptionNoArg, (caddr_t) "on"},
{"+l", ".listFonts", XrmoptionNoArg, (caddr_t) "off"},
***************
*** 1599,1604 ****
--- 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),
***************
*** 1622,1628 ****
{"cursorColor", "CursorColor", XtRString, sizeof(char *),
(Cardinal)&curs_color, XtRString, NULL},
{"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
! (Cardinal)&icon_geometry, XtRString, (caddr_t) NULL},
{"copy", "Copy", XtRBoolean, sizeof(Boolean),
(Cardinal)©, XtRBoolean, (caddr_t) ©},
{"thorough", "Thorough", XtRBoolean, sizeof(Boolean),
--- 1762,1768 ----
{"cursorColor", "CursorColor", XtRString, sizeof(char *),
(Cardinal)&curs_color, XtRString, NULL},
{"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
! (Cardinal)&icon_geometry, XtRString, NULL},
{"copy", "Copy", XtRBoolean, sizeof(Boolean),
(Cardinal)©, XtRBoolean, (caddr_t) ©},
{"thorough", "Thorough", XtRBoolean, sizeof(Boolean),
***************
*** 1656,1661 ****
--- 1796,1802 ----
{XtNwidth, (XtArgVal) 0},
{XtNheight, (XtArgVal) 0},
{XtNiconPixmap, (XtArgVal) 0},
+ {XtNinput, (XtArgVal) True},
};
#else TOOLKIT
***************
*** 1714,1719 ****
--- 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},
***************
*** 1851,1856 ****
--- 1994,2000 ----
(strcmp(optstring, "on") == 0);
}
}
+
#endif TOOLKIT
/*
***************
*** 1861,1866 ****
--- 2005,2011 ----
int argc;
char **argv;
{
+
#ifndef TOOLKIT
#ifndef X10
XSizeHints size_hints;
***************
*** 1910,1924 ****
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 ((font_path = getenv(FONT_PATH)) == NULL)
! font_path = default_font_path;
! else if (*font_path == ':')
! /*concatenate default_font_path before font_path */
! font_path = strcat(strcpy(malloc((unsigned)
! strlen(default_font_path) + strlen(font_path) + 1),
! default_font_path), font_path);
!
open_dvi_file();
if (curr_page) {
current_page = (*curr_page ? atoi(curr_page) : total_pages) - 1;
--- 2055,2064 ----
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();
if (curr_page) {
current_page = (*curr_page ? atoi(curr_page) : total_pages) - 1;
***************
*** 1999,2019 ****
XGeometry(DISP, scr, icon_geometry, "", 0, 0, 0, 0, 0,
&temp_args1[0].value, &temp_args1[1].value, &junk, &junk);
! XtSetValues(top_level, temp_args1, 2);
}
/* Set default window size and icon */
XtGetValues(top_level, &temp_args2, 1); /* get border width */
screen_w = WidthOfScreen(SCRN) - 2*bwidth;
screen_h = HeightOfScreen(SCRN) - 2*bwidth;
temp_args3[0].value = (XtArgVal) (page_w<screen_w ? page_w : screen_w);
temp_args3[1].value = (XtArgVal) (page_h<screen_h ? page_h : screen_h);
temp_args3[2].value = (XtArgVal) (XCreateBitmapFromData(DISP,
RootWindowOfScreen(SCRN),
xdvi_bits, xdvi_width, xdvi_height));
! XtSetValues(top_level, temp_args3, 3);
vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
top_level, vport_args, XtNumber(vport_args));
clip_widget = XtNameToWidget(vport_widget, "clip");
set_draw_args();
draw_widget = XtCreateManagedWidget("drawing", widgetClass,
--- 2139,2195 ----
XGeometry(DISP, scr, icon_geometry, "", 0, 0, 0, 0, 0,
&temp_args1[0].value, &temp_args1[1].value, &junk, &junk);
! XtSetValues(top_level, temp_args1, XtNumber(temp_args1));
}
/* Set default window size and icon */
XtGetValues(top_level, &temp_args2, 1); /* get border width */
screen_w = WidthOfScreen(SCRN) - 2*bwidth;
screen_h = HeightOfScreen(SCRN) - 2*bwidth;
+ #ifdef BUTTONS
+ temp_args3[0].value = (XtArgVal) (page_w + 100 < screen_w ?
+ page_w + 100 : screen_w);
+ #else BUTTONS
temp_args3[0].value = (XtArgVal) (page_w<screen_w ? page_w : screen_w);
+ #endif BUTTONS
temp_args3[1].value = (XtArgVal) (page_h<screen_h ? page_h : screen_h);
temp_args3[2].value = (XtArgVal) (XCreateBitmapFromData(DISP,
RootWindowOfScreen(SCRN),
xdvi_bits, xdvi_width, xdvi_height));
! XtSetValues(top_level, temp_args3, XtNumber(temp_args3));
+ #ifdef BUTTONS
+ form_widget = XtCreateManagedWidget("form", formWidgetClass,
+ top_level, form_args, XtNumber(form_args));
+
+ vport_args[0].value = temp_args3[0].value - 79;
+ vport_args[1].value = temp_args3[1].value;
vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
+ form_widget, vport_args, XtNumber(vport_args));
+
+ line_args[0].value = (XtArgVal) high_color ? hl_Pixel : fore_Pixel;
+ line_args[2].value = temp_args3[1].value;
+ line_args[3].value = (XtArgVal) vport_widget;
+ strut_args[0].value = (XtArgVal) XtCreateManagedWidget("line",
+ widgetClass, form_widget, line_args, XtNumber(line_args));
+ (void) XtCreateManagedWidget("strut", widgetClass, form_widget,
+ strut_args, XtNumber(strut_args));
+
+ command_args[2].value = (XtArgVal) vport_widget;
+ {
+ int i;
+ for (i = 0; i < XtNumber(command_table); ++i) {
+ command_args[0].value = (XtArgVal) command_table[i].label;
+ command_args[1].value = (XtArgVal) command_table[i].y_pos;
+ command_call[0].closure = (caddr_t) command_table[i].closure;
+ command_wid[i] = XtCreateManagedWidget(command_table[i].name,
+ commandWidgetClass, form_widget,
+ command_args, XtNumber(command_args));
+ }
+ }
+ #else BUTTONS
+ vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
top_level, vport_args, XtNumber(vport_args));
+ #endif BUTTONS
clip_widget = XtNameToWidget(vport_widget, "clip");
set_draw_args();
draw_widget = XtCreateManagedWidget("drawing", widgetClass,
***************
*** 2036,2043 ****
XtAddEventHandler(draw_widget, ButtonReleaseMask, False, handle_release,
(caddr_t) NULL);
XtRealizeWidget(top_level);
- curr.win = mane.win = (void *) XtWindow(draw_widget);
#else TOOLKIT
/*
--- 2212,2220 ----
XtAddEventHandler(draw_widget, ButtonReleaseMask, False, handle_release,
(caddr_t) NULL);
XtRealizeWidget(top_level);
+ curr.win = mane.win = (caddr_t) XtWindow(draw_widget);
+
#else TOOLKIT
/*
***************
*** 2100,2106 ****
image->bitmap_bit_order = MSBFirst;
#endif MSBITFIRST
{
! short endian = (MSBFirst << 8) + LSBFirst;
image->byte_order = *((char *) &endian);
}
--- 2277,2283 ----
image->bitmap_bit_order = MSBFirst;
#endif MSBITFIRST
{
! short endian = MSBFirst << 8 | LSBFirst;
image->byte_order = *((char *) &endian);
}
diff -cr old/xdvi.h new/xdvi.h
*** old/xdvi.h Fri Nov 17 21:23:17 1989
--- new/xdvi.h Sat Nov 4 16:25:24 1989
***************
*** 96,103 ****
#define ZZ stack[stackp].z
#define ROUNDUP(x,y) (((x)+(y)-1)/(y))
! #define PAPER_WIDTH ROUNDUP(17*pixels_per_inch, shrink_factor*2)
! #define PAPER_HEIGHT ROUNDUP(11*pixels_per_inch, shrink_factor)
extern int current_page;
extern int total_pages;
--- 96,103 ----
#define ZZ stack[stackp].z
#define ROUNDUP(x,y) (((x)+(y)-1)/(y))
! #define PAPER_WIDTH ROUNDUP(unshrunk_page_w, shrink_factor)
! #define PAPER_HEIGHT ROUNDUP(unshrunk_page_h, shrink_factor)
extern int current_page;
extern int total_pages;
***************
*** 171,176 ****
--- 171,177 ----
struct font *next; /* link to next font info block */
int TeXnumber; /* font number (in DVI file) */
int scale; /* scaled size in SPELL units */
+ float factor; /* multiply char. widths by this */
char *fontname; /* PXL file name */
short size; /* dots per 5 inches */
FILE *file; /* open PXL file or NULL */
***************
*** 199,204 ****
--- 200,206 ----
extern Boolean list_fonts;
extern int pixels_per_inch;
+ extern int unshrunk_page_w, unshrunk_page_h;
extern int density;
extern char *dvi_name;
***************
*** 206,212 ****
extern char *prog;
extern struct WindowRec {
! void *win; /* type Window is not defined yet */
int shrinkfactor;
int base_x, base_y;
int width, height;
--- 208,214 ----
extern char *prog;
extern struct WindowRec {
! caddr_t win; /* type Window is not defined yet */
int shrinkfactor;
int base_x, base_y;
int width, height;
diff -cr old/xdvi.man.sed new/xdvi.man.sed
*** old/xdvi.man.sed Fri Nov 17 21:23:20 1989
--- new/xdvi.man.sed Sat Nov 4 16:25:32 1989
***************
*** 1,4 ****
--- 1,8 ----
+ #ifx11
.TH XDVI SIPB "8 May 1989" "X Version 11"
+ #ifx10
+ .TH XDVI SIPB "8 May 1989" "X Version 10"
+ #endif
.SH NAME
xdvi \- DVI Previewer for the X Window System
.SH SYNOPSIS
***************
*** 5,15 ****
.B xdvi
.nh
[+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP]
! [\-altfont \fIfont\fP] [\-l] [\-rv] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP]
! [\-hl \fIcolor\fP] [\-bd \fIcolor\fP] [\-cr \fIcolor\fP] [-thorough] [-copy]
[\-margins \fIinches\fP] [\-sidemargin \fIinches\fP] [\-topmargin \fIinches\fP]
! [\-mgs[\fIn\fP] \fIsize\fP] [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
! [%\fIgeometry\fP] [\-display \fIdisplay\fP] file
.hy
.SH DESCRIPTION
.I Xdvi
--- 9,27 ----
.B xdvi
.nh
[+[\fIpage\fP]] [\-s \fIshrink\fP] [\-S \fIdensity\fP] [\-p \fIpixels\fP]
! [\-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]
! #ifx10
! [\-geometry \fIgeometry\fP | =\fIgeometry\fP]
! [\-display \fIhost\fP:\fIdisplay\fP | \fIhost\fP:\fIdisplay\fP]
! #endif
! dvi_file
.hy
.SH DESCRIPTION
.I Xdvi
***************
*** 16,32 ****
is a program which runs under the X window system. It is used to preview
DVI files, such as are produced by TeX.
.PP
! This program has the capability of
! showing the file shrunken by various (integer) factors, and also has a
! ``magnifying glass'' which allows one to see a small part of the unshrunk
! image momentarily.
.PP
! Also, before displaying any page or part thereof, it checks to see if the dvi
file has changed since the last time it was displayed. If this is the case,
then \fIxdvi\fR will reinitialize itself for the new dvi file. For this reason,
exposing parts of the \fIxdvi\fR window while \fITeX\fR is running should be
avoided. This feature allows you to preview many versions
of the same file while running \fIxdvi\fR only once.
.SH OPTIONS
In addition to specifying the .\fPdvi\fR file (with or without the .\fPdvi\fR),
\fIXdvi\fR supports the following command line options.
--- 28,49 ----
is a program which runs under the X window system. It is used to preview
DVI files, such as are produced by TeX.
.PP
! This program has the capability of showing the file shrunken by various
! (integer) factors, and also has a ``magnifying glass'' which allows one
! to see a small part of the unshrunk image momentarily.
.PP
! Before displaying any page or part thereof, it checks to see if the dvi
file has changed since the last time it was displayed. If this is the case,
then \fIxdvi\fR will reinitialize itself for the new dvi file. For this reason,
exposing parts of the \fIxdvi\fR window while \fITeX\fR is running should be
avoided. This feature allows you to preview many versions
of the same file while running \fIxdvi\fR only once.
+ #ifbuttons
+ .PP
+ In addition to using keystrokes to move within the file, \fIxdvi\fR provides
+ buttons on the right side of the window, which are synonymous with various
+ sequences of keystrokes.
+ #endif
.SH OPTIONS
In addition to specifying the .\fPdvi\fR file (with or without the .\fPdvi\fR),
\fIXdvi\fR supports the following command line options.
***************
*** 34,42 ****
--- 51,65 ----
.RB ` + '
instead of a
.RB ` \- ',
+ #ifx11
the option is restored to its default value. By default, these options can
be set via the resource names given in parentheses in the description of
each option.
+ #ifx10
+ the option is restored to its default value. These options override those
+ set in the ``.Xdefaults'' file (via the resource names given in parentheses
+ in the description of each option).
+ #endif
.TP
.IB + page
Specifies the first page to show. If \fI+\fR is given without a
***************
*** 43,77 ****
number, the last page is assumed; the first page is the default.
.TP
.BI \-s " shrink"
! (.shrinkFactor)
Defines the initial shrink factor. The default value is 3.
.TP
.BI \-S " density"
! (.densityPercent)
Determines the density used when shrinking bitmaps for fonts.
A higher value produces a lighter font. The default value is 40.
.TP
.BI \-p " pixels"
! (.pixelsPerInch)
Defines the size of the fonts to use, in pixels per inch. The
default value is 300.
.TP
.BI \-altfont " font"
! (.altFont)
Declares a default font to use when the font in the dvi file cannot be found.
This is useful, for example, with PostScript <tm> fonts.
.TP
.B \-l
! (.listFonts)
Causes the names of the fonts used to be listed.
.TP
.B \-rv
! (.reverseVideo)
Causes the page to be displayed with white characters on a
black background, instead of vice versa.
.TP
.BI \-bw " width"
! (.borderWidth)
Specifies the width of the border of the window.
.TP
.BI \-borderwidth " width"
--- 66,100 ----
number, the last page is assumed; the first page is the default.
.TP
.BI \-s " shrink"
! (%%dot%%shrinkFactor)
Defines the initial shrink factor. The default value is 3.
.TP
.BI \-S " density"
! (%%dot%%densityPercent)
Determines the density used when shrinking bitmaps for fonts.
A higher value produces a lighter font. The default value is 40.
.TP
.BI \-p " pixels"
! (%%dot%%pixelsPerInch)
Defines the size of the fonts to use, in pixels per inch. The
default value is 300.
.TP
.BI \-altfont " font"
! (%%dot%%altFont)
Declares a default font to use when the font in the dvi file cannot be found.
This is useful, for example, with PostScript <tm> fonts.
.TP
.B \-l
! (%%dot%%listFonts)
Causes the names of the fonts used to be listed.
.TP
.B \-rv
! (%%dot%%reverseVideo)
Causes the page to be displayed with white characters on a
black background, instead of vice versa.
.TP
.BI \-bw " width"
! (%%dot%%borderWidth)
Specifies the width of the border of the window.
.TP
.BI \-borderwidth " width"
***************
*** 78,84 ****
Same as \fB-bw\fR, above.
.TP
.BI \-fg " color"
! (.foreground)
Determines the color of the text (foreground).
.TP
.BI \-foreground " color"
--- 101,107 ----
Same as \fB-bw\fR, above.
.TP
.BI \-fg " color"
! (%%dot%%foreground)
Determines the color of the text (foreground).
.TP
.BI \-foreground " color"
***************
*** 85,91 ****
Same as \fB-fg\fR, above.
.TP
.BI \-bg " color"
! (.background)
Determines the color of the background.
.TP
.BI \-background " color"
--- 108,114 ----
Same as \fB-fg\fR, above.
.TP
.BI \-bg " color"
! (%%dot%%background)
Determines the color of the background.
.TP
.BI \-background " color"
***************
*** 92,108 ****
Same as \fB-bg\fR, above.
.TP
.BI \-hl " color"
! (.highlight)
Determines the color of the page border.
.TP
.BI \-bd " color"
! (.borderColor)
Determines the color of the window border.
.TP
.BI \-cr " color"
! (.cursorColor)
Determines the color of the cursor. The default is the
foreground color.
.TP
.B \-thorough
(.thorough)
--- 115,132 ----
Same as \fB-bg\fR, above.
.TP
.BI \-hl " color"
! (%%dot%%highlight)
Determines the color of the page border.
.TP
.BI \-bd " color"
! (%%dot%%borderColor)
Determines the color of the window border.
.TP
.BI \-cr " color"
! (%%dot%%cursorColor)
Determines the color of the cursor. The default is the
foreground color.
+ #ifx11
.TP
.B \-thorough
(.thorough)
***************
*** 120,128 ****
Always use the \fIcopy\fR operation when writing characters to the display.
This option may be necessary for correct operation on a color display, but
overstrike characters will be incorrect.
.TP
.BI \-margins " inches"
! (.margins)
Specifies the size of both the top margin and side margin. This
can be a decimal number, \fIe.g.\fR, 1.5. It determines
the ``home'' position of the page within the window as follows. If the entire
--- 144,153 ----
Always use the \fIcopy\fR operation when writing characters to the display.
This option may be necessary for correct operation on a color display, but
overstrike characters will be incorrect.
+ #endif
.TP
.BI \-margins " inches"
! (%%dot%%margins)
Specifies the size of both the top margin and side margin. This
can be a decimal number, \fIe.g.\fR, 1.5. It determines
the ``home'' position of the page within the window as follows. If the entire
***************
*** 135,147 ****
the KEY\%STROKES section.
.TP
.BI \-sidemargin " inches"
! (.sideMargin)
Specifies the side margin (see above).
.TP
.BI \-topmargin " inches"
! (.topMargin)
Specifies the top and bottom margins (see above).
.TP
.BI "\-mgs[n]" " size"
(.magnifierSize[n])
Specifies the size of the window to be used for the ``magnifying glass''
--- 160,182 ----
the KEY\%STROKES section.
.TP
.BI \-sidemargin " inches"
! (%%dot%%sideMargin)
Specifies the side margin (see above).
.TP
.BI \-topmargin " inches"
! (%%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"
(.magnifierSize[n])
Specifies the size of the window to be used for the ``magnifying glass''
***************
*** 150,167 ****
.TP
.BI \-mgs " size"
Same as \fB-mgs1\fR, above.
.TP
! .BI = geometry
(*geometry)
Specifies the initial geometry of the window.
.TP
- .BI \-geometry " geometry"
- Same as above.
- .TP
.BI # geometry
! (.iconGeometry)
Specifies the initial position for the icon.
.TP
.BI \-display " host:display"
Specifies the host and screen to be used for displaying the dvi file.
This is normally obtained from the environment variable ``DISPLAY.''
--- 185,227 ----
.TP
.BI \-mgs " size"
Same as \fB-mgs1\fR, above.
+ #ifx10
+ .BI \-mgs " size"
+ (magnifierSize1)
+ Specifies the size of the window to be used for the ``magnifying glass''
+ for the left button. See the MOUSE ACTIONS section. Default is 200.
.TP
! .BI \-mgs1 " size"
! Same as \fB-mgs\fR, above.
! .TP
! .BI \-mgs2 " size"
! (magnifierSize2)
! Specifies the ``magnifying glass'' size for the middle
! button. Default is 350.
! .TP
! .BI \-mgs3 " size"
! (magnifierSize3)
! Specifies the ``magnifying glass'' size for the right
! button. Default is 600.
! #endif
! .TP
! #ifx11
! .BI \-geometry " geometry"
(*geometry)
Specifies the initial geometry of the window.
.TP
.BI # geometry
! (%%dot%%iconGeometry)
Specifies the initial position for the icon.
+ #ifx10
+ .BI = geometry
+ (geometry)
+ Specifies the initial geometry of the window.
.TP
+ .BI \-geometry " geometry"
+ Same as above.
+ #endif
+ .TP
.BI \-display " host:display"
Specifies the host and screen to be used for displaying the dvi file.
This is normally obtained from the environment variable ``DISPLAY.''
***************
*** 254,260 ****
Uses the environment variable ``DISPLAY'' to specify which bit map display
terminal to use.
.PP
! The environment variable ``%%FONT_PATH%%'' determines the path(s) searched for
fonts in the following manner. The string consists of one or more strings
separated by colons. In each such string, the substring ``%f'' is
changed to the font name; ``%d'' is changed to the magnification; and
--- 314,320 ----
Uses the environment variable ``DISPLAY'' to specify which bit map display
terminal to use.
.PP
! The environment variable ``XDVIFONTS'' determines the path(s) searched for
fonts in the following manner. The string consists of one or more strings
separated by colons. In each such string, the substring ``%f'' is
changed to the font name; ``%d'' is changed to the magnification; and
***************
*** 263,270 ****
the end. For example, if the string is ``/usr/local/tex/fonts'' and the font is
cmr10 at 300dpi, then it searches for /usr/local/tex/fonts/cmr10.300gf,
/usr/local/tex/fonts/cmr10.300pk, and /usr/local/tex/fonts/cmr10.1500pxl,
! in that order. If the first character of the ``%%FONT_PATH%%'' variable
! is a colon, then the system default paths are tried first.
.SH FILES
.br
%%DEFAULT_FONT_PATH%% Font pixel files.
--- 323,342 ----
the end. For example, if the string is ``/usr/local/tex/fonts'' and the font is
cmr10 at 300dpi, then it searches for /usr/local/tex/fonts/cmr10.300gf,
/usr/local/tex/fonts/cmr10.300pk, and /usr/local/tex/fonts/cmr10.1500pxl,
! in that order. If the first character of the ``XDVIFONTS'' variable
! is a colon, then the system default paths are tried first. If the font is not
! found in the desired size, then \fIxdvi\fR will try to find the nearest size.
! If the font cannot be found at all, then \fIxdvi\fR will try to vary the point
! size of the font (within a certain range), and if this fails, then it will
! use the font specified as the alternate font (cf. \fB-altfont\fR).
! .PP
! The ``XDVISIZES'' variable must be set to indicate which sizes of fonts are
! available. It should consists of a list of numbers separated by colons. If
! the list begins with a colon, the system default sizes are used, as well.
! Sizes are expressed in dots per inch; decimals may be used for ``pxl'' files:
! for example, a 300 dots per inch file magnified by half a step comes out to
! 1643 dots per five inches, which should be encoded as 328.6. The current
! default set of sizes is %%DEFAULT_FONT_SIZES%%.
.SH FILES
.br
%%DEFAULT_FONT_PATH%% Font pixel files.
More information about the Comp.sources.x
mailing list