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

📄 tex2any.cpp

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/////////////////////////////////////////////////////////////////////////////// Name:        tex2any.cpp// Purpose:     Utilities for Latex conversion.// Author:      Julian Smart// Modified by: Wlodzimierz ABX Skiba 2003/2004 Unicode support//              Ron Lee// Created:     01/01/99// RCS-ID:      $Id: tex2any.cpp,v 1.43 2006/07/04 16:08:16 AVV Exp $// Copyright:   (c) Julian Smart// Licence:     wxWindows licence/////////////////////////////////////////////////////////////////////////////// For compilers that support precompilation, includes "wx.h".#include "wx/wxprec.h"#ifdef __BORLANDC__#pragma hdrstop#endif#ifndef WX_PRECOMP#endif#include <ctype.h>#include "tex2any.h"#include <stdlib.h>#include <time.h>#if !WXWIN_COMPATIBILITY_2_4static inline wxChar* copystring(const wxChar* s)    { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); }#endif/* * Variables accessible from clients * */TexChunk *      DocumentTitle = NULL;TexChunk *      DocumentAuthor = NULL;TexChunk *      DocumentDate = NULL;// Header/footers/pagestyleTexChunk *      LeftHeaderEven = NULL;TexChunk *      LeftFooterEven = NULL;TexChunk *      CentreHeaderEven = NULL;TexChunk *      CentreFooterEven = NULL;TexChunk *      RightHeaderEven = NULL;TexChunk *      RightFooterEven = NULL;TexChunk *      LeftHeaderOdd = NULL;TexChunk *      LeftFooterOdd = NULL;TexChunk *      CentreHeaderOdd = NULL;TexChunk *      CentreFooterOdd = NULL;TexChunk *      RightHeaderOdd = NULL;TexChunk *      RightFooterOdd = NULL;wxChar *        PageStyle = copystring(_T("plain"));int             DocumentStyle = LATEX_REPORT;int             MinorDocumentStyle = 0;wxPathList      TexPathList;wxChar *        BibliographyStyleString = copystring(_T("plain"));wxChar *        DocumentStyleString = copystring(_T("report"));wxChar *        MinorDocumentStyleString = NULL;int             ParSkip = 0;int             ParIndent = 0;int             normalFont = 10;int             smallFont = 8;int             tinyFont = 6;int             largeFont1 = 12;int             LargeFont2 = 14;int             LARGEFont3 = 18;int             hugeFont1 = 20;int             HugeFont2 = 24;int             HUGEFont3 = 28;// All of these tokens MUST be found on a line by themselves (no other// text) and must start at the first character of the line, or tex2rtf// will fail to process them correctly (a limitation of tex2rtf, not TeX)static const wxString syntaxTokens[] ={ _T("\\begin{verbatim}"),  _T("\\begin{toocomplex}"),  _T("\\end{verbatim}"),  _T("\\end{toocomplex}"),  _T("\\verb"),  _T("\\begin{comment}"),  _T("\\end{comment}"),  _T("\\verbatiminput"),//  _T("\\par"),  _T("\\input"),  _T("\\helpinput"),  _T("\\include"),  wxEmptyString};/* * USER-ADJUSTABLE SETTINGS * */// Section font sizesint             chapterFont =    12; // LARGEFont3;int             sectionFont =    12; // LargeFont2;int             subsectionFont = 12; // largeFont1;int             titleFont = LARGEFont3;int             authorFont = LargeFont2;int             mirrorMargins = true;bool            winHelp = false;  // Output in Windows Help format if true, linear otherwisebool            isInteractive = false;bool            runTwice = false;int             convertMode = TEX_RTF;bool            checkCurlyBraces = false;bool            checkSyntax = false;bool            headerRule = false;bool            footerRule = false;bool            compatibilityMode = false; // If true, maximum Latex compatibility                                // (Quality of RTF generation deteriorate)bool            generateHPJ; // Generate WinHelp Help Project filewxChar         *winHelpTitle = NULL; // Windows Help titleint             defaultTableColumnWidth = 2000;int             labelIndentTab = 18;  // From left indent to item label (points)int             itemIndentTab = 40;   // From left indent to item (points)bool            useUpButton = true;int             htmlBrowseButtons = HTML_BUTTONS_TEXT;bool            truncateFilenames = false; // Truncate for DOSint             winHelpVersion = 3; // WinHelp Version (3 for Windows 3.1, 4 for Win95)bool            winHelpContents = false; // Generate .cnt file for WinHelp 4bool            htmlIndex = false; // Generate .htx file for HTMLbool            htmlFrameContents = false; // Use frames for HTML contents pagewxChar         *htmlStylesheet = NULL; // Use this CSS stylesheet for HTML pagesbool            useHeadingStyles = true; // Insert \s1, s2 etc.bool            useWord = true; // Insert proper Word table of contents, etc etcint             contentsDepth = 4; // Depth of Word table of contentsbool            indexSubsections = true; // Index subsections in linear RTF// Linear RTF method of including bitmaps. Can be "includepicture", "hex"wxChar         *bitmapMethod = copystring(_T("includepicture"));bool            upperCaseNames = false;// HTML background and text colourswxChar         *backgroundImageString = NULL;wxChar         *backgroundColourString = copystring(_T("255;255;255"));wxChar         *textColourString = NULL;wxChar         *linkColourString = NULL;wxChar         *followedLinkColourString = NULL;bool            combineSubSections = false;bool            htmlWorkshopFiles = false;bool            ignoreBadRefs = false;wxChar         *htmlFaceName = NULL;extern int passNumber;extern wxHashTable TexReferences;/* * International support */// Names to help with internationalisationwxChar *ContentsNameString = copystring(_T("Contents"));wxChar *AbstractNameString = copystring(_T("Abstract"));wxChar *GlossaryNameString = copystring(_T("Glossary"));wxChar *ReferencesNameString = copystring(_T("References"));wxChar *FiguresNameString = copystring(_T("List of Figures"));wxChar *TablesNameString = copystring(_T("List of Tables"));wxChar *FigureNameString = copystring(_T("Figure"));wxChar *TableNameString = copystring(_T("Table"));wxChar *IndexNameString = copystring(_T("Index"));wxChar *ChapterNameString = copystring(_T("chapter"));wxChar *SectionNameString = copystring(_T("section"));wxChar *SubsectionNameString = copystring(_T("subsection"));wxChar *SubsubsectionNameString = copystring(_T("subsubsection"));wxChar *UpNameString = copystring(_T("Up"));/* * Section numbering * */int             chapterNo = 0;int             sectionNo = 0;int             subsectionNo = 0;int             subsubsectionNo = 0;int             figureNo = 0;int             tableNo = 0;/* * Other variables * */FILE *CurrentOutput1 = NULL;FILE *CurrentOutput2 = NULL;FILE *Inputs[15];unsigned long LineNumbers[15];wxChar *FileNames[15];int CurrentInputIndex = 0;wxChar *TexFileRoot = NULL;wxChar *TexBibName = NULL;         // Bibliography output file namewxChar *TexTmpBibName = NULL;      // Temporary bibliography output file namebool isSync = false;             // If true, should not yield to other processes.bool stopRunning = false;        // If true, should abort.static int currentColumn = 0;wxChar *currentArgData = NULL;bool haveArgData = false; // If true, we're simulating the data.TexChunk *currentArgument = NULL;TexChunk *nextChunk = NULL;bool isArgOptional = false;int noArgs = 0;TexChunk *TopLevel = NULL;// wxList MacroDefs(wxKEY_STRING);wxHashTable MacroDefs(wxKEY_STRING);wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.texwxChar *BigBuffer = NULL;  // For reading in large chunks of textTexMacroDef *SoloBlockDef = NULL;TexMacroDef *VerbatimMacroDef = NULL;#define IncrementLineNumber() LineNumbers[CurrentInputIndex] ++TexRef::TexRef(const wxChar *label, const wxChar *file,               const wxChar *section, const wxChar *sectionN){    refLabel = copystring(label);    refFile = file ? copystring(file) : (wxChar*) NULL;    sectionNumber = section ? copystring(section) : copystring(_T("??"));    sectionName = sectionN ? copystring(sectionN) : copystring(_T("??"));}TexRef::~TexRef(void){    delete [] refLabel;      refLabel = NULL;    delete [] refFile;       refFile = NULL;    delete [] sectionNumber; sectionNumber = NULL;    delete [] sectionName;   sectionName = NULL;}CustomMacro::~CustomMacro(){    if (macroName)        delete [] macroName;    if (macroBody)        delete [] macroBody;}void TexOutput(const wxChar *s, bool ordinaryText){  int len = wxStrlen(s);  // Update current column, but only if we're guaranteed to  // be ordinary text (not mark-up stuff)  int i;  if (ordinaryText)    for (i = 0; i < len; i++)    {      if (s[i] == 13 || s[i] == 10)        currentColumn = 0;      else        currentColumn ++;    }  if (CurrentOutput1)

⌨️ 快捷键说明

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