]>
Commit | Line | Data |
---|---|---|
9a29912f JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tex2any.h | |
3 | // Purpose: Latex conversion header | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 7.9.93 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include <stdio.h> | |
9a29912f JS |
13 | #include "wx/utils.h" |
14 | #include "wx/list.h" | |
15 | #include "wx/hash.h" | |
6c155d33 | 16 | #include "wx/tokenzr.h" |
9a29912f JS |
17 | #include "wxhlpblk.h" |
18 | ||
19 | /* | |
20 | * Conversion modes | |
21 | * | |
22 | */ | |
23 | ||
24 | #define TEX_RTF 1 | |
25 | #define TEX_XLP 2 | |
26 | #define TEX_HTML 3 | |
27 | ||
28 | /* | |
29 | * We have a list of macro definitions which we must define | |
30 | * in advance to enable the parsing to recognize macros. | |
31 | */ | |
32 | ||
33 | #define FORBID_OK 0 | |
34 | #define FORBID_WARN 1 | |
35 | #define FORBID_ABSOLUTELY 2 | |
36 | ||
1e33e2f3 GT |
37 | |
38 | #ifdef __WXMSW__ | |
dda2e4fd | 39 | const unsigned long MAX_LINE_BUFFER_SIZE = 600; |
1e33e2f3 | 40 | #else |
dda2e4fd | 41 | const unsigned long MAX_LINE_BUFFER_SIZE = 11000; |
1e33e2f3 GT |
42 | #endif |
43 | ||
9a29912f JS |
44 | class TexMacroDef: public wxObject |
45 | { | |
46 | public: | |
47 | int no_args; | |
6c155d33 | 48 | wxChar *name; |
9a29912f JS |
49 | bool ignore; |
50 | int forbidden; | |
51 | int macroId; | |
52 | ||
6c155d33 | 53 | TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel = FORBID_OK); |
9a29912f JS |
54 | ~TexMacroDef(void); |
55 | }; | |
56 | ||
57 | #define CHUNK_TYPE_MACRO 1 | |
58 | #define CHUNK_TYPE_ARG 2 | |
59 | #define CHUNK_TYPE_STRING 3 | |
60 | ||
61 | /* | |
62 | We have nested lists to represent the Tex document. | |
63 | Each element of a list of chunks can be one of: | |
64 | - a plain string | |
65 | - a macro with/without arguments. Arguments are lists of TexChunks. | |
66 | ||
67 | Example (\toplevel is implicit but made explicit here): | |
68 | ||
69 | AddMacroDef(ltMYMAT, "mymat", 2); | |
70 | ||
71 | \toplevel{The cat sat on the \mymat{very coarse and {\it cheap}}{mat}}. | |
72 | ||
73 | Parsed as: | |
74 | ||
75 | TexChunk: type = macro, name = toplevel, no_args = 1 | |
76 | Children: | |
77 | ||
78 | TexChunk: type = argument | |
79 | ||
80 | Children: | |
81 | TexChunk: type = string, value = "The cat sat on the " | |
82 | TexChunk: type = macro, name = mymat, no_args = 2 | |
83 | ||
84 | Children: | |
85 | TexChunk: type = argument | |
86 | ||
87 | Children: | |
88 | TexChunk: type = string, value = "very coarse and " | |
89 | TexChunk: type = macro, name = it, no_args = 1 | |
90 | ||
91 | Children: | |
92 | TexChunk: type = argument | |
93 | ||
94 | Children: | |
95 | TexChunk: type = string, value = "cheap" | |
96 | ||
97 | TexChunk: type = argument | |
98 | ||
99 | Children: | |
100 | TexChunk: type = string, value = mat | |
101 | */ | |
102 | ||
103 | class TexChunk | |
104 | { | |
105 | public: | |
106 | int type; | |
107 | // char *name; | |
108 | TexMacroDef *def; | |
6c155d33 | 109 | wxChar *value; |
9a29912f JS |
110 | int macroId; |
111 | int no_args; | |
112 | int argn; | |
113 | bool optional; // Is an optional argument | |
114 | ||
115 | wxList children; | |
116 | TexChunk(int the_type, TexMacroDef *the_def = NULL); | |
117 | TexChunk(TexChunk& toCopy); | |
118 | virtual ~TexChunk(void); | |
119 | }; | |
120 | ||
121 | // Represents a topic, used for generating a table of contents file (.cnt). | |
122 | // Also for storing keywords found in a topic, a list of which is then inserted | |
123 | // into the topic in the next pass. | |
124 | class TexTopic: public wxObject | |
125 | { | |
126 | public: | |
127 | // This flag is set to indicate that the topic has children. | |
128 | // If this is the case, we know to insert a 'book' icon at this level, | |
129 | // not just a 'page' icon. We don't want to have to open a book only | |
130 | // to find there's only one page in it. We might force a book to be used if | |
131 | // a top-level topic has no children (?) | |
132 | bool hasChildren; | |
6c155d33 | 133 | wxChar *filename; |
9a29912f | 134 | wxStringList *keywords; |
6c155d33 | 135 | TexTopic(wxChar *f = NULL); |
9a29912f JS |
136 | ~TexTopic(void); |
137 | }; | |
138 | extern wxHashTable TopicTable; | |
6c155d33 | 139 | void AddKeyWordForTopic(wxChar *topic, wxChar *entry, wxChar *filename = NULL); |
9a29912f JS |
140 | void ClearKeyWordTable(void); |
141 | ||
6c155d33 | 142 | extern wxChar wxTex2RTFBuffer[]; |
9a29912f JS |
143 | extern TexChunk *TopLevel; |
144 | extern wxHashTable MacroDefs; | |
145 | extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex | |
146 | ||
6c155d33 JS |
147 | bool read_a_line(wxChar *buf); |
148 | bool TexLoadFile(wxChar *filename); | |
149 | int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, | |
b63b07a8 | 150 | wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL); |
6c155d33 | 151 | int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args, |
b63b07a8 | 152 | wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL); |
9a29912f | 153 | void TraverseDocument(void); |
b63b07a8 RL |
154 | void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = false); |
155 | #define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, true) | |
9a29912f JS |
156 | void SetCurrentOutput(FILE *fd); |
157 | void SetCurrentOutputs(FILE *fd1, FILE *fd2); | |
158 | extern FILE *CurrentOutput1; | |
159 | extern FILE *CurrentOutput2; | |
b63b07a8 | 160 | void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = false, bool forbidden = false); |
9a29912f JS |
161 | void TexInitialize(int bufSize); |
162 | void TexCleanUp(void); | |
b63b07a8 | 163 | void TexOutput(const wxChar *s, bool ordinaryText = false); |
6c155d33 JS |
164 | wxChar *GetArgData(TexChunk *chunk); |
165 | wxChar *GetArgData(void); // Get the string for the current argument | |
9a29912f JS |
166 | int GetNoArgs(void); // Get the number of arguments for the current macro |
167 | TexChunk *GetArgChunk(void); // Get the chunk for the current argument | |
168 | TexChunk *GetTopLevelChunk(void); // Get the chunk for the top level | |
169 | TexChunk *GetNextChunk(void); // Look ahead to the next chunk | |
170 | bool IsArgOptional(void); // Is this argument an optional argument? | |
171 | void DefineDefaultMacros(void); // Optional set of default macros | |
172 | int GetCurrentColumn(void); // number of characters on current line | |
6c155d33 | 173 | wxChar *ConvertCase(wxChar *s); // Convert case, according to upperCaseNames setting. |
9a29912f JS |
174 | extern wxPathList TexPathList; // Path list, can be used for file searching. |
175 | ||
2b5f62a0 | 176 | #if !WXWIN_COMPATIBILITY_2 |
b63b07a8 | 177 | extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = true, bool exact = false); |
2b5f62a0 VZ |
178 | #endif |
179 | ||
9a29912f | 180 | // Define a variable value from the .ini file |
b63b07a8 | 181 | wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interactive = true); |
9a29912f JS |
182 | |
183 | // Major document styles | |
184 | #define LATEX_REPORT 1 | |
185 | #define LATEX_ARTICLE 2 | |
186 | #define LATEX_LETTER 3 | |
187 | #define LATEX_BOOK 4 | |
188 | #define LATEX_SLIDES 5 | |
189 | ||
190 | extern TexChunk *DocumentTitle; | |
191 | extern TexChunk *DocumentAuthor; | |
192 | extern TexChunk *DocumentDate; | |
193 | extern int DocumentStyle; | |
194 | extern int MinorDocumentStyle; | |
6c155d33 JS |
195 | extern wxChar *BibliographyStyleString; |
196 | extern wxChar *DocumentStyleString; | |
197 | extern wxChar *MinorDocumentStyleString; | |
9a29912f JS |
198 | |
199 | extern int normalFont; | |
200 | extern int smallFont; | |
201 | extern int tinyFont; | |
202 | extern int largeFont1; | |
203 | extern int LargeFont2; | |
204 | extern int LARGEFont3; | |
205 | extern int hugeFont1; | |
206 | extern int HugeFont2; | |
207 | extern int HUGEFont3; | |
208 | ||
209 | /* | |
210 | * USER-ADJUSTABLE SETTINGS | |
211 | * | |
212 | */ | |
213 | ||
214 | // Section font sizes | |
215 | extern int chapterFont; | |
216 | extern int sectionFont; | |
217 | extern int subsectionFont; | |
218 | extern int titleFont; | |
219 | extern int authorFont; | |
4fe30bce | 220 | extern bool winHelp; // Output in Windows Help format if true, linear otherwise |
9a29912f JS |
221 | extern bool isInteractive; |
222 | extern bool runTwice; | |
223 | extern int convertMode; | |
fad535ee GT |
224 | extern bool checkCurleyBraces; |
225 | extern bool checkSyntax; | |
9a29912f JS |
226 | extern bool stopRunning; |
227 | extern int mirrorMargins; | |
228 | extern bool headerRule; | |
229 | extern bool footerRule; | |
230 | extern int labelIndentTab; // From left indent to item label (points) | |
231 | extern int itemIndentTab; // From left indent to item (points) | |
232 | extern bool useUpButton; | |
233 | extern int htmlBrowseButtons; | |
234 | extern bool useHeadingStyles; // Insert \s1, s2 etc. | |
235 | extern bool useWord; // Insert Word table of contents, etc. etc. | |
236 | extern bool indexSubsections; // put subsections in index | |
237 | extern bool compatibilityMode; | |
238 | extern bool generateHPJ; // Generate WinHelp HPJ file | |
6c155d33 | 239 | extern wxChar *winHelpTitle; // Title for Windows Help file |
9a29912f | 240 | extern int defaultTableColumnWidth; |
6c155d33 | 241 | extern wxChar *bitmapMethod; |
9a29912f JS |
242 | extern bool truncateFilenames; // Truncate for DOS |
243 | extern int winHelpVersion; // Version e.g. 4 for Win95 | |
244 | extern bool winHelpContents; // Generate .cnt file | |
245 | extern bool htmlIndex; // Generate .htx HTML index file | |
246 | extern bool htmlFrameContents; // Use frames for HTML contents page | |
6c155d33 | 247 | extern wxChar *htmlStylesheet; // Use this CSS stylesheet for HTML pages |
9a29912f JS |
248 | extern int contentsDepth; // Depth of contents for linear RTF files |
249 | extern bool upperCaseNames; // Filenames; default is lower case | |
6c155d33 JS |
250 | extern wxChar *backgroundImageString; // HTML background image |
251 | extern wxChar *backgroundColourString; // HTML background colour | |
252 | extern wxChar *textColourString; // HTML text colour | |
253 | extern wxChar *linkColourString; // HTML link colour | |
254 | extern wxChar *followedLinkColourString; // HTML followed link colour | |
9a29912f | 255 | extern bool combineSubSections; // Stop splitting files below section |
14204c7a | 256 | extern bool htmlWorkshopFiles; // generate HTML Help Workshop project files |
bf16085d | 257 | extern bool ignoreBadRefs; // Don't insert (REF NOT FOUND) |
6c155d33 | 258 | extern wxChar *htmlFaceName; // HTML face name |
9a29912f JS |
259 | |
260 | // Names to help with internationalisation | |
6c155d33 JS |
261 | extern wxChar *ContentsNameString; |
262 | extern wxChar *AbstractNameString; | |
263 | extern wxChar *GlossaryNameString; | |
264 | extern wxChar *ReferencesNameString; | |
265 | extern wxChar *FiguresNameString; | |
266 | extern wxChar *TablesNameString; | |
267 | extern wxChar *FigureNameString; | |
268 | extern wxChar *TableNameString; | |
269 | extern wxChar *IndexNameString; | |
270 | extern wxChar *ChapterNameString; | |
271 | extern wxChar *SectionNameString; | |
272 | extern wxChar *SubsectionNameString; | |
273 | extern wxChar *SubsubsectionNameString; | |
274 | extern wxChar *UpNameString; | |
9a29912f JS |
275 | |
276 | /* | |
277 | * HTML button identifiers: what kind of browse buttons | |
278 | * are placed in HTML files, if any. | |
279 | * | |
280 | */ | |
281 | ||
282 | #define HTML_BUTTONS_NONE 0 | |
283 | #define HTML_BUTTONS_BITMAP 1 | |
284 | #define HTML_BUTTONS_TEXT 2 | |
285 | ||
286 | /* | |
287 | * Section numbering | |
288 | * | |
289 | */ | |
290 | ||
291 | extern int chapterNo; | |
292 | extern int sectionNo; | |
293 | extern int subsectionNo; | |
294 | extern int subsubsectionNo; | |
295 | extern int figureNo; | |
296 | extern int tableNo; | |
297 | ||
298 | extern int ParSkip; | |
299 | extern int ParIndent; | |
300 | ||
301 | extern bool isSync; | |
302 | ||
303 | // Set by client and by Tex2Any | |
304 | extern TexChunk *currentSection; | |
305 | ||
306 | // Header/footers/pagestyle | |
307 | extern TexChunk * LeftHeaderOdd; | |
308 | extern TexChunk * LeftFooterOdd; | |
309 | extern TexChunk * CentreHeaderOdd; | |
310 | extern TexChunk * CentreFooterOdd; | |
311 | extern TexChunk * RightHeaderOdd; | |
312 | extern TexChunk * RightFooterOdd; | |
313 | extern TexChunk * LeftHeaderEven; | |
314 | extern TexChunk * LeftFooterEven; | |
315 | extern TexChunk * CentreHeaderEven; | |
316 | extern TexChunk * CentreFooterEven; | |
317 | extern TexChunk * RightHeaderEven; | |
318 | extern TexChunk * RightFooterEven; | |
6c155d33 | 319 | extern wxChar * PageStyle; |
9a29912f JS |
320 | |
321 | // Repeat the currentSection, either real (Chapter) or simulated (References) | |
322 | extern void OutputCurrentSection(void); | |
6c155d33 JS |
323 | extern void OutputCurrentSectionToString(wxChar *buf); |
324 | extern void OutputChunkToString(TexChunk *chunk, wxChar *buf); | |
9a29912f JS |
325 | |
326 | // Called by Tex2Any to simulate a section | |
b63b07a8 | 327 | extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = true); |
9a29912f JS |
328 | |
329 | /* | |
330 | * Local to Tex2Any library | |
331 | * | |
332 | */ | |
333 | ||
6c155d33 | 334 | extern wxChar *currentArgData; |
4fe30bce | 335 | extern bool haveArgData; // If true, we're simulating the data. |
6c155d33 | 336 | void StartSimulateArgument(wxChar *data); |
9a29912f JS |
337 | void EndSimulateArgument(void); |
338 | ||
339 | /* | |
340 | * Client-defined | |
341 | * | |
342 | */ | |
343 | ||
344 | // Called on start/end of macro examination | |
345 | void OnMacro(int macroId, int no_args, bool start); | |
346 | ||
347 | // Called on start/end of argument examination. | |
4fe30bce | 348 | // Return true at the start of an argument to traverse |
9a29912f JS |
349 | // (output) the argument. |
350 | bool OnArgument(int macroId, int arg_no, bool start); | |
351 | ||
352 | // Default: library-defined | |
353 | void DefaultOnMacro(int macroId, int no_args, bool start); | |
354 | ||
355 | // Default: library-defined | |
356 | bool DefaultOnArgument(int macroId, int arg_no, bool start); | |
357 | ||
358 | // Called on error | |
6c155d33 | 359 | void OnError(const wxChar *msg); |
9a29912f JS |
360 | |
361 | // Called for information | |
6c155d33 | 362 | void OnInform(const wxChar *msg); |
9a29912f JS |
363 | |
364 | // Special yield wrapper | |
b63b07a8 | 365 | void Tex2RTFYield(bool force = false); |
9a29912f JS |
366 | |
367 | /* | |
368 | * Useful utilities | |
369 | * | |
370 | */ | |
371 | ||
372 | // Look for \label macro, use this ref name if found or | |
373 | // make up a topic name otherwise. | |
6c155d33 | 374 | wxChar *FindTopicName(TexChunk *chunk); |
9a29912f | 375 | // Force the current topic to be this (e.g. force 'references' label). |
6c155d33 | 376 | void ForceTopicName(const wxChar *name); |
9a29912f JS |
377 | void ResetTopicCounter(void); |
378 | ||
379 | // Parse unit eg. 14, 12pt, 34cm and return value in points. | |
6c155d33 | 380 | int ParseUnitArgument(wxChar *unitArg); |
9a29912f JS |
381 | |
382 | // Set small, large, normal etc. point sizes for reference size | |
383 | void SetFontSizes(int pointSize); | |
384 | ||
385 | /* | |
386 | * Strip off any extension (dot something) from end of file, | |
387 | * IF one exists. Inserts zero into buffer. | |
388 | * | |
389 | */ | |
390 | ||
6c155d33 | 391 | void StripExtension(wxChar *buffer); |
9a29912f JS |
392 | |
393 | /* | |
394 | * Reference structure | |
395 | * | |
396 | */ | |
397 | ||
398 | class TexRef: public wxObject | |
399 | { | |
400 | public: | |
6c155d33 JS |
401 | wxChar *refLabel; // Reference label |
402 | wxChar *refFile; // Reference filename (can be NULL) | |
403 | wxChar *sectionNumber; // Section or figure number (as a string) | |
404 | wxChar *sectionName; // name e.g. 'section' | |
405 | TexRef(const wxChar *label, const wxChar *file, const wxChar *section, const wxChar *sectionN = NULL); | |
3924dd22 | 406 | ~TexRef(void); |
9a29912f JS |
407 | }; |
408 | ||
9a29912f JS |
409 | /* |
410 | * Add a reference | |
411 | * | |
412 | */ | |
413 | ||
6c155d33 | 414 | void AddTexRef(wxChar *name, wxChar *file = NULL, wxChar *sectionName = NULL, |
9a29912f JS |
415 | int chapter = 0, int section = 0, int subsection = 0, int subsubsection = 0); |
416 | ||
417 | /* | |
418 | * Read and write reference file (.ref), to resolve refs for second pass. | |
419 | * | |
420 | */ | |
6c155d33 JS |
421 | void WriteTexReferences(wxChar *filename); |
422 | void ReadTexReferences(wxChar *filename); | |
9a29912f JS |
423 | |
424 | /* | |
425 | * Bibliography stuff | |
426 | * | |
427 | */ | |
428 | ||
429 | class BibEntry: public wxObject | |
430 | { | |
431 | public: | |
6c155d33 | 432 | wxChar *key; |
9a29912f JS |
433 | |
434 | /* | |
435 | * book, inbook, article, phdthesis, inproceedings, techreport | |
436 | */ | |
6c155d33 | 437 | wxChar *type; |
9a29912f JS |
438 | |
439 | /* | |
440 | * Possible fields | |
441 | * | |
442 | */ | |
6c155d33 JS |
443 | wxChar *editor; |
444 | wxChar *title; | |
445 | wxChar *booktitle; | |
446 | wxChar *author; | |
447 | wxChar *journal; | |
448 | wxChar *volume; | |
449 | wxChar *number; | |
450 | wxChar *year; | |
451 | wxChar *month; | |
452 | wxChar *pages; | |
453 | wxChar *chapter; | |
454 | wxChar *publisher; | |
455 | wxChar *address; | |
456 | wxChar *institution; | |
457 | wxChar *organization; | |
458 | wxChar *comment; | |
9a29912f JS |
459 | |
460 | inline BibEntry(void) | |
461 | { | |
462 | key = NULL; | |
463 | type = NULL; | |
464 | editor = NULL; | |
465 | title = NULL; | |
466 | booktitle = NULL; | |
467 | author = NULL; | |
468 | journal = NULL; | |
469 | volume = NULL; | |
470 | number = NULL; | |
471 | chapter = NULL; | |
472 | year = NULL; | |
473 | month = NULL; | |
474 | pages = NULL; | |
475 | publisher = NULL; | |
476 | address = NULL; | |
477 | institution = NULL; | |
478 | organization = NULL; | |
479 | comment = NULL; | |
480 | } | |
481 | }; | |
482 | ||
483 | extern wxList BibList; | |
484 | extern wxStringList CitationList; | |
485 | ||
6c155d33 | 486 | bool ReadBib(wxChar *filename); |
9a29912f JS |
487 | void OutputBib(void); |
488 | void ResolveBibReferences(void); | |
6c155d33 JS |
489 | void AddCitation(wxChar *citeKey); |
490 | TexRef *FindReference(wxChar *key); | |
9a29912f JS |
491 | |
492 | /* | |
493 | * Ability to customize, or at least suppress unknown macro errors | |
494 | * | |
495 | */ | |
496 | ||
497 | extern wxList CustomMacroList; | |
498 | ||
499 | #define CUSTOM_MACRO_IGNORE 0 | |
500 | #define CUSTOM_MACRO_OUTPUT 1 | |
501 | #define CUSTOM_MACRO_MARK 2 | |
502 | ||
503 | class CustomMacro: public wxObject | |
504 | { | |
505 | public: | |
6c155d33 JS |
506 | wxChar *macroName; |
507 | wxChar *macroBody; | |
9a29912f | 508 | int noArgs; |
6c155d33 | 509 | inline CustomMacro(wxChar *name, int args, wxChar *body) |
9a29912f JS |
510 | { |
511 | noArgs = args; | |
6c155d33 | 512 | macroName = wxStrcpy(new wxChar[wxStrlen(name) + 1], name); |
9a29912f | 513 | if (body) |
6c155d33 | 514 | macroBody = wxStrcpy(new wxChar[wxStrlen(body) + 1], body); |
9a29912f JS |
515 | else |
516 | macroBody = NULL; | |
517 | } | |
3924dd22 | 518 | ~CustomMacro(); |
9a29912f JS |
519 | }; |
520 | ||
6c155d33 | 521 | bool ReadCustomMacros(wxChar *filename); |
9a29912f | 522 | void ShowCustomMacros(void); |
6c155d33 JS |
523 | CustomMacro *FindCustomMacro(wxChar *name); |
524 | wxChar *ParseMultifieldString(wxChar *s, int *pos); | |
9a29912f JS |
525 | |
526 | /* | |
527 | * Colour table stuff | |
528 | * | |
529 | */ | |
530 | ||
531 | class ColourTableEntry: public wxObject | |
532 | { | |
533 | public: | |
6c155d33 | 534 | wxChar *name; |
9a29912f JS |
535 | unsigned int red; |
536 | unsigned int green; | |
537 | unsigned int blue; | |
538 | ||
6c155d33 | 539 | ColourTableEntry(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b); |
9a29912f JS |
540 | ~ColourTableEntry(void); |
541 | }; | |
542 | ||
543 | extern wxList ColourTable; | |
6c155d33 JS |
544 | extern void AddColour(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b); |
545 | extern int FindColourPosition(wxChar *theName); | |
9a29912f | 546 | // Converts e.g. "red" -> "#FF0000" |
6c155d33 | 547 | extern bool FindColourHTMLString(wxChar *theName, wxChar *buf); |
9a29912f JS |
548 | extern void InitialiseColourTable(void); |
549 | ||
550 | #define ltABSTRACT 1 | |
551 | #define ltADDCONTENTSLINE 2 | |
552 | #define ltADDTOCOUNTER 3 | |
553 | #define ltALPH1 4 | |
554 | #define ltALPH2 5 | |
555 | #define ltAPPENDIX 6 | |
556 | #define ltARABIC 7 | |
557 | #define ltARRAY 8 | |
558 | #define ltAUTHOR 9 | |
559 | ||
560 | #define ltBACKSLASH 30 | |
561 | #define ltBASELINESKIP 31 | |
562 | #define ltBF 32 | |
563 | #define ltBIBITEM 33 | |
564 | #define ltBIBLIOGRAPHYSTYLE 34 | |
565 | #define ltBIBLIOGRAPHY 35 | |
566 | #define ltBOXIT 36 | |
567 | #define ltBACKSLASHRAW 37 | |
568 | #define ltBACKGROUND 38 | |
569 | #define ltBACKGROUNDCOLOUR 39 | |
570 | #define ltBACKGROUNDIMAGE 40 | |
571 | #define ltBRCLEAR 41 | |
572 | ||
573 | #define ltCAPTIONSTAR 50 | |
574 | #define ltCAPTION 51 | |
575 | #define ltCDOTS 52 | |
576 | #define ltCENTERLINE 53 | |
577 | #define ltCENTERING 54 | |
578 | #define ltCENTER 55 | |
579 | #define ltCEXTRACT 56 | |
580 | #define ltCHAPTERHEADING 57 | |
581 | #define ltCHAPTERSTAR 58 | |
582 | #define ltCHAPTER 59 | |
583 | #define ltCINSERT 60 | |
584 | #define ltCITE 61 | |
585 | #define ltCLASS 62 | |
586 | #define ltCLEARDOUBLEPAGE 63 | |
587 | #define ltCLEARPAGE 64 | |
588 | #define ltCLINE 65 | |
589 | #define ltCLIPSFUNC 66 | |
590 | #define ltCOLUMNSEP 67 | |
591 | #define ltCOMMENT 68 | |
592 | #define ltCOPYRIGHT 69 | |
593 | #define ltCPARAM 70 | |
594 | ||
595 | #define ltCHEAD 71 | |
596 | #define ltCFOOT 72 | |
597 | ||
598 | #define ltCHAPTERHEADINGSTAR 73 | |
599 | ||
600 | #define ltDATE 90 | |
601 | #define ltDESCRIPTION 91 | |
602 | #define ltDESTRUCT 92 | |
603 | #define ltDOCUMENTSTYLE 93 | |
604 | #define ltDOCUMENT 94 | |
605 | #define ltDOUBLESPACE 95 | |
606 | #define ltDEFINECOLOUR 96 | |
607 | #define ltDEFINECOLOR 97 | |
608 | ||
609 | #define ltEM 120 | |
610 | #define ltENUMERATE 121 | |
611 | #define ltEQUATION 122 | |
612 | #define ltEVENSIDEMARGIN 123 | |
613 | ||
614 | #define ltFBOX 150 | |
615 | #define ltFIGURE 151 | |
616 | #define ltFLUSHLEFT 152 | |
617 | #define ltFLUSHRIGHT 153 | |
618 | #define ltFOOTHEIGHT 154 | |
619 | #define ltFOOTNOTE 155 | |
620 | #define ltFOOTSKIP 156 | |
621 | #define ltFRAMEBOX 157 | |
622 | #define ltFUNCTIONSECTION 158 | |
623 | #define ltFUNC 159 | |
624 | #define ltFIGURESTAR 160 | |
625 | #define ltFOOTNOTESIZE 161 | |
626 | #define ltFOOTNOTEPOPUP 162 | |
627 | #define ltFANCYPLAIN 163 | |
628 | #define ltFCOL 164 | |
629 | #define ltBCOL 165 | |
630 | #define ltFOLLOWEDLINKCOLOUR 166 | |
631 | ||
632 | #define ltGLOSSARY 180 | |
633 | #define ltGLOSS 181 | |
634 | ||
635 | #define ltHEADHEIGHT 200 | |
636 | #define ltHELPGLOSSARY 201 | |
637 | #define ltHELPIGNORE 202 | |
638 | #define ltHELPONLY 203 | |
639 | #define ltHELPINPUT 204 | |
640 | #define ltHELPFONTFAMILY 205 | |
641 | #define ltHELPFONTSIZE 206 | |
642 | #define ltHELPREFN 207 | |
643 | #define ltHELPREF 208 | |
644 | #define ltHFILL 209 | |
645 | #define ltHLINE 210 | |
646 | #define ltHRULE 211 | |
647 | #define ltHSPACESTAR 212 | |
648 | #define ltHSPACE 213 | |
649 | #define ltHSKIPSTAR 214 | |
650 | #define ltHSKIP 215 | |
651 | #define lthuge 216 | |
652 | #define ltHuge 217 | |
653 | #define ltHUGE 218 | |
654 | #define ltHTMLIGNORE 219 | |
655 | #define ltHTMLONLY 220 | |
656 | ||
657 | #define ltINCLUDEONLY 240 | |
658 | #define ltINCLUDE 241 | |
659 | #define ltINDEX 242 | |
660 | #define ltINPUT 243 | |
661 | #define ltITEMIZE 244 | |
662 | #define ltITEM 245 | |
663 | #define ltIMAGE 246 | |
664 | #define ltIT 247 | |
665 | #define ltITEMSEP 248 | |
666 | #define ltINDENTED 249 | |
667 | #define ltIMAGEMAP 250 | |
668 | #define ltIMAGER 251 | |
669 | #define ltIMAGEL 252 | |
670 | #define ltINSERTATLEVEL 253 | |
671 | ||
672 | #define ltKILL 260 | |
673 | ||
674 | #define ltLABEL 280 | |
675 | #define ltlarge 281 | |
676 | #define ltLarge 282 | |
677 | #define ltLARGE 283 | |
678 | #define ltLATEX 284 | |
679 | #define ltLBOX 285 | |
680 | #define ltLDOTS 286 | |
681 | #define ltLINEBREAK 287 | |
682 | #define ltLISTOFFIGURES 288 | |
683 | #define ltLISTOFTABLES 289 | |
684 | #define ltLHEAD 290 | |
685 | #define ltLFOOT 291 | |
686 | #define ltLATEXIGNORE 292 | |
687 | #define ltLATEXONLY 293 | |
688 | #define ltLOWERCASE 294 | |
689 | #define ltLBRACERAW 295 | |
690 | #define ltLINKCOLOUR 296 | |
691 | ||
692 | #define ltMAKEGLOSSARY 300 | |
693 | #define ltMAKEINDEX 301 | |
694 | #define ltMAKETITLE 302 | |
695 | #define ltMARKRIGHT 303 | |
696 | #define ltMARKBOTH 304 | |
697 | #define ltMARGINPARWIDTH 305 | |
698 | #define ltMARGINPAR 306 | |
699 | #define ltMARGINPARODD 307 | |
700 | #define ltMARGINPAREVEN 308 | |
701 | #define ltMBOX 309 | |
702 | #define ltMEMBERSECTION 310 | |
703 | #define ltMEMBER 311 | |
704 | #define ltMULTICOLUMN 312 | |
705 | #define ltMARGINPARSEP 313 | |
706 | ||
707 | #define ltNEWCOUNTER 330 | |
708 | #define ltNEWLINE 331 | |
709 | #define ltNEWPAGE 332 | |
710 | #define ltNOCITE 333 | |
711 | #define ltNOINDENT 334 | |
712 | #define ltNOLINEBREAK 335 | |
713 | #define ltNOPAGEBREAK 336 | |
714 | #define ltNORMALSIZE 337 | |
715 | #define ltNORMALBOX 338 | |
716 | #define ltNORMALBOXD 339 | |
717 | #define ltNUMBEREDBIBITEM 340 | |
718 | ||
719 | #define ltONECOLUMN 360 | |
720 | #define ltODDSIDEMARGIN 361 | |
721 | ||
722 | #define ltPAGEBREAK 380 | |
723 | #define ltPAGEREF 381 | |
724 | #define ltPAGESTYLE 382 | |
725 | #define ltPAGENUMBERING 383 | |
726 | #define ltPARAGRAPHSTAR 384 | |
727 | #define ltPARAGRAPH 385 | |
728 | #define ltPARAM 386 | |
729 | #define ltPARINDENT 387 | |
730 | #define ltPARSKIP 388 | |
731 | #define ltPARTSTAR 389 | |
732 | #define ltPART 390 | |
733 | #define ltPAR 391 | |
734 | #define ltPFUNC 392 | |
735 | #define ltPICTURE 393 | |
736 | #define ltPOPREF 394 | |
737 | #define ltPOUNDS 395 | |
738 | #define ltPRINTINDEX 396 | |
739 | #define ltPSBOXTO 397 | |
740 | #define ltPSBOX 398 | |
741 | #define ltPOPREFONLY 399 | |
742 | ||
743 | #define ltQUOTE 420 | |
744 | #define ltQUOTATION 421 | |
745 | ||
746 | #define ltRAGGEDBOTTOM 440 | |
747 | #define ltRAGGEDLEFT 441 | |
748 | #define ltRAGGEDRIGHT 442 | |
749 | #define ltREF 443 | |
750 | #define ltRM 444 | |
751 | #define ltROMAN 445 | |
752 | #define ltROMAN2 446 | |
753 | #define ltRTFSP 447 | |
754 | #define ltRULE 448 | |
755 | #define ltRULEDROW 449 | |
756 | #define ltDRULED 450 | |
757 | #define ltRHEAD 451 | |
758 | #define ltRFOOT 452 | |
759 | #define ltROW 453 | |
760 | #define ltRTFIGNORE 454 | |
761 | #define ltRTFONLY 455 | |
762 | #define ltRBRACERAW 456 | |
763 | #define ltREGISTERED 457 | |
764 | ||
765 | #define ltSC 470 | |
766 | #define ltSECTIONHEADING 471 | |
767 | #define ltSECTIONSTAR 472 | |
768 | #define ltSECTION 473 | |
769 | #define ltSETCOUNTER 474 | |
770 | #define ltSF 475 | |
771 | #define ltSHORTCITE 476 | |
772 | #define ltSINGLESPACE 477 | |
773 | #define ltSLOPPYPAR 478 | |
774 | #define ltSLOPPY 479 | |
775 | #define ltSL 480 | |
776 | #define ltSMALL 481 | |
777 | #define ltSUBITEM 482 | |
778 | #define ltSUBPARAGRAPHSTAR 483 | |
779 | #define ltSUBPARAGRAPH 484 | |
780 | #define ltSPECIAL 485 | |
781 | #define ltSUBSECTIONSTAR 486 | |
782 | #define ltSUBSECTION 487 | |
783 | #define ltSUBSUBSECTIONSTAR 488 | |
784 | #define ltSUBSUBSECTION 489 | |
785 | #define ltSCRIPTSIZE 490 | |
786 | #define ltSETHEADER 491 | |
787 | #define ltSETFOOTER 492 | |
788 | #define ltSIZEDBOX 493 | |
789 | #define ltSIZEDBOXD 494 | |
790 | #define ltSECTIONHEADINGSTAR 495 | |
791 | #define ltSS 496 | |
792 | #define ltSETHOTSPOTCOLOUR 497 | |
793 | #define ltSETHOTSPOTCOLOR 498 | |
794 | #define ltSETHOTSPOTUNDERLINE 499 | |
795 | #define ltSETTRANSPARENCY 500 | |
796 | ||
797 | #define ltTABBING 510 | |
798 | #define ltTABLEOFCONTENTS 511 | |
799 | #define ltTABLE 512 | |
800 | #define ltTABULAR 513 | |
801 | #define ltTAB 514 | |
802 | #define ltTEX 515 | |
803 | #define ltTEXTWIDTH 516 | |
804 | #define ltTEXTHEIGHT 517 | |
805 | #define ltTHEBIBLIOGRAPHY 518 | |
806 | #define ltTITLEPAGE 519 | |
807 | #define ltTITLE 520 | |
808 | #define ltTINY 521 | |
809 | #define ltTODAY 522 | |
810 | #define ltTOPMARGIN 523 | |
811 | #define ltTOPSKIP 524 | |
812 | #define ltTT 525 | |
813 | #define ltTYPEIN 526 | |
814 | #define ltTYPEOUT 527 | |
815 | #define ltTWOCOLUMN 528 | |
816 | #define ltTHEPAGE 529 | |
817 | #define ltTHECHAPTER 530 | |
818 | #define ltTHESECTION 531 | |
819 | #define ltTHISPAGESTYLE 532 | |
820 | ||
821 | #define ltTWOCOLWIDTHA 533 | |
822 | #define ltTWOCOLWIDTHB 534 | |
823 | #define ltTWOCOLSPACING 535 | |
824 | #define ltTWOCOLITEM 536 | |
825 | #define ltTWOCOLITEMRULED 537 | |
826 | #define ltTWOCOLLIST 538 | |
827 | #define ltTEXTCOLOUR 539 | |
828 | ||
829 | #define ltUNDERLINE 550 | |
830 | #define ltURLREF 551 | |
831 | #define ltUPPERCASE 552 | |
832 | #define ltUSEPACKAGE 553 | |
833 | ||
834 | #define ltVDOTS 570 | |
835 | #define ltVERBATIMINPUT 571 | |
836 | #define ltVERBATIM 572 | |
837 | #define ltVERB 573 | |
838 | #define ltVERSE 574 | |
839 | #define ltVFILL 575 | |
840 | #define ltVLINE 576 | |
841 | #define ltVOID 577 | |
842 | #define ltVRULE 578 | |
843 | #define ltVSPACESTAR 579 | |
844 | #define ltVSKIPSTAR 580 | |
845 | #define ltVSPACE 581 | |
846 | #define ltVSKIP 582 | |
847 | #define ltVERBSTAR 583 | |
848 | ||
849 | #define ltWXCLIPS 600 | |
850 | #define ltWINHELPIGNORE 601 | |
851 | #define ltWINHELPONLY 602 | |
852 | ||
853 | #define ltXLPIGNORE 603 | |
854 | #define ltXLPONLY 604 | |
855 | ||
856 | #define ltSPACE 620 | |
857 | #define ltBACKSLASHCHAR 621 | |
858 | #define ltPIPE 622 | |
859 | #define ltFORWARDSLASH 623 | |
860 | #define ltUNDERSCORE 624 | |
861 | #define ltAMPERSAND 625 | |
862 | #define ltPERCENT 626 | |
863 | #define ltDOLLAR 627 | |
864 | #define ltHASH 628 | |
865 | #define ltLPARENTH 629 | |
866 | #define ltRPARENTH 630 | |
867 | #define ltLBRACE 631 | |
868 | #define ltRBRACE 632 | |
869 | #define ltEQUALS 633 | |
870 | #define ltRANGLEBRA 634 | |
871 | #define ltLANGLEBRA 635 | |
872 | #define ltPLUS 636 | |
873 | #define ltDASH 637 | |
874 | #define ltSINGLEQUOTE 638 | |
875 | #define ltBACKQUOTE 639 | |
876 | #define ltTILDE 640 | |
877 | #define ltAT_SYMBOL 641 | |
878 | ||
879 | // Characters, not macros but with special Latex significance | |
880 | #define ltSPECIALDOLLAR 660 | |
881 | #define ltSPECIALDOUBLEDOLLAR 661 | |
882 | #define ltSPECIALTILDE 662 | |
883 | #define ltSPECIALHASH 663 | |
884 | #define ltSPECIALAMPERSAND 664 | |
885 | #define ltSUPERTABULAR 665 | |
886 | ||
887 | // Accents | |
888 | #define ltACCENT_GRAVE 700 | |
889 | #define ltACCENT_ACUTE 701 | |
890 | #define ltACCENT_CARET 702 | |
891 | #define ltACCENT_UMLAUT 703 | |
892 | #define ltACCENT_TILDE 704 | |
893 | #define ltACCENT_DOT 705 | |
894 | #define ltACCENT_CADILLA 706 | |
895 | ||
896 | // Symbols | |
897 | #define ltALPHA 800 | |
898 | #define ltBETA 801 | |
899 | #define ltGAMMA 802 | |
900 | #define ltDELTA 803 | |
901 | #define ltEPSILON 804 | |
902 | #define ltVAREPSILON 805 | |
903 | #define ltZETA 806 | |
904 | #define ltETA 807 | |
905 | #define ltTHETA 808 | |
906 | #define ltVARTHETA 809 | |
907 | #define ltIOTA 810 | |
908 | #define ltKAPPA 811 | |
909 | #define ltLAMBDA 812 | |
910 | #define ltMU 813 | |
911 | #define ltNU 814 | |
912 | #define ltXI 815 | |
913 | #define ltPI 816 | |
914 | #define ltVARPI 817 | |
915 | #define ltRHO 818 | |
916 | #define ltVARRHO 819 | |
917 | #define ltSIGMA 820 | |
918 | #define ltVARSIGMA 821 | |
919 | #define ltTAU 822 | |
920 | #define ltUPSILON 823 | |
921 | #define ltPHI 824 | |
922 | #define ltVARPHI 825 | |
923 | #define ltCHI 826 | |
924 | #define ltPSI 827 | |
925 | #define ltOMEGA 828 | |
926 | ||
927 | #define ltCAP_GAMMA 830 | |
928 | #define ltCAP_DELTA 831 | |
929 | #define ltCAP_THETA 832 | |
930 | #define ltCAP_LAMBDA 833 | |
931 | #define ltCAP_XI 834 | |
932 | #define ltCAP_PI 835 | |
933 | #define ltCAP_SIGMA 836 | |
934 | #define ltCAP_UPSILON 837 | |
935 | #define ltCAP_PHI 838 | |
936 | #define ltCAP_PSI 839 | |
937 | #define ltCAP_OMEGA 840 | |
938 | ||
939 | // Binary operation symbols | |
940 | #define ltLE 850 | |
941 | #define ltLEQ 851 | |
942 | #define ltLL 852 | |
943 | #define ltSUBSET 853 | |
944 | #define ltSUBSETEQ 854 | |
945 | #define ltSQSUBSET 855 | |
946 | #define ltSQSUBSETEQ 856 | |
947 | #define ltIN 857 | |
948 | #define ltVDASH 858 | |
949 | #define ltMODELS 859 | |
950 | #define ltGE 860 | |
951 | #define ltGEQ 861 | |
952 | #define ltGG 862 | |
953 | #define ltSUPSET 863 | |
954 | #define ltSUPSETEQ 864 | |
955 | #define ltSQSUPSET 865 | |
956 | #define ltSQSUPSETEQ 866 | |
957 | #define ltNI 867 | |
958 | #define ltDASHV 868 | |
959 | #define ltPERP 869 | |
960 | #define ltNEQ 870 | |
961 | #define ltDOTEQ 871 | |
962 | #define ltAPPROX 872 | |
963 | #define ltCONG 873 | |
964 | #define ltEQUIV 874 | |
965 | #define ltPROPTO 875 | |
966 | #define ltPREC 876 | |
967 | #define ltPRECEQ 877 | |
968 | #define ltPARALLEL 878 | |
969 | #define ltSIM 879 | |
970 | #define ltSIMEQ 880 | |
971 | #define ltASYMP 881 | |
972 | #define ltSMILE 882 | |
973 | #define ltFROWN 883 | |
974 | #define ltBOWTIE 884 | |
975 | #define ltSUCC 885 | |
976 | #define ltSUCCEQ 886 | |
977 | #define ltMID 887 | |
978 | ||
979 | // Negated relation symbols (selected) | |
980 | #define ltNOTEQ 890 | |
981 | #define ltNOTIN 891 | |
982 | #define ltNOTSUBSET 892 | |
983 | ||
984 | // Arrows | |
985 | #define ltLEFTARROW 900 | |
986 | #define ltLEFTARROW2 901 | |
987 | #define ltRIGHTARROW 902 | |
988 | #define ltRIGHTARROW2 903 | |
989 | #define ltLEFTRIGHTARROW 904 | |
990 | #define ltLEFTRIGHTARROW2 905 | |
991 | #define ltUPARROW 906 | |
992 | #define ltUPARROW2 907 | |
993 | #define ltDOWNARROW 908 | |
994 | #define ltDOWNARROW2 909 | |
995 | ||
996 | // Miscellaneous symbols | |
997 | #define ltALEPH 1000 | |
998 | #define ltWP 1001 | |
999 | #define ltRE 1002 | |
1000 | #define ltIM 1003 | |
1001 | #define ltEMPTYSET 1004 | |
1002 | #define ltNABLA 1005 | |
1003 | #define ltSURD 1006 | |
1004 | #define ltPARTIAL 1007 | |
1005 | #define ltBOT 1008 | |
1006 | #define ltFORALL 1009 | |
1007 | #define ltEXISTS 1010 | |
1008 | #define ltNEG 1011 | |
1009 | #define ltSHARP 1012 | |
1010 | #define ltANGLE 1013 | |
1011 | #define ltTRIANGLE 1014 | |
1012 | #define ltCLUBSUIT 1015 | |
1013 | #define ltDIAMONDSUIT 1016 | |
1014 | #define ltHEARTSUIT 1017 | |
1015 | #define ltSPADESUIT 1018 | |
1016 | #define ltINFTY 1019 | |
1017 | ||
1018 | // Binary operation symbols | |
1019 | #define ltPM 1030 | |
1020 | #define ltMP 1031 | |
1021 | #define ltTIMES 1032 | |
1022 | #define ltDIV 1033 | |
1023 | #define ltCDOT 1034 | |
1024 | #define ltAST 1035 | |
1025 | #define ltSTAR 1036 | |
1026 | #define ltCAP 1037 | |
1027 | #define ltCUP 1038 | |
1028 | #define ltVEE 1039 | |
1029 | #define ltWEDGE 1040 | |
1030 | #define ltCIRC 1041 | |
1031 | #define ltBULLET 1042 | |
1032 | #define ltDIAMOND 1043 | |
1033 | #define ltOSLASH 1044 | |
1034 | #define ltBOX 1045 | |
1035 | #define ltDIAMOND2 1046 | |
1036 | #define ltBIGTRIANGLEDOWN 1047 | |
1037 | #define ltOPLUS 1048 | |
1038 | #define ltOTIMES 1049 | |
1039 | ||
1040 | // Latex2e commands | |
1041 | #define ltRMFAMILY 1200 | |
1042 | #define ltSFFAMILY 1201 | |
1043 | #define ltTTFAMILY 1202 | |
1044 | #define ltBFSERIES 1203 | |
1045 | #define ltITSHAPE 1204 | |
1046 | #define ltSLSHAPE 1205 | |
1047 | #define ltSCSHAPE 1206 | |
1048 | ||
1049 | #define ltMDSERIES 1207 | |
1050 | #define ltUPSHAPE 1208 | |
1051 | ||
1052 | #define ltTEXTRM 1209 | |
1053 | #define ltTEXTSF 1210 | |
1054 | #define ltTEXTTT 1211 | |
1055 | #define ltTEXTBF 1212 | |
1056 | #define ltTEXTIT 1213 | |
1057 | #define ltTEXTSL 1214 | |
1058 | #define ltTEXTSC 1215 | |
1059 | #define ltEMPH 1216 | |
1060 | ||
1061 | #define ltDOCUMENTCLASS 1217 | |
1062 | ||
1063 | // Space macros | |
1064 | #define ltSMALLSPACE1 1250 | |
1065 | #define ltSMALLSPACE2 1251 | |
1066 | ||
1067 | // Pseudo-macros | |
1068 | #define ltTOPLEVEL 15000 | |
1069 | #define ltCUSTOM_MACRO 15001 | |
1070 | #define ltSOLO_BLOCK 15002 | |
1071 | ||
1072 | ||
1073 |