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 30 typedef void (*DviSaveProc)(); 31 32 /* 33 * New fields for the Dvi widget class record 34 */ 35 36 37 typedef struct _DviClass { 38 DviSaveProc save; 39 } DviClassPart; 40 41 /* 42 * Full class record declaration 43 */ 44 45 typedef struct _DviClassRec { 46 CoreClassPart core_class; 47 DviClassPart command_class; 48 } DviClassRec; 49 50 extern 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 62 typedef struct _dviFontSizeList { 63 struct _dviFontSizeList *next; 64 int size; 65 char *x_name; 66 XFontStruct *font; 67 int doesnt_exist; 68 } DviFontSizeList; 69 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; 81 82 typedef 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 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; 104 105 typedef struct _dviState { 106 struct _dviState *next; 107 int font_size; 108 int font_number; 109 int x; 110 int y; 111 } DviState; 112 113 typedef 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 123 typedef 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; 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 185 #define DviGetIn(dw,cp)\ 186 (dw->dvi.tmpFile ? (\ 187 DviGetAndPut (dw, cp) \ 188 ) :\ 189 (*cp = getc (dw->dvi.file))\ 190 ) 191 192 #define DviGetC(dw, cp)\ 193 (dw->dvi.readingTmp ? (\ 194 ((*cp = getc (dw->dvi.tmpFile)) == EOF) ? (\ 195 fseek (dw->dvi.tmpFile, 0l, 2),\ 196 (dw->dvi.readingTmp = 0),\ 197 DviGetIn (dw,cp)\ 198 ) : (\ 199 *cp\ 200 )\ 201 ) : (\ 202 DviGetIn(dw,cp)\ 203 )\ 204 ) 205 206 #define DviUngetC(dw, c)\ 207 (dw->dvi.readingTmp ? (\ 208 ungetc (c, dw->dvi.tmpFile)\ 209 ) : ( \ 210 (dw->dvi.ungot = 1),\ 211 ungetc (c, dw->dvi.file))) 212 213 /* 214 * Full widget declaration 215 */ 216 217 typedef struct _DviRec { 218 CorePart core; 219 DviPart dvi; 220 } DviRec; 221 222 #define InheritSaveToFile ((DviSaveProc)_XtInherit) 223 224 extern XFontStruct *QueryFont (); 225 226 extern DviCharNameMap *QueryFontMap (); 227 228 extern DeviceFont *QueryDeviceFont (); 229 230 extern char *GetWord(), *GetLine(); 231 #endif /* _XtDviP_h */ 232 233 234