int i;
for (i = l; i < 5; i++)
ContentsLevels[i] = false;
-
+
// There are always books on the top level
ContentsLevels[0] = true;
}
void OutputSectionKeyword(FILE *fd)
{
OutputCurrentSectionToString(wxTex2RTFBuffer);
-
+
unsigned int i;
for (i = 0; i < wxStrlen(wxTex2RTFBuffer); i++)
if (wxTex2RTFBuffer[i] == ':')
wxFprintf(fd, _T("K{\\footnote {K} "));
wxFprintf(fd, _T("%s"), wxTex2RTFBuffer);
-
+
wxFprintf(fd, _T("}\n"));
}
int d=0;
while ( (xitle[s]!=0)&&(d<255) )
{
- wxChar ch=xitle[s]&0xff;
+ wxChar ch=wxChar(xitle[s]&0xff);
if (ch==0x5c) {
- wxChar ch1=xitle[s+1]&0xff;
- wxChar ch2=xitle[s+2]&0xff;
- wxChar ch3=xitle[s+3]&0xff;
- s+=4; // next character
+ 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('ü'); }
} 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);
// Must separate out main entry form subentry (only 1 subentry allowed)
wxChar buf1[100]; wxChar buf2[100];
SplitIndexEntry(s, buf1, buf2);
-
+
// Check for ':' which messes up index
unsigned int i;
for (i = 0; i < wxStrlen(buf1) ; i++)
* Output index entry in linear RTF
*
*/
-
+
void GenerateIndexEntry(wxChar *entry)
{
if (useWord)
* Write a suitable RTF header.
*
*/
-
+
void WriteColourTable(FILE *fd)
{
wxFprintf(fd, _T("{\\colortbl"));
// Table of contents styles
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"));
/*
* Write a Windows help project file
*/
-
+
bool WriteHPJ(wxChar *filename)
{
wxChar hpjFilename[256];
wxStrcpy(rtfFile, helpFile);
wxStrcat(helpFile, _T(".hlp"));
wxStrcat(rtfFile, _T(".rtf"));
-
+
FILE *fd = wxFopen(hpjFilename, _T("w"));
if (!fd)
return false;
wxChar *helpTitle = winHelpTitle;
if (!helpTitle)
helpTitle = _T("Untitled");
-
+
wxString thePath = wxPathOnly(InputFile);
if (thePath.IsEmpty())
thePath = _T(".");
* and before TraverseDocument is called.
*
*/
-
+
void Text2RTF(TexChunk *chunk)
{
Tex2RTFYield();
* Not used yet
*
*/
-
+
wxChar browseBuf[10];
static long browseId = 0;
wxChar *GetBrowseString(void)
{
int oldForbidResetPar = forbidResetPar;
forbidResetPar = 0;
-
+
if (LeftHeaderEven || CentreHeaderEven || RightHeaderEven)
{
TexOutput(_T("{\\headerl\\fi0 "));
OutputRTFHeaderCommands();
OutputRTFFooterCommands();
}
-
+
// Need to reset the current numbering style, or RTF forgets it.
SetCurrentOutput(Chapters);
OutputNumberStyle(currentNumberStyle);
else SetCurrentOutput(NULL); // No entry in table of contents
}
}
-
+
startedSections = true;
// Output heading to contents page
if (!InPopups())
{
OutputCurrentSection();
-
+
if (winHelp)
{
wxFprintf(Contents, _T("}{\\v %s}\\pard\\par\n"), topicName);
// From here, just output to chapter
SetCurrentOutput(Chapters);
}
-
+
if (winHelp)
{
wxFprintf(Chapters, _T("}\n#{\\footnote %s}\n"), topicName);
wxFprintf(Chapters, _T("+{\\footnote %s}\n"), GetBrowseString());
-
+
OutputSectionKeyword(Chapters);
GenerateKeywordsForTopic(topicName);
}
}
else SetCurrentOutput(NULL);
- }
+ }
if (startedSections)
{
else
wxFprintf(Contents, _T("}\\par\\par\\pard\n"));
}
-
+
SetCurrentOutput(winHelp ? Sections : Chapters);
if (winHelp)
wxChar *keep = _T("");
if (winHelp && (macroId != ltGLOSS) && !InPopups())
keep = _T("\\keepn\\sa140\\sb140");
-
+
wxFprintf(winHelp ? Sections : Chapters, _T("\\pard{%s%s"),
keep, styleCommand);
#if 0
else
wxFprintf(Chapters, _T("\\par\n"));
-#endif
+#endif
}
startedSections = true;
}
}
OutputCurrentSection(); // Repeat section header
-
+
// Experimental JACS
TexOutput(_T("\\par\\pard}\n"));
// TexOutput(_T("\\par\\pard}\\par\n"));
else
SetCurrentOutput(NULL); // Don't write it into the contents, or anywhere else
}
-
+
if (startedSections)
{
if (winHelp)
#if 0
else
wxFprintf(Chapters, _T("\\par\n"));
-#endif
+#endif
}
startedSections = true;
}
else if ((DocumentStyle == LATEX_ARTICLE) && (macroId != ltSUBSUBSECTIONSTAR))
wxFprintf(Contents, _T("\\par\\pard\n"));
-
+
SetCurrentOutput(winHelp ? Subsubsections : Chapters);
if (winHelp)
{
WriteHeadingStyle((winHelp ? Subsubsections : Chapters),
(DocumentStyle == LATEX_ARTICLE ? 3 : 4));
wxFprintf(winHelp ? Subsubsections : Chapters, _T(" "));
-
+
if (!winHelp)
{
if ((macroId != ltSUBSUBSECTIONSTAR))
int ch = getc(fd);
while (ch != EOF)
{
- putc(ch, Chapters);
+ wxPutc(ch, Chapters);
ch = getc(fd);
}
fclose(fd);
if (TableData[i].leftBorder)
TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
-
+
wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
TexOutput(buf);
}
ItemizeStruc *struc = new ItemizeStruc(listType, indentSize2, indentSize1);
itemizeStack.Insert(struc);
-
+
wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\tx%d\\li%d\\sa200"), indentSize1, indentSize2, indentSize2);
PushEnvironmentStyle(buf);
}
ItemizeStruc *struc = new ItemizeStruc(LATEX_TWOCOL, indentSize);
itemizeStack.Insert(struc);
-
+
// 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);
OnMacro(ltPAR, 0, true);
OnMacro(ltPAR, 0, false);
}
-#endif
+#endif
}
break;
}
// WriteEnvironmentStyles();
}
-#endif
+#endif
// wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\\ri%d\n"), TwoColWidthA,
// TwoColWidthA, TwoColWidthA, TwoColWidthA+TwoColWidthB+oldIndent);
else issuedNewParagraph = 0;
}
#endif
-
+
if (macroId == ltVERBATIM)
wxSnprintf(buf, sizeof(buf), _T("{\\f3\\s10\\fs20\\li720\\sa0 "));
else
#if 0
TexOutput(_T("\\par\n"));
issuedNewParagraph = 1;
-#endif
+#endif
}
}
break;
case ltRMFAMILY:
case ltRM:
{
-/*
+/*
if (start)
{
TexOutput(_T("{\\plain "));
{
TexOutput(_T("\\par\\pard"));
issuedNewParagraph ++;
-
+
// Extra par if parskip is more than zero (usually looks best.)
// N.B. JACS 2004-02-21: shouldn't need this for linear RTF if
// we have a suitable set of styles.
TexOutput(_T("\\par"));
issuedNewParagraph ++;
}
-#endif
+#endif
WriteEnvironmentStyles();
}
// 1 is a whole paragraph if ParSkip == 0,
TexOutput(_T("\\par"));
issuedNewParagraph ++;
}
-#endif
+#endif
WriteEnvironmentStyles();
}
/*
{
if (!suppressNameDecoration) TexOutput(_T("}"));
}
-
+
if (start && (arg_no == 3))
TexOutput(_T("("));
if (!start && (arg_no == 3))
if (start)
{
wxChar *sec = NULL;
-
+
wxChar *refName = GetArgData();
if (winHelp || !useWord)
{
{
if (arg_no == 3)
return false;
-
+
static int imageWidth = 0;
static int imageHeight = 0;
-
+
if (start && (arg_no == 1))
{
wxChar *imageDimensions = copystring(GetArgData());
if (imageDimensions) // glt
delete [] imageDimensions;
return false;
- }
+ }
else if (start && (arg_no == 2 ))
{
wxChar *filename = copystring(GetArgData());
}
else
{
-#endif
+#endif
TexOutput(_T("[No BMP or WMF for image file "));
TexOutput(filename);
TexOutput(_T("]"));
if (currentNumberStyle) delete[] currentNumberStyle;
currentNumberStyle = copystring(data);
OutputNumberStyle(currentNumberStyle);
-
+
TexOutput(_T("\n"));
}
return false;
if (TableData[i].leftBorder)
TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
-
+
wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
TexOutput(buf);
}
ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
itemizeStack.Insert(struc);
-
+
wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\sa200 "), indentSize, indentSize);
PushEnvironmentStyle(buf);
TexOutput(buf);
ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
itemizeStack.Insert(struc);
-
+
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);
OutputRTFHeaderCommands();
OutputRTFFooterCommands();
}
-
+
// Need to reset the current numbering style, or RTF forgets it.
OutputNumberStyle(currentNumberStyle);
SetCurrentOutput(Contents);
wxFileNameFromPath(FileRoot), "Contents");
}
}
-
+
SetCurrentOutput(Chapters);
wxChar *styleCommand = _T("");
if (!winHelp && useHeadingStyles)
startedSections = false;
inVerbatim = false;
browseId = 0;
-
+
if (InputFile && OutputFile)
{
// Do some RTF-specific transformations on all the strings,
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.
wxFprintf(Contents, _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"),
// By default, Swiss, 11 point.
wxFprintf(Chapters, _T("\\f2\\fs22\n"));
-
+
PushEnvironmentStyle(_T("\\f2\\fs22\\sa200"));
SetCurrentOutput(Chapters);
fclose(Header);
PopEnvironmentStyle();
-
+
Tex2RTFYield(true);
if (winHelp)
{
Tex2RTFYield(true);
wxRemoveFile(_T("tmp1.rtf"));
}
-
+
if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
if (!wxRenameFile(TmpContentsName, ContentsName))
wxRemoveFile(_T("chapters.rtf"));
wxRemoveFile(_T("header.rtf"));
-
+
if (winHelp)
{
wxRemoveFile(_T("sections.rtf"));