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