wdvi

network DVI viewer
Log | Files | Refs

xdvi.h (3785B)


      1 /*========================================================================*\
      2 
      3 Copyright (c) 1990-2013  Paul Vojta
      4 
      5 Permission is hereby granted, free of charge, to any person obtaining a copy
      6 of this software and associated documentation files (the "Software"), to
      7 deal in the Software without restriction, including without limitation the
      8 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
      9 sell copies of the Software, and to permit persons to whom the Software is
     10 furnished to do so, subject to the following conditions:
     11 
     12 The above copyright notice and this permission notice shall be included in
     13 all copies or substantial portions of the Software.
     14 
     15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     18 PAUL VOJTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
     19 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     21 
     22 NOTE:
     23 	xdvi is based on prior work, as noted in the modification history
     24 	in xdvi.c.
     25 
     26 \*========================================================================*/
     27 
     28 /*
     29  *	Written by Eric C. Cooper, CMU
     30  */
     31 
     32 #ifndef	XDVI_H
     33 #define	XDVI_H
     34 
     35 #include <stdio.h>
     36 
     37 #include <X11/Intrinsic.h>
     38 
     39 #include "data.h"	/* struct rgb */
     40 
     41 
     42 #ifndef __BYTE_ORDER__
     43 #error "Compiler does not have __BYTE_ORDER__ predefined macro"
     44 #endif
     45 
     46 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
     47 #define WORDS_BIGENDIAN 1
     48 #endif
     49 
     50 static const char addr_default[] = "https://www.0x30.net/index.dvi";
     51 
     52 #define	MAXDIM		32767
     53 
     54 int	current_page;
     55 int	total_pages;
     56 int	pageno_correct	= 1;
     57 double	dimconv;
     58 double	tpic_conv;
     59 unsigned int	page_w, page_h;
     60 
     61 /*
     62  * Used for window manager delete protocol (toolkit only).
     63  */
     64 Atom	atoms[2];
     65 #define	XA_WM_DELETE_WINDOW	(atoms[0])
     66 #define	XA_WM_PROTOCOLS		(atoms[1])
     67 
     68 
     69 /*
     70  *	Command line flags.
     71  */
     72 
     73 struct _resource {
     74 	int		shrinkfactor;
     75 	const char	*main_translations;
     76 	const char	*wheel_translations;
     77 	float		_gamma;
     78 	int		_pixels_per_inch;
     79 	const	char	*_alt_font;
     80 	const	char	*mfmode;
     81 	Boolean		_list_fonts;
     82 	Boolean		reverse;
     83 	Pixel		_fore_Pixel;
     84 	Pixel		_back_Pixel;
     85 	const	char	*icon_geometry;
     86 	Boolean		copy;
     87 	Boolean		thorough;
     88 	const	char	*debug_arg;
     89 	Boolean		version_flag;
     90 	Boolean		_use_color;
     91 } resource;
     92 
     93 /* As a convenience, we define the field names without leading underscores
     94  * to point to the field of the above record.  Here are the global ones;
     95  * the local ones are defined in each module.  */
     96 
     97 #define	pixels_per_inch	resource._pixels_per_inch
     98 
     99 
    100 XColor		color_data[2];
    101 #define	fore_color_data		color_data[0]
    102 #define	back_color_data		color_data[1]
    103 
    104 
    105 /* Color states.  */
    106 struct rgb	fg_initial;	/* Initial fg (from command line) */
    107 struct rgb	bg_initial;	/* Initial bg */
    108 
    109 
    110 int		debug		= 0;
    111 
    112 #define	DBG_BITMAP	1
    113 #define	DBG_DVI		2
    114 #define	DBG_PK		4
    115 #define	DBG_EVENT	16
    116 #define	DBG_OPEN	32
    117 #define	DBG_PS		64
    118 #define	DBG_CLIENT	128
    119 #define	DBG_ALL		(~0)
    120 
    121 int		offset_x, offset_y;
    122 unsigned int	unshrunk_paper_w, unshrunk_paper_h;
    123 unsigned int	unshrunk_page_w, unshrunk_page_h;
    124 
    125 char		*dvi_name	= NULL;	/* dvi file name */
    126 FILE		*dvi_file;		/* user's file */
    127 
    128 int		bak_shrink;		/* last shrink factor != 1 */
    129 XImage		*image;
    130 
    131 Display		*DISP;
    132 Screen		*SCRN;
    133 
    134 Cursor		redraw_cursor, ready_cursor;
    135 
    136 Widget		top_level	= 0;
    137 Widget		vport_widget, draw_widget, clip_widget;
    138 Widget		addr_widget, form_widget;
    139 
    140 char	*ffline	= NULL;	/* an array used by filefind to store */
    141 					/* the file name being formed.  */
    142 					/* It expands as needed. */
    143 					/* Also used elsewhere.  */
    144 size_t	ffline_len = 0;	/* current length of ffline[] */
    145 
    146 #endif	/* XDVI_H */