PageRenderTime 29ms CodeModel.GetById 9ms app.highlight 15ms RepoModel.GetById 2ms app.codeStats 0ms

/contrib/groff/src/devices/xditview/DviP.h

https://bitbucket.org/freebsd/freebsd-head/
C++ Header | 233 lines | 154 code | 36 blank | 43 comment | 1 complexity | afbd7d1fac3145256be7ee24a6c0edb0 MD5 | raw file
  1/*
  2 * $XConsortium: DviP.h,v 1.5 89/07/22 19:44:08 keith Exp $
  3 */
  4
  5/* 
  6 * DviP.h - Private definitions for Dvi widget
  7 */
  8
  9#ifndef _XtDviP_h
 10#define _XtDviP_h
 11
 12#include "Dvi.h"
 13#include "DviChar.h"
 14#include "device.h"
 15
 16/***********************************************************************
 17 *
 18 * Dvi Widget Private Data
 19 *
 20 ***********************************************************************/
 21
 22/************************************
 23 *
 24 *  Class structure
 25 *
 26 ***********************************/
 27
 28/* Type for save method. */
 29
 30typedef void (*DviSaveProc)(Widget, FILE *);
 31
 32/*
 33 * New fields for the Dvi widget class record
 34 */
 35
 36
 37typedef struct _DviClass {
 38      DviSaveProc	save;
 39} DviClassPart;
 40
 41/*
 42 * Full class record declaration
 43 */
 44
 45typedef struct _DviClassRec {
 46	CoreClassPart	core_class;
 47	DviClassPart	command_class;
 48} DviClassRec;
 49
 50extern DviClassRec dviClassRec;
 51
 52/***************************************
 53 *
 54 *  Instance (widget) structure 
 55 *
 56 **************************************/
 57
 58/*
 59 * a list of fonts we've used for this widget
 60 */
 61
 62typedef struct _dviFontSizeList {
 63	struct _dviFontSizeList	*next;
 64	int			size;
 65	char			*x_name;
 66	XFontStruct		*font;
 67	int			doesnt_exist;
 68} DviFontSizeList;
 69
 70typedef struct _dviFontList {
 71	struct _dviFontList	*next;
 72	char			*dvi_name;
 73	char			*x_name;
 74	int			dvi_number;
 75	Boolean			initialized;
 76	Boolean			scalable;
 77	DviFontSizeList		*sizes;
 78	DviCharNameMap		*char_map;
 79	DeviceFont		*device_font;
 80} DviFontList;
 81
 82typedef struct _dviFontMap {
 83	struct _dviFontMap	*next;
 84	char			*dvi_name;
 85	char			*x_name;
 86} DviFontMap;
 87
 88#define DVI_TEXT_CACHE_SIZE	256
 89#define DVI_CHAR_CACHE_SIZE	1024
 90
 91typedef struct _dviCharCache {
 92	XTextItem	cache[DVI_TEXT_CACHE_SIZE];
 93	char		adjustable[DVI_TEXT_CACHE_SIZE];
 94	char		char_cache[DVI_CHAR_CACHE_SIZE];
 95	int		index;
 96	int		max;
 97	int		char_index;
 98	int		font_size;
 99	int		font_number;
100	XFontStruct	*font;
101	int		start_x, start_y;
102	int		x, y;
103} DviCharCache;
104
105typedef struct _dviState {
106	struct _dviState	*next;
107	int			font_size;
108	int			font_number;
109	int			x;
110	int			y;
111} DviState;
112
113typedef struct _dviFileMap {
114	struct _dviFileMap	*next;
115	long			position;
116	int			page_number;
117} DviFileMap;
118
119/*
120 * New fields for the Dvi widget record
121 */
122
123typedef struct {
124	/*
125	 * resource specifiable items
126	 */
127	char		*font_map_string;
128	unsigned long	foreground;
129	unsigned long	background;
130	int		requested_page;
131	int		last_page;
132	XFontStruct	*default_font;
133	FILE		*file;
134	Boolean		noPolyText;
135	Boolean		seek;		/* file is "seekable" */
136	int		default_resolution;
137	/*
138 	 * private state
139 	 */
140	FILE		*tmpFile;	/* used when reading stdin */
141	char		readingTmp;	/* reading now from tmp */
142	char		ungot;		/* have ungetc'd a char */
143	GC		normal_GC;
144	GC		fill_GC;
145	DviFileMap	*file_map;
146	DviFontList	*fonts;
147	DviFontMap	*font_map;
148	int		current_page;
149	int		font_size;
150	int		font_number;
151	DeviceFont	*device_font;
152	int		device_font_number;
153	Device		*device;
154	int		native;
155	int		device_resolution;
156	int		display_resolution;
157	int		paperlength;
158	int		paperwidth;
159	double		scale_factor;	/* display res / device res */
160	int		sizescale;
161	int		line_thickness;
162	int		line_width;
163
164#define DVI_FILL_MAX 1000
165
166	int		fill;
167#define DVI_FILL_WHITE 0
168#define DVI_FILL_GRAY 1
169#define DVI_FILL_BLACK 2
170	int		fill_type;
171	Pixmap		gray[8];
172	int		backing_store;
173	XFontStruct	*font;
174	int		display_enable;
175	struct ExposedExtents {
176	    int x1, y1, x2, y2;
177	}		extents;
178	DviState	*state;
179	DviCharCache	cache;
180	int		text_x_width;
181	int		text_device_width;
182	int		word_flag;
183} DviPart;
184
185int DviGetAndPut(DviWidget, int *);
186#define DviGetIn(dw,cp)\
187    (dw->dvi.tmpFile ? (\
188	DviGetAndPut (dw, cp) \
189    ) :\
190	(*cp = getc (dw->dvi.file))\
191)
192
193#define DviGetC(dw, cp)\
194    (dw->dvi.readingTmp ? (\
195	((*cp = getc (dw->dvi.tmpFile)) == EOF) ? (\
196	    fseek (dw->dvi.tmpFile, 0l, 2),\
197	    (dw->dvi.readingTmp = 0),\
198	    DviGetIn (dw,cp)\
199	) : (\
200	    *cp\
201	)\
202    ) : (\
203	DviGetIn(dw,cp)\
204    )\
205)
206
207#define DviUngetC(dw, c)\
208    (dw->dvi.readingTmp ? (\
209	ungetc (c, dw->dvi.tmpFile)\
210    ) : ( \
211	(dw->dvi.ungot = 1),\
212	ungetc (c, dw->dvi.file)))
213
214/*
215 * Full widget declaration
216 */
217
218typedef struct _DviRec {
219	CorePart	core;
220	DviPart		dvi;
221} DviRec;
222
223#define InheritSaveToFile ((DviSaveProc)_XtInherit)
224
225XFontStruct	*QueryFont (DviWidget, int, int);
226
227DviCharNameMap	*QueryFontMap (DviWidget, int);
228
229DeviceFont	*QueryDeviceFont (DviWidget, int);
230
231char *GetWord(DviWidget, char *, int);
232char *GetLine(DviWidget, char *, int);
233#endif /* _XtDviP_h */