wdvi

network DVI viewer
Log | Files | Refs

commit f7fcbd7712bce60888a3ca1a5f121aa40e744769
parent 0f51246d655a98b110de3b8d6970dae12c63ddee
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Fri, 10 Sep 2021 19:37:07 +0000

remove more command line arguments

- will will always prescan
- freetype is always enabled
- no support for margin changing
- no support for offsets
- simplify usage() printing by using hard coded list
- update manual to reflect reality
- plus some other small cleanups

Diffstat:
Mdvi-init.c | 9---------
Mevents.c | 55+++++--------------------------------------------------
Mfont-open.c | 17++++++++---------
Mft.c | 7-------
Mpopups.c | 4++--
Mspecial.c | 6+-----
Mwdvi.1 | 604++++++++++++++++---------------------------------------------------------------
Mxdvi.c | 184++++++++++++-------------------------------------------------------------------
Mxdvi.h | 12------------
9 files changed, 159 insertions(+), 739 deletions(-)

diff --git a/dvi-init.c b/dvi-init.c @@ -676,15 +676,6 @@ prepare_pages() Fseek(dvi_file, (long) (1+4+(9*4)), 1); Fseek(dvi_file, page_info[--i].offset = four(dvi_file), 0); } - - /* If not prescanning, initialize page sizes. */ - if (!resource.prescan) - for (i = 0; i < total_pages; ++i) { - page_info[i].pw = unshrunk_paper_w; - page_info[i].ph = unshrunk_paper_h; - page_info[i].ww = dvi_unshrunk_page_w; - page_info[i].wh = dvi_unshrunk_page_h; - } } void diff --git a/events.c b/events.c @@ -32,14 +32,13 @@ NOTE: #include <ctype.h> #include <errno.h> #include <limits.h> /* abs() */ +#include <math.h> /* pow() */ #include <signal.h> #include <stdlib.h> /* free(), atoi(), atof(), exit(), abs() */ -/* Xlib and Xutil are already included */ #include <X11/Xatom.h> #include <X11/StringDefs.h> -#include <X11/Shell.h> /* needed for def. of XtNiconX */ -#include <X11/cursorfont.h> +#include <X11/Shell.h> /* XtNiconX */ #include <X11/IntrinsicI.h> /* _XtComputeLateBindings */ #include <X11/Xaw/Viewport.h> #include <X11/XKBlib.h> @@ -127,13 +126,11 @@ static ACTION_DECL(Act_up); static ACTION_DECL(Act_down); static ACTION_DECL(Act_up_or_previous); static ACTION_DECL(Act_down_or_next); -static ACTION_DECL(Act_set_margins); static ACTION_DECL(Act_show_display_attributes); static ACTION_DECL(Act_set_shrink_factor); static ACTION_DECL(Act_shrink_to_dpi); static ACTION_DECL(Act_set_density); static ACTION_DECL(Act_set_color); -static ACTION_DECL(Act_reread_dvi_file); static ACTION_DECL(Act_discard_number); static ACTION_DECL(Act_magnifier); @@ -163,14 +160,12 @@ XtActionsRec Actions[] = { {"down", Act_down}, {"up-or-previous", Act_up_or_previous}, {"down-or-next", Act_down_or_next}, - {"set-margins", Act_set_margins}, {"show-display-attributes", Act_show_display_attributes}, {"set-shrink-factor", Act_set_shrink_factor}, {"shrink-to-dpi", Act_shrink_to_dpi}, {"set-density", Act_set_density}, {"print", Act_print}, {"set-color", Act_set_color}, - {"reread-dvi-file", Act_reread_dvi_file}, {"discard-number", Act_discard_number}, {"magnifier", Act_magnifier}, {"drag", Act_drag}, @@ -307,8 +302,6 @@ static void can_exposures(); #define gamma resource._gamma -extern double pow(); - static void mask_shifts(mask, pshift1, pshift2) Pixel mask; @@ -650,20 +643,12 @@ home(Boolean scrl) if (!scrl) XUnmapWindow(DISP, mane.win); get_xy(); if (x_bar != NULL) { - int coord = (page_w - clip_w) / 2; - - if (coord > home_x / mane.shrinkfactor) - coord = home_x / mane.shrinkfactor; XtCallCallbacks(x_bar, XtNscrollProc, - (XtPointer) (ptrdiff_t) (window_x + coord)); + (XtPointer) (ptrdiff_t) window_x); } if (y_bar != NULL) { - int coord = (page_h - clip_h) / 2; - - if (coord > home_y / mane.shrinkfactor) - coord = home_y / mane.shrinkfactor; XtCallCallbacks(y_bar, XtNscrollProc, - (XtPointer) (ptrdiff_t) (window_y + coord)); + (XtPointer) (ptrdiff_t) window_y); } if (!scrl) { XMapWindow(DISP, mane.win); @@ -682,12 +667,8 @@ home_bottom(Boolean scrl) XUnmapWindow(DISP, mane.win); get_xy(); if (x_bar != NULL) { - int coord = (page_w - clip_w) / 2; - - if (coord > home_x / mane.shrinkfactor) - coord = home_x / mane.shrinkfactor; XtCallCallbacks(x_bar, XtNscrollProc, - (XtPointer) (ptrdiff_t) (window_x + coord)); + (XtPointer) (ptrdiff_t) (window_x)); } if (y_bar != NULL) XtCallCallbacks(y_bar, XtNscrollProc, @@ -1113,19 +1094,6 @@ ACTION(Act_up_or_previous) } static -ACTION(Act_set_margins) -{ - Window ww; - - - (void) XTranslateCoordinates(DISP, event->xkey.window, mane.win, - event->xkey.x, event->xkey.y, &home_x, &home_y, - &ww); /* throw away last argument */ - home_x *= mane.shrinkfactor; - home_y *= mane.shrinkfactor; -} - -static ACTION(Act_show_display_attributes) { Printf("Unit = %d, bitord = %d, byteord = %d\n", @@ -1257,19 +1225,6 @@ ACTION(Act_set_color) } - - -static -ACTION(Act_reread_dvi_file) -{ - if (dvi_file != NULL) { - Fclose(dvi_file); - dvi_file = NULL; - dvi_file_ready = False; - } - ev_flags |= EV_NEWDOC; -} - static ACTION(Act_discard_number) { diff --git a/font-open.c b/font-open.c @@ -1605,21 +1605,20 @@ pre_font_open(struct font *fontp, const char *fontname, double fdpi, * First look for a scalable font. */ - if (resource.freetype) { - struct avl_t1 *t1p = lookup_t1_font(fontp); + struct avl_t1 *t1p = lookup_t1_font(fontp); - if (t1p != NULL) { /* if font found */ + if (t1p != NULL) { /* if font found */ if (debug & DBG_OPEN) - Printf("lookup_t1_font(%s) --> found %s\n", fontp->fontname, - t1p->fontfile != NULL ? t1p->fontfile : t1p->psname); + printf("lookup_t1_font(%s) --> found %s\n", + fontp->fontname, t1p->fontfile != NULL ? + t1p->fontfile : t1p->psname); return True; - } - - if (debug & DBG_OPEN) - Printf("lookup_t1_font(%s) --> not found\n", fontp->fontname); } + if (debug & DBG_OPEN) + printf("lookup_t1_font(%s) --> not found\n", fontp->fontname); + /* * Loop over sizes. Try actual size first, then closest sizes. * If the pathname is absolutely or explicitly relative, don't diff --git a/ft.c b/ft.c @@ -291,12 +291,6 @@ load_ft_font(fontp) t1p = ftp->t1; fontp2 = ftp->first_size; - if (!resource.freetype) { - if (debug & DBG_OPEN) - Puts("load_ft_font returning: freetype has been turned off"); - return False; - } - if (t1p->bad) { if (debug & DBG_OPEN) Printf("Font %s was flagged as bad; skipping (size %d)\n", @@ -325,7 +319,6 @@ load_ft_font(fontp) if (err != 0) { Fprintf(stderr, "Could not initialize FreeType library: FreeType FT_Init_FreeType error = %d.\nTurning off use of FreeType.\nPlease see the FreeType documentation for details about this.\n", err); - resource.freetype = False; free((char *) path); Fclose(f); ++n_files_left; diff --git a/popups.c b/popups.c @@ -1208,7 +1208,7 @@ print_do_it() /* Compute length of dvips command line */ /* dvips [-Pps] -f [-o!command] [-p=n -lm] [xargs] */ argc = 3; - len = strlen(resource.dvips_path) + 4; + len = strlen("dvips") + 4; /* "dvips -f\0" */ if (prn != NULL) argc = 4, len += strlen(prn) + 3; if (pr_save_fileradio == &r1radio1) ++argc, len += strlen(dest) + 4; @@ -1233,7 +1233,7 @@ print_do_it() argv = xmalloc(argc * sizeof(char *)); p = argv[0] = xmalloc(len + 1); argnext = argv + 1; - p += strlen(strcpy(p, resource.dvips_path)); + p += strlen(strcpy(p, "dvips")); *p++ = ' '; *argnext++ = p; diff --git a/special.c b/special.c @@ -547,11 +547,7 @@ draw_bbox() void init_prescan() { - - scanned_page = - scanned_page_color = - scanned_page_reset = resource.prescan ? -1 : total_pages + 1; - + scanned_page = scanned_page_color = scanned_page_reset = -1; if (!use_color) scanned_page_color = total_pages + 1; diff --git a/wdvi.1 b/wdvi.1 @@ -25,83 +25,66 @@ .de SB \&\fB\s-1\&\\$1 \\$2\s0\fR .. -.TH XDVI 1 "18 April 2013" "X Version 11" +.TH WDVI 1 "9 September 2021" "X Version 11" .SH NAME -xdvi \- DVI Previewer for the X Window System +wdvi \- network DVI viewer for the X Window System .SH SYNOPSIS -.B xdvi +.B wdvi .nh -[\fB+\fP[\fIpage\fP]] [\fB\-s\fP \fIshrink\fP] [\fB\-S\fP \fIdensity\fP] +[\fB\-s\fP \fIshrink\fP] +[\fB\-S\fP \fIdensity\fP] [\fB\-nocolor\fP] -[\fB\-nogrey\fP] [\fB\-gamma\fP \fIg\fP] [\fB\-install\fP] [\fB\-noinstall\fP] +[\fB\-gamma\fP \fIg\fP] [\fB\-p\fP \fIpixels\fP] -[\fB\-margins\fP \fIdimen\fP] -[\fB\-sidemargin\fP \fIdimen\fP] [\fB\-topmargin\fP \fIdimen\fP] -[\fB\-offsets\fP \fIdimen\fP] -[\fB\-xoffset\fP \fIdimen\fP] [\fB\-yoffset\fP \fIdimen\fP] -[\fB\-paper\fP \fIpapertype\fP] [\fB\-altfont\fP \fIfont\fP] +[\fB\-paper\fP \fIpapertype\fP] +[\fB\-altfont\fP \fIfont\fP] [\fB\-mfmode\fP \fImode-def\fP[\fB:\fP\fIdpi\fP]] -[\fB\-nofreetypefonts\fP] -[\fB\-editor\fP \fIeditor\fP] -[\fB\-sourceposition\fP \fIline\fP[\fB:\fP\fIcol\fP][\ ]\fIfilename\fP] -[\fB\-nofork\fP] [\fB\-l\fP] [\fB\-rv\fP] -[\fB\-mgs\fP[\fIn\fP] \fIsize\fP] [\fB\-warnspecials\fP] +[\fB\-mgs\fP[\fIn\fP] \fIsize\fP] +[\fB\-warnspecials\fP] [\fB\-hush\fP] -[\fB\-hushchars\fP] [\fB\-hushchecksums\fP] -[\fB\-safer\fP] -[\fB\-fg\fP \fIcolor\fP] [\fB\-bg\fP \fIcolor\fP] [\fB\-hl\fP \fIcolor\fP] -[\fB\-bd\fP \fIcolor\fP] [\fB\-cr\fP \fIcolor\fP] +[\fB\-hushchars\fP] +[\fB\-hushchecksums\fP] +[\fB\-fg\fP \fIcolor\fP] +[\fB\-bg\fP \fIcolor\fP] +[\fB\-hl\fP \fIcolor\fP] +[\fB\-bd\fP \fIcolor\fP] [\fB\-bw\fP \fIwidth\fP] -[\fB\-display\fP \fIhost:display\fP] [\fB\-geometry\fP \fIgeometry\fP] +[\fB\-display\fP \fIhost:display\fP] +[\fB\-geometry\fP \fIgeometry\fP] [\fB\-icongeometry\fP \fIgeometry\fP] [\fB\-iconic\fP] -[\fB\-keep\fP] [\fB\-copy\fP] [\fB\-thorough\fP] +[\fB\-keep\fP] +[\fB\-copy\fP] +[\fB\-thorough\fP] [\fB\-wheelunit\fP \fIpixels\fP] -[\fB\-noscan\fP] -[\fB\-dvipspath\fP \fIpath\fP] -[\fB\-debug\fP \fIbitmask\fP] [\fB\-version\fP] -.I dvi_file +[\fB\-debug\fP \fIbitmask\fP] +[\fB\-version\fP] +.I url .hy .SH DESCRIPTION -.B xdvi -is a program which runs under the X window system. It is used to preview +.B wdvi +is a program which runs under the X window system. It is used to view .I dvi files, such as are produced by .BR tex (1). +It fetches these +.I dvi +files over the network using the hypertext transfer protocol secure (HTTPS). .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 -.I dvi -file has changed since the last time it was displayed. If this is the case, -then -.B xdvi -will reinitialize itself for the new -.I dvi -file. For this reason, exposing parts of the -.B xdvi -window while \*(Te\& is running should be avoided. This feature allows you -to preview many versions of the same file while running -.B xdvi -only once. -.PP If -.B xdvi +.B wdvi is run without the -.I dvi-file -argument, then it pops up a window asking for a -.I dvi -file. +.I url +argument, then it opens a default document and waits for user input. .SH OPTIONS -In addition to specifying the -.I dvi -file (with or without the -.B .dvi -extension), -.B xdvi +In addition to specifying a +.I url +.B wdvi supports the following command line options. If the option begins with a .RB ` + ' instead of a @@ -110,12 +93,6 @@ 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. .TP -.BI + page -Specifies the first page to show. If -.B + -is given without a number, the last page is assumed; the first page is -the default. -.TP .BI \-altfont " font" .RB ( .altFont ) Declares a default font to use when the font in the @@ -162,17 +139,12 @@ out incorrectly. See also .BR \-thorough . .TP -.BI \-cr " color" -.RB ( .cursorColor ) -Determines the color of the cursor. The default is the color of the page -border. -.TP .BI \-debug " bitmask" .RB ( .debugLevel ) If nonzero, prints additional debugging information on standard output. The bitmask should be given as a decimal number. The values of the bits are defined in the source file -.BR xdvi.h . +.BR wdvi.h . .TP .BI \-density " density" .RB ( .densityPercent ) @@ -193,22 +165,6 @@ Specifies the host and screen to be used for displaying the file. By default this is obtained from the environment variable .SB DISPLAY. .TP -.BI \-dvipspath " path" -.RB ( .dvipsPath ) -Use -.I path -as the -.B dvips -program to use when printing. By default it uses -.BR dvips . -.TP -.BI \-editor " editor" -.RB ( .editor ) -Specifies the editor to be invoked for reading the source file corresponding to -the -.I dvi -file. For details on how to do this, see the section on SOURCE SPECIALS. -.TP .BI \-fg " color" .RB ( .foreground ) Determines the color of the text (foreground). @@ -243,20 +199,20 @@ Determines the color of the page border. The default is the foreground color. .B \-hush .RB ( .Hush ) Causes -.B xdvi +.B wdvi to suppress all suppressible warnings. .TP .B \-hushchars .RB ( .hushLostChars ) Causes -.B xdvi +.B wdvi to suppress warnings about references to characters which are not defined in the font. .TP .B \-hushchecksums .RB ( .hushChecksums ) Causes -.B xdvi +.B wdvi to suppress warnings about checksum mismatches between the .I dvi file and the font file. @@ -268,43 +224,14 @@ Specifies the initial position for the icon. .B \-iconic .RB ( .iconic ) Causes the -.B xdvi +.B wdvi window to start in the iconic state. The default is to start with the window open. .TP -.B \-install -.RB ( .install ) -If -.B xdvi -is running under a -.B PseudoColor -visual, then (by default) it will check for -.B TrueColor -visuals with more bits per pixel, and switch to such a visual if one exists. -If no such visual exists, it will use the current visual and colormap. If -.B \-install -is selected, however, it will still use a -.B TrueColor -visual with a greater depth, if one is available; otherwise, it will -install its own colormap on the current visual. If the current visual is not -.BR PseudoColor , -then -.B xdvi -will not switch the visual or colormap, regardless of its options. -The default value of the -.B install -resource is the special value, -.BR maybe . -There is no -.B +install -option. See also -.BR \-noinstall , -and the GREYSCALING AND COLORMAPS section. -.TP .B \-keep .RB ( .keepPosition ) Sets a flag to indicate that -.B xdvi +.B wdvi should not move to the home position when moving to a new page. See also the .RB ` k ' keystroke. @@ -313,36 +240,6 @@ keystroke. .RB ( .listFonts ) Causes the names of the fonts used to be listed. .TP -.BI \-margins " dimen" -.RB ( .Margin ) -Specifies the size of both the top margin and side margin. -This determines the ``home'' position of the page within the window as -follows. If the entire page fits in the window, then the margin settings -are ignored. If, even after removing the margins from the left, right, -top, and bottom, the page 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. -The dimension should be a decimal number optionally followed by -any of the two-letter abbreviations for units accepted by \*(Te\& -.RB ( pt , -.BR pc , -.BR in , -.BR bp , -.BR cm , -.BR mm , -.BR dd , -.BR cc , -or -.BR sp ). -By default, the unit will be -.BR @DEFAULT_UNIT@. -See also -.BR \-sidemargin ", " \-topmargin , -and the keystroke -.RB ` M .' -.TP .BI \-mfmode " mode-def\fR[\fP\fB:\fPdpi\fR]\fP" .RB ( .mfMode ) Specifies a @@ -390,126 +287,6 @@ corresponds to to .BR color:on .) .TP -.B \-nofork -.RB ( .fork ) -When the -.B \-sourceposition -argument is used and there is no appropriate instance of -.B xdvi -already running, then the default behavior is for -.B xdvi -to run itself in the background (as if it were a daemon). This argument -makes it run in the foreground instead. This is useful for debugging, -or if -.B xdvi -is run from a broken set of -.B emacs -macros. If no -.B \-sourceposition -argument is given, then this option has no effect. -(For this option, the logic of the corresponding resource is reversed: -.B \-nofork -corresponds to -.BR fork:off ; -.B +nofork -to -.BR fork:on .) -.TP -.B \-nofreetypefonts -.RB ( .freetypeFonts ) -This will disable the use of the FreeType library to display PostScript<tm> -Type 1 fonts. Use this option as a workaround when you encounter problems -with the display of Type 1 fonts (but please don't forget to send a bug report -in this case, to the URL mentioned in the section AUTHORS below). -.br -(Note: -.B \-nofreetypefonts -corresponds to -.BR freetypeFonts:off ; -.B +nofreetypefonts -to -.BR freetypeFonts:on .) -.TP -.B \-nogrey -.RB ( .grey ) -Turns off the use of greyscale anti-aliasing when printing shrunken bitmaps. -(For this option, the logic of the corresponding resource is reversed: -.B \-nogrey -corresponds to -.BR grey:off ; -.B +nogrey -to -.BR grey:on .) -See also the -.RB ` G ' -keystroke. -.TP -.B \-noinstall -.RB ( .install ) -Inhibit the default behavior of switching to a -.B TrueColor -visual if one is available with more bits per pixel than the current visual. -This option corresponds to a resource of -.BR install:off . -There is no -.B +noinstall -option. See also -.BR \-install , -and the GREYSCALING AND COLORMAPS section. -.TP -.B \-noscan -.RB ( .prescan ) -By default, -.B xdvi -does a preliminary scan of the -.I dvi -file, in order to process any -.B papersize -specials; this is especially important at startup since the paper size may be -needed to determine the window size. -In addition, prescanning is needed to correctly determine the background color -of a page. -This option turns off such prescanning. -(Prescanning will be automatically be turned back on if -.B xdvi -detects any of the specials mentioned above.) (For the -.B \-noscan -option, the logic of the corresponding resource is reversed: -.B \-noscan -corresponds to -.BR prescan:off ; -.B +noscan -to -.BR prescan:on .) -.TP -.BI \-offsets " dimen" -.RB ( .Offset ) -Specifies the size of both the horizontal and vertical offsets of the -output on the page. By decree of the Stanford \*(Te\& Project, -the default \*(Te\& page origin is always 1 inch over and down from -the top-left page corner, even when non-American paper sizes are used. -Therefore, the default offsets are 1.0 inch. -The argument -.I dimen -should be a decimal number optionally followed by any of the two-letter -abbreviations for units accepted by \*(Te\& -.RB ( pt , -.BR pc , -.BR in , -.BR bp , -.BR cm , -.BR mm , -.BR dd , -.BR cc , -or -.BR sp ). -By default, the unit will be -.BR @DEFAULT_UNIT@. -See also -.B \-xoffset -and -.BR \-yoffset . -.TP .BI \-p " pixels" .RB ( .pixelsPerInch ) Defines the size of the fonts to use, in pixels per inch. The @@ -540,7 +317,7 @@ by \*(Te\& or .BR sp ). By default, the unit will be -.BR @DEFAULT_UNIT@. +.BR in " (inches)". There are also synonyms which may be used: .B letter (8.5x11in), @@ -563,7 +340,7 @@ etc. Any of the above sizes may be preceded by a plus sign .RB (` + '); this causes the paper size given here to override any paper size given in the .I dvi -file. The default paper size is @DEFAULT_PAGE_SIZE@. +file. The default paper size is 8.5 x 11 inches. .TP .B \-rv .RB ( .reverseVideo ) @@ -584,52 +361,9 @@ Same as .BR \-density , .I q.v. .TP -.B \-safer -.RB ( .safer ) -This option turns on all available security options; it is designed for use when -.B xdvi -is called by a browser that obtains a -.I dvi -or \*(Te\& file from another site. -.TP -.BI \-sidemargin " dimen" -.RB ( .sideMargin ) -Specifies the side margin (see -.BR \-margins ). -.TP -.BI \-sourceposition " line\fR[\fP\fB:\fPcol\fR][ ]\fPfilename" -.RB ( .sourcePosition ) -This option makes -.B xdvi -search in the -.I dvi -file for the place corresponding to the indicated line (and, optionally, -column) in the .tex source file, and highlight the place found by drawing a -rectangle in the -.I highlight -color (see the -.B \-hl -option) around the corresponding text. In addition, when run with this -argument (and the -.B \-nofork -option is not given; q.v.), -.B xdvi -will always return immediately: if it finds another instance of -.B xdvi -already showing -.I dvi_file, -then it will cause that instance to raise its window and move to the given -place in the -.I dvi -file; otherwise it will start up its own instance in the background. -This option requires that -.I dvi_file -be prepared with source special information. See the section on SOURCE SPECIALS -for more details. -.TP .B \-thorough .RB ( .thorough ) -.B xdvi +.B wdvi will usually try to ensure that overstrike characters .RI ( e.g. , .BR \enotin ) @@ -641,7 +375,7 @@ or On color displays, however, this may take two operations, one to set the appropriate bits and one to clear other bits. If this is the case, then by default -.B xdvi +.B wdvi will instead use the .I copy operation, which does not handle overstriking correctly. The @@ -649,19 +383,14 @@ operation, which does not handle overstriking correctly. The option chooses the slower but more correct choice. See also .BR \-copy . .TP -.BI \-topmargin " dimen" -.RB ( .topMargin ) -Specifies the top and bottom margins (see -.BR \-margins ). -.TP .BI \-version Print information on the version of -.BR xdvi . +.BR wdvi . .TP .B \-warnspecials .RB ( .warnSpecials ) Causes -.B xdvi +.B wdvi to issue warnings about .B \especial strings that it cannot process. @@ -671,18 +400,8 @@ strings that it cannot process. Sets the number of pixels that a motion of a wheel mouse will move the image up, down, left, or right. If set to zero, the wheel mouse functionality is (essentially) disabled. The default value is 80. -.TP -.BI \-xoffset " dimen" -.RB ( .xOffset ) -Specifies the size of the horizontal offset of the output on the page. See -.BR \-offsets . -.TP -.BI \-yoffset " dimen" -.RB ( .yOffset ) -Specifies the size of the vertical offset of the output on the page. See -.BR -offsets . .SH KEYSTROKES -.B xdvi +.B wdvi recognizes the following keystrokes when typed in its window. Each may optionally be preceded by a (positive or negative) number, whose interpretation will depend on the particular keystroke. @@ -698,24 +417,29 @@ and keys, respectively. .TP .B q -#tool.RB [ quit() ] +.RB [ quit() ] Quits the program. Control-C and control-D will do this, too. .TP .B n -#tool.RB [ forward-page() ] +.RB [ forward-page() ] Moves to the next page (or to the .IR n th next page if a number is given). Synonyms are .RB ` f ', -Return, and Line Feed. +and Line Feed. .TP .I Space -#tool.RB [ down-or-next() ] +.RB [ down-or-next() ] Moves down two-thirds of a window-full, or to the next page if already at the bottom of the page. .TP +.I Return +.RB [ addr-go() ] +Fetches the current document in the address bar. If an error occurs, the +current document will not be replaced. +.TP .B p -#tool.RB [ back-page() ] +.RB [ back-page() ] Moves to the previous page (or back .I n pages). Synonyms are @@ -723,19 +447,19 @@ pages). Synonyms are and control-H. .TP .I Delete -#tool.RB [ up-or-previous() ] +.RB [ up-or-previous() ] Moves up two-thirds of a window-full, or to the bottom of the previous page if already at the top of the page. The BackSpace key will also do this. .TP .B g -#tool.RB [ goto-page() ] +.RB [ goto-page() ] Moves to the page with the given number. Initially, the first page is assumed to be page number 1, but this can be changed with the .RB ` P ' keystroke, below. If no page number is given, then it goes to the last page. .TP .B P -#tool.RB [ declare-page-number() ] +.RB [ declare-page-number() ] ``This is page number .IR n .'' This can be used to make the @@ -743,50 +467,41 @@ This can be used to make the keystroke refer to actual page numbers instead of absolute page numbers. .TP .IB Control\- L -#tool.RB [ forward-page(0) ] +.RB [ forward-page(0) ] Redisplays the current page. .TP .B ^ -#tool.RB [ home() ] +.RB [ home() ] Move to the ``home'' position of the page. This is normally the upper left-hand corner of the page, depending on the margins as described in the .B \-margins option, above. .TP .B u -#tool.RB [ up() ] +.RB [ up() ] Moves up two thirds of a window-full. .TP .B d -#tool.RB [ down() ] +.RB [ down() ] Moves down two thirds of a window-full. .TP .B l -#tool.RB [ left() ] +.RB [ left() ] Moves left two thirds of a window-full. .TP .B r -#tool.RB [ right() ] +.RB [ right() ] Moves right two thirds of a window-full. .TP .B c -#tool.RB [ center() ] +.RB [ center() ] Moves the page so that the point currently beneath the cursor is moved to the middle of the window. It also (gasp!) warps the cursor to the same place. .TP -.B M -#tool.RB [ set-margins() ] -Sets the margins so that the point currently under the cursor is the upper -left-hand corner of the text in the page. Note that this command itself does -not move the image at all. For details on how the margins are used, see -the -.B \-margins -option. -.TP .IB Control\- P .RB [ print() ] Pop up a window to allow -.B xdvi +.B wdvi to print the .I dvi file or a range of pages from it. The popup window is mostly self-explanatory, @@ -809,32 +524,23 @@ select and deselect, respectively, the option of keeping the window open after finishes. .TP .B s -#tool.RB [ set-shrink-factor() ] +.RB [ set-shrink-factor() ] Changes the shrink factor to the given number. If no number is given, the smallest factor that makes the entire page fit in the window will be used. (Margins are ignored in this computation.) .TP .B S -#tool.RB [ set-density() ] +.RB [ set-density() ] Sets the density factor to be used when shrinking bitmaps. This should be a number between 0 and 100; higher numbers produce lighter characters. If greyscaling mode is in effect, this changes the value of gamma instead. The new value of gamma is the given number divided by 100; negative values are allowed. .TP -.B R -#tool.RB [ reread-dvi-file() ] -Forces the -.I dvi -file to be reread. This allows you to preview many versions of the same -file while running -.B xdvi -only once. -.TP .B k -#tool.RB [ set-keep-flag() ] +.RB [ set-keep-flag() ] Normally when -.B xdvi +.B wdvi switches pages, it moves to the home position as well. The .RB ` k ' keystroke toggles a `keep-position' flag which, when set, will keep @@ -846,19 +552,8 @@ clear and set this flag, respectively. See also the .B \-keep option. .TP -.B G -#tool.RB [ set-greyscaling() ] -This key toggles the use of greyscale anti-aliasing for displaying shrunken -bitmaps. In addition, the key sequences -.RB ` 0G ' -and -.RB ` 1G ' -clear and set this flag, respectively. See also the -.B \-nogrey -option. -.TP .B C -#tool.RB [ set-color() ] +.RB [ set-color() ] This key toggles the use of color specials. The key sequences .RB ` 0C ' and @@ -929,7 +624,7 @@ if customization is used. This action takes one (required) argument. It sets the shrink factor to an integer so as to approximate the use of fonts with the corresponding number of dots per inch. If -.B xdvi +.B wdvi is using fonts scaled for .I p dots per inch, and the argument to @@ -1009,12 +704,12 @@ XDvi.mainTranslations: #override \\ .RE .PP Because -.B xdvi +.B wdvi needs to capture pointer motion events, and because the X Toolkit translations mechanism cannot accommodate both motion events and double-click events at the same time, it is not possible to specify double-click actions in -.B xdvi +.B wdvi customizations. For information on this and other aspects of translations, see the X Toolkit Intrinsics documentation. .PP @@ -1055,7 +750,7 @@ types of or .BR Btn7Down . Because of this, -.B xdvi +.B wdvi implements its own parser for translations given in .BR wheelTranslations . This parser is more limited than the parser built in to the X Toolkit. @@ -1102,7 +797,7 @@ command-line option provided by the X toolkit. For example, .nf .ft 3 .sp 1n -xdvi \-xrm 'XDvi.mainTranslations: #override "z":quit()' ... +wdvi \-xrm 'XDvi.mainTranslations: #override "z":quit()' ... .sp 1n .ft .fi @@ -1112,7 +807,7 @@ or .nf .ft 3 .sp 1n -xdvi \-xrm 'XDvi.mainTranslations: #override <Key>z:quit()' ... +wdvi \-xrm 'XDvi.mainTranslations: #override <Key>z:quit()' ... .sp 1n .ft .fi @@ -1120,20 +815,20 @@ xdvi \-xrm 'XDvi.mainTranslations: #override <Key>z:quit()' ... will cause the key .RB ` z ' to quit -.BR xdvi . +.BR wdvi . This method also works with the other translation resources. .SH SPECIALS (GENERALLY) Any of the specials used by -.B xdvi +.B wdvi may be preceded by the characters -.RB `` xdvi: ''. +.RB `` wdvi: ''. Doing so does not change the behavior of the special under -.BR xdvi , +.BR wdvi , but it causes other .I dvi viewers to ignore the special. .SH PAPERSIZE SPECIALS -.B xdvi +.B wdvi accepts specials to set the paper size for the document. These specials should be of the form .RS 5 @@ -1174,7 +869,7 @@ of the document; e.g., .nf .ft 3 .sp 1n -\\special{xdvi: papersize=*\\number\\wd\\mybox sp,\\number\\ht\\mybox sp} +\\special{wdvi: papersize=*\\number\\wd\\mybox sp,\\number\\ht\\mybox sp} .sp 1n .ft .fi @@ -1212,7 +907,7 @@ specials in the file are ignored. .SH COLOR SPECIALS The color specials supported by -.B xdvi +.B wdvi are the same as those supported by .BR dvips , except that the literal PostScript color specification (as in the @@ -1222,7 +917,7 @@ example in the documentation) is not supported. In particular, the LaTeX .B color package will work with -.BR xdvi . +.BR wdvi . See the documentation of the LaTeX .B color package for details on its use, and also see the @@ -1317,69 +1012,9 @@ package, and the environment in the .B framed La\*(Te\&2e package. -.SH GREYSCALING AND COLORMAPS -The greyscale anti-aliasing feature in -.B xdvi -will not work at its best if the display does not have enough colors available. -This can happen if other applications are using most of the colormap -(even if they are iconified). If this occurs, then -.B xdvi -will print an error message and turn on the -.B -copy -option. This will result in overstrike characters appearing wrong; -it may also result in poor display quality if the number of available -colors is very small. -.PP -Typically this problem occurs on displays that allocate eight bits -of video memory per pixel. To see how many bits per pixel your display -uses, type -.B xwininfo -in an -.B xterm -window, and then click the mouse on the root window when asked. The -``Depth:'' entry will tell you how many bits are allocated per pixel. -.PP -Displays using at least 15 bits per pixel are typically -.B TrueColor -visuals, which do not have this problem, since their colormap is -permanently allocated and available to all applications. (The visual -class is also displayed by -.BR xwininfo .) -For more information on visual classes see the documentation for the -X Window System. -.PP -To alleviate this problem, therefore, one may (a) run with more bits -per pixel (this may require adding more video memory or replacing the video -card), (b) shut down other applications that may be using much of the colormap -and then restart -.BR xdvi , -or (c) run -.B xdvi -with the -.B \-install -option. -.PP -One application which is often the cause of this problem is -.BR Netscape . -In this case there are two more alternatives to remedying the situation. -One can run -.RB `` "netscape -install" '' -to cause -.B Netscape -to install a private colormap. This can cause colors to change in -bizarre ways when the mouse is moved to a different window. -Or, one can run -.RB `` "netscape -ncols 220" '' -to limit -.B Netscape -to a smaller number of colors. A smaller number will ensure that -other applications have more colors available, but will degrade the -color quality in the -.B Netscape -window. .SH SIGNALS When -.B xdvi +.B wdvi receives a .SB SIGUSR1 signal, it rereads the @@ -1400,7 +1035,7 @@ See the section on FILE SEARCHING for more details. .SB XDVISIZES A list of font resolutions separated by colons. If a font cannot be found or made at its stated size, then these sizes are tried as a fallback. -.B xdvi +.B wdvi tries the actual size of the font before trying any of the given sizes. Each font resolution should be a positive integer, specifying the number of dots per inch, or a string of the form @@ -1425,7 +1060,7 @@ power, and rounded to the nearest integer. If the list begins with a colon, the system default sizes are used, as well. Sizes are expressed in dots per inch and must be integers. The current default set of sizes is @DEFAULT_FONT_SIZES@. -.B xdvi +.B wdvi will also try the actual size of the font before trying any of the given sizes. .TP .SB XDVIFONTS @@ -1468,14 +1103,14 @@ and .SB TEXPKS are set. It may also be used for searching for fontmap files, encoding files, and Type 1 font files, if -.B xdvi +.B wdvi has been compiled with support for the FreeType library. If .SB TEXFONTS is used, it should not contain any .RB ` % ' signs, since -.B xdvi +.B wdvi interprets this as a special character, but other applications do not. #endif .TP @@ -1493,7 +1128,7 @@ fonts if is not set. If this is used, it should not contain any .RB ` % ' signs, since -.B xdvi +.B wdvi interprets this as a special character, but other applications do not. #endif .TP @@ -1566,7 +1201,7 @@ is not set. .SH FILE SEARCHING In order to accommodate the wide variety of ways in which fonts are stored on various sites, -.B xdvi +.B wdvi has a fairly elaborate mechanism for indicating where to look for font files. For other types of files, the mechanism is similar, but simpler. The method for looking for font pixel files will be described first; other file types will @@ -1684,7 +1319,7 @@ is used instead of the specifier(s) given by .PP The recursive search over subdirectories triggered by a double slash often causes a severe performance penalty; therefore, -.B xdvi +.B wdvi implements a speedup called ``quick find.'' This is triggered by the presence of a .RB `` %q '' @@ -1697,12 +1332,12 @@ should exist in that directory; that file should be the output of a or .B ls -LR command executed while in that directory. If such a file exists, then -.B xdvi +.B wdvi will search that file instead of searching through the directory tree. If such a file does not exist, and if .RB `` %Q '' was used, then -.B xdvi +.B wdvi will skip the specifier entirely. .PP In order for ``quick find'' to work, @@ -1714,7 +1349,7 @@ must occur immediately after a slash, and no later than immediately following the double slash. Secondly, there must be exactly one double slash in the specifier (having more than one double slash requires more complicated code in -.BR xdvi ; +.BR wdvi ; if there are no double slashes then there is no need for ``quick find''). Third, there may be no wild cards other than .B { @@ -1752,7 +1387,7 @@ environment variable begins with a tilde (after the .RB `` !! '', if any), then -.B xdvi +.B wdvi will attempt to replace a string of the form .BI ~ username with the home directory of @@ -1764,7 +1399,7 @@ if it is empty, then the current user's home directory is substituted instead. If the username does not exist, then the string is left unchanged. .SH SEARCHING FOR FONTS When -.B xdvi +.B wdvi searches for a font, the first thing it does is to look for a PostScript Type 1 font (unless Type 1 fonts have been turned off by the .B \-nofreetypefonts @@ -1776,7 +1411,7 @@ X resource). It does so by the following method. First, it compiles a list of dvips-style map files, using the same procedure as .B dvips would use for a hypothetical printer named -.BR xdvi . +.BR wdvi . In other words, it searches the files .BR config.ps , .B $HOME/.dvipsrc @@ -1799,7 +1434,7 @@ documentation for details on this procedure. If the map entry for the font gives a file name, then the named file is searched for and used (if found) to provide the font. Otherwise (if the map entry does not give a file name), then -.B xdvi +.B wdvi uses the PostScript name given in the map entry to search for the font in .B Fontmap files, using the same method as Ghostscript uses to search for PostScript @@ -1807,7 +1442,7 @@ fonts. .PP If an entry for the font is not found in one of the dvips map files, then it is assumed not to be available in Type 1 format, and -.B xdvi +.B wdvi will then search for a .I pk or @@ -1846,22 +1481,22 @@ is added at the end; and finally replaces all the specifiers. .PP If no virtual font is found, then -.B xdvi +.B wdvi will try to find the nearest size. If the font cannot be found at all, then -.B xdvi +.B wdvi 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 (see .BR \-altfont ). .SH EXAMPLE OF FONT SEARCHING This example describes how -.B xdvi +.B wdvi would search for the font .B cmr10 at 300 dots per inch. First, -.B xdvi +.B wdvi searches the map files for an entry describing a font with TeX name .BR cmr10 . It will likely find a line @@ -1912,18 +1547,18 @@ replaces all the specifiers. If no such map file entry is found, if the file .B cmr10.pfb cannot be found, or if Type 1 fonts have been turned off, then -.B xdvi +.B wdvi searches for the font in raster format at 300 dpi. For example, if the specifier is .RB `` /usr/local/tex/fonts '', then -.B xdvi +.B wdvi looks for .B /usr/local/tex/fonts/cmr10.300pk and .BR /usr/local/tex/fonts/cmr10.300gf , in that order (provided that -.B xdvi +.B wdvi is compiled to accept both .I pk and @@ -1939,7 +1574,7 @@ in that case, if (or, again, its compiled-in default) is set to .RB `` /usr/local/texmf '', then -.B xdvi +.B wdvi will look within that directory for the font file, in accordance with the TDS standard. .PP @@ -1955,14 +1590,14 @@ then setting to .RB `` /home/user/fonts: '' will cause -.B xdvi +.B wdvi to check that directory for font files before checking its default list. Similarly, setting .SB XDVIFONTS to .RB `` :/home/user/fonts '' will cause -.B xdvi +.B wdvi to check that directory .I after checking its default locations. This is true even if the system uses a TDS @@ -1989,14 +1624,14 @@ must be set explicitly, and therefore this feature is not useful, the variable may be set to an empty string (i.e., .RB `` "setenv XDVIFONTS" '') to cause -.B xdvi +.B wdvi to ignore .SB TEXFONTS. #endif .PP If the user has a large number of fonts and wishes to keep them in a TDS tree, then that is also possible with -.BR xdvi : +.BR wdvi : if, for example, the TDS tree is .BR /home/user/texmf , then setting @@ -2004,7 +1639,7 @@ then setting to .RB `` /home/user/texmf: '' will cause -.B xdvi +.B wdvi to check that TDS tree before its default actions. This assumes, however, that the site uses a TDS tree also (since .SB TEXMF @@ -2045,8 +1680,3 @@ Modified for X11 by Mark Eichin, MIT SIPB. Additional enhancements by many others. The current maintainer is Paul Vojta, U.C. Berkeley. .PP -Please report bugs to the SourceForge bug tracker: -.PP -.nf -.B http://sourceforge.net/tracker/?func=add&group_id=23164&atid=377580 -.PP diff --git a/xdvi.c b/xdvi.c @@ -67,12 +67,11 @@ NOTE: #include <stdarg.h> #include <stdlib.h> /* exit(), atof(), atoi(), free() */ -/* Xlib and Xutil are already included */ #include <X11/cursorfont.h> #include <X11/keysym.h> #include <X11/Xatom.h> #include <X11/StringDefs.h> -#include <X11/Shell.h> /* needed for def. of XtNiconX */ +#include <X11/Shell.h> /* XtNiconX */ #include <X11/IntrinsicI.h> #include <X11/IntrinsicP.h> #include <X11/Xaw/Viewport.h> @@ -83,8 +82,7 @@ NOTE: #include "dvi-init.h" /* init_dvi_file(), init_page() */ #include "dvi-draw.h" /* prescan() */ #include "events.h" /* enable_intr(), compile_action(), ... */ -#include "font-open.h" -#include "special.h" /* page_info */ +#include "font-open.h" /* init_font_open() */ #include "util.h" /* xmalloc(), memicmp() */ #include "version.h" #include "xdvi.h" @@ -113,7 +111,6 @@ static Dimension bwidth = 2; struct _resource resource; #define brdr_Pixel resource._brdr_Pixel #define hl_Pixel resource._hl_Pixel -#define cr_Pixel resource._cr_Pixel struct mg_size_rec mg_size[5] = {{200, 150}, {400, 250}, {700, 500}, {1000, 800}, {1200, 1200}}; @@ -127,10 +124,6 @@ struct WindowRec currwin= {(Window) 0, 1, 0, 0, 0, 0, MAXDIM, 0, MAXDIM, 0}; * Data for options processing */ -static const char silent[] = " "; /* flag value for usage() */ -static const char subst[] = "x"; /* another flag value */ -static const char *subst_val[] = { "-mgs[n] <size>" }; - static XrmOptionDescRec options[] = { {"-s", ".shrinkFactor", XrmoptionSepArg, (XPointer) NULL}, {"-S", ".densityPercent", XrmoptionSepArg, (XPointer) NULL}, @@ -139,19 +132,11 @@ static XrmOptionDescRec options[] = { {"+nocolor", ".color", XrmoptionNoArg, (XPointer) "on"}, {"-gamma", ".gamma", XrmoptionSepArg, (XPointer) NULL}, {"-p", ".pixelsPerInch", XrmoptionSepArg, (XPointer) NULL}, -{"-margins", ".Margin", XrmoptionSepArg, (XPointer) NULL}, -{"-sidemargin", ".sideMargin", XrmoptionSepArg, (XPointer) NULL}, -{"-topmargin", ".topMargin", XrmoptionSepArg, (XPointer) NULL}, -{"-offsets", ".Offset", XrmoptionSepArg, (XPointer) NULL}, -{"-xoffset", ".xOffset", XrmoptionSepArg, (XPointer) NULL}, -{"-yoffset", ".yOffset", XrmoptionSepArg, (XPointer) NULL}, {"-paper", ".paper", XrmoptionSepArg, (XPointer) NULL}, {"-altfont", ".altFont", XrmoptionSepArg, (XPointer) NULL}, {"-mfmode", ".mfMode", XrmoptionSepArg, (XPointer) NULL}, {"-l", ".listFonts", XrmoptionNoArg, (XPointer) "on"}, {"+l", ".listFonts", XrmoptionNoArg, (XPointer) "off"}, -{"-nofreetypefonts", ".freetypeFonts", XrmoptionNoArg, (XPointer) "off"}, -{"+nofreetypefonts", ".freetypeFonts", XrmoptionNoArg, (XPointer) "on"}, {"-mgs", ".magnifierSize1",XrmoptionSepArg, (XPointer) NULL}, {"-mgs1", ".magnifierSize1",XrmoptionSepArg, (XPointer) NULL}, {"-mgs2", ".magnifierSize2",XrmoptionSepArg, (XPointer) NULL}, @@ -166,14 +151,11 @@ static XrmOptionDescRec options[] = { {"+hushchars", ".hushLostChars", XrmoptionNoArg, (XPointer) "off"}, {"-hushchecksums", ".hushChecksums", XrmoptionNoArg, (XPointer) "on"}, {"+hushchecksums", ".hushChecksums", XrmoptionNoArg, (XPointer) "off"}, -{"-safer", ".safer", XrmoptionNoArg, (XPointer) "on"}, -{"+safer", ".safer", XrmoptionNoArg, (XPointer) "off"}, {"-fg", ".foreground", XrmoptionSepArg, (XPointer) NULL}, {"-foreground", ".foreground", XrmoptionSepArg, (XPointer) NULL}, {"-bg", ".background", XrmoptionSepArg, (XPointer) NULL}, {"-background", ".background", XrmoptionSepArg, (XPointer) NULL}, {"-hl", ".highlight", XrmoptionSepArg, (XPointer) NULL}, -{"-cr", ".cursorColor", XrmoptionSepArg, (XPointer) NULL}, {"-icongeometry",".iconGeometry",XrmoptionSepArg, (XPointer) NULL}, {"-keep", ".keepPosition",XrmoptionNoArg, (XPointer) "on"}, {"+keep", ".keepPosition",XrmoptionNoArg, (XPointer) "off"}, @@ -182,9 +164,6 @@ static XrmOptionDescRec options[] = { {"-thorough", ".thorough", XrmoptionNoArg, (XPointer) "on"}, {"+thorough", ".thorough", XrmoptionNoArg, (XPointer) "off"}, {"-wheelunit", ".wheelUnit", XrmoptionSepArg, (XPointer) NULL}, -{"-noscan", ".prescan", XrmoptionNoArg, (XPointer) "off"}, -{"+noscan", ".prescan", XrmoptionNoArg, (XPointer) "on"}, -{"-dvipspath", ".dvipsPath", XrmoptionSepArg, (XPointer) NULL}, {"-debug", ".debugLevel", XrmoptionSepArg, (XPointer) NULL}, {"-version", ".version", XrmoptionNoArg, (XPointer) "on"}, {"+version", ".version", XrmoptionNoArg, (XPointer) "off"}, @@ -205,7 +184,7 @@ static const char base_translations[] = "" "\"f\":forward-page()\n" "\"n\":forward-page()\n" "\" \":down-or-next()\n" -"<Key>Return:forward-page()\n" +"<Key>Return:addr-go()\n" "\"p\":back-page()\n" "\"b\":back-page()\n" "<Key>Delete:up-or-previous()\n" @@ -218,7 +197,6 @@ static const char base_translations[] = "" "\"l\":left()\n" "\"r\":right()\n" "\"u\":up()\n" -"\"M\":set-margins()\n" "\"s\":set-shrink-factor()\n" "\"S\":set-density()\n" "<Key>Home:home()\n" @@ -228,17 +206,6 @@ static const char base_translations[] = "" "<Key>Down:down()\n" "<Key>Prior:back-page()\n" "<Key>Next:forward-page()\n" -#ifdef XK_KP_Left -"<Key>KP_Home:home()\n" -"<Key>KP_Left:left()\n" -"<Key>KP_Up:up()\n" -"<Key>KP_Right:right()\n" -"<Key>KP_Down:down()\n" -"<Key>KP_Prior:back-page()\n" -"<Key>KP_Next:forward-page()\n" -"<Key>KP_Delete:up-or-previous()\n" -"<Key>KP_Enter:forward-page()\n" -#endif "\"C\":set-color()\n" "<Key>Escape:discard-number()\n" /* Esc */ "s<Btn1Down>:drag(|)\n" @@ -246,8 +213,7 @@ static const char base_translations[] = "" "s<Btn3Down>:drag(-)\n" "<Btn1Down>:magnifier(*1)\n" "<Btn2Down>:magnifier(*2)\n" -"<Btn3Down>:magnifier(*3)\n" -"\"R\":reread-dvi-file()"; +"<Btn3Down>:magnifier(*3)\n"; #define offset(field) XtOffsetOf(struct _resource, field) @@ -263,22 +229,10 @@ static XtResource application_resources[] = { <Btn5Down>:wheel(1.)\n<Btn6Down>:hwheel(-1.)\n<Btn7Down>:hwheel(1.)"}, {"wheelUnit", "WheelUnit", XtRInt, sizeof(int), offset(wheel_unit), XtRImmediate, (XtPointer) 80}, -{"dvipsHangTime", "DvipsHangTime", XtRInt, sizeof(int), - offset(dvips_hang), XtRImmediate, (XtPointer) 700}, -{"dvipsFailHangTime", "DvipsFailHangTime", XtRInt, sizeof(int), - offset(dvips_fail_hang), XtRImmediate, (XtPointer) 5000}, {"gamma", "Gamma", XtRFloat, sizeof(float), offset(_gamma), XtRString, "1"}, {"pixelsPerInch", "PixelsPerInch", XtRInt, sizeof(int), offset(_pixels_per_inch), XtRImmediate, (XtPointer) BDPI}, -{"sideMargin", "Margin", XtRString, sizeof(char *), - offset(sidemargin), XtRString, (XtPointer) NULL}, -{"topMargin", "Margin", XtRString, sizeof(char *), - offset(topmargin), XtRString, (XtPointer) NULL}, -{"xOffset", "Offset", XtRString, sizeof(char *), - offset(xoffset), XtRString, (XtPointer) NULL}, -{"yOffset", "Offset", XtRString, sizeof(char *), - offset(yoffset), XtRString, (XtPointer) NULL}, {"paper", "Paper", XtRString, sizeof(char *), offset(paper), XtRString, (XtPointer) DEFAULT_PAPER}, {"altFont", "AltFont", XtRString, sizeof(char *), @@ -287,8 +241,6 @@ static XtResource application_resources[] = { offset(mfmode), XtRString, MFMODE}, {"listFonts", "ListFonts", XtRBoolean, sizeof(Boolean), offset(_list_fonts), XtRString, "false"}, -{"freetypeFonts", "FreetypeFonts", XtRBoolean, sizeof(Boolean), - offset(freetype), XtRString, "true"}, {"reverseVideo", "ReverseVideo", XtRBoolean, sizeof(Boolean), offset(reverse), XtRString, "false"}, {"warnSpecials", "WarnSpecials", XtRBoolean, sizeof(Boolean), @@ -297,14 +249,10 @@ static XtResource application_resources[] = { offset(_hush_chars), XtRString, "false"}, {"hushChecksums", "Hush", XtRBoolean, sizeof(Boolean), offset(_hush_chk), XtRString, "false"}, -{"safer", "Safer", XtRBoolean, sizeof(Boolean), - offset(safer), XtRString, "false"}, {"iconGeometry", "IconGeometry", XtRString, sizeof(char *), offset(icon_geometry), XtRString, (XtPointer) NULL}, {"keepPosition", "KeepPosition", XtRBoolean, sizeof(Boolean), offset(keep_flag), XtRString, "false"}, -{"prescan", "Prescan", XtRBoolean, sizeof(Boolean), - offset(prescan), XtRString, "true"}, {"copy", "Copy", XtRBoolean, sizeof(Boolean), offset(copy), XtRString, "false"}, {"thorough", "Thorough", XtRBoolean, sizeof(Boolean), @@ -325,8 +273,6 @@ static XtResource application_resources[] = { offset(mg_arg[4]), XtRString, (XtPointer) NULL}, {"color", "Color", XtRBoolean, sizeof(Boolean), offset(_use_color), XtRString, "true"}, -{"dvipsPath", "DvipsPath", XtRString, sizeof(char *), - offset(dvips_path), XtRString, (XtPointer) "dvips"}, }; static XtResource app_pixel_resources[] = { /* get these later */ @@ -338,51 +284,9 @@ static XtResource app_pixel_resources[] = { /* get these later */ offset(_brdr_Pixel), XtRPixel, (XtPointer) &resource._fore_Pixel}, {"highlight", "Highlight", XtRPixel, sizeof(Pixel), offset(_hl_Pixel), XtRPixel, (XtPointer) &resource._fore_Pixel}, -{"cursorColor", "CursorColor", XtRPixel, sizeof(Pixel), - offset(_cr_Pixel), XtRPixel, (XtPointer) &resource._fore_Pixel}, }; #undef offset -static const char *usagestr[] = { - /* shrinkFactor */ "shrink", - /* S */ "density", - /* density */ silent, - /* gamma */ "g", - /* p */ "pixels", - /* margins */ "dimen", - /* sidemargin */ "dimen", - /* topmargin */ "dimen", - /* offsets */ "dimen", - /* xoffset */ "dimen", - /* yoffset */ "dimen", - /* paper */ "papertype", - /* altfont */ "font", - /* mfmode */ "mode-def", - /* rv */ "^-l", "-rv", - /* mgs */ subst, - /* mgs1 */ silent, - /* mgs2 */ silent, - /* mgs3 */ silent, - /* mgs4 */ silent, - /* mgs5 */ silent, - /* bw */ "^-safer", "-bw <width>", - /* fg */ "color", - /* foreground */ silent, - /* bg */ "color", - /* background */ silent, - /* hl */ "color", - /* bd */ "^-hl", "-bd <color>", - /* cr */ "color", - /* display */ "^-cr", "-display <host:display>", - /* geometry */ "^-cr", "-geometry <geometry>", - /* icongeometry */ "geometry", - /* iconic */ "^-icongeometry", "-iconic", - /* wheelunit */ "pixels", - /* dvipspath */ "path", - /* debug */ "bitmask", - /* [dummy] */ "z" -}; - /* ARGSUSED */ static XtGeometryResult @@ -433,60 +337,26 @@ static WidgetClassRec drawingWidgetClass = { } }; -static void +static void usage(const char *message, ...) { va_list args; - XrmOptionDescRec *opt; - const char **usageptr = usagestr; - const char **sv = subst_val; - const char *str1; - const char *str2; - int col = 23; - int n; - - Fprintf(stderr, "%s: ", prog); va_start(args, message); - (void) vfprintf(stderr, message, args); + vwarnx(message, args); va_end(args); - Fputs("\n\nUsage: wdvi ", stderr); - for (opt = options; opt < options + XtNumber(options); ++opt) { - str1 = opt->option; - if (*str1 != '-') continue; - str2 = NULL; - if (opt->argKind != XrmoptionNoArg) { - str2 = *usageptr++; - if (str2 == silent) continue; - if (str2 == subst) { - str1 = *sv++; - str2 = NULL; - } - } - for (;;) { - n = strlen(str1) + 3; - if (str2 != NULL) n += strlen(str2) + 3; - if (col + n < 80) Putc(' ', stderr); - else { - Fputs("\n\t", stderr); - col = 8 - 1; - } - if (str2 == NULL) - Fprintf(stderr, "[%s]", str1); - else - Fprintf(stderr, "[%s <%s>]", str1, str2); - col += n; - if (**usageptr != '^' - || strcmp(*usageptr + 1, opt->option) != 0) break; - ++usageptr; - str1 = *usageptr++; - str2 = NULL; - } - } - if (col + 9 < 80) Putc(' ', stderr); - else Fputs("\n\t", stderr); - Fputs("url\n", stderr); + fprintf(stderr, "\nUsage: wdvi "); + fprintf(stderr, + "[-s <shrink>] [-S <density>] [-nocolor] [-gamma <g>]\n" + "\t[-p <pixels>] [-paper <papertype>] [-altfont <font>]\n" + "\t[-mfmode <mode-def>] [-l] [-rv] [-mgs[n] <size>] [-warnspecials]\n" + "\t[-hush] [-hushchars] [-hushchecksums] [-bw <width>] [-fg <color>]\n" + "\t[-bg <color>] [-hl <color>] [-bd <color>] [-display <host:display>]\n" + "\t[-geometry <geometry>] [-icongeometry <geometry>] [-iconic]\n" + "\t[-font <font>] [-keep] [-copy] [-thorough] [-wheelunit <pixels>]\n" + "\t[-debug <bitmask>] [-version] [--version] url\n"); + exit(1); } @@ -946,8 +816,10 @@ main(int argc, char **argv) while (--argc > 0) { arg = *++argv; + if (arg[0] == '-') + usage("Unknown option '%s'.", arg); if (url != NULL) - warnx("more than one url given, discarding '%s'", arg); + usage("More than one url specified", arg); else url = arg; } @@ -1042,14 +914,11 @@ main(int argc, char **argv) bak_shrink = shrink_factor; mane.shrinkfactor = shrink_factor; /* otherwise it's 1 */ } - if (resource.sidemargin) - home_x = atopix(resource.sidemargin, False); - if (resource.topmargin) - home_y = atopix(resource.topmargin, False); - offset_x = resource.xoffset ? atopix(resource.xoffset, True) - : pixels_per_inch; - offset_y = resource.yoffset ? atopix(resource.yoffset, True) - : pixels_per_inch; + + /* 1 inch */ + offset_x = pixels_per_inch; + offset_y = pixels_per_inch; + if (!set_paper_type()) { warnx("Unrecognized paper type '%s'. Legal values are:", resource.paper); @@ -1111,8 +980,7 @@ main(int argc, char **argv) init_font_open(); init_dvi_file(); - if (resource.prescan) - prescan(); + prescan(); init_page(); /* diff --git a/xdvi.h b/xdvi.h @@ -139,41 +139,30 @@ extern struct _resource { int shrinkfactor; const char *main_translations; const char *wheel_translations; - int dvips_hang; - int dvips_fail_hang; int wheel_unit; int _density; float _gamma; int _pixels_per_inch; - const char *sidemargin; - const char *topmargin; - const char *xoffset; - const char *yoffset; const char *paper; const char *_alt_font; const char *mfmode; Boolean _list_fonts; - Boolean freetype; Boolean reverse; Boolean _warn_spec; Boolean _hush_chars; Boolean _hush_chk; - Boolean safer; Pixel _fore_Pixel; Pixel _back_Pixel; Pixel _brdr_Pixel; Pixel _hl_Pixel; - Pixel _cr_Pixel; const char *icon_geometry; Boolean keep_flag; Boolean copy; Boolean thorough; - Boolean prescan; const char *debug_arg; Boolean version_flag; const char *mg_arg[5]; Boolean _use_color; - const char *dvips_path; } resource; /* As a convenience, we define the field names without leading underscores @@ -269,7 +258,6 @@ int bak_shrink; /* last shrink factor != 1 */ Dimension window_w, window_h; XImage *image; int backing_store; -int home_x, home_y; Display *DISP; Screen *SCRN;