-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGlobalParamsGUI.h
338 lines (307 loc) · 13.2 KB
/
GlobalParamsGUI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
//========================================================================
//
// GlobalParamsGUI.h
//
// Copyright 2001-2003 Glyph & Cog, LLC
//
//========================================================================
#ifndef GLOBALPARAMSGUI_H
#define GLOBALPARAMSGUI_H
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include "config.h"
#include <stdio.h>
#include <fontconfig/fontconfig.h>
#include <GlobalParams.h>
#include "goo/gtypes.h"
#include "CharTypes.h"
class GooString;
class GooList;
class GooHash;
class NameToCharCode;
class CharCodeToUnicode;
class CharCodeToUnicodeCache;
class UnicodeMap;
class UnicodeMapCache;
class CMap;
class CMapCache;
struct XpdfSecurityHandler;
class GlobalParamsGUI;
class GfxFont;
//------------------------------------------------------------------------
// The global parameters object.
extern GlobalParamsGUI *globalParamsGUI;
//------------------------------------------------------------------------
class KeyBinding {
public:
int code; // 0x20 .. 0xfe = ASCII,
// >=0x10000 = special keys, mouse buttons,
// etc. (xpdfKeyCode* symbols)
int mods; // modifiers (xpdfKeyMod* symbols, or-ed
// together)
int context; // context (xpdfKeyContext* symbols, or-ed
// together)
GooList *cmds; // list of commands [GooString]
KeyBinding(int codeA, int modsA, int contextA, char *cmd0);
KeyBinding(int codeA, int modsA, int contextA, char *cmd0, char *cmd1);
KeyBinding(int codeA, int modsA, int contextA, GooList *cmdsA);
~KeyBinding();
};
#define xpdfKeyCodeTab 0x1000
#define xpdfKeyCodeReturn 0x1001
#define xpdfKeyCodeEnter 0x1002
#define xpdfKeyCodeBackspace 0x1003
#define xpdfKeyCodeInsert 0x1004
#define xpdfKeyCodeDelete 0x1005
#define xpdfKeyCodeHome 0x1006
#define xpdfKeyCodeEnd 0x1007
#define xpdfKeyCodePgUp 0x1008
#define xpdfKeyCodePgDn 0x1009
#define xpdfKeyCodeLeft 0x100a
#define xpdfKeyCodeRight 0x100b
#define xpdfKeyCodeUp 0x100c
#define xpdfKeyCodeDown 0x100d
#define xpdfKeyCodeF1 0x1100
#define xpdfKeyCodeF35 0x1122
#define xpdfKeyCodeAdd 0x1200
#define xpdfKeyCodeSubtract 0x1201
#define xpdfKeyCodeMousePress1 0x2001
#define xpdfKeyCodeMousePress2 0x2002
#define xpdfKeyCodeMousePress3 0x2003
#define xpdfKeyCodeMousePress4 0x2004
#define xpdfKeyCodeMousePress5 0x2005
#define xpdfKeyCodeMousePress6 0x2006
#define xpdfKeyCodeMousePress7 0x2007
#define xpdfKeyCodeMouseRelease1 0x2101
#define xpdfKeyCodeMouseRelease2 0x2102
#define xpdfKeyCodeMouseRelease3 0x2103
#define xpdfKeyCodeMouseRelease4 0x2104
#define xpdfKeyCodeMouseRelease5 0x2105
#define xpdfKeyCodeMouseRelease6 0x2106
#define xpdfKeyCodeMouseRelease7 0x2107
#define xpdfKeyModNone 0
#define xpdfKeyModShift (1 << 0)
#define xpdfKeyModCtrl (1 << 1)
#define xpdfKeyModAlt (1 << 2)
#define xpdfKeyContextAny 0
#define xpdfKeyContextFullScreen (1 << 0)
#define xpdfKeyContextWindow (2 << 0)
#define xpdfKeyContextContinuous (1 << 2)
#define xpdfKeyContextSinglePage (2 << 2)
#define xpdfKeyContextOverLink (1 << 4)
#define xpdfKeyContextOffLink (2 << 4)
#define xpdfKeyContextOutline (1 << 6)
#define xpdfKeyContextMainWin (2 << 6)
#define xpdfKeyContextScrLockOn (1 << 8)
#define xpdfKeyContextScrLockOff (2 << 8)
//------------------------------------------------------------------------
class GlobalParamsGUI : public GlobalParams {
public:
// Initialize the global parameters by attempting to read a config
// file.
GlobalParamsGUI(char *cfgFileName = NULL);
void parseLine(char *buf, GooString *fileName, int line);
void warnDeprecated(char *option, char *message = NULL);
//----- accessors
GooString *getPSFile();
GBool getPSCrop();
GooString *getInitialZoom();
GBool getContinuousView();
GBool getEnableFreeTypeHinting();
GBool getEnableFreeTypeSlightHinting();
GBool getAntialias();
GBool getVectorAntialias();
GBool getStrokeAdjust();
ScreenType getScreenType();
int getScreenSize();
int getScreenDotRadius();
double getScreenGamma();
double getScreenBlackThreshold();
double getScreenWhiteThreshold();
GooString *getURLCommand() { return urlCommand; }
GooString *getMovieCommand() { return movieCommand; }
GBool getMapNumericCharNames();
GBool getMapUnknownCharNames();
GooList *getKeyBinding(int code, int mods, int context);
GBool getPrintCommands();
GBool getProfileCommands();
GBool getErrQuiet();
CharCodeToUnicode *getCIDToUnicode(GooString *collection);
CharCodeToUnicode *getUnicodeToUnicode(GooString *fontName);
UnicodeMap *getUnicodeMap(GooString *encodingName);
CMap *getCMap(GooString *collection, GooString *cMapName, Stream *stream);
UnicodeMap *getTextEncoding();
//----- functions to set parameters
void addDisplayFont(DisplayFontParam *param);
void setPSFile(char *file);
GBool setPSPaperSize(char *size);
void setPSPaperWidth(int width);
void setPSPaperHeight(int height);
void setPSImageableArea(int llx, int lly, int urx, int ury);
void setPSDuplex(GBool duplex);
void setPSCrop(GBool crop);
void setPSExpandSmaller(GBool expand);
void setPSShrinkLarger(GBool shrink);
void setPSCenter(GBool center);
void setPSLevel(PSLevel level);
void setPSEmbedType1(GBool embed);
void setPSEmbedTrueType(GBool embed);
void setPSEmbedCIDPostScript(GBool embed);
void setPSEmbedCIDTrueType(GBool embed);
void setPSPreload(GBool preload);
void setPSOPI(GBool opi);
void setPSASCIIHex(GBool hex);
void setTextEncoding(char *encodingName);
GBool setTextEOL(char *s);
void setTextPageBreaks(GBool pageBreaks);
void setTextKeepTinyChars(GBool keep);
void setInitialZoom(char *s);
void setContinuousView(GBool cont);
GBool setEnableT1lib(char *s);
GBool setEnableFreeType(char *s);
GBool setEnableFreeTypeHinting(char *s);
GBool setEnableFreeTypeSlightHinting(char *s);
GBool setAntialias(char *s);
GBool setVectorAntialias(char *s);
void setStrokeAdjust(GBool strokeAdjust);
void setScreenType(ScreenType st);
void setScreenSize(int size);
void setScreenDotRadius(int radius);
void setScreenGamma(double gamma);
void setScreenBlackThreshold(double blackThreshold);
void setScreenWhiteThreshold(double whiteThreshold);
void setMapNumericCharNames(GBool map);
void setMapUnknownCharNames(GBool map);
void setPrintCommands(GBool printCommandsA);
void setProfileCommands(GBool profileCommandsA);
void setErrQuiet(GBool errQuietA);
//----- security handlers
void addSecurityHandler(XpdfSecurityHandler *handler);
XpdfSecurityHandler *getSecurityHandler(char *name);
GBool parseYesNo2(char *token, GBool *flag);
private:
void createDefaultKeyBindings();
void parseFile(GooString *fileName, FILE *f);
void parseNameToUnicode(GooList *tokens, GooString *fileName, int line);
void parseNameToUnicode(GooString *name);
void parseCIDToUnicode(GooList *tokens, GooString *fileName, int line);
void parseUnicodeToUnicode(GooList *tokens, GooString *fileName, int line);
void parseUnicodeMap(GooList *tokens, GooString *fileName, int line);
void parseCMapDir(GooList *tokens, GooString *fileName, int line);
void parseToUnicodeDir(GooList *tokens, GooString *fileName, int line);
void parseDisplayFont(GooList *tokens, GooHash *fontHash,
DisplayFontParamKind kind,
GooString *fileName, int line);
void parsePSFile(GooList *tokens, GooString *fileName, int line);
void parsePSPaperSize(GooList *tokens, GooString *fileName, int line);
void parsePSImageableArea(GooList *tokens, GooString *fileName, int line);
void parsePSLevel(GooList *tokens, GooString *fileName, int line);
void parsePSFont(GooList *tokens, GooString *fileName, int line);
void parsePSFont16(char *cmdName, GooList *fontList,
GooList *tokens, GooString *fileName, int line);
void parseTextEncoding(GooList *tokens, GooString *fileName, int line);
void parseTextEOL(GooList *tokens, GooString *fileName, int line);
void parseFontDir(GooList *tokens, GooString *fileName, int line);
void parseInitialZoom(GooList *tokens, GooString *fileName, int line);
void parseScreenType(GooList *tokens, GooString *fileName, int line);
void parseBind(GooList *tokens, GooString *fileName, int line);
void parseUnbind(GooList *tokens, GooString *fileName, int line);
GBool parseKey(GooString *modKeyStr, GooString *contextStr,
int *code, int *mods, int *context,
char *cmdName,
GooList *tokens, GooString *fileName, int line);
void parseCommand(char *cmdName, GooString **val,
GooList *tokens, GooString *fileName, int line);
void parseYesNo(char *cmdName, GBool *flag,
GooList *tokens, GooString *fileName, int line);
void parseInteger(char *cmdName, int *val,
GooList *tokens, GooString *fileName, int line);
void parseFloat(char *cmdName, double *val,
GooList *tokens, GooString *fileName, int line);
UnicodeMap *getUnicodeMap2(GooString *encodingName);
//----- static tables
NameToCharCode * // mapping from char name to
macRomanReverseMap; // MacRomanEncoding index
//----- user-modifiable settings
GooString *baseDir; // base directory - for plugins, etc.
NameToCharCode * // mapping from char name to Unicode
nameToUnicode;
GooHash *cidToUnicodes; // files for mappings from char collections
// to Unicode, indexed by collection name
// [GooString]
GooHash *unicodeToUnicodes; // files for Unicode-to-Unicode mappings,
// indexed by font name pattern [GooString]
GooHash *residentUnicodeMaps; // mappings from Unicode to char codes,
// indexed by encoding name [UnicodeMap]
GooHash *unicodeMaps; // files for mappings from Unicode to char
// codes, indexed by encoding name [GooString]
GooHash *cMapDirs; // list of CMap dirs, indexed by collection
// name [GooList[GooString]]
GooList *toUnicodeDirs; // list of ToUnicode CMap dirs [GooString]
GooHash *displayFonts; // display font info, indexed by font name
// [DisplayFontParam]
GooHash *displayCIDFonts; // display CID font info, indexed by
// collection [DisplayFontParam]
GooHash *displayNamedCIDFonts; // display CID font info, indexed by
// font name [DisplayFontParam]
GooString *psFile; // PostScript file or command (for xpdf)
int psPaperWidth; // paper size, in PostScript points, for
int psPaperHeight; // PostScript output
int psImageableLLX, // imageable area, in PostScript points,
psImageableLLY, // for PostScript output
psImageableURX,
psImageableURY;
GBool psCrop; // crop PS output to CropBox
GBool psExpandSmaller; // expand smaller pages to fill paper
GBool psShrinkLarger; // shrink larger pages to fit paper
GBool psCenter; // center pages on the paper
GBool psDuplex; // enable duplexing in PostScript?
PSLevel psLevel; // PostScript level to generate
GooHash *psFonts; // PostScript font info, indexed by PDF
// font name [PSFontParam16]
GooList *psNamedFonts16; // named 16-bit fonts [PSFontParam16]
GooList *psFonts16; // generic 16-bit fonts [PSFontParam16]
GBool psEmbedType1; // embed Type 1 fonts?
GBool psEmbedTrueType; // embed TrueType fonts?
GBool psEmbedCIDPostScript; // embed CID PostScript fonts?
GBool psEmbedCIDTrueType; // embed CID TrueType fonts?
GBool psPreload; // preload PostScript images and forms into
// memory
GBool psOPI; // generate PostScript OPI comments?
GBool psASCIIHex; // use ASCIIHex instead of ASCII85?
GooString *textEncoding; // encoding (unicodeMap) to use for text
// output
EndOfLineKind textEOL; // type of EOL marker to use for text
// output
GBool textPageBreaks; // insert end-of-page markers?
GBool textKeepTinyChars; // keep all characters in text output
GooList *fontDirs; // list of font dirs [GooString]
GooString *initialZoom; // initial zoom level
GBool continuousView; // continuous view mode
GBool enableFreeTypeHinting; // FreeType hinting enable flag
GBool enableFreeTypeSlightHinting; // FreeType Slight (or Full) hinting enable flag
GBool antialias; // anti-aliasing enable flag
GBool vectorAntialias; // vector anti-aliasing enable flag
GBool strokeAdjust; // stroke adjustment enable flag
ScreenType screenType; // halftone screen type
int screenSize; // screen matrix size
int screenDotRadius; // screen dot radius
double screenGamma; // screen gamma correction
double screenBlackThreshold; // screen black clamping threshold
double screenWhiteThreshold; // screen white clamping threshold
GooString *urlCommand; // command executed for URL links
GooString *movieCommand; // command executed for movie annotations
GBool mapNumericCharNames; // map numeric char names (from font subsets)?
GBool mapUnknownCharNames; // map unknown char names?
GooList *keyBindings; // key & mouse button bindings [KeyBinding]
GBool printCommands; // print the drawing commands
GBool profileCommands; // profile the drawing commands
GBool errQuiet; // suppress error messages?
CharCodeToUnicodeCache *cidToUnicodeCache;
CharCodeToUnicodeCache *unicodeToUnicodeCache;
UnicodeMapCache *unicodeMapCache;
CMapCache *cMapCache;
FcConfig *FCcfg;
};
#endif