* Makefile.in (SEP): Replaced with...
[s-roff.git] / src / xditview / DviP.h
blob825d42b3421f6bb55154b3d08c97511ab042ff46
1 /*
2 * $XConsortium: DviP.h,v 1.5 89/07/22 19:44:08 keith Exp $
3 */
5 /*
6 * DviP.h - Private definitions for Dvi widget
7 */
9 #ifndef _XtDviP_h
10 #define _XtDviP_h
12 #include "Dvi.h"
13 #include "DviChar.h"
14 #include "device.h"
16 /***********************************************************************
18 * Dvi Widget Private Data
20 ***********************************************************************/
22 /************************************
24 * Class structure
26 ***********************************/
28 /* Type for save method. */
30 typedef void (*DviSaveProc)();
33 * New fields for the Dvi widget class record
37 typedef struct _DviClass {
38 DviSaveProc save;
39 } DviClassPart;
42 * Full class record declaration
45 typedef struct _DviClassRec {
46 CoreClassPart core_class;
47 DviClassPart command_class;
48 } DviClassRec;
50 extern DviClassRec dviClassRec;
52 /***************************************
54 * Instance (widget) structure
56 **************************************/
59 * a list of fonts we've used for this widget
62 typedef struct _dviFontSizeList {
63 struct _dviFontSizeList *next;
64 int size;
65 char *x_name;
66 XFontStruct *font;
67 int doesnt_exist;
68 } DviFontSizeList;
70 typedef 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;
82 typedef struct _dviFontMap {
83 struct _dviFontMap *next;
84 char *dvi_name;
85 char *x_name;
86 } DviFontMap;
88 #define DVI_TEXT_CACHE_SIZE 256
89 #define DVI_CHAR_CACHE_SIZE 1024
91 typedef 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;
105 typedef struct _dviState {
106 struct _dviState *next;
107 int font_size;
108 int font_number;
109 int x;
110 int y;
111 } DviState;
113 typedef struct _dviFileMap {
114 struct _dviFileMap *next;
115 long position;
116 int page_number;
117 } DviFileMap;
120 * New fields for the Dvi widget record
123 typedef struct {
125 * resource specifiable items
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;
138 * private state
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;
164 #define DVI_FILL_MAX 1000
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;
185 extern int DviGetAndPut();
186 #define DviGetIn(dw,cp)\
187 (dw->dvi.tmpFile ? (\
188 DviGetAndPut (dw, cp) \
189 ) :\
190 (*cp = getc (dw->dvi.file))\
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\
202 ) : (\
203 DviGetIn(dw,cp)\
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)))
215 * Full widget declaration
218 typedef struct _DviRec {
219 CorePart core;
220 DviPart dvi;
221 } DviRec;
223 #define InheritSaveToFile ((DviSaveProc)_XtInherit)
225 extern XFontStruct *QueryFont ();
227 extern DviCharNameMap *QueryFontMap ();
229 extern DeviceFont *QueryDeviceFont ();
231 extern char *GetWord(), *GetLine();
232 #endif /* _XtDviP_h */