⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tex2any.h

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 H
📖 第 1 页 / 共 3 页
字号:
/////////////////////////////////////////////////////////////////////////////// Name:        tex2any.h// Purpose:     Latex conversion header// Author:      Julian Smart// Modified by:// Created:     7.9.93// RCS-ID:      $Id: tex2any.h,v 1.23 2006/09/05 20:44:44 VZ Exp $// Copyright:   (c) Julian Smart// Licence:     wxWindows licence/////////////////////////////////////////////////////////////////////////////#include <stdio.h>#include "wx/utils.h"#include "wx/list.h"#include "wx/hash.h"#include "wx/tokenzr.h"#include "wx/wfstream.h"#include "wx/txtstrm.h"#include "wxhlpblk.h"/* * Conversion modes * */#define TEX_RTF  1#define TEX_XLP  2#define TEX_HTML 3/* * We have a list of macro definitions which we must define * in advance to enable the parsing to recognize macros. */#define FORBID_OK         0#define FORBID_WARN       1#define FORBID_ABSOLUTELY 2#ifdef __WXMSW__  const unsigned long MAX_LINE_BUFFER_SIZE = 600;#else  const unsigned long MAX_LINE_BUFFER_SIZE = 11000;#endifclass TexMacroDef: public wxObject{ public:  int no_args;  wxChar *name;  bool ignore;  int forbidden;  int macroId;  TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel = FORBID_OK);  virtual ~TexMacroDef(void);};#define CHUNK_TYPE_MACRO    1#define CHUNK_TYPE_ARG      2#define CHUNK_TYPE_STRING   3/* We have nested lists to represent the Tex document. Each element of a list of chunks can be one of:  - a plain string  - a macro with/without arguments. Arguments are lists of TexChunks.Example (\toplevel is implicit but made explicit here):AddMacroDef(ltMYMAT, "mymat", 2);\toplevel{The cat sat on the \mymat{very coarse and {\it cheap}}{mat}}.Parsed as:TexChunk: type = macro, name = toplevel, no_args = 1  Children:    TexChunk: type = argument      Children:        TexChunk: type = string, value = "The cat sat on the "        TexChunk: type = macro, name = mymat, no_args = 2          Children:            TexChunk: type = argument              Children:                TexChunk: type = string, value = "very coarse and "                TexChunk: type = macro, name = it, no_args = 1                  Children:                    TexChunk: type = argument                      Children:                        TexChunk: type = string, value = "cheap"            TexChunk: type = argument              Children:                TexChunk: type = string, value = mat */class TexChunk{ public:  int type;//  char *name;  TexMacroDef *def;  wxChar *value;  int macroId;  int no_args;  int argn;  bool optional;      // Is an optional argument  wxList children;  TexChunk(int the_type, TexMacroDef *the_def = NULL);  TexChunk(TexChunk& toCopy);  virtual ~TexChunk(void);};// Represents a topic, used for generating a table of contents file (.cnt).// Also for storing keywords found in a topic, a list of which is then inserted// into the topic in the next pass.class TexTopic: public wxObject{ public:  // This flag is set to indicate that the topic has children.  // If this is the case, we know to insert a 'book' icon at this level,  // not just a 'page' icon. We don't want to have to open a book only  // to find there's only one page in it. We might force a book to be used if  // a top-level topic has no children (?)  bool hasChildren;  wxChar *filename;  wxStringList *keywords;  TexTopic(wxChar *f = NULL);  virtual ~TexTopic(void);};extern wxHashTable TopicTable;void AddKeyWordForTopic(wxChar *topic, wxChar *entry, wxChar *filename = NULL);void ClearKeyWordTable(void);extern wxChar wxTex2RTFBuffer[];extern TexChunk     *TopLevel;extern wxHashTable  MacroDefs;extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.texbool read_a_line(wxChar *buf);bool TexLoadFile(const wxString& filename);int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos,           wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args,           wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);void TraverseDocument(void);void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = false);#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, true)void SetCurrentOutput(FILE *fd);void SetCurrentOutputs(FILE *fd1, FILE *fd2);extern FILE *CurrentOutput1;extern FILE *CurrentOutput2;void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = false, bool forbidden = false);void TexInitialize(int bufSize);void TexCleanUp(void);void TexOutput(const wxChar *s, bool ordinaryText = false);wxChar *GetArgData(TexChunk *chunk);wxChar *GetArgData(void);             // Get the string for the current argumentint GetNoArgs(void);                // Get the number of arguments for the current macroTexChunk *GetArgChunk(void);        // Get the chunk for the current argumentTexChunk *GetTopLevelChunk(void);   // Get the chunk for the top levelTexChunk *GetNextChunk(void);       // Look ahead to the next chunkbool IsArgOptional(void);           // Is this argument an optional argument?void DefineDefaultMacros(void);     // Optional set of default macrosint GetCurrentColumn(void);         // number of characters on current linewxChar *ConvertCase(wxChar *s);         // Convert case, according to upperCaseNames setting.extern wxPathList TexPathList;      // Path list, can be used for file searching.extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = true, bool exact = false);// Define a variable value from the .ini filewxChar *RegisterSetting(const wxString& settingName, const wxString& settingValue, bool interactive = true);// Major document styles#define LATEX_REPORT    1#define LATEX_ARTICLE   2#define LATEX_LETTER    3#define LATEX_BOOK      4#define LATEX_SLIDES    5extern TexChunk *DocumentTitle;extern TexChunk *DocumentAuthor;extern TexChunk *DocumentDate;extern int DocumentStyle;extern int MinorDocumentStyle;extern wxChar *BibliographyStyleString;extern wxChar *DocumentStyleString;extern wxChar *MinorDocumentStyleString;extern int normalFont;extern int smallFont;extern int tinyFont;extern int largeFont1;extern int LargeFont2;extern int LARGEFont3;extern int hugeFont1;extern int HugeFont2;extern int HUGEFont3;/* * USER-ADJUSTABLE SETTINGS * */// Section font sizesextern int chapterFont;extern int sectionFont;extern int subsectionFont;extern int titleFont;extern int authorFont;extern bool winHelp;  // Output in Windows Help format if true, linear otherwiseextern bool isInteractive;extern bool runTwice;extern int convertMode;extern bool checkCurlyBraces;extern bool checkSyntax;extern bool stopRunning;extern int  mirrorMargins;extern bool headerRule;extern bool footerRule;extern int labelIndentTab;  // From left indent to item label (points)extern int itemIndentTab;   // From left indent to item (points)extern bool useUpButton;extern int htmlBrowseButtons;extern bool useHeadingStyles; // Insert \s1, s2 etc.extern bool useWord; // Insert Word table of contents, etc. etc.extern bool indexSubsections; // put subsections in indexextern bool compatibilityMode;extern bool generateHPJ;      // Generate WinHelp HPJ fileextern wxChar *winHelpTitle;    // Title for Windows Help fileextern int defaultTableColumnWidth;extern wxChar *bitmapMethod;extern bool truncateFilenames; // Truncate for DOSextern int  winHelpVersion;    // Version e.g. 4 for Win95extern bool winHelpContents;   // Generate .cnt fileextern bool htmlIndex;         // Generate .htx HTML index fileextern bool htmlFrameContents; // Use frames for HTML contents pageextern wxChar *htmlStylesheet; // Use this CSS stylesheet for HTML pagesextern int  contentsDepth;     // Depth of contents for linear RTF filesextern bool upperCaseNames;    // Filenames; default is lower caseextern wxChar *backgroundImageString; // HTML background imageextern wxChar *backgroundColourString; // HTML background colourextern wxChar *textColourString; // HTML text colourextern wxChar *linkColourString; // HTML link colourextern wxChar *followedLinkColourString; // HTML followed link colourextern bool combineSubSections; // Stop splitting files below sectionextern bool htmlWorkshopFiles;  // generate HTML Help Workshop project filesextern bool ignoreBadRefs;      // Don't insert (REF NOT FOUND)extern wxChar *htmlFaceName;      // HTML face name// Names to help with internationalisationextern wxChar *ContentsNameString;extern wxChar *AbstractNameString;extern wxChar *GlossaryNameString;extern wxChar *ReferencesNameString;extern wxChar *FiguresNameString;extern wxChar *TablesNameString;extern wxChar *FigureNameString;extern wxChar *TableNameString;extern wxChar *IndexNameString;extern wxChar *ChapterNameString;extern wxChar *SectionNameString;extern wxChar *SubsectionNameString;extern wxChar *SubsubsectionNameString;extern wxChar *UpNameString;/* * HTML button identifiers: what kind of browse buttons * are placed in HTML files, if any. * */#define HTML_BUTTONS_NONE       0#define HTML_BUTTONS_BITMAP     1#define HTML_BUTTONS_TEXT       2/* * Section numbering * */extern int chapterNo;extern int sectionNo;extern int subsectionNo;extern int subsubsectionNo;extern int figureNo;extern int tableNo;extern int ParSkip;extern int ParIndent;extern bool isSync;// Set by client and by Tex2Anyextern TexChunk *currentSection;// Header/footers/pagestyleextern TexChunk *      LeftHeaderOdd;extern TexChunk *      LeftFooterOdd;extern TexChunk *      CentreHeaderOdd;extern TexChunk *      CentreFooterOdd;extern TexChunk *      RightHeaderOdd;extern TexChunk *      RightFooterOdd;extern TexChunk *      LeftHeaderEven;extern TexChunk *      LeftFooterEven;extern TexChunk *      CentreHeaderEven;extern TexChunk *      CentreFooterEven;extern TexChunk *      RightHeaderEven;extern TexChunk *      RightFooterEven;extern wxChar *        PageStyle;// Repeat the currentSection, either real (Chapter) or simulated (References)extern void OutputCurrentSection(void);extern void OutputCurrentSectionToString(wxChar *buf);extern void OutputChunkToString(TexChunk *chunk, wxChar *buf);// Called by Tex2Any to simulate a sectionextern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = true);/* * Local to Tex2Any library * */extern wxChar *currentArgData;extern bool haveArgData; // If true, we're simulating the data.void StartSimulateArgument(wxChar *data);void EndSimulateArgument(void);/* * Client-defined * */// Called on start/end of macro examinationvoid OnMacro(int macroId, int no_args, bool start);// Called on start/end of argument examination.// Return true at the start of an argument to traverse// (output) the argument.bool OnArgument(int macroId, int arg_no, bool start);// Default: library-definedvoid DefaultOnMacro(int macroId, int no_args, bool start);// Default: library-definedbool DefaultOnArgument(int macroId, int arg_no, bool start);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -