// Name: rtfutils.cpp
// Purpose: Converts Latex to Word RTF/WinHelp RTF
// Author: Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+// Ron Lee
// Created: 7.9.93
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
#endif
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#include "tex2any.h"
#include "bmputils.h"
#include "table.h"
+#if !WXWIN_COMPATIBILITY_2_4
+static inline wxChar* copystring(const wxChar* s)
+ { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); }
+#endif
+
wxList itemizeStack;
static int indentLevel = 0;
static int forbidParindent = 0; // if > 0, no parindent (e.g. in center environment)
int forbidResetPar = 0; // If > 0, don't reset memory of having output a new par
-static char *contentsLineSection = NULL;
-static char *contentsLineValue = NULL;
+static wxChar *contentsLineSection = NULL;
+static wxChar *contentsLineValue = NULL;
static TexChunk *descriptionItemArg = NULL;
static wxStringList environmentStack; // Stack of paragraph styles we need to remember
static int footnoteCount = 0;
static int citeCount = 1;
-extern char *FileRoot;
extern bool winHelp;
extern bool startedSections;
extern FILE *Contents;
extern FILE *Chapters;
extern FILE *Popups;
extern FILE *WinHelpContentsFile;
-extern char *RTFCharset;
+extern wxChar *RTFCharset;
// This is defined in the Tex2Any library and isn't in use after parsing
-extern char *BigBuffer;
+extern wxChar *BigBuffer;
+
+extern wxHashTable TexReferences;
+
// Are we in verbatim mode? If so, format differently.
-static bool inVerbatim = FALSE;
+static bool inVerbatim = false;
// We're in a series of PopRef topics, so don't output section headings
-bool inPopRefSection = FALSE;
+bool inPopRefSection = false;
// Green colour?
-static bool hotSpotColour = TRUE;
-static bool hotSpotUnderline = TRUE;
+static bool hotSpotColour = true;
+static bool hotSpotUnderline = true;
// Transparency (WHITE = transparent)
-static bool bitmapTransparency = TRUE;
+static bool bitmapTransparency = true;
// Linear RTF requires us to set the style per section.
-static char *currentNumberStyle = NULL;
+static wxChar *currentNumberStyle = NULL;
static int currentItemSep = 8;
static int CurrentTextWidth = 8640; // Say, six inches
static int CurrentLeftMarginOdd = 400;
const int PageWidth = 12242; // 8.25 inches wide for A4
+// Remember the anchor in a helpref
+static TexChunk *helpRefText = NULL;
/*
* Flag to say we've just issued a \par\pard command, so don't
// Need to know whether we're in a table or figure for benefit
// of listoffigures/listoftables
-static bool inFigure = FALSE;
-static bool inTable = FALSE;
+static bool inFigure = false;
+static bool inTable = false;
/*
* Current topics
*
*/
-static char *CurrentChapterName = NULL;
-static char *CurrentSectionName = NULL;
-static char *CurrentSubsectionName = NULL;
-static char *CurrentTopic = NULL;
+static wxChar *CurrentChapterName = NULL;
+static wxChar *CurrentSectionName = NULL;
+static wxChar *CurrentSubsectionName = NULL;
+static wxChar *CurrentTopic = NULL;
static bool InPopups()
{
- if (CurrentChapterName && (strcmp(CurrentChapterName, "popups") == 0))
- return TRUE;
- if (CurrentSectionName && (strcmp(CurrentSectionName, "popups") == 0))
- return TRUE;
- return FALSE;
+ if (CurrentChapterName && (wxStrcmp(CurrentChapterName, _T("popups")) == 0))
+ return true;
+ if (CurrentSectionName && (wxStrcmp(CurrentSectionName, _T("popups")) == 0))
+ return true;
+ return false;
}
-static void SetCurrentTopic(char *s)
+static void SetCurrentTopic(wxChar *s)
{
if (CurrentTopic) delete[] CurrentTopic;
CurrentTopic = copystring(s);
}
-void SetCurrentChapterName(char *s)
+void SetCurrentChapterName(wxChar *s)
{
if (CurrentChapterName) delete[] CurrentChapterName;
CurrentChapterName = copystring(s);
SetCurrentTopic(s);
}
-void SetCurrentSectionName(char *s)
+void SetCurrentSectionName(wxChar *s)
{
if (CurrentSectionName) delete[] CurrentSectionName;
CurrentSectionName = copystring(s);
SetCurrentTopic(s);
}
-void SetCurrentSubsectionName(char *s)
+void SetCurrentSubsectionName(wxChar *s)
{
if (CurrentSubsectionName) delete[] CurrentSubsectionName;
CurrentSubsectionName = copystring(s);
// Level 1 is a chapter, 2 is a section, etc.
void NotifyParentHasChildren(int parentLevel)
{
- char *parentTopic = NULL;
+ wxChar *parentTopic = NULL;
switch (parentLevel)
{
case 1:
texTopic = new TexTopic;
TopicTable.Put(parentTopic, texTopic);
}
- texTopic->hasChildren = TRUE;
+ texTopic->hasChildren = true;
}
}
{
int i;
for (i = l; i < 5; i++)
- ContentsLevels[i] = FALSE;
-
+ ContentsLevels[i] = false;
+
// There are always books on the top level
- ContentsLevels[0] = TRUE;
+ ContentsLevels[0] = true;
}
// Output a WinHelp section as a keyword, substituting
// : for space.
void OutputSectionKeyword(FILE *fd)
{
- OutputCurrentSectionToString(wxBuffer);
-
- int i;
- for (i = 0; i < strlen(wxBuffer); i++)
- if (wxBuffer[i] == ':')
- wxBuffer[i] = ' ';
+ OutputCurrentSectionToString(wxTex2RTFBuffer);
+
+ unsigned int i;
+ for (i = 0; i < wxStrlen(wxTex2RTFBuffer); i++)
+ if (wxTex2RTFBuffer[i] == ':')
+ wxTex2RTFBuffer[i] = ' ';
// Don't write to index if there's some RTF in the string
- else if ( wxBuffer[i] == '{' )
+ else if ( wxTex2RTFBuffer[i] == '{' )
return;
- fprintf(fd, "K{\\footnote {K} ");
- fprintf(fd, "%s", wxBuffer);
-
- fprintf(fd, "}\n");
+ wxFprintf(fd, _T("K{\\footnote {K} "));
+ wxFprintf(fd, _T("%s"), wxTex2RTFBuffer);
+
+ wxFprintf(fd, _T("}\n"));
}
// Write a line for the .cnt file, if we're doing this.
-void WriteWinHelpContentsFileLine(char *topicName, char *xitle, int level)
+void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level)
{
// First, convert any RTF characters to ASCII
- char title[255];
+ wxChar title[255];
int s=0;
int d=0;
while ( (xitle[s]!=0)&&(d<255) )
{
- char ch=xitle[s]&0xff;
- if (ch==0x5c) {
- char ch1=xitle[s+1]&0xff;
- char ch2=xitle[s+2]&0xff;
- char ch3=xitle[s+3]&0xff;
- char ch4=xitle[s+4]&0xff;
- s+=4; // next character
- char a=0;
- if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x36)) { title[d++]='ö'; a=1; }
- if ((ch1==0x27)&&(ch2==0x65)&&(ch3==0x34)) { title[d++]='ä'; a=1; }
- if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x63)) { title[d++]='ü'; a=1; }
- if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x36)) { title[d++]='Ö'; a=1; }
- if ((ch1==0x27)&&(ch2==0x63)&&(ch3==0x34)) { title[d++]='Ä'; a=1; }
- if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x63)) { title[d++]='Ü'; a=1; }
-// if (a==0)
-// printf("!!!!! %04X %04X %04X %04X! \n",ch1,ch2,ch3,ch4);
- } else {
- title[d++]=ch;
- s++;
- }
+ wxChar ch=wxChar(xitle[s]&0xff);
+ if (ch==0x5c) {
+ wxChar ch1=wxChar(xitle[s+1]&0xff);
+ wxChar ch2=wxChar(xitle[s+2]&0xff);
+ wxChar ch3=wxChar(xitle[s+3]&0xff);
+ s+=4; // next character
+ if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x36)) { title[d++]=_T('ö'); }
+ if ((ch1==0x27)&&(ch2==0x65)&&(ch3==0x34)) { title[d++]=_T('ä'); }
+ if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x63)) { title[d++]=_T('ü'); }
+ if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x36)) { title[d++]=_T('Ö'); }
+ if ((ch1==0x27)&&(ch2==0x63)&&(ch3==0x34)) { title[d++]=_T('Ä'); }
+ if ((ch1==0x27)&&(ch2==0x64)&&(ch3==0x63)) { title[d++]=_T('Ü'); }
+ } else {
+ title[d++]=ch;
+ s++;
+ }
}
title[d]=0;
if (level == 0) // Means we had a Chapter in an article, oops.
return;
-
+
ResetContentsLevels(level);
-
- if (!title)
- return;
-
+
if (winHelp && winHelpContents && WinHelpContentsFile)
{
TexTopic *texTopic = (TexTopic *)TopicTable.Get(topicName);
{
// At this level, we have a pointer to a further hierarchy.
// So we need a 'book' consisting of (say) Chapter 1.
- fprintf(WinHelpContentsFile, "%d %s\n", level, title);
+ wxFprintf(WinHelpContentsFile, _T("%d %s\n"), level, title);
// Then we have a 'page' consisting of the text for this chapter
- fprintf(WinHelpContentsFile, "%d %s=%s\n", level+1, title, topicName);
+ wxFprintf(WinHelpContentsFile, _T("%d %s=%s\n"), level+1, title, topicName);
// Then we'll be writing out further pages or books at level + 1...
// Remember that at this level, we had a book and *must* for the
// remainder of sections at this level.
- ContentsLevels[level-1] = TRUE;
+ ContentsLevels[level-1] = true;
}
else
{
- fprintf(WinHelpContentsFile, "%d %s=%s\n", level, title, topicName);
+ wxFprintf(WinHelpContentsFile, _T("%d %s=%s\n"), level, title, topicName);
}
}
else
if (level == 1 || ContentsLevels[level-1])
{
// Always have a book at level 1
- fprintf(WinHelpContentsFile, "%d %s\n", level, title);
- fprintf(WinHelpContentsFile, "%d %s=%s\n", level+1, title, topicName);
- ContentsLevels[level-1] = TRUE;
+ wxFprintf(WinHelpContentsFile, _T("%d %s\n"), level, title);
+ wxFprintf(WinHelpContentsFile, _T("%d %s=%s\n"), level+1, title, topicName);
+ ContentsLevels[level-1] = true;
}
else
// Probably doesn't have children if it hasn't been added to the topic table
- fprintf(WinHelpContentsFile, "%d %s=%s\n", level, title, topicName);
+ wxFprintf(WinHelpContentsFile, _T("%d %s=%s\n"), level, title, topicName);
}
}
}
-void SplitIndexEntry(char *entry, char *buf1, char *buf2)
+void SplitIndexEntry(wxChar *entry, wxChar *buf1, wxChar *buf2)
{
- int len = strlen(entry); int i = 0;
+ int len = wxStrlen(entry); int i = 0;
while ((i < len) && entry[i] != '!')
{ buf1[i] = entry[i]; i ++; }
buf1[i] = 0; buf2[0] = 0; int j = 0;
* Output topic index entries in WinHelp RTF
*
*/
-void GenerateKeywordsForTopic(char *topic)
+void GenerateKeywordsForTopic(wxChar *topic)
{
TexTopic *texTopic = (TexTopic *)TopicTable.Get(topic);
if (!texTopic)
wxStringList *list = texTopic->keywords;
if (list)
{
- wxNode *node = list->First();
+ wxStringListNode *node = list->GetFirst();
while (node)
{
- char *s = (char *)node->Data();
+ wxChar *s = (wxChar *)node->GetData();
// Must separate out main entry form subentry (only 1 subentry allowed)
- char buf1[100]; char buf2[100];
+ wxChar buf1[100]; wxChar buf2[100];
SplitIndexEntry(s, buf1, buf2);
-
+
// Check for ':' which messes up index
- int i;
- for (i = 0; i < strlen(buf1) ; i++)
+ unsigned int i;
+ for (i = 0; i < wxStrlen(buf1) ; i++)
if (buf1[i] == ':')
buf1[i] = ' ';
- for (i = 0; i < strlen(buf2) ; i++)
+ for (i = 0; i < wxStrlen(buf2) ; i++)
if (buf2[i] == ':')
buf2[i] = ' ';
// {K} is a strange fix to prevent words beginning with K not
// being indexed properly
- TexOutput("K{\\footnote {K} ");
+ TexOutput(_T("K{\\footnote {K} "));
TexOutput(buf1);
- if (strlen(buf2) > 0)
+ if (wxStrlen(buf2) > 0)
{
// Output subentry
- TexOutput(", ");
+ TexOutput(_T(", "));
TexOutput(buf2);
}
- TexOutput("}\n");
- node = node->Next();
+ TexOutput(_T("}\n"));
+ node = node->GetNext();
}
}
}
* Output index entry in linear RTF
*
*/
-
-void GenerateIndexEntry(char *entry)
+
+void GenerateIndexEntry(wxChar *entry)
{
if (useWord)
{
- char buf1[100]; char buf2[100];
+ wxChar buf1[100]; wxChar buf2[100];
SplitIndexEntry(entry, buf1, buf2);
- TexOutput("{\\xe\\v {");
+ TexOutput(_T("{\\xe\\v {"));
TexOutput(buf1);
- if (strlen(buf2) > 0)
+ if (wxStrlen(buf2) > 0)
{
- TexOutput("\\:");
+ TexOutput(_T("\\:"));
TexOutput(buf2);
}
- TexOutput("}}");
+ TexOutput(_T("}}"));
}
}
* Write a suitable RTF header.
*
*/
-
+
void WriteColourTable(FILE *fd)
{
- fprintf(fd, "{\\colortbl");
- wxNode *node = ColourTable.First();
+ wxFprintf(fd, _T("{\\colortbl"));
+ wxNode *node = ColourTable.GetFirst();
while (node)
{
- ColourTableEntry *entry = (ColourTableEntry *)node->Data();
- fprintf(fd, "\\red%d\\green%d\\blue%d;\n", entry->red, entry->green, entry->blue);
- node = node->Next();
+ ColourTableEntry *entry = (ColourTableEntry *)node->GetData();
+ wxFprintf(fd, _T("\\red%d\\green%d\\blue%d;\n"), entry->red, entry->green, entry->blue);
+ node = node->GetNext();
}
- fprintf(fd, "}");
+ wxFprintf(fd, _T("}"));
}
/*
{
case 1:
{
- fprintf(fd, "\\b\\fs%d", chapterFont*2);
+ wxFprintf(fd, _T("\\sb300\\sa260\\f2\\b\\fs%d"), chapterFont*2);
break;
}
case 2:
{
- fprintf(fd, "\\b\\fs%d", sectionFont*2);
+ wxFprintf(fd, _T("\\sb200\\sa240\\f2\\b\\fs%d"), sectionFont*2);
break;
}
case 3:
{
- fprintf(fd, "\\b\\fs%d", subsectionFont*2);
+ wxFprintf(fd, _T("\\sb120\\sa240\\f2\\b\\fs%d"), subsectionFont*2);
break;
}
case 4:
{
- fprintf(fd, "\\b\\fs%d", subsectionFont*2);
+ wxFprintf(fd, _T("\\sb120\\sa240\\f2\\b\\fs%d"), subsectionFont*2);
break;
}
default:
void WriteRTFHeader(FILE *fd)
{
- fprintf(fd, "{\\rtf1\\%s \\deff0\n", RTFCharset);
- fprintf(fd, "{\\fonttbl{\\f0\\froman Times New Roman;}{\\f1\\ftech Symbol;}{\\f2\\fswiss Arial;}\n");
- fprintf(fd, "{\\f3\\fmodern Courier;}{\\f4\\ftech Wingdings;}{\\f5\\ftech Monotype Sorts;}\n}");
+ wxFprintf(fd, _T("{\\rtf1\\%s \\deff0\n"), RTFCharset);
+ wxFprintf(fd, _T("{\\fonttbl{\\f0\\froman Times New Roman;}{\\f1\\ftech Symbol;}{\\f2\\fswiss Arial;}\n"));
+ wxFprintf(fd, _T("{\\f3\\fmodern Courier;}{\\f4\\ftech Wingdings;}{\\f5\\ftech Monotype Sorts;}\n}"));
/*
* Style sheet
*/
- fprintf(fd, "{\\stylesheet{\\f2\\fs20 \\snext0 Normal;}\n");
+ wxFprintf(fd, _T("{\\stylesheet{\\f2\\fs22\\sa200 \\snext0 Normal;}\n"));
// Headings
- fprintf(fd, "{\\s1 "); WriteHeadingStyle(fd, 1); fprintf(fd, "\\sbasedon0\\snext0 heading 1;}\n");
- fprintf(fd, "{\\s2 "); WriteHeadingStyle(fd, 2); fprintf(fd, "\\sbasedon0\\snext0 heading 2;}\n");
- fprintf(fd, "{\\s3 "); WriteHeadingStyle(fd, 3); fprintf(fd, "\\sbasedon0\\snext0 heading 3;}\n");
- fprintf(fd, "{\\s4 "); WriteHeadingStyle(fd, 4); fprintf(fd, "\\sbasedon0\\snext0 heading 4;}\n");
+ wxFprintf(fd, _T("{\\s1 ")); WriteHeadingStyle(fd, 1); wxFprintf(fd, _T("\\sbasedon0\\snext0 heading 1;}\n"));
+ wxFprintf(fd, _T("{\\s2 ")); WriteHeadingStyle(fd, 2); wxFprintf(fd, _T("\\sbasedon0\\snext0 heading 2;}\n"));
+ wxFprintf(fd, _T("{\\s3 ")); WriteHeadingStyle(fd, 3); wxFprintf(fd, _T("\\sbasedon0\\snext0 heading 3;}\n"));
+ wxFprintf(fd, _T("{\\s4 ")); WriteHeadingStyle(fd, 4); wxFprintf(fd, _T("\\sbasedon0\\snext0 heading 4;}\n"));
+
+ // Code style
+ wxFprintf(fd, _T("{\\s10\\ql \\li720\\ri0\\nowidctlpar\\faauto\\rin0\\lin720\\itap0 \\cbpat17\
+\\f2\\fs20 \\sbasedon0 \\snext24 Code;}\n"));
+
// Table of contents styles
- fprintf(fd, "{\\s20\\sb300\\tqr\\tldot\\tx8640 \\b\\f2 \\sbasedon0\\snext0 toc 1;}\n");
-
- fprintf(fd, "{\\s21\\sb90\\tqr\\tldot\\li400\\tqr\\tx8640 \\f2\\fs20\\sbasedon0\\snext0 toc 2;}\n");
- fprintf(fd, "{\\s22\\sb90\\tqr\\tldot\\li800\\tx8640 \\f2\\fs20 \\sbasedon0\\snext0 toc 3;}\n");
- fprintf(fd, "{\\s23\\sb90\\tqr\\tldot\\li1200\\tx8640 \\f2\\fs20 \\sbasedon0\\snext0 toc 4;}\n");
+ wxFprintf(fd, _T("{\\s20\\sb300\\tqr\\tldot\\tx8640 \\b\\f2 \\sbasedon0\\snext0 toc 1;}\n"));
+
+ wxFprintf(fd, _T("{\\s21\\sb90\\tqr\\tldot\\li400\\tqr\\tx8640 \\f2\\fs20\\sbasedon0\\snext0 toc 2;}\n"));
+ wxFprintf(fd, _T("{\\s22\\sb90\\tqr\\tldot\\li800\\tx8640 \\f2\\fs20 \\sbasedon0\\snext0 toc 3;}\n"));
+ wxFprintf(fd, _T("{\\s23\\sb90\\tqr\\tldot\\li1200\\tx8640 \\f2\\fs20 \\sbasedon0\\snext0 toc 4;}\n"));
// Index styles
- fprintf(fd, "{\\s30\\fi-200\\li200\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 1;}\n");
- fprintf(fd, "{\\s31\\fi-200\\li400\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 2;}\n");
- fprintf(fd, "{\\s32\\fi-200\\li600\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 3;}\n");
- fprintf(fd, "{\\s33\\fi-200\\li800\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 4;}\n");
- fprintf(fd, "{\\s35\\qc\\sb240\\sa120 \\b\\f2\\fs26 \\sbasedon0\\snext30 index heading;}\n");
- fprintf(fd, "}\n");
+ wxFprintf(fd, _T("{\\s30\\fi-200\\li200\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 1;}\n"));
+ wxFprintf(fd, _T("{\\s31\\fi-200\\li400\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 2;}\n"));
+ wxFprintf(fd, _T("{\\s32\\fi-200\\li600\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 3;}\n"));
+ wxFprintf(fd, _T("{\\s33\\fi-200\\li800\\tqr\\tx3960 \\f2\\fs18 \\sbasedon0\\snext0 index 4;}\n"));
+ wxFprintf(fd, _T("{\\s35\\qc\\sb240\\sa120 \\b\\f2\\fs26 \\sbasedon0\\snext30 index heading;}\n"));
+ wxFprintf(fd, _T("}\n"));
WriteColourTable(fd);
- fprintf(fd, "\n\\ftnbj\\ftnrestart"); // Latex default is footnotes at bottom of page, not section.
- fprintf(fd, "\n");
+ wxFprintf(fd, _T("\n\\ftnbj\\ftnrestart")); // Latex default is footnotes at bottom of page, not section.
+ wxFprintf(fd, _T("\n"));
}
-void OutputNumberStyle(char *numberStyle)
+void OutputNumberStyle(wxChar *numberStyle)
{
if (numberStyle)
{
- if (strcmp(numberStyle, "arabic") == 0)
+ if (wxStrcmp(numberStyle, _T("arabic")) == 0)
{
- TexOutput("\\pgndec");
+ TexOutput(_T("\\pgndec"));
}
- else if (strcmp(numberStyle, "roman") == 0)
+ else if (wxStrcmp(numberStyle, _T("roman")) == 0)
{
- TexOutput("\\pgnlcrm");
+ TexOutput(_T("\\pgnlcrm"));
}
- else if (strcmp(numberStyle, "Roman") == 0)
+ else if (wxStrcmp(numberStyle, _T("Roman")) == 0)
{
- TexOutput("\\pgnucrm");
+ TexOutput(_T("\\pgnucrm"));
}
- else if (strcmp(numberStyle, "alph") == 0)
+ else if (wxStrcmp(numberStyle, _T("alph")) == 0)
{
- TexOutput("\\pgnlcltr");
+ TexOutput(_T("\\pgnlcltr"));
}
- else if (strcmp(numberStyle, "Alph") == 0)
+ else if (wxStrcmp(numberStyle, _T("Alph")) == 0)
{
- TexOutput("\\pgnucltr");
+ TexOutput(_T("\\pgnucltr"));
}
}
}
/*
* Write a Windows help project file
*/
-
-bool WriteHPJ(char *filename)
+
+bool WriteHPJ(wxChar *filename)
{
- char hpjFilename[256];
- char helpFile[50];
- char rtfFile[50];
- strcpy(hpjFilename, filename);
+ wxChar hpjFilename[256];
+ wxChar helpFile[50];
+ wxChar rtfFile[50];
+ wxStrcpy(hpjFilename, filename);
StripExtension(hpjFilename);
- strcat(hpjFilename, ".hpj");
+ wxStrcat(hpjFilename, _T(".hpj"));
- strcpy(helpFile, FileNameFromPath(filename));
+ wxStrcpy(helpFile, wxFileNameFromPath(filename));
StripExtension(helpFile);
- strcpy(rtfFile, helpFile);
- strcat(helpFile, ".hlp");
- strcat(rtfFile, ".rtf");
-
- FILE *fd = fopen(hpjFilename, "w");
+ wxStrcpy(rtfFile, helpFile);
+ wxStrcat(helpFile, _T(".hlp"));
+ wxStrcat(rtfFile, _T(".rtf"));
+
+ FILE *fd = wxFopen(hpjFilename, _T("w"));
if (!fd)
- return FALSE;
+ return false;
- char *helpTitle = winHelpTitle;
+ wxChar *helpTitle = winHelpTitle;
if (!helpTitle)
- helpTitle = "Untitled";
-
+ helpTitle = _T("Untitled");
+
wxString thePath = wxPathOnly(InputFile);
if (thePath.IsEmpty())
- thePath = ".";
- fprintf(fd, "[OPTIONS]\n");
- fprintf(fd, "BMROOT=%s ; Assume that bitmaps are where the source is\n", thePath.c_str());
- fprintf(fd, "TITLE=%s\n", helpTitle);
- fprintf(fd, "CONTENTS=Contents\n");
+ thePath = _T(".");
+ wxFprintf(fd, _T("[OPTIONS]\n"));
+ wxFprintf(fd, _T("BMROOT=%s ; Assume that bitmaps are where the source is\n"), thePath.c_str());
+ wxFprintf(fd, _T("TITLE=%s\n"), helpTitle);
+ wxFprintf(fd, _T("CONTENTS=Contents\n"));
if (winHelpVersion > 3)
{
- fprintf(fd, "; COMPRESS=12 Hall Zeck ; Max compression, but needs lots of memory\n");
- fprintf(fd, "COMPRESS=8 Zeck\n");
- fprintf(fd, "LCID=0x809 0x0 0x0 ;English (British)\n");
- fprintf(fd, "HLP=.\\%s.hlp\n", wxFileNameFromPath(FileRoot));
+ wxFprintf(fd, _T("; COMPRESS=12 Hall Zeck ; Max compression, but needs lots of memory\n"));
+ wxFprintf(fd, _T("COMPRESS=8 Zeck\n"));
+ wxFprintf(fd, _T("LCID=0x809 0x0 0x0 ;English (British)\n"));
+ wxFprintf(fd, _T("HLP=.\\%s.hlp\n"), wxFileNameFromPath(FileRoot));
}
else
{
- fprintf(fd, "COMPRESS=HIGH\n");
+ wxFprintf(fd, _T("COMPRESS=HIGH\n"));
}
- fprintf(fd, "\n");
+ wxFprintf(fd, _T("\n"));
if (winHelpVersion > 3)
{
- fprintf(fd, "[WINDOWS]\n");
- fprintf(fd, "Main=\"\",(553,102,400,600),20736,(r14876671),(r12632256),f3\n");
- fprintf(fd, "\n");
+ wxFprintf(fd, _T("[WINDOWS]\n"));
+ wxFprintf(fd, _T("Main=\"\",(553,102,400,600),20736,(r14876671),(r12632256),f3\n"));
+ wxFprintf(fd, _T("\n"));
}
- fprintf(fd, "[FILES]\n%s\n\n", rtfFile);
- fprintf(fd, "[CONFIG]\n");
+ wxFprintf(fd, _T("[FILES]\n%s\n\n"), rtfFile);
+ wxFprintf(fd, _T("[CONFIG]\n"));
if (useUpButton)
- fprintf(fd, "CreateButton(\"Up\", \"&Up\", \"JumpId(`%s', `Contents')\")\n", helpFile);
- fprintf(fd, "BrowseButtons()\n\n");
- fprintf(fd, "[MAP]\n\n[BITMAPS]\n\n");
+ wxFprintf(fd, _T("CreateButton(\"Up\", \"&Up\", \"JumpId(`%s', `Contents')\")\n"), helpFile);
+ wxFprintf(fd, _T("BrowseButtons()\n\n"));
+ wxFprintf(fd, _T("[MAP]\n\n[BITMAPS]\n\n"));
fclose(fd);
- return TRUE;
+ return true;
}
void ProcessText2RTF(TexChunk *chunk)
{
- bool changed = FALSE;
+ bool changed = false;
int ptr = 0;
int i = 0;
- char ch = 1;
- int len = strlen(chunk->value);
+ wxChar ch = 1;
+ int len = wxStrlen(chunk->value);
while (ch != 0)
{
ch = chunk->value[i];
{
if (inVerbatim)
{
- BigBuffer[ptr] = 0; strcat(BigBuffer, "\\par\n"); ptr += 5;
+ BigBuffer[ptr] = 0; wxStrcat(BigBuffer, _T("\\par\n")); ptr += 5;
+// BigBuffer[ptr] = 0; wxStrcat(BigBuffer, _T("\\par{\\v this was verbatim}\n")); ptr += 5;
i ++;
- changed = TRUE;
+ changed = true;
}
else
{
((len > i+1 && chunk->value[i+1] == 13) &&
(len > i+2 && isascii(chunk->value[i+2]) &&
!isspace(chunk->value[i+2]))))
-// if (TRUE)
+// if (true)
{
// DOS files have a 13 after the 10
BigBuffer[ptr] = 10;
// Note that the actual ASCII character seen is dealt with in the next
// iteration
- changed = TRUE;
+ changed = true;
}
else
{
{
BigBuffer[ptr] = '"'; ptr ++;
i += 2;
- changed = TRUE;
+ changed = true;
}
else if (!inVerbatim && ch == '`') // Change ` to '
{
BigBuffer[ptr] = 39; ptr ++;
i += 1;
- changed = TRUE;
+ changed = true;
}
else if (inVerbatim && ch == '\\') // Change backslash to two backslashes
{
BigBuffer[ptr] = '\\'; ptr ++;
BigBuffer[ptr] = '\\'; ptr ++;
i += 1;
- changed = TRUE;
+ changed = true;
}
- else if (inVerbatim && (ch == '{' || ch == '}')) // Escape the curly bracket
+ else if (inVerbatim && (ch == '{' || ch == '}')) // Escape the curley bracket
{
BigBuffer[ptr] = '\\'; ptr ++;
BigBuffer[ptr] = ch; ptr ++;
i += 1;
- changed = TRUE;
+ changed = true;
}
else
{
* and before TraverseDocument is called.
*
*/
-
+
void Text2RTF(TexChunk *chunk)
{
Tex2RTFYield();
return;
if (def && (def->macroId == ltVERBATIM || def->macroId == ltVERB))
- inVerbatim = TRUE;
+ inVerbatim = true;
- wxNode *node = chunk->children.First();
+ wxNode *node = chunk->children.GetFirst();
while (node)
{
- TexChunk *child_chunk = (TexChunk *)node->Data();
+ TexChunk *child_chunk = (TexChunk *)node->GetData();
Text2RTF(child_chunk);
- node = node->Next();
+ node = node->GetNext();
}
if (def && (def->macroId == ltVERBATIM || def->macroId == ltVERB))
- inVerbatim = FALSE;
+ inVerbatim = false;
break;
}
case CHUNK_TYPE_ARG:
{
- wxNode *node = chunk->children.First();
+ wxNode *node = chunk->children.GetFirst();
while (node)
{
- TexChunk *child_chunk = (TexChunk *)node->Data();
+ TexChunk *child_chunk = (TexChunk *)node->GetData();
Text2RTF(child_chunk);
- node = node->Next();
+ node = node->GetNext();
}
break;
* Not used yet
*
*/
-
-char browseBuf[10];
+
+wxChar browseBuf[10];
static long browseId = 0;
-char *GetBrowseString(void)
+wxChar *GetBrowseString(void)
{
- char buf[10];
+ wxChar buf[10];
browseId ++;
- sprintf(buf, "%ld", browseId);
- int noZeroes = 5-strlen(buf);
- strcpy(browseBuf, "browse");
+ wxSnprintf(buf, sizeof(buf), _T("%ld"), browseId);
+ int noZeroes = 5-wxStrlen(buf);
+ wxStrcpy(browseBuf, _T("browse"));
for (int i = 0; i < noZeroes; i++)
- strcat(browseBuf, "0");
- strcat(browseBuf, buf);
+ wxStrcat(browseBuf, _T("0"));
+ wxStrcat(browseBuf, buf);
return browseBuf;
}
*
*/
-void PushEnvironmentStyle(char *style)
+void PushEnvironmentStyle(wxChar *style)
{
environmentStack.Add(style);
}
void PopEnvironmentStyle(void)
{
- wxNode *node = environmentStack.Last();
+ wxStringListNode *node = environmentStack.GetLast();
if (node)
{
- char *val = (char *)node->Data();
+ wxChar *val = (wxChar *)node->GetData();
delete[] val;
delete node;
}
// Write out the styles, most recent first.
void WriteEnvironmentStyles(void)
{
- wxNode *node = environmentStack.Last();
+ wxStringListNode *node = environmentStack.GetLast();
while (node)
{
- char *val = (char *)node->Data();
+ wxChar *val = (wxChar *)node->GetData();
TexOutput(val);
- node = node->Next();
+ node = node->GetNext();
}
if (!inTabular && (ParIndent > 0) && (forbidParindent == 0))
{
- char buf[15];
- sprintf(buf, "\\fi%d", ParIndent*20); // Convert points to TWIPS
+ wxChar buf[15];
+ wxSnprintf(buf, sizeof(buf), _T("\\fi%d"), ParIndent*20); // Convert points to TWIPS
TexOutput(buf);
}
- if (environmentStack.Number() > 0 || (ParIndent > 0))
- TexOutput("\n");
+ if (environmentStack.GetCount() > 0 || (ParIndent > 0))
+ TexOutput(_T("\n"));
}
void OutputRTFHeaderCommands(void)
{
- char buf[300];
- if (PageStyle && strcmp(PageStyle, "plain") == 0)
+ wxChar buf[300];
+ if (PageStyle && wxStrcmp(PageStyle, _T("plain")) == 0)
{
- TexOutput("{\\headerl }{\\headerr }");
+ TexOutput(_T("{\\headerl }{\\headerr }"));
}
- else if (PageStyle && strcmp(PageStyle, "empty") == 0)
+ else if (PageStyle && wxStrcmp(PageStyle, _T("empty")) == 0)
{
- TexOutput("{\\headerl }{\\headerr }");
+ TexOutput(_T("{\\headerl }{\\headerr }"));
}
- else if (PageStyle && strcmp(PageStyle, "headings") == 0)
+ else if (PageStyle && wxStrcmp(PageStyle, _T("headings")) == 0)
{
// Left header
- TexOutput("{\\headerl\\fi0 ");
+ TexOutput(_T("{\\headerl\\fi0 "));
if (headerRule)
- TexOutput("\\brdrb\\brdrs\\brdrw15\\brsp20 ");
+ TexOutput(_T("\\brdrb\\brdrs\\brdrw15\\brsp20 "));
- TexOutput("{\\i \\qr ");
+ TexOutput(_T("{\\i \\qr "));
if (DocumentStyle == LATEX_ARTICLE)
{
- sprintf(buf, "SECTION %d", sectionNo);
+ wxSnprintf(buf, sizeof(buf), _T("SECTION %d"), sectionNo);
TexOutput(buf);
}
else
{
- sprintf(buf, "CHAPTER %d: ", chapterNo);
+ wxSnprintf(buf, sizeof(buf), _T("CHAPTER %d: "), chapterNo);
TexOutput(buf);
}
- TexOutput("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}");
- TexOutput("}\\par\\pard}");
+ TexOutput(_T("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
+ TexOutput(_T("}\\par\\pard}"));
// Right header
- TexOutput("{\\headerr\\fi0 ");
+ TexOutput(_T("{\\headerr\\fi0 "));
if (headerRule)
- TexOutput("\\brdrb\\brdrs\\brdrw15\\brsp20 ");
+ TexOutput(_T("\\brdrb\\brdrs\\brdrw15\\brsp20 "));
- TexOutput("{\\i \\qc ");
+ TexOutput(_T("{\\i \\qc "));
if (DocumentStyle == LATEX_ARTICLE)
{
- sprintf(buf, "SECTION %d", sectionNo);
+ wxSnprintf(buf, sizeof(buf), _T("SECTION %d"), sectionNo);
TexOutput(buf);
}
else
{
- sprintf(buf, "CHAPTER %d", chapterNo);
+ wxSnprintf(buf, sizeof(buf), _T("CHAPTER %d"), chapterNo);
TexOutput(buf);
}
- TexOutput("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}");
- TexOutput("}\\par\\pard}");
+ TexOutput(_T("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
+ TexOutput(_T("}\\par\\pard}"));
}
else
{
int oldForbidResetPar = forbidResetPar;
forbidResetPar = 0;
-
+
if (LeftHeaderEven || CentreHeaderEven || RightHeaderEven)
{
- TexOutput("{\\headerl\\fi0 ");
+ TexOutput(_T("{\\headerl\\fi0 "));
if (headerRule)
- TexOutput("\\brdrb\\brdrs\\brdrw15\\brsp20 ");
+ TexOutput(_T("\\brdrb\\brdrs\\brdrw15\\brsp20 "));
if (LeftHeaderEven)
{
if (!CentreHeaderEven && !RightHeaderEven)
- TexOutput("\\ql ");
+ TexOutput(_T("\\ql "));
TraverseChildrenFromChunk(LeftHeaderEven);
}
if (CentreHeaderEven)
{
if (!LeftHeaderEven && !RightHeaderEven)
- TexOutput("\\qc ");
+ TexOutput(_T("\\qc "));
else
- TexOutput("\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab "));
TraverseChildrenFromChunk(CentreHeaderEven);
}
if (RightHeaderEven)
{
if (!LeftHeaderEven && !CentreHeaderEven)
- TexOutput("\\qr ");
+ TexOutput(_T("\\qr "));
else
- TexOutput("\\tab\\tab\\tab\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab\\tab\\tab\\tab "));
TraverseChildrenFromChunk(RightHeaderEven);
}
- TexOutput("\\par\\pard}");
+ TexOutput(_T("\\par\\pard}"));
}
if (LeftHeaderOdd || CentreHeaderOdd || RightHeaderOdd)
{
- TexOutput("{\\headerr\\fi0 ");
+ TexOutput(_T("{\\headerr\\fi0 "));
if (headerRule)
- TexOutput("\\brdrb\\brdrs\\brdrw15\\brsp20 ");
+ TexOutput(_T("\\brdrb\\brdrs\\brdrw15\\brsp20 "));
if (LeftHeaderOdd)
{
if (!CentreHeaderOdd && !RightHeaderOdd)
- TexOutput("\\ql ");
+ TexOutput(_T("\\ql "));
TraverseChildrenFromChunk(LeftHeaderOdd);
}
if (CentreHeaderOdd)
{
if (!LeftHeaderOdd && !RightHeaderOdd)
- TexOutput("\\qc ");
+ TexOutput(_T("\\qc "));
else
- TexOutput("\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab "));
TraverseChildrenFromChunk(CentreHeaderOdd);
}
if (RightHeaderOdd)
{
if (!LeftHeaderOdd && !CentreHeaderOdd)
- TexOutput("\\qr ");
+ TexOutput(_T("\\qr "));
else
- TexOutput("\\tab\\tab\\tab\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab\\tab\\tab\\tab "));
TraverseChildrenFromChunk(RightHeaderOdd);
}
- TexOutput("\\par\\pard}");
+ TexOutput(_T("\\par\\pard}"));
}
// As an approximation, don't put a header on the first page of a section.
// This may not always be desired, but it's a reasonable guess.
- TexOutput("{\\headerf }");
+ TexOutput(_T("{\\headerf }"));
forbidResetPar = oldForbidResetPar;
}
void OutputRTFFooterCommands(void)
{
- if (PageStyle && strcmp(PageStyle, "plain") == 0)
+ if (PageStyle && wxStrcmp(PageStyle, _T("plain")) == 0)
{
- TexOutput("{\\footerl\\fi0 ");
+ TexOutput(_T("{\\footerl\\fi0 "));
if (footerRule)
- TexOutput("\\brdrt\\brdrs\\brdrw15\\brsp20 ");
- TexOutput("{\\qc ");
- TexOutput("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}");
- TexOutput("}\\par\\pard}");
+ TexOutput(_T("\\brdrt\\brdrs\\brdrw15\\brsp20 "));
+ TexOutput(_T("{\\qc "));
+ TexOutput(_T("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
+ TexOutput(_T("}\\par\\pard}"));
- TexOutput("{\\footerr\\fi0 ");
+ TexOutput(_T("{\\footerr\\fi0 "));
if (footerRule)
- TexOutput("\\brdrt\\brdrs\\brdrw15\\brsp20 ");
- TexOutput("{\\qc ");
- TexOutput("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}");
- TexOutput("}\\par\\pard}");
+ TexOutput(_T("\\brdrt\\brdrs\\brdrw15\\brsp20 "));
+ TexOutput(_T("{\\qc "));
+ TexOutput(_T("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
+ TexOutput(_T("}\\par\\pard}"));
}
- else if (PageStyle && strcmp(PageStyle, "empty") == 0)
+ else if (PageStyle && wxStrcmp(PageStyle, _T("empty")) == 0)
{
- TexOutput("{\\footerl }{\\footerr }");
+ TexOutput(_T("{\\footerl }{\\footerr }"));
}
- else if (PageStyle && strcmp(PageStyle, "headings") == 0)
+ else if (PageStyle && wxStrcmp(PageStyle, _T("headings")) == 0)
{
- TexOutput("{\\footerl }{\\footerr }");
+ TexOutput(_T("{\\footerl }{\\footerr }"));
}
else
{
if (LeftFooterEven || CentreFooterEven || RightFooterEven)
{
- TexOutput("{\\footerl\\fi0 ");
+ TexOutput(_T("{\\footerl\\fi0 "));
if (footerRule)
- TexOutput("\\brdrt\\brdrs\\brdrw15\\brsp20 ");
+ TexOutput(_T("\\brdrt\\brdrs\\brdrw15\\brsp20 "));
if (LeftFooterEven)
{
if (!CentreFooterEven && !RightFooterEven)
- TexOutput("\\ql ");
+ TexOutput(_T("\\ql "));
TraverseChildrenFromChunk(LeftFooterEven);
}
if (CentreFooterEven)
{
if (!LeftFooterEven && !RightFooterEven)
- TexOutput("\\qc ");
+ TexOutput(_T("\\qc "));
else
- TexOutput("\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab "));
TraverseChildrenFromChunk(CentreFooterEven);
}
if (RightFooterEven)
{
if (!LeftFooterEven && !CentreFooterEven)
- TexOutput("\\qr ");
+ TexOutput(_T("\\qr "));
else
- TexOutput("\\tab\\tab\\tab\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab\\tab\\tab\\tab "));
TraverseChildrenFromChunk(RightFooterEven);
}
- TexOutput("\\par\\pard}");
+ TexOutput(_T("\\par\\pard}"));
}
if (LeftFooterOdd || CentreFooterOdd || RightFooterOdd)
{
- TexOutput("{\\footerr\\fi0 ");
+ TexOutput(_T("{\\footerr\\fi0 "));
if (footerRule)
- TexOutput("\\brdrt\\brdrs\\brdrw15\\brsp20 ");
+ TexOutput(_T("\\brdrt\\brdrs\\brdrw15\\brsp20 "));
if (LeftFooterOdd)
{
if (!CentreFooterOdd && !RightFooterOdd)
- TexOutput("\\ql ");
+ TexOutput(_T("\\ql "));
TraverseChildrenFromChunk(LeftFooterOdd);
}
if (CentreFooterOdd)
{
if (!LeftFooterOdd && !RightFooterOdd)
- TexOutput("\\qc ");
+ TexOutput(_T("\\qc "));
else
- TexOutput("\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab "));
TraverseChildrenFromChunk(CentreFooterOdd);
}
if (RightFooterOdd)
{
if (!LeftFooterOdd && !CentreFooterOdd)
- TexOutput("\\qr ");
+ TexOutput(_T("\\qr "));
else
- TexOutput("\\tab\\tab\\tab\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab\\tab\\tab\\tab "));
TraverseChildrenFromChunk(RightFooterOdd);
}
- TexOutput("\\par\\pard}");
+ TexOutput(_T("\\par\\pard}"));
}
// As an approximation, put a footer on the first page of a section.
// This may not always be desired, but it's a reasonable guess.
if (LeftFooterOdd || CentreFooterOdd || RightFooterOdd)
{
- TexOutput("{\\footerf\\fi0 ");
+ TexOutput(_T("{\\footerf\\fi0 "));
if (LeftFooterOdd)
{
if (!CentreFooterOdd && !RightFooterOdd)
- TexOutput("\\ql ");
+ TexOutput(_T("\\ql "));
TraverseChildrenFromChunk(LeftFooterOdd);
}
if (CentreFooterOdd)
{
if (!LeftFooterOdd && !RightFooterOdd)
- TexOutput("\\qc ");
+ TexOutput(_T("\\qc "));
else
- TexOutput("\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab "));
TraverseChildrenFromChunk(CentreFooterOdd);
}
if (RightFooterOdd)
{
if (!LeftFooterOdd && !CentreFooterOdd)
- TexOutput("\\qr ");
+ TexOutput(_T("\\qr "));
else
- TexOutput("\\tab\\tab\\tab\\tab\\tab\\tab ");
+ TexOutput(_T("\\tab\\tab\\tab\\tab\\tab\\tab "));
TraverseChildrenFromChunk(RightFooterOdd);
}
- TexOutput("\\par\\pard}");
+ TexOutput(_T("\\par\\pard}"));
}
}
}
void RTFOnMacro(int macroId, int no_args, bool start)
{
/*
- char tmpBuf[40];
- sprintf(tmpBuf, "%d (%d)", macroId, (int)start);
+ wxChar tmpBuf[40];
+ wxSnprintf(tmpBuf, sizeof(tmpBuf), _T("%d (%d)"), macroId, (int)start);
OutputDebugString("RTFOnMacro Start "); OutputDebugString(tmpBuf);
OutputDebugString("\n"); wxYield();
*/
issuedNewParagraph = 0;
}
- char buf[300];
+ wxChar buf[300];
switch (macroId)
{
case ltCHAPTER:
if (macroId != ltCHAPTERSTAR && macroId != ltCHAPTERHEADINGSTAR)
chapterNo ++;
- char *topicName = FindTopicName(GetNextChunk());
+ wxChar *topicName = FindTopicName(GetNextChunk());
SetCurrentChapterName(topicName);
if (winHelpContents && winHelp && !InPopups())
{
- OutputCurrentSectionToString(wxBuffer);
- WriteWinHelpContentsFileLine(topicName, wxBuffer, 1);
+ OutputCurrentSectionToString(wxTex2RTFBuffer);
+ WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 1);
}
AddTexRef(topicName, NULL, ChapterNameString, chapterNo);
if (winHelp)
{
if (!InPopups())
- fprintf(Contents, "\n{\\uldb ");
- fprintf(Chapters, "\\page");
- fprintf(Chapters, "\n${\\footnote ");
+ wxFprintf(Contents, _T("\n{\\uldb "));
+ wxFprintf(Chapters, _T("\\page"));
+ wxFprintf(Chapters, _T("\n${\\footnote "));
if (!InPopups())
SetCurrentOutputs(Contents, Chapters);
else
}
else
{
- fprintf(Chapters, "\\sect\\pgncont\\titlepg\n");
+ wxFprintf(Chapters, _T("\\sect\\pgncont\\titlepg\n"));
// If a non-custom page style, we generate the header now.
- if (PageStyle && (strcmp(PageStyle, "plain") == 0 ||
- strcmp(PageStyle, "empty") == 0 ||
- strcmp(PageStyle, "headings") == 0))
+ if (PageStyle && (wxStrcmp(PageStyle, _T("plain")) == 0 ||
+ wxStrcmp(PageStyle, _T("empty")) == 0 ||
+ wxStrcmp(PageStyle, _T("headings")) == 0))
{
OutputRTFHeaderCommands();
OutputRTFFooterCommands();
}
-
+
// Need to reset the current numbering style, or RTF forgets it.
SetCurrentOutput(Chapters);
OutputNumberStyle(currentNumberStyle);
if (macroId == ltCHAPTER)
{
// Section
- fprintf(Contents, "\\par\n\\pard{\\b %d\\tab ", chapterNo);
+ wxFprintf(Contents, _T("\\par\n\\pard{\\b %d\\tab "), chapterNo);
}
else if (macroId == ltCHAPTERHEADING)
{
- fprintf(Contents, "\\par\n\\pard{\\b ");
+ wxFprintf(Contents, _T("\\par\n\\pard{\\b "));
}
else SetCurrentOutput(NULL); // No entry in table of contents
}
}
-
- startedSections = TRUE;
+
+ startedSections = true;
// Output heading to contents page
if (!InPopups())
{
OutputCurrentSection();
-
+
if (winHelp)
- fprintf(Contents, "}{\\v %s}\\par\\pard\n", topicName);
+ {
+ wxFprintf(Contents, _T("}{\\v %s}\\pard\\par\n"), topicName);
+ //WriteEnvironmentStyles();
+ }
else if ((macroId == ltCHAPTER) || (macroId == ltCHAPTERHEADING))
- fprintf(Contents, "}\\par\\par\\pard\n");
+ wxFprintf(Contents, _T("}\\par\\par\\pard\n"));
// From here, just output to chapter
SetCurrentOutput(Chapters);
}
-
+
if (winHelp)
{
- fprintf(Chapters, "}\n#{\\footnote %s}\n", topicName);
- fprintf(Chapters, "+{\\footnote %s}\n", GetBrowseString());
-
+ wxFprintf(Chapters, _T("}\n#{\\footnote %s}\n"), topicName);
+ wxFprintf(Chapters, _T("+{\\footnote %s}\n"), GetBrowseString());
+
OutputSectionKeyword(Chapters);
GenerateKeywordsForTopic(topicName);
// If we're generating a .cnt file, we don't want to be able
// jump up to the old-style contents page, so disable it.
if (winHelpContents)
- fprintf(Chapters, "!{\\footnote DisableButton(\"Up\")}\n");
+ wxFprintf(Chapters, _T("!{\\footnote DisableButton(\"Up\")}\n"));
else
- fprintf(Chapters, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
- FileNameFromPath(FileRoot), "Contents");
+ wxFprintf(Chapters, _T("!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n"),
+ wxFileNameFromPath(FileRoot), _T("Contents"));
}
}
if (!InPopups())
{
- char *styleCommand = "";
+ wxChar *styleCommand = _T("");
if (!winHelp && useHeadingStyles && (macroId == ltCHAPTER || macroId == ltCHAPTERHEADING || macroId == ltCHAPTERHEADINGSTAR))
- styleCommand = "\\s1";
- fprintf(Chapters, "\\pard{%s", ((winHelp && !InPopups()) ? "\\keepn\\sa140\\sb140" : styleCommand));
- WriteHeadingStyle(Chapters, 1); fprintf(Chapters, " ");
+ styleCommand = _T("\\s1");
+ wxFprintf(Chapters, _T("\\pard{%s"), ((winHelp && !InPopups()) ? _T("\\keepn\\sa140\\sb140") : styleCommand));
+ WriteHeadingStyle(Chapters, 1); wxFprintf(Chapters, _T(" "));
if (!winHelp)
{
if (macroId == ltCHAPTER)
{
if (useWord)
-// fprintf(Chapters, "{\\bkmkstart %s}%d{\\bkmkend %s}. ", topicName, chapterNo,
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName, topicName);
+// wxFprintf(Chapters, "{\\bkmkstart %s}%d{\\bkmkend %s}. ", topicName, chapterNo,
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName, topicName);
else
- fprintf(Chapters, "%d. ", chapterNo);
+ wxFprintf(Chapters, _T("%d. "), chapterNo);
}
else if ( useWord )
{
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName, topicName);
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName, topicName);
}
}
OutputCurrentSection();
- TexOutput("\\par\\pard}\\par\n");
+ TexOutput(_T("\\par\\pard}\n"));
}
- issuedNewParagraph = 2;
+ issuedNewParagraph = 1;
+ WriteEnvironmentStyles();
}
break;
}
if (macroId != ltSECTIONSTAR && macroId != ltSECTIONHEADINGSTAR)
sectionNo ++;
- char *topicName = FindTopicName(GetNextChunk());
+ wxChar *topicName = FindTopicName(GetNextChunk());
SetCurrentSectionName(topicName);
NotifyParentHasChildren(1);
if (winHelpContents && winHelp && !InPopups())
{
- OutputCurrentSectionToString(wxBuffer);
- WriteWinHelpContentsFileLine(topicName, wxBuffer, 2);
+ OutputCurrentSectionToString(wxTex2RTFBuffer);
+ WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 2);
}
AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo);
// Newline for a new section if this is an article
if ((DocumentStyle == LATEX_ARTICLE) &&
((macroId == ltSECTION) || (macroId == ltSECTIONSTAR) || (macroId == ltSECTIONHEADINGSTAR)))
- fprintf(Sections, "\\page\n");
+ wxFprintf(Sections, _T("\\page\n"));
if (!InPopups())
- fprintf(jumpFrom, "\n{\\uldb ");
+ wxFprintf(jumpFrom, _T("\n{\\uldb "));
}
else
{
if (DocumentStyle == LATEX_ARTICLE)
{
- TexOutput("\\sect\\pgncont\n");
+ TexOutput(_T("\\sect\\pgncont\n"));
// If a non-custom page style, we generate the header now.
- if (PageStyle && (strcmp(PageStyle, "plain") == 0 ||
- strcmp(PageStyle, "empty") == 0 ||
- strcmp(PageStyle, "headings") == 0))
+ if (PageStyle && (wxStrcmp(PageStyle, _T("plain")) == 0 ||
+ wxStrcmp(PageStyle, _T("empty")) == 0 ||
+ wxStrcmp(PageStyle, _T("headings")) == 0))
{
OutputRTFHeaderCommands();
OutputRTFFooterCommands();
if (!InPopups())
{
if (DocumentStyle == LATEX_REPORT)
- fprintf(Contents, "\n\\pard{\\tab %d.%d\\tab ", chapterNo, sectionNo);
+ wxFprintf(Contents, _T("\n\\pard{\\tab %d.%d\\tab "), chapterNo, sectionNo);
else
- fprintf(Contents, "\\par\n\\pard{\\b %d\\tab ", sectionNo);
+ wxFprintf(Contents, _T("\\par\n\\pard{\\b %d\\tab "), sectionNo);
}
}
else if (macroId == ltSECTIONHEADING)
if (!InPopups())
{
if (DocumentStyle == LATEX_REPORT)
- fprintf(Contents, "\n\\pard{\\tab "); //, chapterNo, sectionNo);
+ wxFprintf(Contents, _T("\n\\pard{\\tab ")); //, chapterNo, sectionNo);
else
- fprintf(Contents, "\\par\n\\pard{\\b "); //, sectionNo);
+ wxFprintf(Contents, _T("\\par\n\\pard{\\b ")); //, sectionNo);
}
}
else SetCurrentOutput(NULL);
- }
+ }
if (startedSections)
{
if (winHelp)
- fprintf(Sections, "\\page\n");
+ wxFprintf(Sections, _T("\\page\n"));
}
- startedSections = TRUE;
+ startedSections = true;
if (winHelp)
- fprintf(Sections, "\n${\\footnote ");
+ wxFprintf(Sections, _T("\n${\\footnote "));
// Output heading to contents page
if (!InPopups())
if (winHelp)
{
if (!InPopups())
- fprintf(jumpFrom, "}{\\v %s}\\par\\pard\n", topicName);
+ {
+ wxFprintf(jumpFrom, _T("}{\\v %s}\\pard\\par\n"), topicName);
+ //WriteEnvironmentStyles();
+ }
}
else if ((macroId != ltSECTIONSTAR) && (macroId != ltGLOSS))
{
if (DocumentStyle == LATEX_REPORT)
- fprintf(Contents, "}\\par\\pard\n");
+ wxFprintf(Contents, _T("}\\par\\pard\n"));
else
- fprintf(Contents, "}\\par\\par\\pard\n");
+ wxFprintf(Contents, _T("}\\par\\par\\pard\n"));
}
-
+
SetCurrentOutput(winHelp ? Sections : Chapters);
if (winHelp)
{
- fprintf(Sections, "}\n#{\\footnote %s}\n", topicName);
- fprintf(Sections, "+{\\footnote %s}\n", GetBrowseString());
+ wxFprintf(Sections, _T("}\n#{\\footnote %s}\n"), topicName);
+ wxFprintf(Sections, _T("+{\\footnote %s}\n"), GetBrowseString());
OutputSectionKeyword(Sections);
GenerateKeywordsForTopic(topicName);
if (useUpButton)
{
if (DocumentStyle == LATEX_ARTICLE)
{
- fprintf(Sections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
- FileNameFromPath(FileRoot), "Contents");
+ wxFprintf(Sections, _T("!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n"),
+ wxFileNameFromPath(FileRoot), _T("Contents"));
}
else if (CurrentChapterName)
{
- fprintf(Sections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
- FileNameFromPath(FileRoot), CurrentChapterName);
+ wxFprintf(Sections, _T("!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n"),
+ wxFileNameFromPath(FileRoot), CurrentChapterName);
}
}
}
if (!InPopups())
{
- char *styleCommand = "";
+ wxChar *styleCommand = _T("");
if (!winHelp && useHeadingStyles && (macroId != ltSECTIONSTAR))
{
if (DocumentStyle == LATEX_ARTICLE)
- styleCommand = "\\s1";
+ styleCommand = _T("\\s1");
else
- styleCommand = "\\s2";
+ styleCommand = _T("\\s2");
}
- char *keep = "";
+ wxChar *keep = _T("");
if (winHelp && (macroId != ltGLOSS) && !InPopups())
- keep = "\\keepn\\sa140\\sb140";
-
- fprintf(winHelp ? Sections : Chapters, "\\pard{%s%s",
+ keep = _T("\\keepn\\sa140\\sb140");
+
+ wxFprintf(winHelp ? Sections : Chapters, _T("\\pard{%s%s"),
keep, styleCommand);
WriteHeadingStyle((winHelp ? Sections : Chapters),
(DocumentStyle == LATEX_ARTICLE ? 1 : 2));
- fprintf(winHelp ? Sections : Chapters, " ");
+ wxFprintf(winHelp ? Sections : Chapters, _T(" "));
if (!winHelp)
{
if (DocumentStyle == LATEX_REPORT)
{
if (useWord)
-// fprintf(Chapters, "{\\bkmkstart %s}%d.%d{\\bkmkend %s}. ", topicName, chapterNo, sectionNo,
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName,
+// wxFprintf(Chapters, _T("{\\bkmkstart %s}%d.%d{\\bkmkend %s}. "), topicName, chapterNo, sectionNo,
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName,
topicName);
else
- fprintf(Chapters, "%d.%d. ", chapterNo, sectionNo);
+ wxFprintf(Chapters, _T("%d.%d. "), chapterNo, sectionNo);
}
else
{
if (useWord)
-// fprintf(Chapters, "{\\bkmkstart %s}%d{\\bkmkend %s}. ", topicName, sectionNo,
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName,
+// wxFprintf(Chapters, "{\\bkmkstart %s}%d{\\bkmkend %s}. ", topicName, sectionNo,
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName,
topicName);
else
- fprintf(Chapters, "%d. ", sectionNo);
+ wxFprintf(Chapters, _T("%d. "), sectionNo);
}
}
else if ( useWord )
{
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName, topicName);
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName, topicName);
}
}
OutputCurrentSection();
- TexOutput("\\par\\pard}\\par\n");
+ TexOutput(_T("\\par\\pard}\n"));
+// TexOutput(_T("\\par\\pard}\\par\n"));
}
- issuedNewParagraph = 2;
+ issuedNewParagraph = 1;
+ WriteEnvironmentStyles();
+// issuedNewParagraph = 2;
}
break;
}
{
if (winHelp && !Sections)
{
- OnError("You cannot have a subsection before a section!");
+ OnError(_T("You cannot have a subsection before a section!"));
}
else
{
if (macroId != ltSUBSECTIONSTAR)
subsectionNo ++;
- char *topicName = FindTopicName(GetNextChunk());
+ wxChar *topicName = FindTopicName(GetNextChunk());
SetCurrentSubsectionName(topicName);
NotifyParentHasChildren(2);
if (winHelpContents && winHelp && !InPopups())
{
- OutputCurrentSectionToString(wxBuffer);
- WriteWinHelpContentsFileLine(topicName, wxBuffer, 3);
+ OutputCurrentSectionToString(wxTex2RTFBuffer);
+ WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 3);
}
AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo, subsectionNo);
SetCurrentOutputs(Sections, Subsections);
SetCurrentOutputs(Sections, Subsections);
if (!InPopups())
- fprintf(Sections, "\n{\\uldb ");
+ wxFprintf(Sections, _T("\n{\\uldb "));
}
else
{
{
SetCurrentOutput(Contents);
if (DocumentStyle == LATEX_REPORT)
- fprintf(Contents, "\n\\pard\\tab\\tab %d.%d.%d\\tab ", chapterNo, sectionNo, subsectionNo);
+ wxFprintf(Contents, _T("\n\\pard\\tab\\tab %d.%d.%d\\tab "), chapterNo, sectionNo, subsectionNo);
else
- fprintf(Contents, "\n\\pard\\tab %d.%d\\tab ", sectionNo, subsectionNo);
+ wxFprintf(Contents, _T("\n\\pard\\tab %d.%d\\tab "), sectionNo, subsectionNo);
} else SetCurrentOutput(NULL);
}
if (startedSections)
if (winHelp)
{
if (!InPopups())
- fprintf(Subsections, "\\page\n");
+ wxFprintf(Subsections, _T("\\page\n"));
}
+ // Experimental JACS 2004-02-21
+#if 0
else
- fprintf(Chapters, "\\par\n");
+ wxFprintf(Chapters, _T("\\par\n"));
+#endif
}
- startedSections = TRUE;
+ startedSections = true;
if (winHelp)
- fprintf(Subsections, "\n${\\footnote ");
+ wxFprintf(Subsections, _T("\n${\\footnote "));
// Output to contents page
if (!InPopups())
if (winHelp)
{
if (!InPopups())
- fprintf(Sections, "}{\\v %s}\\par\\pard\n", topicName);
+ {
+ wxFprintf(Sections, _T("}{\\v %s}\\pard\\par\n"), topicName);
+ //WriteEnvironmentStyles();
+ }
}
else if ((macroId != ltSUBSECTIONSTAR) && (macroId != ltMEMBERSECTION) &&
(macroId != ltFUNCTIONSECTION))
- fprintf(Contents, "\\par\\pard\n");
+ wxFprintf(Contents, _T("\\par\\pard\n"));
SetCurrentOutput(winHelp ? Subsections : Chapters);
if (winHelp)
{
- fprintf(Subsections, "}\n#{\\footnote %s}\n", topicName);
- fprintf(Subsections, "+{\\footnote %s}\n", GetBrowseString());
+ wxFprintf(Subsections, _T("}\n#{\\footnote %s}\n"), topicName);
+ wxFprintf(Subsections, _T("+{\\footnote %s}\n"), GetBrowseString());
OutputSectionKeyword(Subsections);
GenerateKeywordsForTopic(topicName);
if (useUpButton && CurrentSectionName)
{
- fprintf(Subsections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
- FileNameFromPath(FileRoot), CurrentSectionName);
+ wxFprintf(Subsections, _T("!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n"),
+ wxFileNameFromPath(FileRoot), CurrentSectionName);
}
}
if (!winHelp && indexSubsections && useWord)
{
// Insert index entry for this subsection
- TexOutput("{\\xe\\v {");
+ TexOutput(_T("{\\xe\\v {"));
OutputCurrentSection();
- TexOutput("}}");
+ TexOutput(_T("}}"));
}
if (!InPopups())
{
- char *styleCommand = "";
+ wxChar *styleCommand = _T("");
if (!winHelp && useHeadingStyles && (macroId != ltSUBSECTIONSTAR))
{
if (DocumentStyle == LATEX_ARTICLE)
- styleCommand = "\\s2";
+ styleCommand = _T("\\s2");
else
- styleCommand = "\\s3";
+ styleCommand = _T("\\s3");
}
- char *keep = "";
+ wxChar *keep = _T("");
if (winHelp && !InPopups())
- keep = "\\keepn\\sa140\\sb140";
+ keep = _T("\\keepn\\sa140\\sb140");
- fprintf(winHelp ? Subsections : Chapters, "\\pard{%s%s",
+ wxFprintf(winHelp ? Subsections : Chapters, _T("\\pard{%s%s"),
keep, styleCommand);
WriteHeadingStyle((winHelp ? Subsections : Chapters),
(DocumentStyle == LATEX_ARTICLE ? 2 : 3));
- fprintf(winHelp ? Subsections : Chapters, " ");
+ wxFprintf(winHelp ? Subsections : Chapters, _T(" "));
if (!winHelp)
{
if (DocumentStyle == LATEX_REPORT)
{
if (useWord)
-// fprintf(Chapters, "{\\bkmkstart %s}%d.%d.%d{\\bkmkend %s}. ", topicName, chapterNo, sectionNo, subsectionNo,
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName,
+// wxFprintf(Chapters, _T("{\\bkmkstart %s}%d.%d.%d{\\bkmkend %s}. "), topicName, chapterNo, sectionNo, subsectionNo,
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName,
topicName);
else
- fprintf(Chapters, "%d.%d.%d. ", chapterNo, sectionNo, subsectionNo);
+ wxFprintf(Chapters, _T("%d.%d.%d. "), chapterNo, sectionNo, subsectionNo);
}
else
{
if (useWord)
-// fprintf(Chapters, "{\\bkmkstart %s}%d.%d{\\bkmkend %s}. ", topicName, sectionNo, subsectionNo,
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName,
+// wxFprintf(Chapters, _T("{\\bkmkstart %s}%d.%d{\\bkmkend %s}. "), topicName, sectionNo, subsectionNo,
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName,
topicName);
else
- fprintf(Chapters, "%d.%d. ", sectionNo, subsectionNo);
+ wxFprintf(Chapters, _T("%d.%d. "), sectionNo, subsectionNo);
}
}
else if ( useWord )
{
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName, topicName);
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName, topicName);
}
}
OutputCurrentSection(); // Repeat section header
- TexOutput("\\par\\pard}\\par\n");
+
+ // Experimental JACS
+ TexOutput(_T("\\par\\pard}\n"));
+ // TexOutput(_T("\\par\\pard}\\par\n"));
}
- issuedNewParagraph = 2;
+ issuedNewParagraph = 1;
+ WriteEnvironmentStyles();
}
}
break;
{
if (winHelp && !Subsections)
{
- OnError("You cannot have a subsubsection before a subsection!");
+ OnError(_T("You cannot have a subsubsection before a subsection!"));
}
else
{
if (macroId != ltSUBSUBSECTIONSTAR)
subsubsectionNo ++;
- char *topicName = FindTopicName(GetNextChunk());
+ wxChar *topicName = FindTopicName(GetNextChunk());
SetCurrentTopic(topicName);
NotifyParentHasChildren(3);
if (winHelpContents && winHelp)
{
- OutputCurrentSectionToString(wxBuffer);
- WriteWinHelpContentsFileLine(topicName, wxBuffer, 4);
+ OutputCurrentSectionToString(wxTex2RTFBuffer);
+ WriteWinHelpContentsFileLine(topicName, wxTex2RTFBuffer, 4);
}
AddTexRef(topicName, NULL, SectionNameString, chapterNo, sectionNo, subsectionNo, subsubsectionNo);
if (winHelp)
{
SetCurrentOutputs(Subsections, Subsubsections);
- fprintf(Subsections, "\n{\\uldb ");
+ wxFprintf(Subsections, _T("\n{\\uldb "));
}
else
{
if (DocumentStyle == LATEX_ARTICLE)
{
SetCurrentOutput(Contents);
- fprintf(Contents, "\n\\tab\\tab %d.%d.%d\\tab ",
+ wxFprintf(Contents, _T("\n\\tab\\tab %d.%d.%d\\tab "),
sectionNo, subsectionNo, subsubsectionNo);
}
else
SetCurrentOutput(NULL); // Don't write it into the contents, or anywhere else
- }
+ }
else
SetCurrentOutput(NULL); // Don't write it into the contents, or anywhere else
}
-
+
if (startedSections)
{
if (winHelp)
- fprintf(Subsubsections, "\\page\n");
+ wxFprintf(Subsubsections, _T("\\page\n"));
+ // Experimental JACS 2004-02-21
+#if 0
else
- fprintf(Chapters, "\\par\n");
+ wxFprintf(Chapters, _T("\\par\n"));
+#endif
}
- startedSections = TRUE;
+ startedSections = true;
if (winHelp)
- fprintf(Subsubsections, "\n${\\footnote ");
+ wxFprintf(Subsubsections, _T("\n${\\footnote "));
// Output header to contents page
OutputCurrentSection();
if (winHelp)
- fprintf(Subsections, "}{\\v %s}\\par\\pard\n", topicName);
+ {
+ wxFprintf(Subsections, _T("}{\\v %s}\\pard\\par\n"), topicName);
+ //WriteEnvironmentStyles();
+ }
else if ((DocumentStyle == LATEX_ARTICLE) && (macroId != ltSUBSUBSECTIONSTAR))
- fprintf(Contents, "\\par\\pard\n");
-
+ wxFprintf(Contents, _T("\\par\\pard\n"));
+
SetCurrentOutput(winHelp ? Subsubsections : Chapters);
if (winHelp)
{
- fprintf(Subsubsections, "}\n#{\\footnote %s}\n", topicName);
- fprintf(Subsubsections, "+{\\footnote %s}\n", GetBrowseString());
+ wxFprintf(Subsubsections, _T("}\n#{\\footnote %s}\n"), topicName);
+ wxFprintf(Subsubsections, _T("+{\\footnote %s}\n"), GetBrowseString());
OutputSectionKeyword(Subsubsections);
GenerateKeywordsForTopic(topicName);
if (useUpButton && CurrentSubsectionName)
{
- fprintf(Subsubsections, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
- FileNameFromPath(FileRoot), CurrentSubsectionName);
+ wxFprintf(Subsubsections, _T("!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n"),
+ wxFileNameFromPath(FileRoot), CurrentSubsectionName);
}
}
if (!winHelp && indexSubsections && useWord)
{
// Insert index entry for this subsubsection
- TexOutput("{\\xe\\v {");
+ TexOutput(_T("{\\xe\\v {"));
OutputCurrentSection();
- TexOutput("}}");
+ TexOutput(_T("}}"));
}
- char *styleCommand = "";
+ wxChar *styleCommand = _T("");
if (!winHelp && useHeadingStyles && (macroId != ltSUBSUBSECTIONSTAR))
{
if (DocumentStyle == LATEX_ARTICLE)
- styleCommand = "\\s3";
+ styleCommand = _T("\\s3");
else
- styleCommand = "\\s4";
+ styleCommand = _T("\\s4");
}
- char *keep = "";
+ wxChar *keep = _T("");
if (winHelp)
- keep = "\\keepn\\sa140\\sb140";
+ keep = _T("\\keepn\\sa140\\sb140");
- fprintf(winHelp ? Subsubsections : Chapters, "\\pard{%s%s",
+ wxFprintf(winHelp ? Subsubsections : Chapters, _T("\\pard{%s%s"),
keep, styleCommand);
WriteHeadingStyle((winHelp ? Subsubsections : Chapters),
(DocumentStyle == LATEX_ARTICLE ? 3 : 4));
- fprintf(winHelp ? Subsubsections : Chapters, " ");
-
+ wxFprintf(winHelp ? Subsubsections : Chapters, _T(" "));
+
if (!winHelp)
{
if ((macroId != ltSUBSUBSECTIONSTAR))
if (DocumentStyle == LATEX_ARTICLE)
{
if (useWord)
-// fprintf(Chapters, "{\\bkmkstart %s}%d.%d.%d{\\bkmkend %s}. ", topicName, sectionNo, subsectionNo, subsubsectionNo,
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName,
+// wxFprintf(Chapters, _T("{\\bkmkstart %s}%d.%d.%d{\\bkmkend %s}. "), topicName, sectionNo, subsectionNo, subsubsectionNo,
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName,
topicName);
else
- fprintf(Chapters, "%d.%d.%d. ", sectionNo, subsectionNo, subsubsectionNo);
+ wxFprintf(Chapters, _T("%d.%d.%d. "), sectionNo, subsectionNo, subsubsectionNo);
}
else
{
if (useWord)
-// fprintf(Chapters, "{\\bkmkstart %s}%d.%d.%d.%d{\\bkmkend %s}. ", topicName, chapterNo, sectionNo, subsectionNo, subsubsectionNo,
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName,
+// wxFprintf(Chapters, _T("{\\bkmkstart %s}%d.%d.%d.%d{\\bkmkend %s}. "), topicName, chapterNo, sectionNo, subsectionNo, subsubsectionNo,
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName,
topicName);
else
- fprintf(Chapters, "%d.%d.%d.%d. ", chapterNo, sectionNo, subsectionNo, subsubsectionNo);
+ wxFprintf(Chapters, _T("%d.%d.%d.%d. "), chapterNo, sectionNo, subsectionNo, subsubsectionNo);
}
}
else if ( useWord )
{
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", topicName, topicName);
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), topicName, topicName);
}
}
OutputCurrentSection(); // Repeat section header
- TexOutput("\\par\\pard}\\par\n");
- issuedNewParagraph = 2;
-// if (winHelp) TexOutput("\\pard");
+ TexOutput(_T("\\par\\pard}\n"));
+ issuedNewParagraph = 1;
+ WriteEnvironmentStyles();
+// TexOutput(_T("\\par\\pard}\\par\n"));
+// issuedNewParagraph = 2;
}
}
break;
{
if (!start)
{
- char *topicName = FindTopicName(GetNextChunk());
+ wxChar *topicName = FindTopicName(GetNextChunk());
SetCurrentTopic(topicName);
- TexOutput("\\pard\\par");
- char figBuf[200];
+ TexOutput(_T("\\pard\\par"));
+ wxChar figBuf[200];
if (inFigure)
{
if (winHelp || !useWord)
{
if (DocumentStyle != LATEX_ARTICLE)
- sprintf(figBuf, "%s %d.%d: ", FigureNameString, chapterNo, figureNo);
+ wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), FigureNameString, chapterNo, figureNo);
else
- sprintf(figBuf, "%s %d: ", FigureNameString, figureNo);
+ wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), FigureNameString, figureNo);
}
else
{
- sprintf(figBuf, "%s {\\field\\flddirty{\\*\\fldinst SEQ Figure \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: ",
+ wxSnprintf(figBuf, sizeof(figBuf), _T("%s {\\field\\flddirty{\\*\\fldinst SEQ Figure \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: "),
FigureNameString, topicName, topicName);
}
}
if (winHelp || !useWord)
{
if (DocumentStyle != LATEX_ARTICLE)
- sprintf(figBuf, "%s %d.%d: ", TableNameString, chapterNo, tableNo);
+ wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), TableNameString, chapterNo, tableNo);
else
- sprintf(figBuf, "%s %d: ", TableNameString, tableNo);
+ wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), TableNameString, tableNo);
}
else
{
- sprintf(figBuf, "%s {\\field\\flddirty{\\*\\fldinst SEQ Table \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: ",
+ wxSnprintf(figBuf, sizeof(figBuf), _T("%s {\\field\\flddirty{\\*\\fldinst SEQ Table \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: "),
TableNameString, topicName, topicName);
}
}
((DocumentStyle != LATEX_ARTICLE) ? n : 0));
if (winHelp)
- TexOutput("\\qc{\\b ");
+ TexOutput(_T("\\qc{\\b "));
else
- TexOutput("\\ql{\\b ");
+ TexOutput(_T("\\ql{\\b "));
TexOutput(figBuf);
OutputCurrentSection();
- TexOutput("}\\par\\pard\n");
+ TexOutput(_T("}\\par\\pard\n"));
WriteEnvironmentStyles();
}
break;
// SetCurrentOutput(winHelp ? Subsections : Chapters);
if (start)
{
- TexOutput("{");
+ TexOutput(_T("{"));
}
else
{
- TexOutput("}\n");
+ TexOutput(_T("}\n"));
if (winHelp)
{
- TexOutput("K{\\footnote {K} ");
- suppressNameDecoration = TRUE;
+ TexOutput(_T("K{\\footnote {K} "));
+ suppressNameDecoration = true;
TraverseChildrenFromChunk(currentMember);
- suppressNameDecoration = FALSE;
- TexOutput("}\n");
+ suppressNameDecoration = false;
+ TexOutput(_T("}\n"));
}
if (!winHelp && useWord)
{
// Insert index entry for this function
- TexOutput("{\\xe\\v {");
- suppressNameDecoration = TRUE; // Necessary so don't print "(\\bf" etc.
+ TexOutput(_T("{\\xe\\v {"));
+ suppressNameDecoration = true; // Necessary so don't print "(\\bf" etc.
TraverseChildrenFromChunk(currentMember);
- suppressNameDecoration = FALSE;
- TexOutput("}}");
+ suppressNameDecoration = false;
+ TexOutput(_T("}}"));
}
}
break;
// SetCurrentOutput(winHelp ? Subsections : Chapters);
if (start)
{
- TexOutput("{");
+ TexOutput(_T("{"));
}
else
{
- TexOutput("}\n");
+ TexOutput(_T("}\n"));
if (winHelp)
{
- TexOutput("K{\\footnote {K} ");
- suppressNameDecoration = TRUE; // Necessary so don't print "(\\bf" etc.
+ TexOutput(_T("K{\\footnote {K} "));
+ suppressNameDecoration = true; // Necessary so don't print "(\\bf" etc.
TraverseChildrenFromChunk(currentMember);
- suppressNameDecoration = FALSE;
- TexOutput("}\n");
+ suppressNameDecoration = false;
+ TexOutput(_T("}\n"));
}
if (!winHelp && useWord)
{
// Insert index entry for this function
- TexOutput("{\\xe\\v {");
- suppressNameDecoration = TRUE; // Necessary so don't print "(\\bf" etc.
+ TexOutput(_T("{\\xe\\v {"));
+ suppressNameDecoration = true; // Necessary so don't print "(\\bf" etc.
TraverseChildrenFromChunk(currentMember);
- suppressNameDecoration = FALSE;
- TexOutput("}}");
+ suppressNameDecoration = false;
+ TexOutput(_T("}}"));
}
}
break;
// SetCurrentOutput(winHelp ? Subsections : Chapters);
if (start)
{
- TexOutput("{\\b ");
+ TexOutput(_T("{\\b "));
}
else
{
- TexOutput("}\n");
+ TexOutput(_T("}\n"));
if (winHelp)
{
- TexOutput("K{\\footnote {K} ");
+ TexOutput(_T("K{\\footnote {K} "));
TraverseChildrenFromChunk(currentMember);
- TexOutput("}\n");
+ TexOutput(_T("}\n"));
}
if (!winHelp && useWord)
{
// Insert index entry for this function
- TexOutput("{\\xe\\v {");
- suppressNameDecoration = TRUE; // Necessary so don't print "(\\bf" etc.
+ TexOutput(_T("{\\xe\\v {"));
+ suppressNameDecoration = true; // Necessary so don't print "(\\bf" etc.
TraverseChildrenFromChunk(currentMember);
- suppressNameDecoration = FALSE;
- TexOutput("}}");
+ suppressNameDecoration = false;
+ TexOutput(_T("}}"));
}
}
break;
if (!winHelp && useWord)
{
// Insert Word for Windows table of contents
- TexOutput("\\par\\pard\\pgnrestart\\sect\\titlepg");
+ TexOutput(_T("\\par\\pard\\pgnrestart\\sect\\titlepg"));
// In linear RTF, same as chapter headings.
- sprintf(buf, "{\\b\\fs%d %s}\\par\\par\\pard\n\n", chapterFont*2, ContentsNameString);
+ wxSnprintf(buf, sizeof(buf), _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"), chapterFont*2, ContentsNameString);
TexOutput(buf);
- sprintf(buf, "{\\field{\\*\\fldinst TOC \\\\o \"1-%d\" }{\\fldrslt PRESS F9 TO REFORMAT CONTENTS}}\n", contentsDepth);
+ wxSnprintf(buf, sizeof(buf), _T("{\\field{\\*\\fldinst TOC \\\\o \"1-%d\" }{\\fldrslt PRESS F9 TO REFORMAT CONTENTS}}\n"), contentsDepth);
TexOutput(buf);
-// TexOutput("\\sect\\sectd");
+// TexOutput(_T("\\sect\\sectd"));
}
else
{
- FILE *fd = fopen(ContentsName, "r");
+ FILE *fd = wxFopen(ContentsName, _T("r"));
if (fd)
{
int ch = getc(fd);
while (ch != EOF)
{
- putc(ch, Chapters);
+ wxPutc(ch, Chapters);
ch = getc(fd);
}
fclose(fd);
}
else
{
- TexOutput("{\\i RUN TEX2RTF AGAIN FOR CONTENTS PAGE}\\par\n");
- OnInform("Run Tex2RTF again to include contents page.");
+ TexOutput(_T("{\\i RUN TEX2RTF AGAIN FOR CONTENTS PAGE}\\par\n"));
+ OnInform(_T("Run Tex2RTF again to include contents page."));
}
}
}
case ltVOID:
{
// if (start)
-// TexOutput("{\\b void}");
+// TexOutput(_T("{\\b void}"));
break;
}
case ltHARDY:
{
if (start)
- TexOutput("{\\scaps HARDY}");
+ TexOutput(_T("{\\scaps HARDY}"));
break;
}
case ltWXCLIPS:
{
if (start)
- TexOutput("wxCLIPS");
+ TexOutput(_T("wxCLIPS"));
break;
}
case ltSPECIALAMPERSAND:
if (start)
{
if (inTabular)
- TexOutput("\\cell ");
+ TexOutput(_T("\\cell "));
else
- TexOutput("&");
+ TexOutput(_T("&"));
}
break;
}
{
if (start)
{
- if (inVerbatim)
- TexOutput("~");
- else
- TexOutput(" ");
+ #if 1 // if(inVerbatim)
+ TexOutput(_T("~"));
+ #else
+ TexOutput(_T(" "));
+ #endif
}
break;
}
{
if (inTabular)
{
-// TexOutput("\\cell\\row\\trowd\\trgaph108\\trleft-108\n");
- TexOutput("\\cell\\row\\trowd\\trgaph108\n");
+// TexOutput(_T("\\cell\\row\\trowd\\trgaph108\\trleft-108\n"));
+ TexOutput(_T("\\cell\\row\\trowd\\trgaph108\n"));
int currentWidth = 0;
for (int i = 0; i < noColumns; i++)
{
currentWidth += TableData[i].width;
if (TableData[i].rightBorder)
- TexOutput("\\clbrdrr\\brdrs\\brdrw15");
+ TexOutput(_T("\\clbrdrr\\brdrs\\brdrw15"));
if (TableData[i].leftBorder)
- TexOutput("\\clbrdrl\\brdrs\\brdrw15");
-
- sprintf(buf, "\\cellx%d", currentWidth);
+ TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
+
+ wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
TexOutput(buf);
}
- TexOutput("\\pard\\intbl\n");
+ TexOutput(_T("\\pard\\intbl\n"));
}
else
- TexOutput("\\line\n");
+ TexOutput(_T("\\line\n"));
}
break;
}
case ltRANGLEBRA:
{
if (start)
- TexOutput("\tab ");
+ TexOutput(_T("\tab "));
break;
}
case ltRTFSP: // Explicit space, RTF only
{
if (start)
- TexOutput(" ");
+ TexOutput(_T(" "));
break;
}
case ltITEMIZE:
{
if (indentLevel > 0)
{
- TexOutput("\\par\\par\n");
- issuedNewParagraph = 2;
+ // Experimental JACS 2004-02-21
+ TexOutput(_T("\\par\n"));
+ issuedNewParagraph = 1;
+// TexOutput(_T("\\par\\par\n"));
+// issuedNewParagraph = 2;
}
else
{
// just done so
if (!issuedNewParagraph)
{
- TexOutput("\\par\\pard");
+ TexOutput(_T("\\par\\pard"));
WriteEnvironmentStyles();
issuedNewParagraph = 1;
}
else issuedNewParagraph = 0;
}
indentLevel ++;
- TexOutput("\\fi0\n");
+ TexOutput(_T("\\fi0\n"));
int listType;
if (macroId == ltENUMERATE)
listType = LATEX_ENUMERATE;
listType = LATEX_DESCRIPTION;
int oldIndent = 0;
- wxNode *node = itemizeStack.First();
+ wxNode *node = itemizeStack.GetFirst();
if (node)
- oldIndent = ((ItemizeStruc *)node->Data())->indentation;
+ oldIndent = ((ItemizeStruc *)node->GetData())->indentation;
int indentSize1 = oldIndent + 20*labelIndentTab;
int indentSize2 = oldIndent + 20*itemIndentTab;
ItemizeStruc *struc = new ItemizeStruc(listType, indentSize2, indentSize1);
itemizeStack.Insert(struc);
-
- sprintf(buf, "\\tx%d\\tx%d\\li%d", indentSize1, indentSize2, indentSize2);
+
+ wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\tx%d\\li%d\\sa200"), indentSize1, indentSize2, indentSize2);
PushEnvironmentStyle(buf);
}
else
indentLevel --;
PopEnvironmentStyle();
- if (itemizeStack.First())
+ if (itemizeStack.GetFirst())
{
- ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.First()->Data();
+ ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.GetFirst()->GetData();
delete struc;
- delete itemizeStack.First();
+ delete itemizeStack.GetFirst();
}
/* Change 18/7/97 - don't know why we wish to do this
if (itemizeStack.Number() == 0)
{
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
issuedNewParagraph = 2;
}
*/
{
indentLevel ++;
int oldIndent = 0;
- wxNode *node = itemizeStack.First();
+ wxNode *node = itemizeStack.GetFirst();
if (node)
- oldIndent = ((ItemizeStruc *)node->Data())->indentation;
+ oldIndent = ((ItemizeStruc *)node->GetData())->indentation;
int indentSize = oldIndent + TwoColWidthA;
ItemizeStruc *struc = new ItemizeStruc(LATEX_TWOCOL, indentSize);
itemizeStack.Insert(struc);
-
-// sprintf(buf, "\\tx%d\\li%d\\ri%d", indentSize, indentSize, TwoColWidthA+TwoColWidthB+oldIndent);
- sprintf(buf, "\\tx%d\\li%d", indentSize, indentSize);
+
+// wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\ri%d"), indentSize, indentSize, TwoColWidthA+TwoColWidthB+oldIndent);
+ wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\sa200"), indentSize, indentSize);
PushEnvironmentStyle(buf);
}
else
{
indentLevel --;
PopEnvironmentStyle();
- if (itemizeStack.First())
+ if (itemizeStack.GetFirst())
{
- ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.First()->Data();
+ ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.GetFirst()->GetData();
delete struc;
- delete itemizeStack.First();
+ delete itemizeStack.GetFirst();
}
/*
// JACS June 1997
- TexOutput("\\pard\n");
+ TexOutput(_T("\\pard\n"));
WriteEnvironmentStyles();
*/
/* why do we need this? */
- if (itemizeStack.Number() == 0)
+// Experimental
+ TexOutput(_T("\\pard\n"));
+#if 0
+ if (itemizeStack.GetCount() == 0)
{
issuedNewParagraph = 0;
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
}
+#endif
}
break;
}
case ltITEM:
{
- wxNode *node = itemizeStack.First();
+ wxNode *node = itemizeStack.GetFirst();
if (node)
{
- ItemizeStruc *struc = (ItemizeStruc *)node->Data();
+ ItemizeStruc *struc = (ItemizeStruc *)node->GetData();
if (!start)
{
struc->currentItem += 1;
- char indentBuf[60];
+ wxChar indentBuf[60];
int indentSize1 = struc->labelIndentation;
int indentSize2 = struc->indentation;
- TexOutput("\n");
- if (struc->currentItem > 1)
+ TexOutput(_T("\n"));
+ if (struc->currentItem > 1 && issuedNewParagraph == 0)
{
- if (currentItemSep > 0)
- TexOutput("\\par");
+ // JACS
+// if (currentItemSep > 0)
+// TexOutput(_T("\\par"));
- TexOutput("\\par");
+ TexOutput(_T("\\par"));
+ issuedNewParagraph = 1;
// WriteEnvironmentStyles();
}
- sprintf(buf, "\\tx%d\\tx%d\\li%d\\fi-%d\n", indentSize1, indentSize2,
+ wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\tx%d\\li%d\\fi-%d\n"), indentSize1, indentSize2,
indentSize2, 20*itemIndentTab);
TexOutput(buf);
{
if (descriptionItemArg)
{
- TexOutput("\\tab{ ");
+ TexOutput(_T("\\tab{ "));
TraverseChildrenFromChunk(descriptionItemArg);
- TexOutput("}\\tab");
+ TexOutput(_T("}\\tab"));
descriptionItemArg = NULL;
- }
- else
- {
- sprintf(indentBuf, "\\tab{\\b %d.}\\tab", struc->currentItem);
+ }
+ else
+ {
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab{\\b %d.}\\tab"), struc->currentItem);
TexOutput(indentBuf);
}
break;
{
if (descriptionItemArg)
{
- TexOutput("\\tab{ ");
+ TexOutput(_T("\\tab{ "));
TraverseChildrenFromChunk(descriptionItemArg);
- TexOutput("}\\tab");
+ TexOutput(_T("}\\tab"));
descriptionItemArg = NULL;
- }
- else
- {
+ }
+ else
+ {
if (bulletFile && winHelp)
{
if (winHelpVersion > 3) // Transparent bitmap
- sprintf(indentBuf, "\\tab\\{bmct %s\\}\\tab", bulletFile);
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab\\{bmct %s\\}\\tab"), bulletFile);
else
- sprintf(indentBuf, "\\tab\\{bmc %s\\}\\tab", bulletFile);
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab\\{bmc %s\\}\\tab"), bulletFile);
}
else if (winHelp)
- sprintf(indentBuf, "\\tab{\\b o}\\tab");
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab{\\b o}\\tab"));
else
- sprintf(indentBuf, "\\tab{\\f1\\'b7}\\tab");
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab{\\f1\\'b7}\\tab"));
TexOutput(indentBuf);
}
break;
{
if (descriptionItemArg)
{
- TexOutput("\\tab{\\b ");
+ TexOutput(_T("\\tab{\\b "));
TraverseChildrenFromChunk(descriptionItemArg);
- TexOutput("} ");
+ TexOutput(_T("} "));
descriptionItemArg = NULL;
}
break;
}
- }
+ }
}
}
break;
case ltTWOCOLITEM:
case ltTWOCOLITEMRULED:
{
- wxNode *node = itemizeStack.First();
+ wxNode *node = itemizeStack.GetFirst();
if (node)
{
- ItemizeStruc *struc = (ItemizeStruc *)node->Data();
+ ItemizeStruc *struc = (ItemizeStruc *)node->GetData();
if (start)
{
struc->currentItem += 1;
- int indentSize = struc->indentation;
int oldIndent = 0;
wxNode *node2 = NULL;
- if (itemizeStack.Number() > 1) // TODO: do I actually mean Nth(0) here??
- node2 = itemizeStack.Nth(1);
+ if (itemizeStack.GetCount() > 1) // TODO: do I actually mean Nth(0) here??
+ node2 = itemizeStack.Item(1);
if (node2)
- oldIndent = ((ItemizeStruc *)node2->Data())->indentation;
+ oldIndent = ((ItemizeStruc *)node2->GetData())->indentation;
- TexOutput("\n");
+ TexOutput(_T("\n"));
+ // JACS
+#if 0
if (struc->currentItem > 1)
{
if (currentItemSep > 0)
- TexOutput("\\par");
+ TexOutput(_T("\\par"));
// WriteEnvironmentStyles();
}
+#endif
-// sprintf(buf, "\\tx%d\\li%d\\fi-%d\\ri%d\n", TwoColWidthA,
+// wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\\ri%d\n"), TwoColWidthA,
// TwoColWidthA, TwoColWidthA, TwoColWidthA+TwoColWidthB+oldIndent);
/*
- sprintf(buf, "\\tx%d\\li%d\\fi-%d\n", TwoColWidthA,
+ wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\n"), TwoColWidthA,
TwoColWidthA, TwoColWidthA);
*/
- sprintf(buf, "\\tx%d\\li%d\\fi-%d\n", TwoColWidthA + oldIndent,
+ wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\n"), TwoColWidthA + oldIndent,
TwoColWidthA + oldIndent, TwoColWidthA);
TexOutput(buf);
}
{
if (start)
{
+ // JACS
+#if 0
if (macroId == ltVERBATIM)
{
if (!issuedNewParagraph)
{
- TexOutput("\\par\\pard");
+ TexOutput(_T("\\par\\pard"));
WriteEnvironmentStyles();
issuedNewParagraph = 1;
}
else issuedNewParagraph = 0;
}
- sprintf(buf, "{\\f3\\fs20 ");
+#endif
+
+ if (macroId == ltVERBATIM)
+ wxSnprintf(buf, sizeof(buf), _T("{\\f3\\s10\\fs20\\li720\\sa0 "));
+ else
+ wxSnprintf(buf, sizeof(buf), _T("{\\f3\\fs20 "));
TexOutput(buf);
}
else
{
- TexOutput("}");
+ TexOutput(_T("}"));
if (macroId == ltVERBATIM)
{
- TexOutput("\\pard\n");
-// issuedNewParagraph = 1;
+ TexOutput(_T("\\pard\n"));
WriteEnvironmentStyles();
+ // JACS
+#if 0
+ TexOutput(_T("\\par\n"));
+ issuedNewParagraph = 1;
+#endif
}
}
break;
{
if (start)
{
- TexOutput("\\fi0\\qc ");
+ TexOutput(_T("\\qc "));
forbidParindent ++;
- PushEnvironmentStyle("\\qc");
+ PushEnvironmentStyle(_T("\\qc\\sa200"));
}
else
{
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
issuedNewParagraph = 1;
forbidParindent --;
PopEnvironmentStyle();
{
if (start)
{
- TexOutput("\\fi0\\ql ");
+ TexOutput(_T("\\ql\\sa200 "));
forbidParindent ++;
- PushEnvironmentStyle("\\ql");
+ PushEnvironmentStyle(_T("\\ql"));
}
else
{
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
issuedNewParagraph = 1;
forbidParindent --;
PopEnvironmentStyle();
{
if (start)
{
- TexOutput("\\fi0\\qr ");
+ TexOutput(_T("\\qr\\sa200 "));
forbidParindent ++;
- PushEnvironmentStyle("\\qr");
+ PushEnvironmentStyle(_T("\\qr"));
}
else
{
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
issuedNewParagraph = 1;
forbidParindent --;
PopEnvironmentStyle();
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", smallFont*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), smallFont*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltTINY:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", tinyFont*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), tinyFont*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltNORMALSIZE:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", normalFont*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), normalFont*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltlarge:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", largeFont1*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), largeFont1*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltLarge:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", LargeFont2*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), LargeFont2*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltLARGE:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", LARGEFont3*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), LARGEFont3*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case lthuge:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", hugeFont1*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), hugeFont1*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltHuge:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", HugeFont2*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), HugeFont2*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltHUGE:
{
if (start)
{
- sprintf(buf, "{\\fs%d\n", HUGEFont3*2);
+ wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), HUGEFont3*2);
TexOutput(buf);
}
- else TexOutput("}\n");
+ else TexOutput(_T("}\n"));
break;
}
case ltTEXTBF:
{
if (start)
{
- TexOutput("{\\b ");
+ TexOutput(_T("{\\b "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
break;
}
case ltUNDERLINE:
{
if (start)
{
- TexOutput("{\\ul ");
+ TexOutput(_T("{\\ul "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
break;
}
case ltTEXTIT:
{
if (start)
{
- TexOutput("{\\i ");
+ TexOutput(_T("{\\i "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
break;
}
// Roman font: do nothing. Should really switch between
case ltRMFAMILY:
case ltRM:
{
-/*
+/*
if (start)
{
- TexOutput("{\\plain ");
+ TexOutput(_T("{\\plain "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
*/
break;
}
{
if (start)
{
- TexOutput("{\\b0 ");
+ TexOutput(_T("{\\b0 "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
break;
}
// Upright (un-italic or slant)
{
if (start)
{
- TexOutput("{\\i0 ");
+ TexOutput(_T("{\\i0 "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
break;
}
case ltTEXTSC:
{
if (start)
{
- TexOutput("{\\scaps ");
+ TexOutput(_T("{\\scaps "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
break;
}
case ltTEXTTT:
{
if (start)
{
- TexOutput("{\\f3 ");
+ TexOutput(_T("{\\f3 "));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
break;
}
case ltLBRACE:
{
if (start)
- TexOutput("\\{");
+ TexOutput(_T("\\{"));
break;
}
case ltRBRACE:
{
if (start)
- TexOutput("\\}");
+ TexOutput(_T("\\}"));
break;
}
case ltBACKSLASH:
{
if (start)
- TexOutput("\\\\");
+ TexOutput(_T("\\\\"));
break;
}
case ltPAR:
{
if (start)
{
- if ( issuedNewParagraph == 0 )
- {
- TexOutput("\\par\\pard");
+ if ( issuedNewParagraph == 0 )
+ {
+ TexOutput(_T("\\par\\pard"));
issuedNewParagraph ++;
// Extra par if parskip is more than zero (usually looks best.)
- if (!inTabular && (ParSkip > 0))
- {
- TexOutput("\\par");
+ // N.B. JACS 2004-02-21: shouldn't need this for linear RTF if
+ // we have a suitable set of styles.
+#if 0
+ if (winHelp && !inTabular && (ParSkip > 0))
+ {
+ TexOutput(_T("\\par"));
issuedNewParagraph ++;
- }
+ }
+#endif
WriteEnvironmentStyles();
- }
- // 1 is a whole paragraph if ParSkip == 0,
- // half a paragraph if ParSkip > 0
- else if ( issuedNewParagraph == 1 )
- {
- // Don't need a par at all if we've already had one,
- // and ParSkip == 0.
-
+ }
+ // 1 is a whole paragraph if ParSkip == 0,
+ // half a paragraph if ParSkip > 0
+ else if ( issuedNewParagraph == 1 )
+ {
+ // Don't need a par at all if we've already had one,
+ // and ParSkip == 0.
+#if 0
// Extra par if parskip is more than zero (usually looks best.)
- if (!inTabular && (ParSkip > 0))
- {
- TexOutput("\\par");
+ if (winHelp && !inTabular && (ParSkip > 0))
+ {
+ TexOutput(_T("\\par"));
issuedNewParagraph ++;
- }
+ }
+#endif
WriteEnvironmentStyles();
- }
+ }
/*
if (!issuedNewParagraph || (issuedNewParagraph > 1))
{
- TexOutput("\\par\\pard");
+ TexOutput(_T("\\par\\pard"));
// Extra par if parskip is more than zero (usually looks best.)
if (!inTabular && (ParSkip > 0))
- TexOutput("\\par");
+ TexOutput(_T("\\par"));
WriteEnvironmentStyles();
}
*/
- TexOutput("\n");
+ TexOutput(_T("\n"));
}
break;
}
// In Windows Help, no newpages until we've started some chapters or sections
if (!(winHelp && !startedSections))
if (start)
- TexOutput("\\page\n");
+ TexOutput(_T("\\page\n"));
break;
}
case ltMAKETITLE:
{
if (start && DocumentTitle)
{
- TexOutput("\\par\\pard");
+ TexOutput(_T("\\par\\pard"));
if (!winHelp)
- TexOutput("\\par");
- sprintf(buf, "\\qc{\\fs%d\\b ", titleFont*2);
+ TexOutput(_T("\\par"));
+ wxSnprintf(buf, sizeof(buf), _T("\\qc{\\fs%d\\b "), titleFont*2);
TexOutput(buf);
TraverseChildrenFromChunk(DocumentTitle);
- TexOutput("}\\par\\pard\n");
+ TexOutput(_T("}\\par\\pard\n"));
if (DocumentAuthor)
{
if (!winHelp)
- TexOutput("\\par");
- sprintf(buf, "\\par\\qc{\\fs%d ", authorFont*2);
+ TexOutput(_T("\\par"));
+ wxSnprintf(buf, sizeof(buf), _T("\\par\\qc{\\fs%d "), authorFont*2);
TexOutput(buf);
TraverseChildrenFromChunk(DocumentAuthor);
- TexOutput("}");
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("}"));
+ TexOutput(_T("\\par\\pard\n"));
}
if (DocumentDate)
{
- TexOutput("\\par");
- sprintf(buf, "\\qc{\\fs%d ", authorFont*2);
+ TexOutput(_T("\\par"));
+ wxSnprintf(buf, sizeof(buf), _T("\\qc{\\fs%d "), authorFont*2);
TexOutput(buf);
TraverseChildrenFromChunk(DocumentDate);
- TexOutput("}\\par\\pard\n");
+ TexOutput(_T("}\\par\\pard\n"));
}
// If linear RTF, we want this titlepage to be in a separate
// section with its own (blank) header and footer
if (!winHelp && (DocumentStyle != LATEX_ARTICLE))
{
- TexOutput("{\\header }{\\footer }\n");
+ TexOutput(_T("{\\header }{\\footer }\n"));
// Not sure about this: we get too many sections.
-// TexOutput("\\sect");
+// TexOutput(_T("\\sect"));
}
}
break;
{
if (contentsLineSection && contentsLineValue)
{
- if (strcmp(contentsLineSection, "chapter") == 0)
+ if (wxStrcmp(contentsLineSection, _T("chapter")) == 0)
{
- fprintf(Contents, "\\par\n{\\b %s}\\par\n", contentsLineValue);
+ wxFprintf(Contents, _T("\\par\n{\\b %s}\\par\n"), contentsLineValue);
}
- else if (strcmp(contentsLineSection, "section") == 0)
+ else if (wxStrcmp(contentsLineSection, _T("section")) == 0)
{
if (DocumentStyle != LATEX_ARTICLE)
- fprintf(Contents, "\n\\tab%s\\par\n", contentsLineValue);
+ wxFprintf(Contents, _T("\n\\tab%s\\par\n"), contentsLineValue);
else
- fprintf(Contents, "\\par\n{\\b %s}\\par\n", contentsLineValue);
+ wxFprintf(Contents, _T("\\par\n{\\b %s}\\par\n"), contentsLineValue);
}
}
}
{
if (start)
{
- TexOutput("\\brdrb\\brdrs\\par\\pard\n");
+ TexOutput(_T("\\brdrb\\brdrs\\par\\pard\n"));
issuedNewParagraph = 1;
WriteEnvironmentStyles();
}
{
if (start)
{
- TexOutput("\\brdrb\\brdrs\\par\\pard\n");
+ TexOutput(_T("\\brdrb\\brdrs\\par\\pard\n"));
issuedNewParagraph = 1;
WriteEnvironmentStyles();
}
case ltNUMBEREDBIBITEM:
{
if (start)
- TexOutput("\\li260\\fi-260 "); // Indent from 2nd line
+ TexOutput(_T("\\li260\\fi-260 ")); // Indent from 2nd line
else
- TexOutput("\\par\\pard\\par\n\n");
+ TexOutput(_T("\\par\\pard\\par\n\n"));
break;
}
case ltTHEPAGE:
{
if (start)
{
- TexOutput("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}");
+ TexOutput(_T("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
}
break;
}
{
if (start)
{
-// TexOutput("{\\field{\\*\\fldinst SECTION \\\\* MERGEFORMAT }{\\fldrslt 1}}");
- sprintf(buf, "%d", chapterNo);
+// TexOutput(_T("{\\field{\\*\\fldinst SECTION \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
+ wxSnprintf(buf, sizeof(buf), _T("%d"), chapterNo);
TexOutput(buf);
}
break;
{
if (start)
{
-// TexOutput("{\\field{\\*\\fldinst SECTION \\\\* MERGEFORMAT }{\\fldrslt 1}}");
- sprintf(buf, "%d", sectionNo);
+// TexOutput(_T("{\\field{\\*\\fldinst SECTION \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
+ wxSnprintf(buf, sizeof(buf), _T("%d"), sectionNo);
TexOutput(buf);
}
break;
{
if (!start && !winHelp)
{
- TexOutput("\\cols2\n");
+ TexOutput(_T("\\cols2\n"));
}
break;
}
{
if (!start && !winHelp)
{
- TexOutput("\\cols1\n");
+ TexOutput(_T("\\cols1\n"));
}
break;
}
{
if (start && useWord && !winHelp)
{
- FakeCurrentSection("Index");
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
- TexOutput("\\par{\\field{\\*\\fldinst INDEX \\\\h \"\\emdash A\\emdash \"\\\\c \"2\"}{\\fldrslt PRESS F9 TO REFORMAT INDEX}}\n");
+ FakeCurrentSection(_T("Index"));
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
+ TexOutput(_T("\\par{\\field{\\*\\fldinst INDEX \\\\h \"\\emdash A\\emdash \"\\\\c \"2\"}{\\fldrslt PRESS F9 TO REFORMAT INDEX}}\n"));
}
break;
}
{
if (start && useWord && !winHelp)
{
- FakeCurrentSection(FiguresNameString, FALSE);
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
- char buf[200];
- sprintf(buf, "{\\field\\fldedit{\\*\\fldinst TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF FIGURES}}\n",
+ FakeCurrentSection(FiguresNameString, false);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
+ wxChar buf[200];
+ wxSnprintf(buf, sizeof(buf), _T("{\\field\\fldedit{\\*\\fldinst TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF FIGURES}}\n"),
FigureNameString);
TexOutput(buf);
}
{
if (start && useWord && !winHelp)
{
- FakeCurrentSection(TablesNameString, FALSE);
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
- char buf[200];
- sprintf(buf, "{\\field\\fldedit{\\*\\fldinst TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF TABLES}}\n",
+ FakeCurrentSection(TablesNameString, false);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
+ wxChar buf[200];
+ wxSnprintf(buf, sizeof(buf), _T("{\\field\\fldedit{\\*\\fldinst TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF TABLES}}\n"),
TablesNameString);
TexOutput(buf);
}
}
// Symbols
case ltALPHA:
- if (start) TexOutput("{\\f1\\'61}");
+ if (start) TexOutput(_T("{\\f1\\'61}"));
break;
case ltBETA:
- if (start) TexOutput("{\\f1\\'62}");
+ if (start) TexOutput(_T("{\\f1\\'62}"));
break;
case ltGAMMA:
- if (start) TexOutput("{\\f1\\'63}");
+ if (start) TexOutput(_T("{\\f1\\'63}"));
break;
case ltDELTA:
- if (start) TexOutput("{\\f1\\'64}");
+ if (start) TexOutput(_T("{\\f1\\'64}"));
break;
case ltEPSILON:
case ltVAREPSILON:
- if (start) TexOutput("{\\f1\\'65}");
+ if (start) TexOutput(_T("{\\f1\\'65}"));
break;
case ltZETA:
- if (start) TexOutput("{\\f1\\'7A}");
+ if (start) TexOutput(_T("{\\f1\\'7A}"));
break;
case ltETA:
- if (start) TexOutput("{\\f1\\'68}");
+ if (start) TexOutput(_T("{\\f1\\'68}"));
break;
case ltTHETA:
case ltVARTHETA:
- if (start) TexOutput("{\\f1\\'71}");
+ if (start) TexOutput(_T("{\\f1\\'71}"));
break;
case ltIOTA:
- if (start) TexOutput("{\\f1\\'69}");
+ if (start) TexOutput(_T("{\\f1\\'69}"));
break;
case ltKAPPA:
- if (start) TexOutput("{\\f1\\'6B}");
+ if (start) TexOutput(_T("{\\f1\\'6B}"));
break;
case ltLAMBDA:
- if (start) TexOutput("{\\f1\\'6C}");
+ if (start) TexOutput(_T("{\\f1\\'6C}"));
break;
case ltMU:
- if (start) TexOutput("{\\f1\\'6D}");
+ if (start) TexOutput(_T("{\\f1\\'6D}"));
break;
case ltNU:
- if (start) TexOutput("{\\f1\\'6E}");
+ if (start) TexOutput(_T("{\\f1\\'6E}"));
break;
case ltXI:
- if (start) TexOutput("{\\f1\\'78}");
+ if (start) TexOutput(_T("{\\f1\\'78}"));
break;
case ltPI:
- if (start) TexOutput("{\\f1\\'70}");
+ if (start) TexOutput(_T("{\\f1\\'70}"));
break;
case ltVARPI:
- if (start) TexOutput("{\\f1\\'76}");
+ if (start) TexOutput(_T("{\\f1\\'76}"));
break;
case ltRHO:
case ltVARRHO:
- if (start) TexOutput("{\\f1\\'72}");
+ if (start) TexOutput(_T("{\\f1\\'72}"));
break;
case ltSIGMA:
- if (start) TexOutput("{\\f1\\'73}");
+ if (start) TexOutput(_T("{\\f1\\'73}"));
break;
case ltVARSIGMA:
- if (start) TexOutput("{\\f1\\'56}");
+ if (start) TexOutput(_T("{\\f1\\'56}"));
break;
case ltTAU:
- if (start) TexOutput("{\\f1\\'74}");
+ if (start) TexOutput(_T("{\\f1\\'74}"));
break;
case ltUPSILON:
- if (start) TexOutput("{\\f1\\'75}");
+ if (start) TexOutput(_T("{\\f1\\'75}"));
break;
case ltPHI:
case ltVARPHI:
- if (start) TexOutput("{\\f1\\'66}");
+ if (start) TexOutput(_T("{\\f1\\'66}"));
break;
case ltCHI:
- if (start) TexOutput("{\\f1\\'63}");
+ if (start) TexOutput(_T("{\\f1\\'63}"));
break;
case ltPSI:
- if (start) TexOutput("{\\f1\\'79}");
+ if (start) TexOutput(_T("{\\f1\\'79}"));
break;
case ltOMEGA:
- if (start) TexOutput("{\\f1\\'77}");
+ if (start) TexOutput(_T("{\\f1\\'77}"));
break;
case ltCAP_GAMMA:
- if (start) TexOutput("{\\f1\\'47}");
+ if (start) TexOutput(_T("{\\f1\\'47}"));
break;
case ltCAP_DELTA:
- if (start) TexOutput("{\\f1\\'44}");
+ if (start) TexOutput(_T("{\\f1\\'44}"));
break;
case ltCAP_THETA:
- if (start) TexOutput("{\\f1\\'51}");
+ if (start) TexOutput(_T("{\\f1\\'51}"));
break;
case ltCAP_LAMBDA:
- if (start) TexOutput("{\\f1\\'4C}");
+ if (start) TexOutput(_T("{\\f1\\'4C}"));
break;
case ltCAP_XI:
- if (start) TexOutput("{\\f1\\'58}");
+ if (start) TexOutput(_T("{\\f1\\'58}"));
break;
case ltCAP_PI:
- if (start) TexOutput("{\\f1\\'50}");
+ if (start) TexOutput(_T("{\\f1\\'50}"));
break;
case ltCAP_SIGMA:
- if (start) TexOutput("{\\f1\\'53}");
+ if (start) TexOutput(_T("{\\f1\\'53}"));
break;
case ltCAP_UPSILON:
- if (start) TexOutput("{\\f1\\'54}");
+ if (start) TexOutput(_T("{\\f1\\'54}"));
break;
case ltCAP_PHI:
- if (start) TexOutput("{\\f1\\'46}");
+ if (start) TexOutput(_T("{\\f1\\'46}"));
break;
case ltCAP_PSI:
- if (start) TexOutput("{\\f1\\'59}");
+ if (start) TexOutput(_T("{\\f1\\'59}"));
break;
case ltCAP_OMEGA:
- if (start) TexOutput("{\\f1\\'57}");
+ if (start) TexOutput(_T("{\\f1\\'57}"));
break;
// Binary operation symbols
case ltLE:
case ltLEQ:
- if (start) TexOutput("{\\f1\\'A3}");
+ if (start) TexOutput(_T("{\\f1\\'A3}"));
break;
case ltLL:
- if (start) TexOutput("<<");
+ if (start) TexOutput(_T("<<"));
break;
case ltSUBSET:
- if (start) TexOutput("{\\f1\\'CC}");
+ if (start) TexOutput(_T("{\\f1\\'CC}"));
break;
case ltSUBSETEQ:
- if (start) TexOutput("{\\f1\\'CD}");
+ if (start) TexOutput(_T("{\\f1\\'CD}"));
break;
case ltIN:
- if (start) TexOutput("{\\f1\\'CE}");
+ if (start) TexOutput(_T("{\\f1\\'CE}"));
break;
case ltGE:
case ltGEQ:
- if (start) TexOutput("{\\f1\\'B3}");
+ if (start) TexOutput(_T("{\\f1\\'B3}"));
break;
case ltGG:
- if (start) TexOutput(">>");
+ if (start) TexOutput(_T(">>"));
break;
case ltSUPSET:
- if (start) TexOutput("{\\f1\\'C9}");
+ if (start) TexOutput(_T("{\\f1\\'C9}"));
break;
case ltSUPSETEQ:
- if (start) TexOutput("{\\f1\\'CD}");
+ if (start) TexOutput(_T("{\\f1\\'CD}"));
break;
case ltNI:
- if (start) TexOutput("{\\f1\\'27}");
+ if (start) TexOutput(_T("{\\f1\\'27}"));
break;
case ltPERP:
- if (start) TexOutput("{\\f1\\'5E}");
+ if (start) TexOutput(_T("{\\f1\\'5E}"));
break;
case ltNEQ:
- if (start) TexOutput("{\\f1\\'B9}");
+ if (start) TexOutput(_T("{\\f1\\'B9}"));
break;
case ltAPPROX:
- if (start) TexOutput("{\\f1\\'BB}");
+ if (start) TexOutput(_T("{\\f1\\'BB}"));
break;
case ltCONG:
- if (start) TexOutput("{\\f1\\'40}");
+ if (start) TexOutput(_T("{\\f1\\'40}"));
break;
case ltEQUIV:
- if (start) TexOutput("{\\f1\\'BA}");
+ if (start) TexOutput(_T("{\\f1\\'BA}"));
break;
case ltPROPTO:
- if (start) TexOutput("{\\f1\\'B5}");
+ if (start) TexOutput(_T("{\\f1\\'B5}"));
break;
case ltSIM:
- if (start) TexOutput("{\\f1\\'7E}");
+ if (start) TexOutput(_T("{\\f1\\'7E}"));
break;
case ltSMILE:
- if (start) TexOutput("{\\f4\\'4A}");
+ if (start) TexOutput(_T("{\\f4\\'4A}"));
break;
case ltFROWN:
- if (start) TexOutput("{\\f4\\'4C}");
+ if (start) TexOutput(_T("{\\f4\\'4C}"));
break;
case ltMID:
- if (start) TexOutput("|");
+ if (start) TexOutput(_T("|"));
break;
// Negated relation symbols
case ltNOTEQ:
- if (start) TexOutput("{\\f1\\'B9}");
+ if (start) TexOutput(_T("{\\f1\\'B9}"));
break;
case ltNOTIN:
- if (start) TexOutput("{\\f1\\'CF}");
+ if (start) TexOutput(_T("{\\f1\\'CF}"));
break;
case ltNOTSUBSET:
- if (start) TexOutput("{\\f1\\'CB}");
+ if (start) TexOutput(_T("{\\f1\\'CB}"));
break;
// Arrows
case ltLEFTARROW:
- if (start) TexOutput("{\\f1\\'AC}");
+ if (start) TexOutput(_T("{\\f1\\'AC}"));
break;
case ltLEFTARROW2:
- if (start) TexOutput("{\\f1\\'DC}");
+ if (start) TexOutput(_T("{\\f1\\'DC}"));
break;
case ltRIGHTARROW:
- if (start) TexOutput("{\\f1\\'AE}");
+ if (start) TexOutput(_T("{\\f1\\'AE}"));
break;
case ltRIGHTARROW2:
- if (start) TexOutput("{\\f1\\'DE}");
+ if (start) TexOutput(_T("{\\f1\\'DE}"));
break;
case ltLEFTRIGHTARROW:
- if (start) TexOutput("{\\f1\\'AB}");
+ if (start) TexOutput(_T("{\\f1\\'AB}"));
break;
case ltLEFTRIGHTARROW2:
- if (start) TexOutput("{\\f1\\'DB}");
+ if (start) TexOutput(_T("{\\f1\\'DB}"));
break;
case ltUPARROW:
- if (start) TexOutput("{\\f1\\'AD}");
+ if (start) TexOutput(_T("{\\f1\\'AD}"));
break;
case ltUPARROW2:
- if (start) TexOutput("{\\f1\\'DD}");
+ if (start) TexOutput(_T("{\\f1\\'DD}"));
break;
case ltDOWNARROW:
- if (start) TexOutput("{\\f1\\'AF}");
+ if (start) TexOutput(_T("{\\f1\\'AF}"));
break;
case ltDOWNARROW2:
- if (start) TexOutput("{\\f1\\'DF}");
+ if (start) TexOutput(_T("{\\f1\\'DF}"));
break;
// Miscellaneous symbols
case ltALEPH:
- if (start) TexOutput("{\\f1\\'CO}");
+ if (start) TexOutput(_T("{\\f1\\'CO}"));
break;
case ltWP:
- if (start) TexOutput("{\\f1\\'C3}");
+ if (start) TexOutput(_T("{\\f1\\'C3}"));
break;
case ltRE:
- if (start) TexOutput("{\\f1\\'C2}");
+ if (start) TexOutput(_T("{\\f1\\'C2}"));
break;
case ltIM:
- if (start) TexOutput("{\\f1\\'C1}");
+ if (start) TexOutput(_T("{\\f1\\'C1}"));
break;
case ltEMPTYSET:
- if (start) TexOutput("{\\f1\\'C6}");
+ if (start) TexOutput(_T("{\\f1\\'C6}"));
break;
case ltNABLA:
- if (start) TexOutput("{\\f1\\'D1}");
+ if (start) TexOutput(_T("{\\f1\\'D1}"));
break;
case ltSURD:
- if (start) TexOutput("{\\f1\\'D6}");
+ if (start) TexOutput(_T("{\\f1\\'D6}"));
break;
case ltPARTIAL:
- if (start) TexOutput("{\\f1\\'B6}");
+ if (start) TexOutput(_T("{\\f1\\'B6}"));
break;
case ltBOT:
- if (start) TexOutput("{\\f1\\'5E}");
+ if (start) TexOutput(_T("{\\f1\\'5E}"));
break;
case ltFORALL:
- if (start) TexOutput("{\\f1\\'22}");
+ if (start) TexOutput(_T("{\\f1\\'22}"));
break;
case ltEXISTS:
- if (start) TexOutput("{\\f1\\'24}");
+ if (start) TexOutput(_T("{\\f1\\'24}"));
break;
case ltNEG:
- if (start) TexOutput("{\\f1\\'D8}");
+ if (start) TexOutput(_T("{\\f1\\'D8}"));
break;
case ltSHARP:
- if (start) TexOutput("{\\f1\\'23}");
+ if (start) TexOutput(_T("{\\f1\\'23}"));
break;
case ltANGLE:
- if (start) TexOutput("{\\f1\\'D0}");
+ if (start) TexOutput(_T("{\\f1\\'D0}"));
break;
case ltTRIANGLE:
- if (start) TexOutput("{\\f5\\'73}");
+ if (start) TexOutput(_T("{\\f5\\'73}"));
break;
case ltCLUBSUIT:
- if (start) TexOutput("{\\f5\\'A8}");
+ if (start) TexOutput(_T("{\\f5\\'A8}"));
break;
case ltDIAMONDSUIT:
- if (start) TexOutput("{\\f5\\'A9}");
+ if (start) TexOutput(_T("{\\f5\\'A9}"));
break;
case ltHEARTSUIT:
- if (start) TexOutput("{\\f5\\'AA}");
+ if (start) TexOutput(_T("{\\f5\\'AA}"));
break;
case ltSPADESUIT:
- if (start) TexOutput("{\\f5\\'AB}");
+ if (start) TexOutput(_T("{\\f5\\'AB}"));
break;
case ltINFTY:
- if (start) TexOutput("{\\f1\\'A5}");
+ if (start) TexOutput(_T("{\\f1\\'A5}"));
break;
case ltCOPYRIGHT:
- if (start) TexOutput("{\\f0\\'A9}");
+ if (start) TexOutput(_T("{\\f0\\'A9}"));
break;
case ltREGISTERED:
- if (start) TexOutput("{\\f0\\'AE}");
+ if (start) TexOutput(_T("{\\f0\\'AE}"));
break;
case ltPM:
- if (start) TexOutput("{\\f1\\'B1}");
+ if (start) TexOutput(_T("{\\f1\\'B1}"));
break;
case ltMP:
- if (start) TexOutput("{\\f1\\'B1}");
+ if (start) TexOutput(_T("{\\f1\\'B1}"));
break;
case ltTIMES:
- if (start) TexOutput("{\\f1\\'B4}");
+ if (start) TexOutput(_T("{\\f1\\'B4}"));
break;
case ltDIV:
- if (start) TexOutput("{\\f1\\'B8}");
+ if (start) TexOutput(_T("{\\f1\\'B8}"));
break;
case ltCDOT:
- if (start) TexOutput("{\\f1\\'D7}");
+ if (start) TexOutput(_T("{\\f1\\'D7}"));
break;
case ltAST:
- if (start) TexOutput("{\\f1\\'2A}");
+ if (start) TexOutput(_T("{\\f1\\'2A}"));
break;
case ltSTAR:
- if (start) TexOutput("{\\f5\\'AB}");
+ if (start) TexOutput(_T("{\\f5\\'AB}"));
break;
case ltCAP:
- if (start) TexOutput("{\\f1\\'C7}");
+ if (start) TexOutput(_T("{\\f1\\'C7}"));
break;
case ltCUP:
- if (start) TexOutput("{\\f1\\'C8}");
+ if (start) TexOutput(_T("{\\f1\\'C8}"));
break;
case ltVEE:
- if (start) TexOutput("{\\f1\\'DA}");
+ if (start) TexOutput(_T("{\\f1\\'DA}"));
break;
case ltWEDGE:
- if (start) TexOutput("{\\f1\\'D9}");
+ if (start) TexOutput(_T("{\\f1\\'D9}"));
break;
case ltCIRC:
- if (start) TexOutput("{\\f1\\'B0}");
+ if (start) TexOutput(_T("{\\f1\\'B0}"));
break;
case ltBULLET:
- if (start) TexOutput("{\\f1\\'B7}");
+ if (start) TexOutput(_T("{\\f1\\'B7}"));
break;
case ltDIAMOND:
- if (start) TexOutput("{\\f1\\'E0}");
+ if (start) TexOutput(_T("{\\f1\\'E0}"));
break;
case ltBOX:
- if (start) TexOutput("{\\f1\\'C6}");
+ if (start) TexOutput(_T("{\\f1\\'C6}"));
break;
case ltDIAMOND2:
- if (start) TexOutput("{\\f1\\'E0}");
+ if (start) TexOutput(_T("{\\f1\\'E0}"));
break;
case ltBIGTRIANGLEDOWN:
- if (start) TexOutput("{\\f1\\'D1}");
+ if (start) TexOutput(_T("{\\f1\\'D1}"));
break;
case ltOPLUS:
- if (start) TexOutput("{\\f1\\'C5}");
+ if (start) TexOutput(_T("{\\f1\\'C5}"));
break;
case ltOTIMES:
- if (start) TexOutput("{\\f1\\'C4}");
+ if (start) TexOutput(_T("{\\f1\\'C4}"));
break;
case ltSS:
- if (start) TexOutput("{\\'DF}");
+ if (start) TexOutput(_T("{\\'DF}"));
break;
case ltFIGURE:
{
- if (start) inFigure = TRUE;
- else inFigure = FALSE;
+ if (start) inFigure = true;
+ else inFigure = false;
break;
}
case ltTABLE:
{
- if (start) inTable = TRUE;
- else inTable = FALSE;
+ if (start) inTable = true;
+ else inTable = false;
break;
}
default:
// Called on start/end of argument examination
bool RTFOnArgument(int macroId, int arg_no, bool start)
{
- char buf[300];
+ wxChar buf[300];
switch (macroId)
{
case ltCHAPTER:
{
if (!start && (arg_no == 1))
currentSection = GetArgChunk();
- return FALSE;
- break;
+ return false;
}
case ltFUNC:
{
if (start && (arg_no == 1))
- TexOutput("\\pard\\li600\\fi-600{\\b ");
+ TexOutput(_T("\\pard\\li600\\fi-600{\\b "));
if (!start && (arg_no == 1))
- TexOutput("} ");
+ TexOutput(_T("} "));
if (start && (arg_no == 2))
{
- if (!suppressNameDecoration) TexOutput("{\\b ");
+ if (!suppressNameDecoration) TexOutput(_T("{\\b "));
currentMember = GetArgChunk();
}
if (!start && (arg_no == 2))
{
- if (!suppressNameDecoration) TexOutput("}");
+ if (!suppressNameDecoration) TexOutput(_T("}"));
}
-
+
if (start && (arg_no == 3))
- TexOutput("(");
+ TexOutput(_T("("));
if (!start && (arg_no == 3))
{
-// TexOutput(")\\li0\\fi0");
-// TexOutput(")\\par\\pard\\li0\\fi0");
+// TexOutput(_T(")\\li0\\fi0"));
+// TexOutput(_T(")\\par\\pard\\li0\\fi0"));
// issuedNewParagraph = 1;
- TexOutput(")");
+ TexOutput(_T(")"));
WriteEnvironmentStyles();
}
break;
case ltCLIPSFUNC:
{
if (start && (arg_no == 1))
- TexOutput("\\pard\\li260\\fi-260{\\b ");
+ TexOutput(_T("\\pard\\li260\\fi-260{\\b "));
if (!start && (arg_no == 1))
- TexOutput("} ");
+ TexOutput(_T("} "));
if (start && (arg_no == 2))
{
- if (!suppressNameDecoration) TexOutput("({\\b ");
+ if (!suppressNameDecoration) TexOutput(_T("({\\b "));
currentMember = GetArgChunk();
}
if (!start && (arg_no == 2))
{
- if (!suppressNameDecoration) TexOutput("}");
+ if (!suppressNameDecoration) TexOutput(_T("}"));
}
if (!start && (arg_no == 3))
{
- TexOutput(")\\li0\\fi0");
+ TexOutput(_T(")\\li0\\fi0"));
WriteEnvironmentStyles();
}
break;
case ltPFUNC:
{
if (start && (arg_no == 1))
- TexOutput("\\pard\\li260\\fi-260");
+ TexOutput(_T("\\pard\\li260\\fi-260"));
if (!start && (arg_no == 1))
- TexOutput(" ");
+ TexOutput(_T(" "));
if (start && (arg_no == 2))
- TexOutput("(*");
+ TexOutput(_T("(*"));
if (!start && (arg_no == 2))
- TexOutput(")");
+ TexOutput(_T(")"));
if (start && (arg_no == 2))
currentMember = GetArgChunk();
if (start && (arg_no == 3))
- TexOutput("(");
+ TexOutput(_T("("));
if (!start && (arg_no == 3))
{
- TexOutput(")\\li0\\fi0");
+ TexOutput(_T(")\\li0\\fi0"));
WriteEnvironmentStyles();
}
break;
case ltPARAM:
{
if (start && (arg_no == 1))
- TexOutput("{\\b ");
+ TexOutput(_T("{\\b "));
if (!start && (arg_no == 1))
- TexOutput("}");
+ TexOutput(_T("}"));
if (start && (arg_no == 2))
{
- TexOutput("{\\i ");
+ TexOutput(_T("{\\i "));
}
if (!start && (arg_no == 2))
{
- TexOutput("}");
+ TexOutput(_T("}"));
}
break;
}
case ltCPARAM:
{
if (start && (arg_no == 1))
- TexOutput("{\\b ");
+ TexOutput(_T("{\\b "));
if (!start && (arg_no == 1))
- TexOutput("} "); // This is the difference from param - one space!
+ TexOutput(_T("} ")); // This is the difference from param - one space!
if (start && (arg_no == 2))
{
- TexOutput("{\\i ");
+ TexOutput(_T("{\\i "));
}
if (!start && (arg_no == 2))
{
- TexOutput("}");
+ TexOutput(_T("}"));
}
break;
}
case ltMEMBER:
{
if (!start && (arg_no == 1))
- TexOutput(" ");
+ TexOutput(_T(" "));
if (start && (arg_no == 2))
currentMember = GetArgChunk();
{
if (start)
{
- char *sec = NULL;
- char *secName = NULL;
-
- char *refName = GetArgData();
+ wxChar *sec = NULL;
+
+ wxChar *refName = GetArgData();
if (winHelp || !useWord)
{
if (refName)
if (texRef)
{
sec = texRef->sectionNumber;
- secName = texRef->sectionName;
}
}
if (sec)
}
else
{
- fprintf(Chapters, "{\\field{\\*\\fldinst REF %s \\\\* MERGEFORMAT }{\\fldrslt ??}}",
+ wxFprintf(Chapters, _T("{\\field{\\*\\fldinst REF %s \\\\* MERGEFORMAT }{\\fldrslt ??}}"),
refName);
}
- return FALSE;
+ return false;
}
break;
}
if ((GetNoArgs() - arg_no) == 1)
{
if (start)
- TexOutput("{\\uldb ");
+ TexOutput(_T("{\\uldb "));
else
- TexOutput("}");
+ TexOutput(_T("}"));
}
if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional
{
if (start)
{
- TexOutput("{\\v ");
+ TexOutput(_T("{\\v "));
// Remove green colour/underlining if specified
if (!hotSpotUnderline && !hotSpotColour)
- TexOutput("%");
+ TexOutput(_T("%"));
else if (!hotSpotColour)
- TexOutput("*");
+ TexOutput(_T("*"));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
}
}
else // If a linear document, must resolve the references ourselves
// In a linear document we display the anchor text in italic plus
// the page number.
if (start)
- TexOutput("{\\i ");
+ TexOutput(_T("{\\i "));
else
- TexOutput("}");
- return TRUE;
+ TexOutput(_T("}"));
+
+ if (start)
+ helpRefText = GetArgChunk();
+
+ return true;
}
else if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional
{
if (macroId != ltHELPREFN)
{
+ wxChar *refName = GetArgData();
+ TexRef *texRef = NULL;
+ if (refName)
+ texRef = FindReference(refName);
if (start)
{
- TexOutput(" (");
- char *refName = GetArgData();
+ if (texRef || !ignoreBadRefs)
+ TexOutput(_T(" ("));
if (refName)
{
- if (useWord)
- {
- char *s = GetArgData();
- TexOutput("p. ");
- TexOutput("{\\field{\\*\\fldinst PAGEREF ");
- TexOutput(refName);
- TexOutput(" \\\\* MERGEFORMAT }{\\fldrslt ??}}");
- }
- else
+ if (texRef || !ignoreBadRefs)
{
- // Only print section name if we're not in Word mode,
- // so can't do page references
- TexRef *texRef = FindReference(refName);
- if (texRef)
+ if (useWord)
{
- TexOutput(texRef->sectionName) ; TexOutput(" "); TexOutput(texRef->sectionNumber);
+ TexOutput(_T("p. "));
+ TexOutput(_T("{\\field{\\*\\fldinst PAGEREF "));
+ TexOutput(refName);
+ TexOutput(_T(" \\\\* MERGEFORMAT }{\\fldrslt ??}}"));
}
else
{
- TexOutput("??");
- sprintf(buf, "Warning: unresolved reference %s.", refName);
- OnInform(buf);
+ // Only print section name if we're not in Word mode,
+ // so can't do page references
+ if (texRef)
+ {
+ TexOutput(texRef->sectionName);
+ TexOutput(_T(" "));
+ TexOutput(texRef->sectionNumber);
+ }
+ else
+ {
+ if (!ignoreBadRefs)
+ TexOutput(_T("??"));
+ wxSnprintf(buf, sizeof(buf), _T("Warning: unresolved reference '%s'"), refName);
+ OnInform(buf);
+ }
}
}
}
- else TexOutput("??");
+ else TexOutput(_T("??"));
+ }
+ else
+ {
+ if (texRef || !ignoreBadRefs)
+ TexOutput(_T(")"));
}
- else TexOutput(")");
}
- return FALSE;
+ return false;
}
}
break;
{
if (arg_no == 1)
{
- return TRUE;
+ return true;
}
else if (arg_no == 2)
{
if (start)
{
- inVerbatim = TRUE;
- TexOutput(" ({\\f3 ");
+ inVerbatim = true;
+ TexOutput(_T(" ({\\f3 "));
}
else
{
- TexOutput("})");
- inVerbatim = FALSE;
+ TexOutput(_T("})"));
+ inVerbatim = false;
}
- return TRUE;
+ return true;
}
break;
}
if ((GetNoArgs() - arg_no) == 1)
{
if (start)
- TexOutput("{\\ul ");
+ TexOutput(_T("{\\ul "));
else
- TexOutput("}");
+ TexOutput(_T("}"));
}
if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional
{
if (start)
{
- TexOutput("{\\v ");
+ TexOutput(_T("{\\v "));
// Remove green colour/underlining if specified
if (!hotSpotUnderline && !hotSpotColour)
- TexOutput("%");
+ TexOutput(_T("%"));
else if (!hotSpotColour)
- TexOutput("*");
+ TexOutput(_T("*"));
}
- else TexOutput("}");
+ else TexOutput(_T("}"));
}
}
else // A linear document...
{
// In a linear document we just display the anchor text in italic
if (start)
- TexOutput("{\\i ");
+ TexOutput(_T("{\\i "));
else
- TexOutput("}");
- return TRUE;
+ TexOutput(_T("}"));
+ return true;
}
- else return FALSE;
+ else return false;
}
break;
}
contentsLineSection = copystring(GetArgData());
else if (arg_no == 3)
contentsLineValue = copystring(GetArgData());
- return FALSE;
+ return false;
}
- else return FALSE;
- break;
+ else return false;
}
case ltIMAGE:
case ltIMAGEL:
case ltPSBOXTO:
{
if (arg_no == 3)
- return FALSE;
-
+ return false;
+
static int imageWidth = 0;
static int imageHeight = 0;
-
+
if (start && (arg_no == 1))
{
- char *imageDimensions = copystring(GetArgData());
- char buf1[50];
- strcpy(buf1, imageDimensions);
- char *tok1 = strtok(buf1, ";:");
- char *tok2 = strtok(NULL, ";:");
- // Convert points to TWIPS (1 twip = 1/20th of point)
- imageWidth = (int)(20*(tok1 ? ParseUnitArgument(tok1) : 0));
- imageHeight = (int)(20*(tok2 ? ParseUnitArgument(tok2) : 0));
- return FALSE;
- }
+ wxChar *imageDimensions = copystring(GetArgData());
+
+ // imageWidth - Convert points to TWIPS (1 twip = 1/20th of point)
+ wxStringTokenizer tok(imageDimensions, _T(";:"), wxTOKEN_STRTOK);
+ if(tok.HasMoreTokens())
+ {
+ wxString token = tok.GetNextToken();
+ imageWidth = (int)(20*ParseUnitArgument((wxChar*)token.c_str()));
+ }
+ else
+ {
+ imageWidth = 0;
+ }
+
+ // imageHeight - Convert points to TWIPS (1 twip = 1/20th of point)
+ if(tok.HasMoreTokens())
+ {
+ wxString token = tok.GetNextToken();
+ imageHeight = (int)(20*ParseUnitArgument((wxChar*)token.c_str()));
+ }
+ else
+ {
+ imageHeight = 0;
+ }
+
+ if (imageDimensions) // glt
+ delete [] imageDimensions;
+ return false;
+ }
else if (start && (arg_no == 2 ))
{
- char *filename = copystring(GetArgData());
- wxString f = "";
- if ((winHelp || (strcmp(bitmapMethod, "includepicture") == 0) || (strcmp(bitmapMethod, "import") == 0)) && useWord)
+ wxChar *filename = copystring(GetArgData());
+ wxString f = _T("");
+ if ((winHelp || (wxStrcmp(bitmapMethod, _T("includepicture")) == 0) || (wxStrcmp(bitmapMethod, _T("import")) == 0)) && useWord)
{
- if (f == "") // Try for a .shg (segmented hypergraphics file)
+ if (f == _T("")) // Try for a .shg (segmented hypergraphics file)
{
- strcpy(buf, filename);
+ wxStrcpy(buf, filename);
StripExtension(buf);
- strcat(buf, ".shg");
+ wxStrcat(buf, _T(".shg"));
f = TexPathList.FindValidPath(buf);
}
- if (f == "") // Try for a .bmp
+ if (f == _T("")) // Try for a .bmp
{
- strcpy(buf, filename);
+ wxStrcpy(buf, filename);
StripExtension(buf);
- strcat(buf, ".bmp");
+ wxStrcat(buf, _T(".bmp"));
f = TexPathList.FindValidPath(buf);
}
- if (f == "") // Try for a metafile instead
+ if (f == _T("")) // Try for a metafile instead
{
- strcpy(buf, filename);
+ wxStrcpy(buf, filename);
StripExtension(buf);
- strcat(buf, ".wmf");
+ wxStrcat(buf, _T(".wmf"));
f = TexPathList.FindValidPath(buf);
}
- if (f != "")
+ if (f != _T(""))
{
if (winHelp)
{
if (bitmapTransparency && (winHelpVersion > 3))
- TexOutput("\\{bmct ");
+ TexOutput(_T("\\{bmct "));
else
- TexOutput("\\{bmc ");
+ TexOutput(_T("\\{bmc "));
wxString str = wxFileNameFromPath(f);
- TexOutput((char*) (const char*) str);
- TexOutput("\\}");
+ TexOutput((wxChar*) (const wxChar*) str);
+ TexOutput(_T("\\}"));
}
else
{
// Microsoft Word method
- if (strcmp(bitmapMethod, "import") == 0)
- TexOutput("{\\field{\\*\\fldinst IMPORT ");
+ if (wxStrcmp(bitmapMethod, _T("import")) == 0)
+ TexOutput(_T("{\\field{\\*\\fldinst IMPORT "));
else
- TexOutput("{\\field{\\*\\fldinst INCLUDEPICTURE ");
+ TexOutput(_T("{\\field{\\*\\fldinst INCLUDEPICTURE "));
// Full path appears not to be valid!
wxString str = wxFileNameFromPath(f);
- TexOutput((char*)(const char*) str);
+ TexOutput((wxChar*)(const wxChar*) str);
/*
- int len = strlen(f);
- char smallBuf[2]; smallBuf[1] = 0;
+ int len = wxStrlen(f);
+ wxChar smallBuf[2]; smallBuf[1] = 0;
for (int i = 0; i < len; i++)
{
smallBuf[0] = f[i];
TexOutput(smallBuf);
}
*/
- TexOutput("}{\\fldrslt PRESS F9 TO FORMAT PICTURE}}");
+ TexOutput(_T("}{\\fldrslt PRESS F9 TO FORMAT PICTURE}}"));
}
}
else
{
- TexOutput("[No BMP or WMF for image file ");
+ TexOutput(_T("[No BMP or WMF for image file "));
TexOutput(filename);
- TexOutput("]");
- sprintf(buf, "Warning: could not find a BMP or WMF equivalent for %s.", filename);
+ TexOutput(_T("]"));
+ wxSnprintf(buf, sizeof(buf), _T("Warning: could not find a BMP or WMF equivalent for %s."), filename);
OnInform(buf);
}
+ if (filename) // glt
+ delete [] filename;
}
else // linear RTF
{
- if (f == "") // Try for a .bmp
+ if (f == _T("")) // Try for a .bmp
{
- strcpy(buf, filename);
+ wxStrcpy(buf, filename);
StripExtension(buf);
- strcat(buf, ".bmp");
+ wxStrcat(buf, _T(".bmp"));
f = TexPathList.FindValidPath(buf);
}
- if (f != "")
+ if (f != _T(""))
{
- FILE *fd = fopen(f, "rb");
+ FILE *fd = wxFopen(f, _T("rb"));
if (OutputBitmapHeader(fd, winHelp))
OutputBitmapData(fd);
else
{
- sprintf(buf, "Could not read bitmap %s.\nMay be in wrong format (needs RGB-encoded Windows BMP).", (const char*) f);
+ wxSnprintf(buf, sizeof(buf), _T("Could not read bitmap %s.\nMay be in wrong format (needs RGB-encoded Windows BMP)."), f.c_str());
OnError(buf);
}
fclose(fd);
else // Try for a metafile instead
{
#ifdef __WXMSW__
- strcpy(buf, filename);
+ wxStrcpy(buf, filename);
StripExtension(buf);
- strcat(buf, ".wmf");
+ wxStrcat(buf, _T(".wmf"));
f = TexPathList.FindValidPath(buf);
- if (f != "")
+ if (f != _T(""))
{
// HFILE handle = _lopen(f, READ);
- FILE *fd = fopen(f, "rb");
+ FILE *fd = wxFopen(f, _T("rb"));
if (OutputMetafileHeader(fd, winHelp, imageWidth, imageHeight))
{
OutputMetafileData(fd);
}
else
{
- sprintf(buf, "Could not read metafile %s. Perhaps it's not a placeable metafile?", f);
+ wxSnprintf(buf, sizeof(buf), _T("Could not read metafile %s. Perhaps it's not a placeable metafile?"), f.c_str());
OnError(buf);
}
fclose(fd);
}
else
{
-#endif
- TexOutput("[No BMP or WMF for image file ");
+#endif
+ TexOutput(_T("[No BMP or WMF for image file "));
TexOutput(filename);
- TexOutput("]");
- sprintf(buf, "Warning: could not find a BMP or WMF equivalent for %s.", filename);
+ TexOutput(_T("]"));
+ wxSnprintf(buf, sizeof(buf), _T("Warning: could not find a BMP or WMF equivalent for %s."), filename);
OnInform(buf);
#ifdef __WXMSW__
}
#endif
}
}
- return FALSE;
+ return false;
}
else
- return FALSE;
- break;
+ return false;
}
case ltTABULAR:
case ltSUPERTABULAR:
if (start)
{
currentRowNumber = 0;
- inTabular = TRUE;
- startRows = TRUE;
- tableVerticalLineLeft = FALSE;
- tableVerticalLineRight = FALSE;
+ inTabular = true;
+ startRows = true;
+ tableVerticalLineLeft = false;
+ tableVerticalLineRight = false;
int currentWidth = 0;
- char *alignString = copystring(GetArgData());
+ wxChar *alignString = copystring(GetArgData());
ParseTableArgument(alignString);
-// TexOutput("\\trowd\\trgaph108\\trleft-108");
- TexOutput("\\trowd\\trgaph108");
+// TexOutput(_T("\\trowd\\trgaph108\\trleft-108"));
+ TexOutput(_T("\\trowd\\trgaph108"));
// Write the first row formatting for compatibility
// with standard Latex
for (int i = 0; i < noColumns; i++)
{
currentWidth += TableData[i].width;
- sprintf(buf, "\\cellx%d", currentWidth);
+ wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
TexOutput(buf);
}
- TexOutput("\\pard\\intbl\n");
+ TexOutput(_T("\\pard\\intbl\n"));
}
delete[] alignString;
- return FALSE;
+ return false;
}
}
else if (arg_no == 2 && !start)
{
- TexOutput("\\pard\n");
+ TexOutput(_T("\\pard\n"));
WriteEnvironmentStyles();
- inTabular = FALSE;
+ inTabular = false;
}
break;
}
{
if (start)
{
- TexOutput("\\li360\n");
+ TexOutput(_T("\\li360\n"));
forbidParindent ++;
- PushEnvironmentStyle("\\li360");
+ PushEnvironmentStyle(_T("\\li360\\sa200"));
}
else
{
forbidParindent --;
PopEnvironmentStyle();
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
}
break;
}
{
if (start)
{
- TexOutput("\\li360\n");
- PushEnvironmentStyle("\\li360");
+ TexOutput(_T("\\li360\n"));
+ PushEnvironmentStyle(_T("\\li360\\sa200"));
}
else
{
PopEnvironmentStyle();
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
}
break;
}
{
if (start)
{
- sprintf(buf, "\\box\\trgaph108%s\n", ((macroId == ltNORMALBOXD) ? "\\brdrdb" : "\\brdrs"));
+ wxSnprintf(buf, sizeof(buf), _T("\\sa200\\box\\trgaph108%s\n"), ((macroId == ltNORMALBOXD) ? _T("\\brdrdb") : _T("\\brdrs")));
TexOutput(buf);
PushEnvironmentStyle(buf);
}
else
{
PopEnvironmentStyle();
- OnMacro(ltPAR, 0, TRUE);
- OnMacro(ltPAR, 0, FALSE);
+ OnMacro(ltPAR, 0, true);
+ OnMacro(ltPAR, 0, false);
}
break;
}
{
if (start)
{
- char *data = GetArgData();
- if (strcmp(data, "10") == 0)
+ wxChar *data = GetArgData();
+ if (wxStrcmp(data, _T("10")) == 0)
SetFontSizes(10);
- else if (strcmp(data, "11") == 0)
+ else if (wxStrcmp(data, _T("11")) == 0)
SetFontSizes(11);
- else if (strcmp(data, "12") == 0)
+ else if (wxStrcmp(data, _T("12")) == 0)
SetFontSizes(12);
- sprintf(buf, "\\fs%d\n", normalFont*2);
+ wxSnprintf(buf, sizeof(buf), _T("\\fs%d\n"), normalFont*2);
TexOutput(buf);
TexOutput(buf);
- return FALSE;
+ return false;
}
break;
}
{
if (start)
{
- char *data = GetArgData();
- if (strcmp(data, "Swiss") == 0)
- TexOutput("\\f2\n");
- else if (strcmp(data, "Symbol") == 0)
- TexOutput("\\f1\n");
- else if (strcmp(data, "Times") == 0)
- TexOutput("\\f0\n");
+ wxChar *data = GetArgData();
+ if (wxStrcmp(data, _T("Swiss")) == 0)
+ TexOutput(_T("\\f2\n"));
+ else if (wxStrcmp(data, _T("Symbol")) == 0)
+ TexOutput(_T("\\f1\n"));
+ else if (wxStrcmp(data, _T("Times")) == 0)
+ TexOutput(_T("\\f0\n"));
- return FALSE;
+ return false;
}
break;
}
{
if (start && arg_no == 1)
{
- char *data = GetArgData();
+ wxChar *data = GetArgData();
ParIndent = ParseUnitArgument(data);
if (ParIndent == 0 || forbidParindent == 0)
{
- sprintf(buf, "\\fi%d\n", ParIndent*20);
+ wxSnprintf(buf, sizeof(buf), _T("\\fi%d\n"), ParIndent*20);
TexOutput(buf);
}
- return FALSE;
+ return false;
}
break;
}
if (start && IsArgOptional())
{
descriptionItemArg = GetArgChunk();
- return FALSE;
+ return false;
}
break;
}
case 1:
{
if (!start)
- TexOutput("\\tab ");
+ TexOutput(_T("\\tab "));
break;
}
case 2:
if (!start)
{
if (macroId == ltTWOCOLITEMRULED)
- TexOutput("\\brdrb\\brdrs\\brdrw15\\brsp20 ");
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\brdrb\\brdrs\\brdrw15\\brsp20 "));
+ TexOutput(_T("\\par\\pard\n"));
issuedNewParagraph = 1;
WriteEnvironmentStyles();
}
break;
}
}
- return TRUE;
- break;
+ return true;
}
/*
* Accents
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
if (val)
{
switch (val[0])
{
case 'a':
- TexOutput("\\'e0");
+ TexOutput(_T("\\'e0"));
break;
case 'e':
- TexOutput("\\'e8");
+ TexOutput(_T("\\'e8"));
break;
case 'i':
- TexOutput("\\'ec");
+ TexOutput(_T("\\'ec"));
break;
case 'o':
- TexOutput("\\'f2");
+ TexOutput(_T("\\'f2"));
break;
case 'u':
- TexOutput("\\'f9");
+ TexOutput(_T("\\'f9"));
break;
case 'A':
- TexOutput("\\'c0");
+ TexOutput(_T("\\'c0"));
break;
case 'E':
- TexOutput("\\'c8");
+ TexOutput(_T("\\'c8"));
break;
case 'I':
- TexOutput("\\'cc");
+ TexOutput(_T("\\'cc"));
break;
case 'O':
- TexOutput("\\'d2");
+ TexOutput(_T("\\'d2"));
break;
case 'U':
- TexOutput("\\'d9");
+ TexOutput(_T("\\'d9"));
break;
default:
break;
}
}
}
- return FALSE;
- break;
+ return false;
}
case ltACCENT_ACUTE:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
if (val)
{
switch (val[0])
{
case 'a':
- TexOutput("\\'e1");
+ TexOutput(_T("\\'e1"));
break;
case 'e':
- TexOutput("\\'e9");
+ TexOutput(_T("\\'e9"));
break;
case 'i':
- TexOutput("\\'ed");
+ TexOutput(_T("\\'ed"));
break;
case 'o':
- TexOutput("\\'f3");
+ TexOutput(_T("\\'f3"));
break;
case 'u':
- TexOutput("\\'fa");
+ TexOutput(_T("\\'fa"));
break;
case 'y':
- TexOutput("\\'fd");
+ TexOutput(_T("\\'fd"));
break;
case 'A':
- TexOutput("\\'c1");
+ TexOutput(_T("\\'c1"));
break;
case 'E':
- TexOutput("\\'c9");
+ TexOutput(_T("\\'c9"));
break;
case 'I':
- TexOutput("\\'cd");
+ TexOutput(_T("\\'cd"));
break;
case 'O':
- TexOutput("\\'d3");
+ TexOutput(_T("\\'d3"));
break;
case 'U':
- TexOutput("\\'da");
+ TexOutput(_T("\\'da"));
break;
case 'Y':
- TexOutput("\\'dd");
+ TexOutput(_T("\\'dd"));
break;
default:
break;
}
}
}
- return FALSE;
- break;
+ return false;
}
case ltACCENT_CARET:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
if (val)
{
switch (val[0])
{
case 'a':
- TexOutput("\\'e2");
+ TexOutput(_T("\\'e2"));
break;
case 'e':
- TexOutput("\\'ea");
+ TexOutput(_T("\\'ea"));
break;
case 'i':
- TexOutput("\\'ee");
+ TexOutput(_T("\\'ee"));
break;
case 'o':
- TexOutput("\\'f4");
+ TexOutput(_T("\\'f4"));
break;
case 'u':
- TexOutput("\\'fb");
+ TexOutput(_T("\\'fb"));
break;
case 'A':
- TexOutput("\\'c2");
+ TexOutput(_T("\\'c2"));
break;
case 'E':
- TexOutput("\\'ca");
+ TexOutput(_T("\\'ca"));
break;
case 'I':
- TexOutput("\\'ce");
+ TexOutput(_T("\\'ce"));
break;
case 'O':
- TexOutput("\\'d4");
+ TexOutput(_T("\\'d4"));
break;
case 'U':
- TexOutput("\\'db");
+ TexOutput(_T("\\'db"));
break;
default:
break;
}
}
}
- return FALSE;
- break;
+ return false;
}
case ltACCENT_TILDE:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
if (val)
{
switch (val[0])
{
case 'a':
- TexOutput("\\'e3");
+ TexOutput(_T("\\'e3"));
break;
case ' ':
- TexOutput("~");
+ TexOutput(_T("~"));
break;
case 'n':
- TexOutput("\\'f1");
+ TexOutput(_T("\\'f1"));
break;
case 'o':
- TexOutput("\\'f5");
+ TexOutput(_T("\\'f5"));
break;
case 'A':
- TexOutput("\\'c3");
+ TexOutput(_T("\\'c3"));
break;
case 'N':
- TexOutput("\\'d1");
+ TexOutput(_T("\\'d1"));
break;
case 'O':
- TexOutput("\\'d5");
+ TexOutput(_T("\\'d5"));
break;
default:
break;
}
}
}
- return FALSE;
- break;
+ return false;
}
case ltACCENT_UMLAUT:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
if (val)
{
switch (val[0])
{
case 'a':
- TexOutput("\\'e4");
+ TexOutput(_T("\\'e4"));
break;
case 'e':
- TexOutput("\\'eb");
+ TexOutput(_T("\\'eb"));
break;
case 'i':
- TexOutput("\\'ef");
+ TexOutput(_T("\\'ef"));
break;
case 'o':
- TexOutput("\\'f6");
+ TexOutput(_T("\\'f6"));
break;
case 'u':
- TexOutput("\\'fc");
+ TexOutput(_T("\\'fc"));
break;
case 's':
- TexOutput("\\'df");
+ TexOutput(_T("\\'df"));
break;
case 'y':
- TexOutput("\\'ff");
+ TexOutput(_T("\\'ff"));
break;
case 'A':
- TexOutput("\\'c4");
+ TexOutput(_T("\\'c4"));
break;
case 'E':
- TexOutput("\\'cb");
+ TexOutput(_T("\\'cb"));
break;
case 'I':
- TexOutput("\\'cf");
+ TexOutput(_T("\\'cf"));
break;
case 'O':
- TexOutput("\\'d6");
+ TexOutput(_T("\\'d6"));
break;
case 'U':
- TexOutput("\\'dc");
+ TexOutput(_T("\\'dc"));
break;
case 'Y':
- TexOutput("\\'df");
+ TexOutput(_T("\\'df"));
break;
default:
break;
}
}
}
- return FALSE;
- break;
+ return false;
}
case ltACCENT_DOT:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
if (val)
{
switch (val[0])
{
case 'a':
- TexOutput("\\'e5");
+ TexOutput(_T("\\'e5"));
break;
case 'A':
- TexOutput("\\'c5");
+ TexOutput(_T("\\'c5"));
break;
default:
break;
}
}
}
- return FALSE;
- break;
+ return false;
}
case ltACCENT_CADILLA:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
if (val)
{
switch (val[0])
{
case 'c':
- TexOutput("\\'e7");
+ TexOutput(_T("\\'e7"));
break;
case 'C':
- TexOutput("\\'c7");
+ TexOutput(_T("\\'c7"));
break;
default:
break;
}
}
}
- return FALSE;
- break;
+ return false;
}
case ltFOOTNOTE:
{
- static char *helpTopic = NULL;
+ static wxChar *helpTopic = NULL;
static FILE *savedOutput = NULL;
if (winHelp)
{
{
if (start)
{
- OnInform("Consider using \\footnotepopup instead of \\footnote.");
+ OnInform(_T("Consider using \\footnotepopup instead of \\footnote."));
footnoteCount ++;
- char footBuf[20];
- sprintf(footBuf, "(%d)", footnoteCount);
+ wxChar footBuf[20];
+ wxSnprintf(footBuf, sizeof(footBuf), _T("(%d)"), footnoteCount);
- TexOutput(" {\\ul ");
+ TexOutput(_T(" {\\ul "));
TexOutput(footBuf);
- TexOutput("}");
+ TexOutput(_T("}"));
helpTopic = FindTopicName(NULL);
- TexOutput("{\\v ");
+ TexOutput(_T("{\\v "));
// Remove green colour/underlining if specified
if (!hotSpotUnderline && !hotSpotColour)
- TexOutput("%");
+ TexOutput(_T("%"));
else if (!hotSpotColour)
- TexOutput("*");
+ TexOutput(_T("*"));
TexOutput(helpTopic);
- TexOutput("}");
+ TexOutput(_T("}"));
- fprintf(Popups, "\\page\n");
-// fprintf(Popups, "\n${\\footnote }"); // No title
- fprintf(Popups, "\n#{\\footnote %s}\n", helpTopic);
- fprintf(Popups, "+{\\footnote %s}\n", GetBrowseString());
+ wxFprintf(Popups, _T("\\page\n"));
+// wxFprintf(Popups, _T("\n${\\footnote }")); // No title
+ wxFprintf(Popups, _T("\n#{\\footnote %s}\n"), helpTopic);
+ wxFprintf(Popups, _T("+{\\footnote %s}\n"), GetBrowseString());
savedOutput = CurrentOutput1;
SetCurrentOutput(Popups);
- }
- else
- {
+ }
+ else
+ {
SetCurrentOutput(savedOutput);
- }
- return TRUE;
}
- return TRUE;
+ return true;
+ }
+ return true;
}
else
{
if (start)
{
- TexOutput(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}", TRUE);
+ TexOutput(_T(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}"), true);
}
else
{
- TexOutput("}}", TRUE);
+ TexOutput(_T("}}"), true);
}
- return TRUE;
+ return true;
}
- break;
}
case ltFOOTNOTEPOPUP:
{
- static char *helpTopic = NULL;
+ static wxChar *helpTopic = NULL;
static FILE *savedOutput = NULL;
if (winHelp)
{
{
if (start)
{
- TexOutput("{\\ul ");
- }
- else TexOutput("}");
- return TRUE;
+ TexOutput(_T("{\\ul "));
+ }
+ else
+ {
+ TexOutput(_T("}"));
+ }
+ return true;
}
else if (arg_no == 2)
{
if (start)
{
helpTopic = FindTopicName(NULL);
- TexOutput("{\\v ");
+ TexOutput(_T("{\\v "));
// Remove green colour/underlining if specified
if (!hotSpotUnderline && !hotSpotColour)
- TexOutput("%");
+ TexOutput(_T("%"));
else if (!hotSpotColour)
- TexOutput("*");
+ TexOutput(_T("*"));
TexOutput(helpTopic);
- TexOutput("}");
+ TexOutput(_T("}"));
- fprintf(Popups, "\\page\n");
-// fprintf(Popups, "\n${\\footnote }"); // No title
- fprintf(Popups, "\n#{\\footnote %s}\n", helpTopic);
- fprintf(Popups, "+{\\footnote %s}\n", GetBrowseString());
+ wxFprintf(Popups, _T("\\page\n"));
+// wxFprintf(Popups, _T("\n${\\footnote }")); // No title
+ wxFprintf(Popups, _T("\n#{\\footnote %s}\n"), helpTopic);
+ wxFprintf(Popups, _T("+{\\footnote %s}\n"), GetBrowseString());
savedOutput = CurrentOutput1;
SetCurrentOutput(Popups);
}
{
SetCurrentOutput(savedOutput);
}
- return TRUE;
+ return true;
}
}
else
{
if (arg_no == 1)
- return TRUE;
+ return true;
if (start)
{
- TexOutput(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}", TRUE);
+ TexOutput(_T(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}"), true);
}
else
{
- TexOutput("}}", TRUE);
+ TexOutput(_T("}}"), true);
}
- return TRUE;
+ return true;
}
break;
}
case ltFANCYPLAIN:
{
if (start && (arg_no == 1))
- return FALSE;
+ return false;
else
- return TRUE;
- break;
+ return true;
}
case ltSETHEADER:
{
else
forbidResetPar --;
- if (winHelp) return FALSE;
+ if (winHelp) return false;
if (start)
{
switch (arg_no)
{
case 1:
LeftHeaderEven = GetArgChunk();
- if (strlen(GetArgData(LeftHeaderEven)) == 0)
+ if (wxStrlen(GetArgData(LeftHeaderEven)) == 0)
LeftHeaderEven = NULL;
break;
case 2:
CentreHeaderEven = GetArgChunk();
- if (strlen(GetArgData(CentreHeaderEven)) == 0)
+ if (wxStrlen(GetArgData(CentreHeaderEven)) == 0)
CentreHeaderEven = NULL;
break;
case 3:
RightHeaderEven = GetArgChunk();
- if (strlen(GetArgData(RightHeaderEven)) == 0)
+ if (wxStrlen(GetArgData(RightHeaderEven)) == 0)
RightHeaderEven = NULL;
break;
case 4:
LeftHeaderOdd = GetArgChunk();
- if (strlen(GetArgData(LeftHeaderOdd)) == 0)
+ if (wxStrlen(GetArgData(LeftHeaderOdd)) == 0)
LeftHeaderOdd = NULL;
break;
case 5:
CentreHeaderOdd = GetArgChunk();
- if (strlen(GetArgData(CentreHeaderOdd)) == 0)
+ if (wxStrlen(GetArgData(CentreHeaderOdd)) == 0)
CentreHeaderOdd = NULL;
break;
case 6:
RightHeaderOdd = GetArgChunk();
- if (strlen(GetArgData(RightHeaderOdd)) == 0)
+ if (wxStrlen(GetArgData(RightHeaderOdd)) == 0)
RightHeaderOdd = NULL;
OutputRTFHeaderCommands();
break;
break;
}
}
- return FALSE;
- break;
+ return false;
}
case ltSETFOOTER:
{
else
forbidResetPar --;
- if (winHelp) return FALSE;
+ if (winHelp) return false;
if (start)
{
switch (arg_no)
{
case 1:
LeftFooterEven = GetArgChunk();
- if (strlen(GetArgData(LeftFooterEven)) == 0)
+ if (wxStrlen(GetArgData(LeftFooterEven)) == 0)
LeftFooterEven = NULL;
break;
case 2:
CentreFooterEven = GetArgChunk();
- if (strlen(GetArgData(CentreFooterEven)) == 0)
+ if (wxStrlen(GetArgData(CentreFooterEven)) == 0)
CentreFooterEven = NULL;
break;
case 3:
RightFooterEven = GetArgChunk();
- if (strlen(GetArgData(RightFooterEven)) == 0)
+ if (wxStrlen(GetArgData(RightFooterEven)) == 0)
RightFooterEven = NULL;
break;
case 4:
LeftFooterOdd = GetArgChunk();
- if (strlen(GetArgData(LeftFooterOdd)) == 0)
+ if (wxStrlen(GetArgData(LeftFooterOdd)) == 0)
LeftFooterOdd = NULL;
break;
case 5:
CentreFooterOdd = GetArgChunk();
- if (strlen(GetArgData(CentreFooterOdd)) == 0)
+ if (wxStrlen(GetArgData(CentreFooterOdd)) == 0)
CentreFooterOdd = NULL;
break;
case 6:
RightFooterOdd = GetArgChunk();
- if (strlen(GetArgData(RightFooterOdd)) == 0)
+ if (wxStrlen(GetArgData(RightFooterOdd)) == 0)
RightFooterOdd = NULL;
OutputRTFFooterCommands();
break;
break;
}
}
- return FALSE;
- break;
+ return false;
}
case ltMARKRIGHT:
{
- if (winHelp) return FALSE;
+ if (winHelp) return false;
// Fake a SetHeader command
if (start)
{
LeftHeaderEven = NULL;
CentreHeaderEven = NULL;
RightHeaderEven = NULL;
- OnInform("Consider using setheader/setfooter rather than markright.");
+ OnInform(_T("Consider using setheader/setfooter rather than markright."));
}
RTFOnArgument(ltSETHEADER, 4, start);
if (!start)
OutputRTFHeaderCommands();
- return FALSE;
- break;
+ return false;
}
case ltMARKBOTH:
{
- if (winHelp) return FALSE;
+ if (winHelp) return false;
// Fake a SetHeader command
switch (arg_no)
{
LeftHeaderEven = NULL;
CentreHeaderEven = NULL;
RightHeaderEven = NULL;
- OnInform("Consider using setheader/setfooter rather than markboth.");
+ OnInform(_T("Consider using setheader/setfooter rather than markboth."));
}
return RTFOnArgument(ltSETHEADER, 1, start);
- break;
}
case 2:
{
RTFOnArgument(ltSETHEADER, 4, start);
if (!start)
OutputRTFHeaderCommands();
- return FALSE;
- break;
+ return false;
}
}
break;
else
forbidResetPar --;
- if (winHelp) return FALSE;
+ if (winHelp) return false;
if (start)
{
- TexOutput("\\pgnrestart");
- char *data = GetArgData();
+ TexOutput(_T("\\pgnrestart"));
+ wxChar *data = GetArgData();
if (currentNumberStyle) delete[] currentNumberStyle;
currentNumberStyle = copystring(data);
OutputNumberStyle(currentNumberStyle);
-
- TexOutput("\n");
+
+ TexOutput(_T("\n"));
}
- return FALSE;
- break;
+ return false;
}
case ltTWOCOLUMN:
{
- if (winHelp) return FALSE;
+ if (winHelp) return false;
if (start)
- return TRUE;
+ return true;
break;
}
case ltITEMSEP:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
currentItemSep = ParseUnitArgument(val);
- return FALSE;
+ return false;
}
break;
}
case ltEVENSIDEMARGIN:
{
- return FALSE;
- break;
+ return false;
}
case ltODDSIDEMARGIN:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
int twips = (int)(20*ParseUnitArgument(val));
// Add an inch since in LaTeX it's specified minus an inch
twips += 1440;
CurrentLeftMarginOdd = twips;
- sprintf(buf, "\\margl%d\n", twips);
+ wxSnprintf(buf, sizeof(buf), _T("\\margl%d\n"), twips);
TexOutput(buf);
CurrentMarginParX = CurrentLeftMarginOdd + CurrentTextWidth + CurrentMarginParSep;
}
- return FALSE;
+ return false;
}
case ltMARGINPARWIDTH:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
int twips = (int)(20*ParseUnitArgument(val));
CurrentMarginParWidth = twips;
}
- return FALSE;
+ return false;
}
case ltMARGINPARSEP:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
int twips = (int)(20*ParseUnitArgument(val));
CurrentMarginParSep = twips;
CurrentMarginParX = CurrentLeftMarginOdd + CurrentTextWidth + CurrentMarginParSep;
}
- return FALSE;
+ return false;
}
case ltTEXTWIDTH:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
int twips = (int)(20*ParseUnitArgument(val));
CurrentTextWidth = twips;
CurrentRightMarginOdd = PageWidth - CurrentTextWidth - CurrentLeftMarginOdd;
CurrentRightMarginEven = PageWidth - CurrentTextWidth - CurrentLeftMarginEven;
CurrentMarginParX = CurrentLeftMarginOdd + CurrentTextWidth + CurrentMarginParSep;
- sprintf(buf, "\\margr%d\n", CurrentRightMarginOdd);
+ wxSnprintf(buf, sizeof(buf), _T("\\margr%d\n"), CurrentRightMarginOdd);
TexOutput(buf);
}
- return FALSE;
+ return false;
}
case ltMARGINPAR:
case ltMARGINPARODD:
{
if (winHelp)
{
- TexOutput("\\box\n");
- PushEnvironmentStyle("\\box");
+ TexOutput(_T("\\sa200\\box\n"));
+ PushEnvironmentStyle(_T("\\sa200\\box"));
}
else
{
- sprintf(buf, "\\phpg\\posx%d\\absw%d\n", CurrentMarginParX, CurrentMarginParWidth);
+ wxSnprintf(buf, sizeof(buf), _T("\\phpg\\posx%d\\absw%d\n"), CurrentMarginParX, CurrentMarginParWidth);
TexOutput(buf);
}
- return TRUE;
+ return true;
}
else
{
if (winHelp)
{
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
PopEnvironmentStyle();
WriteEnvironmentStyles();
}
else
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
issuedNewParagraph = 1;
}
- return FALSE;
+ return false;
}
case ltMARGINPAREVEN:
{
{
if (winHelp)
{
- TexOutput("\\box\n");
- PushEnvironmentStyle("\\box");
+ TexOutput(_T("\\sa200\\box\n"));
+ PushEnvironmentStyle(_T("\\sa200\\box"));
}
else
{
// mirror mode, on an even (left-hand) page.
int x = PageWidth - CurrentRightMarginOdd - CurrentMarginParWidth - CurrentMarginParSep
- CurrentTextWidth + GutterWidth;
- sprintf(buf, "\\phpg\\posx%d\\absw%d\n", x, CurrentMarginParWidth);
+ wxSnprintf(buf, sizeof(buf), _T("\\phpg\\posx%d\\absw%d\n"), x, CurrentMarginParWidth);
TexOutput(buf);
}
else
{
- sprintf(buf, "\\phpg\\posx%d\\absw%d\n", CurrentMarginParX, CurrentMarginParWidth);
+ wxSnprintf(buf, sizeof(buf), _T("\\phpg\\posx%d\\absw%d\n"), CurrentMarginParX, CurrentMarginParWidth);
TexOutput(buf);
}
}
- return TRUE;
+ return true;
}
else
{
if (winHelp)
{
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
PopEnvironmentStyle();
WriteEnvironmentStyles();
}
else
issuedNewParagraph = 1;
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
}
- return FALSE;
+ return false;
}
case ltTWOCOLWIDTHA:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
int twips = (int)(20*ParseUnitArgument(val));
TwoColWidthA = twips;
}
- return FALSE;
- break;
+ return false;
}
case ltTWOCOLWIDTHB:
{
if (start)
{
- char *val = GetArgData();
+ wxChar *val = GetArgData();
int twips = (int)(20*ParseUnitArgument(val));
TwoColWidthB = twips;
}
- return FALSE;
- break;
+ return false;
}
case ltROW:
case ltRULEDROW:
if (!compatibilityMode || (currentRowNumber > 0))
{
- TexOutput("\\pard\\intbl");
+ TexOutput(_T("\\pard\\intbl"));
if (macroId == ltRULEDROW)
ruleBottom = 1;
currentWidth += TableData[i].width;
if (ruleTop == 1)
{
- TexOutput("\\clbrdrt\\brdrs\\brdrw15");
+ TexOutput(_T("\\clbrdrt\\brdrs\\brdrw15"));
}
else if (ruleTop > 1)
{
- TexOutput("\\clbrdrt\\brdrdb\\brdrw15");
+ TexOutput(_T("\\clbrdrt\\brdrdb\\brdrw15"));
}
if (ruleBottom == 1)
{
- TexOutput("\\clbrdrb\\brdrs\\brdrw15");
+ TexOutput(_T("\\clbrdrb\\brdrs\\brdrw15"));
}
else if (ruleBottom > 1)
{
- TexOutput("\\clbrdrb\\brdrdb\\brdrw15");
+ TexOutput(_T("\\clbrdrb\\brdrdb\\brdrw15"));
}
if (TableData[i].rightBorder)
- TexOutput("\\clbrdrr\\brdrs\\brdrw15");
+ TexOutput(_T("\\clbrdrr\\brdrs\\brdrw15"));
if (TableData[i].leftBorder)
- TexOutput("\\clbrdrl\\brdrs\\brdrw15");
-
- sprintf(buf, "\\cellx%d", currentWidth);
+ TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
+
+ wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
TexOutput(buf);
}
- TexOutput("\\pard\\intbl\n");
+ TexOutput(_T("\\pard\\intbl\n"));
}
ruleTop = 0;
ruleBottom = 0;
currentRowNumber ++;
- return TRUE;
+ return true;
}
else
{
-// TexOutput("\\cell\\row\\trowd\\trgaph108\\trleft-108\n");
- TexOutput("\\cell\\row\\trowd\\trgaph108\n");
+// TexOutput(_T("\\cell\\row\\trowd\\trgaph108\\trleft-108\n"));
+ TexOutput(_T("\\cell\\row\\trowd\\trgaph108\n"));
}
break;
}
{
case 1:
{
- noMultiColumns = atoi(GetArgData());
- return FALSE;
- break;
+ noMultiColumns = wxAtoi(GetArgData());
+ return false;
}
case 2:
{
- return FALSE;
+ return false;
}
case 3:
{
- return TRUE;
+ return true;
}
}
}
if (arg_no == 3)
{
for (int i = 1; i < noMultiColumns; i ++)
- TexOutput("\\cell");
+ TexOutput(_T("\\cell"));
}
}
break;
if (start && (arg_no == 1))
{
// indentLevel ++;
-// TexOutput("\\fi0\n");
+// TexOutput(_T("\\fi0\n"));
int oldIndent = 0;
- wxNode *node = itemizeStack.First();
+ wxNode *node = itemizeStack.GetFirst();
if (node)
- oldIndent = ((ItemizeStruc *)node->Data())->indentation;
+ oldIndent = ((ItemizeStruc *)node->GetData())->indentation;
int indentValue = 20*ParseUnitArgument(GetArgData());
int indentSize = indentValue + oldIndent;
ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
itemizeStack.Insert(struc);
-
- sprintf(buf, "\\tx%d\\li%d ", indentSize, indentSize);
+
+ wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\sa200 "), indentSize, indentSize);
PushEnvironmentStyle(buf);
TexOutput(buf);
- return FALSE;
+ return false;
}
if (!start && (arg_no == 2))
{
PopEnvironmentStyle();
- if (itemizeStack.First())
+ if (itemizeStack.GetFirst())
{
- ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.First()->Data();
+ ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.GetFirst()->GetData();
delete struc;
- delete itemizeStack.First();
+ delete itemizeStack.GetFirst();
}
- if (itemizeStack.Number() == 0)
+ if (itemizeStack.GetCount() == 0)
{
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
issuedNewParagraph = 1;
WriteEnvironmentStyles();
}
}
- return TRUE;
- break;
+ return true;
}
/*
case ltSIZEDBOX:
if (start && (arg_no == 1))
{
int oldIndent = 0;
- wxNode *node = itemizeStack.First();
+ wxNode *node = itemizeStack.GetFirst();
if (node)
- oldIndent = ((ItemizeStruc *)node->Data())->indentation;
+ oldIndent = ((ItemizeStruc *)node->GetData())->indentation;
int boxWidth = 20*ParseUnitArgument(GetArgData());
ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
itemizeStack.Insert(struc);
-
- sprintf(buf, "\\tx%d\\li%d\\lr%d\\box%s ", indentSize, indentSize, indentSizeRight,
- ((macroId == ltCENTEREDBOX) ? "\\brdrs" : "\\brdrdb"));
+
+ wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\lr%d\\sa200\\box%s "), indentSize, indentSize, indentSizeRight,
+ ((macroId == ltCENTEREDBOX) ? _T("\\brdrs") : _T("\\brdrdb")));
PushEnvironmentStyle(buf);
TexOutput(buf);
- return FALSE;
+ return false;
}
if (!start && (arg_no == 2))
{
PopEnvironmentStyle();
- if (itemizeStack.First())
+ if (itemizeStack.GetFirst())
{
- ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.First()->Data();
+ ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.GetFirst()->GetData();
delete struc;
- delete itemizeStack.First();
+ delete itemizeStack.GetFirst();
}
if (itemizeStack.Number() == 0)
{
- TexOutput("\\par\\pard\n");
+ TexOutput(_T("\\par\\pard\n"));
issuedNewParagraph = 1;
WriteEnvironmentStyles();
}
}
- return TRUE;
+ return true;
break;
}
*/
{
if (MinorDocumentStyleString)
{
- if (StringMatch("twoside", MinorDocumentStyleString))
+ if (StringMatch(_T("twoside"), MinorDocumentStyleString))
// Mirror margins, switch on odd/even headers & footers, and break sections at odd pages
- TexOutput("\\margmirror\\facingp\\sbkodd");
- if (StringMatch("twocolumn", MinorDocumentStyleString))
- TexOutput("\\cols2");
+ TexOutput(_T("\\margmirror\\facingp\\sbkodd"));
+ if (StringMatch(_T("twocolumn"), MinorDocumentStyleString))
+ TexOutput(_T("\\cols2"));
}
- TexOutput("\n");
+ TexOutput(_T("\n"));
}
- return FALSE;
+ return false;
}
case ltSETHOTSPOTCOLOUR:
case ltSETHOTSPOTCOLOR:
{
if (!start)
{
- char *text = GetArgData();
- if (strcmp(text, "yes") == 0 || strcmp(text, "on") == 0 || strcmp(text, "ok") == 0)
- hotSpotColour = TRUE;
+ wxChar *text = GetArgData();
+ if (wxStrcmp(text, _T("yes")) == 0 || wxStrcmp(text, _T("on")) == 0 || wxStrcmp(text, _T("ok")) == 0)
+ hotSpotColour = true;
else
- hotSpotColour = FALSE;
+ hotSpotColour = false;
}
- return FALSE;
+ return false;
}
case ltSETTRANSPARENCY:
{
if (!start)
{
- char *text = GetArgData();
- if (strcmp(text, "yes") == 0 || strcmp(text, "on") == 0 || strcmp(text, "ok") == 0)
- bitmapTransparency = TRUE;
+ wxChar *text = GetArgData();
+ if (wxStrcmp(text, _T("yes")) == 0 || wxStrcmp(text, _T("on")) == 0 || wxStrcmp(text, _T("ok")) == 0)
+ bitmapTransparency = true;
else
- bitmapTransparency = FALSE;
+ bitmapTransparency = false;
}
- return FALSE;
+ return false;
}
case ltSETHOTSPOTUNDERLINE:
{
if (!start)
{
- char *text = GetArgData();
- if (strcmp(text, "yes") == 0 || strcmp(text, "on") == 0 || strcmp(text, "ok") == 0)
- hotSpotUnderline = TRUE;
+ wxChar *text = GetArgData();
+ if (wxStrcmp(text, _T("yes")) == 0 || wxStrcmp(text, _T("on")) == 0 || wxStrcmp(text, _T("ok")) == 0)
+ hotSpotUnderline = true;
else
- hotSpotUnderline = FALSE;
+ hotSpotUnderline = false;
}
- return FALSE;
+ return false;
}
case ltBIBITEM:
{
if (arg_no == 1 && start)
{
- char *citeKey = GetArgData();
+ wxChar *citeKey = GetArgData();
TexRef *ref = (TexRef *)TexReferences.Get(citeKey);
if (ref)
{
if (ref->sectionNumber) delete[] ref->sectionNumber;
- sprintf(buf, "[%d]", citeCount);
+ wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
ref->sectionNumber = copystring(buf);
}
- TexOutput("\\li260\\fi-260 "); // Indent from 2nd line
- sprintf(buf, "{\\b [%d]} ", citeCount);
+ TexOutput(_T("\\li260\\fi-260 ")); // Indent from 2nd line
+ wxSnprintf(buf, sizeof(buf), _T("{\\b [%d]} "), citeCount);
TexOutput(buf);
citeCount ++;
- return FALSE;
+ return false;
}
if (arg_no == 2 && !start)
- TexOutput("\\par\\pard\\par\n\n");
- return TRUE;
- break;
+ TexOutput(_T("\\par\\pard\\par\n\n"));
+ return true;
}
case ltTHEBIBLIOGRAPHY:
{
if (!winHelp)
{
- fprintf(Chapters, "\\sect\\pgncont\\titlepg\n");
+ wxFprintf(Chapters, _T("\\sect\\pgncont\\titlepg\n"));
// If a non-custom page style, we generate the header now.
- if (PageStyle && (strcmp(PageStyle, "plain") == 0 ||
- strcmp(PageStyle, "empty") == 0 ||
- strcmp(PageStyle, "headings") == 0))
+ if (PageStyle && (wxStrcmp(PageStyle, _T("plain")) == 0 ||
+ wxStrcmp(PageStyle, _T("empty")) == 0 ||
+ wxStrcmp(PageStyle, _T("headings")) == 0))
{
OutputRTFHeaderCommands();
OutputRTFFooterCommands();
}
-
+
// Need to reset the current numbering style, or RTF forgets it.
OutputNumberStyle(currentNumberStyle);
SetCurrentOutput(Contents);
}
else
- fprintf(Chapters, "\\page\n");
+ wxFprintf(Chapters, _T("\\page\n"));
if (winHelp)
- fprintf(Contents, "\n{\\uldb %s}", ReferencesNameString);
+ wxFprintf(Contents, _T("\n{\\uldb %s}"), ReferencesNameString);
else
- fprintf(Contents, "\\par\n\\pard{\\b %s}", ReferencesNameString);
+ wxFprintf(Contents, _T("\\par\n\\pard{\\b %s}"), ReferencesNameString);
- startedSections = TRUE;
+ startedSections = true;
if (winHelp)
- fprintf(Chapters, "\n${\\footnote %s}", ReferencesNameString);
+ wxFprintf(Chapters, _T("\n${\\footnote %s}"), ReferencesNameString);
- char *topicName = "bibliography";
+ wxChar *topicName = _T("bibliography");
if (winHelp)
- fprintf(Contents, "{\\v %s}\\par\\pard\n", topicName);
+ {
+ wxFprintf(Contents, _T("{\\v %s}\\par\\pard\n"), topicName);
+ WriteEnvironmentStyles();
+ }
else
- fprintf(Contents, "\\par\\par\\pard\n");
+ wxFprintf(Contents, _T("\\par\\par\\pard\n"));
if (winHelp)
{
- fprintf(Chapters, "\n#{\\footnote %s}\n", topicName);
- fprintf(Chapters, "+{\\footnote %s}\n", GetBrowseString());
- fprintf(Chapters, "K{\\footnote {K} %s}\n", ReferencesNameString);
+ wxFprintf(Chapters, _T("\n#{\\footnote %s}\n"), topicName);
+ wxFprintf(Chapters, _T("+{\\footnote %s}\n"), GetBrowseString());
+ wxFprintf(Chapters, _T("K{\\footnote {K} %s}\n"), ReferencesNameString);
GenerateKeywordsForTopic(topicName);
if (useUpButton)
{
- fprintf(Chapters, "!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n",
- FileNameFromPath(FileRoot), "Contents");
+ wxFprintf(Chapters, _T("!{\\footnote EnableButton(\"Up\");ChangeButtonBinding(\"Up\", \"JumpId(`%s.hlp', `%s')\")}\n"),
+ wxFileNameFromPath(FileRoot), "Contents");
}
}
-
+
SetCurrentOutput(Chapters);
- char *styleCommand = "";
+ wxChar *styleCommand = _T("");
if (!winHelp && useHeadingStyles)
- styleCommand = "\\s1";
- fprintf(Chapters, "\\pard{%s", (winHelp ? "\\keepn\\sa140\\sb140" : styleCommand));
- WriteHeadingStyle(Chapters, 1); fprintf(Chapters, " References\\par\\pard}\n");
+ styleCommand = _T("\\s1");
+ wxFprintf(Chapters, _T("\\pard{%s"), (winHelp ? _T("\\keepn\\sa140\\sb140") : styleCommand));
+ WriteHeadingStyle(Chapters, 1); wxFprintf(Chapters, _T(" References\\par\\pard}\n"));
- return FALSE;
+ return false;
}
- return TRUE;
- break;
+ return true;
}
case ltINDEX:
{
*/
if (start)
{
-// char *entry = GetArgData();
- char buf[300];
+// wxChar *entry = GetArgData();
+ wxChar buf[300];
OutputChunkToString(GetArgChunk(), buf);
if (winHelp)
{
}
else GenerateIndexEntry(buf);
}
- return FALSE;
- break;
+ return false;
}
case ltFCOL:
case ltBCOL:
{
case 1:
{
- char *name = GetArgData();
+ wxChar *name = GetArgData();
int pos = FindColourPosition(name);
if (pos > -1)
{
- sprintf(buf, "{%s%d ", ((macroId == ltFCOL) ? "\\cf" : "\\cb"), pos);
+ wxSnprintf(buf, sizeof(buf), _T("{%s%d "), ((macroId == ltFCOL) ? _T("\\cf") : _T("\\cb")), pos);
TexOutput(buf);
}
- else
- {
- sprintf(buf, "Could not find colour name %s", name);
+ else
+ {
+ wxSnprintf(buf, sizeof(buf), _T("Could not find colour name %s"), name);
OnError(buf);
- }
+ }
break;
}
case 2:
{
- return TRUE;
- break;
+ return true;
}
default:
break;
}
else
{
- if (arg_no == 2) TexOutput("}");
+ if (arg_no == 2) TexOutput(_T("}"));
}
- return FALSE;
- break;
+ return false;
}
case ltLABEL:
{
if (start && !winHelp && useWord)
{
- char *s = GetArgData();
+ wxChar *s = GetArgData();
// Only insert a bookmark here if it's not just been inserted
// in a section heading.
- if ( !CurrentTopic || !(strcmp(CurrentTopic, s) == 0) )
+ if ( !CurrentTopic || !(wxStrcmp(CurrentTopic, s) == 0) )
/*
- if ( (!CurrentChapterName || !(CurrentChapterName && (strcmp(CurrentChapterName, s) == 0))) &&
- (!CurrentSectionName || !(CurrentSectionName && (strcmp(CurrentSectionName, s) == 0))) &&
- (!CurrentSubsectionName || !(CurrentSubsectionName && (strcmp(CurrentSubsectionName, s) == 0)))
+ if ( (!CurrentChapterName || !(CurrentChapterName && (wxStrcmp(CurrentChapterName, s) == 0))) &&
+ (!CurrentSectionName || !(CurrentSectionName && (wxStrcmp(CurrentSectionName, s) == 0))) &&
+ (!CurrentSubsectionName || !(CurrentSubsectionName && (wxStrcmp(CurrentSubsectionName, s) == 0)))
)
*/
{
- fprintf(Chapters, "{\\bkmkstart %s}{\\bkmkend %s}", s,s);
+ wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), s,s);
}
}
- return FALSE;
- break;
+ return false;
}
case ltPAGEREF:
{
if (start && useWord && !winHelp)
{
- char *s = GetArgData();
- fprintf(Chapters, "{\\field{\\*\\fldinst PAGEREF %s \\\\* MERGEFORMAT }{\\fldrslt ??}}",
+ wxChar *s = GetArgData();
+ wxFprintf(Chapters, _T("{\\field{\\*\\fldinst PAGEREF %s \\\\* MERGEFORMAT }{\\fldrslt ??}}"),
s);
}
- return FALSE;
- break;
+ return false;
}
case ltPOPREFONLY:
{
if (start)
- inPopRefSection = TRUE;
+ inPopRefSection = true;
else
- inPopRefSection = FALSE;
+ inPopRefSection = false;
break;
}
case ltINSERTATLEVEL:
// This macro allows you to insert text at a different level
// from the current level, e.g. into the Sections from within a subsubsection.
if (!winHelp & useWord)
- return FALSE;
+ return false;
static int currentLevelNo = 1;
static FILE* oldLevelFile = Chapters;
if (start)
{
oldLevelFile = CurrentOutput1;
- char *str = GetArgData();
- currentLevelNo = atoi(str);
+ wxChar *str = GetArgData();
+ currentLevelNo = wxAtoi(str);
FILE* outputFile;
// TODO: cope with article style (no chapters)
switch (currentLevelNo)
}
if (outputFile)
CurrentOutput1 = outputFile;
- return FALSE;
- break;
+ return false;
}
case 2:
{
- return TRUE;
- break;
+ return true;
}
default:
break;
}
- return TRUE;
+ return true;
}
else
{
{
CurrentOutput1 = oldLevelFile;
}
- return TRUE;
+ return true;
}
- break;
}
default:
- {
return DefaultOnArgument(macroId, arg_no, start);
- break;
}
- }
- return TRUE;
+ return true;
}
bool RTFGo(void)
{
+ if (stopRunning)
+ return false;
+
// Reset variables
indentLevel = 0;
forbidParindent = 0;
contentsLineSection = NULL;
contentsLineValue = NULL;
descriptionItemArg = NULL;
- inTabular = FALSE;
- inTable = FALSE;
- inFigure = FALSE;
- startRows = FALSE;
- tableVerticalLineLeft = FALSE;
- tableVerticalLineRight = FALSE;
+ inTabular = false;
+ inTable = false;
+ inFigure = false;
+ startRows = false;
+ tableVerticalLineLeft = false;
+ tableVerticalLineRight = false;
noColumns = 0;
- startedSections = FALSE;
- inVerbatim = FALSE;
+ startedSections = false;
+ inVerbatim = false;
browseId = 0;
-
+
if (InputFile && OutputFile)
{
// Do some RTF-specific transformations on all the strings,
// recursively
Text2RTF(GetTopLevelChunk());
- Contents = fopen(TmpContentsName, "w");
- Chapters = fopen("chapters.rtf", "w");
+ Contents = wxFopen(TmpContentsName, _T("w"));
+ Chapters = wxFopen(_T("chapters.rtf"), _T("w"));
if (winHelp)
{
- Sections = fopen("sections.rtf", "w");
- Subsections = fopen("subsections.rtf", "w");
- Subsubsections = fopen("subsubsections.rtf", "w");
- Popups = fopen("popups.rtf", "w");
+ Sections = wxFopen(_T("sections.rtf"), _T("w"));
+ Subsections = wxFopen(_T("subsections.rtf"), _T("w"));
+ Subsubsections = wxFopen(_T("subsubsections.rtf"), _T("w"));
+ Popups = wxFopen(_T("popups.rtf"), _T("w"));
if (winHelpContents)
{
- WinHelpContentsFile = fopen(WinHelpContentsFileName, "w");
+ WinHelpContentsFile = wxFopen(WinHelpContentsFileName, _T("w"));
if (WinHelpContentsFile)
- fprintf(WinHelpContentsFile, ":Base %s.hlp\n", wxFileNameFromPath(FileRoot));
+ wxFprintf(WinHelpContentsFile, _T(":Base %s.hlp\n"), wxFileNameFromPath(FileRoot));
}
if (!Sections || !Subsections || !Subsubsections || !Popups || (winHelpContents && !WinHelpContentsFile))
{
- OnError("Ouch! Could not open temporary file(s) for writing.");
- return FALSE;
+ OnError(_T("Ouch! Could not open temporary file(s) for writing."));
+ return false;
}
}
if (!Contents || !Chapters)
{
- OnError("Ouch! Could not open temporary file(s) for writing.");
- return FALSE;
+ OnError(_T("Ouch! Could not open temporary file(s) for writing."));
+ return false;
}
if (winHelp)
{
- fprintf(Chapters, "\n#{\\footnote Contents}\n");
- fprintf(Chapters, "${\\footnote Contents}\n");
- fprintf(Chapters, "+{\\footnote %s}\n", GetBrowseString());
- fprintf(Chapters, "K{\\footnote {K} %s}\n", ContentsNameString);
- fprintf(Chapters, "!{\\footnote DisableButton(\"Up\")}\n");
+ wxFprintf(Chapters, _T("\n#{\\footnote Contents}\n"));
+ wxFprintf(Chapters, _T("${\\footnote Contents}\n"));
+ wxFprintf(Chapters, _T("+{\\footnote %s}\n"), GetBrowseString());
+ wxFprintf(Chapters, _T("K{\\footnote {K} %s}\n"), ContentsNameString);
+ wxFprintf(Chapters, _T("!{\\footnote DisableButton(\"Up\")}\n"));
}
if (!winHelp)
{
- fprintf(Chapters, "\\titlepg\n");
- fprintf(Contents, "\\par\\pard\\pgnrestart\\sect\\titlepg");
+ wxFprintf(Chapters, _T("\\titlepg\n"));
+ wxFprintf(Contents, _T("\\par\\pard\\pgnrestart\\sect\\titlepg"));
}
-
+
// In WinHelp, Contents title takes font of title.
// In linear RTF, same as chapter headings.
- fprintf(Contents, "{\\b\\fs%d %s}\\par\\par\\pard\n\n",
+ wxFprintf(Contents, _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"),
(winHelp ? titleFont : chapterFont)*2, ContentsNameString);
- // By default, Swiss, 10 point.
- fprintf(Chapters, "\\f2\\fs20\n");
+ // By default, Swiss, 11 point.
+ wxFprintf(Chapters, _T("\\f2\\fs22\n"));
+
+ PushEnvironmentStyle(_T("\\f2\\fs22\\sa200"));
SetCurrentOutput(Chapters);
- OnInform("Converting...");
+ if (stopRunning)
+ return false;
+
+ OnInform(_T("Converting..."));
TraverseDocument();
- FILE *Header = fopen("header.rtf", "w");
+ FILE *Header = wxFopen(_T("header.rtf"), _T("w"));
if (!Header)
{
- OnError("Ouch! Could not open temporary file header.rtf for writing.");
- return FALSE;
+ OnError(_T("Ouch! Could not open temporary file header.rtf for writing."));
+ return false;
}
WriteRTFHeader(Header);
- fclose(Header); Header = NULL;
-
- Tex2RTFYield(TRUE);
+ fclose(Header);
+
+ PopEnvironmentStyle();
+
+ Tex2RTFYield(true);
if (winHelp)
{
-// fprintf(Contents, "\\page\n");
- fprintf(Chapters, "\\page\n");
- fprintf(Sections, "\\page\n");
- fprintf(Subsections, "\\page\n");
- fprintf(Subsubsections, "\\page\n\n");
- fprintf(Popups, "\\page\n}\n");
+// wxFprintf(Contents, _T("\\page\n"));
+ wxFprintf(Chapters, _T("\\page\n"));
+ wxFprintf(Sections, _T("\\page\n"));
+ wxFprintf(Subsections, _T("\\page\n"));
+ wxFprintf(Subsubsections, _T("\\page\n\n"));
+ wxFprintf(Popups, _T("\\page\n}\n"));
}
-// TexOutput("\n\\info{\\doccomm Document created by Julian Smart's Tex2RTF.}\n");
+// TexOutput(_T("\n\\info{\\doccomm Document created by Julian Smart's Tex2RTF.}\n"));
if (!winHelp)
- TexOutput("}\n");
+ TexOutput(_T("}\n"));
fclose(Contents); Contents = NULL;
fclose(Chapters); Chapters = NULL;
if (winHelp)
if (winHelp)
{
- wxConcatFiles("header.rtf", "chapters.rtf", "tmp1.rtf");
- Tex2RTFYield(TRUE);
- wxConcatFiles("tmp1.rtf", "sections.rtf", "tmp2.rtf");
- Tex2RTFYield(TRUE);
- wxConcatFiles("tmp2.rtf", "subsections.rtf", "tmp3.rtf");
- Tex2RTFYield(TRUE);
- wxConcatFiles("tmp3.rtf", "subsubsections.rtf", "tmp4.rtf");
- Tex2RTFYield(TRUE);
- wxConcatFiles("tmp4.rtf", "popups.rtf", OutputFile);
- Tex2RTFYield(TRUE);
-
- wxRemoveFile("tmp1.rtf");
- wxRemoveFile("tmp2.rtf");
- wxRemoveFile("tmp3.rtf");
- wxRemoveFile("tmp4.rtf");
+ wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
+ Tex2RTFYield(true);
+ wxConcatFiles(_T("tmp1.rtf"), _T("sections.rtf"), _T("tmp2.rtf"));
+ Tex2RTFYield(true);
+ wxConcatFiles(_T("tmp2.rtf"), _T("subsections.rtf"), _T("tmp3.rtf"));
+ Tex2RTFYield(true);
+ wxConcatFiles(_T("tmp3.rtf"), _T("subsubsections.rtf"), _T("tmp4.rtf"));
+ Tex2RTFYield(true);
+ wxConcatFiles(_T("tmp4.rtf"), _T("popups.rtf"), OutputFile);
+ Tex2RTFYield(true);
+
+ wxRemoveFile(_T("tmp1.rtf"));
+ wxRemoveFile(_T("tmp2.rtf"));
+ wxRemoveFile(_T("tmp3.rtf"));
+ wxRemoveFile(_T("tmp4.rtf"));
}
else
{
- wxConcatFiles("header.rtf", "chapters.rtf", "tmp1.rtf");
- Tex2RTFYield(TRUE);
- if (FileExists(OutputFile)) wxRemoveFile(OutputFile);
- wxCopyFile("tmp1.rtf", OutputFile);
- Tex2RTFYield(TRUE);
- wxRemoveFile("tmp1.rtf");
+ wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
+ Tex2RTFYield(true);
+ if (wxFileExists(OutputFile))
+ wxRemoveFile(OutputFile);
+
+ wxChar *cwdStr;
+ cwdStr = wxGetWorkingDirectory();
+
+ wxString outputDirStr;
+ outputDirStr = wxPathOnly(OutputFile);
+
+ // Determine if the temp file and the output file are in the same directory,
+ // and if they are, then just rename the temp file rather than copying
+ // it, as this is much faster when working with large (multi-megabyte files)
+ if ((wxStrcmp(outputDirStr.c_str(),_T("")) == 0) || // no path specified on output file
+ (wxStrcmp(cwdStr,outputDirStr.c_str()) == 0)) // paths do not match
+ {
+ wxRenameFile(_T("tmp1.rtf"), OutputFile);
+ }
+ else
+ {
+ wxCopyFile(_T("tmp1.rtf"), OutputFile);
+ }
+ delete [] cwdStr;
+ Tex2RTFYield(true);
+ wxRemoveFile(_T("tmp1.rtf"));
}
-
- if (FileExists(ContentsName)) wxRemoveFile(ContentsName);
+
+ if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
if (!wxRenameFile(TmpContentsName, ContentsName))
{
wxRemoveFile(TmpContentsName);
}
- wxRemoveFile("chapters.rtf");
- wxRemoveFile("header.rtf");
-
+ wxRemoveFile(_T("chapters.rtf"));
+ wxRemoveFile(_T("header.rtf"));
+
if (winHelp)
{
- wxRemoveFile("sections.rtf");
- wxRemoveFile("subsections.rtf");
- wxRemoveFile("subsubsections.rtf");
- wxRemoveFile("popups.rtf");
+ wxRemoveFile(_T("sections.rtf"));
+ wxRemoveFile(_T("subsections.rtf"));
+ wxRemoveFile(_T("subsubsections.rtf"));
+ wxRemoveFile(_T("popups.rtf"));
}
if (winHelp && generateHPJ)
WriteHPJ(OutputFile);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}