More updates to the Debian packaging for wxPython, unicode and

the project name change.

Applied patch from ABX to make tex2rtf unicode compatible, then
removed wxSprintf lameness from it so it might actually work.
Also modified it to return true from tex2rtf OnInit in console
builds so the app will exit with a successful return code rather
than always returning failure even when it succeeds.

Implemented unicode capable wxCtime for glibc systems also needed
by tex2rtf.

Wrapped dde include in tex2rtf in a guard and assert that dde is
MSW only in its forwarding header.

Lowered the limit of maxlen in wxSprintf so it actually has a
chance to segfault on people instead of failing silently and
mysteriously with glibc.

Silenced some other 'potentially uninitialised variable' warnings
from gcc3, most of which were bogus, one potentially not so.

Added missing newline at the end of fontdlg.cpp.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ron Lee
2004-03-05 17:40:38 +00:00
parent a0af0d98b5
commit b63b07a809
46 changed files with 1351 additions and 1173 deletions

View File

@@ -3,7 +3,8 @@
// Purpose: Utilities for manipulating bitmap and metafile images for
// the purposes of conversion to 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
@@ -63,7 +64,7 @@ bool GetBMPHeader(FILE *fp, int *Width, int *Height, int *Planes, int *BitsPerPi
/* read the file type (first two bytes) */
int c = getc(fp); int c1 = getc(fp);
if (c!='B' || c1!='M') { return FALSE; }
if (c!='B' || c1!='M') { return false; }
/* bfSize = */ getint(fp);
getshort(fp); /* reserved and ignored */
@@ -88,22 +89,22 @@ bool GetBMPHeader(FILE *fp, int *Width, int *Height, int *Planes, int *BitsPerPi
*BitsPerPixel = (int)biBitCount;
// fseek(fp, bfOffBits, SEEK_SET);
return TRUE;
return true;
}
static int scanLineWidth = 0;
bool OutputBitmapHeader(FILE *fd, bool isWinHelp = FALSE)
bool OutputBitmapHeader(FILE *fd, bool isWinHelp = false)
{
int Width, Height, Planes, BitsPerPixel;
if (!GetBMPHeader(fd, &Width, &Height, &Planes, &BitsPerPixel))
return FALSE;
return false;
scanLineWidth = (int)((float)Width/(8.0/(float)BitsPerPixel));
if ((float)((int)(scanLineWidth/2.0)) != (float)(scanLineWidth/2.0))
scanLineWidth ++;
int goalW = 15*Width;
int goalH = 15*Height;
@@ -112,15 +113,15 @@ bool OutputBitmapHeader(FILE *fd, bool isWinHelp = FALSE)
else TexOutput(_T("\\dibitmap)"));
wxChar buf[50];
TexOutput(_T("\\picw")); wxSprintf(buf, _T("%d"), Width); TexOutput(buf);
TexOutput(_T("\\pich")); wxSprintf(buf, _T("%d"), Height); TexOutput(buf);
TexOutput(_T("\\wbmbitspixel")); wxSprintf(buf, _T("%d"), BitsPerPixel); TexOutput(buf);
TexOutput(_T("\\wbmplanes")); wxSprintf(buf, _T("%d"), Planes); TexOutput(buf);
TexOutput(_T("\\wbmwidthbytes")); wxSprintf(buf, _T("%d"), scanLineWidth); TexOutput(buf);
TexOutput(_T("\\picwgoal")); wxSprintf(buf, _T("%d"), goalW); TexOutput(buf);
TexOutput(_T("\\pichgoal")); wxSprintf(buf, _T("%d"), goalH); TexOutput(buf);
TexOutput(_T("\\picw")); wxSnprintf(buf, sizeof(buf), _T("%d"), Width); TexOutput(buf);
TexOutput(_T("\\pich")); wxSnprintf(buf, sizeof(buf), _T("%d"), Height); TexOutput(buf);
TexOutput(_T("\\wbmbitspixel")); wxSnprintf(buf, sizeof(buf), _T("%d"), BitsPerPixel); TexOutput(buf);
TexOutput(_T("\\wbmplanes")); wxSnprintf(buf, sizeof(buf), _T("%d"), Planes); TexOutput(buf);
TexOutput(_T("\\wbmwidthbytes")); wxSnprintf(buf, sizeof(buf), _T("%d"), scanLineWidth); TexOutput(buf);
TexOutput(_T("\\picwgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalW); TexOutput(buf);
TexOutput(_T("\\pichgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalH); TexOutput(buf);
TexOutput(_T("\n"));
return TRUE;
return true;
}
@@ -143,7 +144,7 @@ bool OutputBitmapData(FILE *fd)
ch = getc(fd);
}
TexOutput(_T("\n}\n"));
return TRUE;
return true;
}
#ifdef __WXMSW__
@@ -164,21 +165,21 @@ bool GetMetafileHeader(FILE *handle, int *width, int *height)
fread((void *)theHeader, sizeof(char), sizeof(mfPLACEABLEHEADER), handle);
if (theHeader->key != 0x9AC6CDD7)
{
return FALSE;
return false;
}
float widthInUnits = (float)theHeader->bbox.right - theHeader->bbox.left;
float heightInUnits = (float)theHeader->bbox.bottom - theHeader->bbox.top;
*width = (int)((widthInUnits*1440.0)/theHeader->inch);
*height = (int)((heightInUnits*1440.0)/theHeader->inch);
return TRUE;
return true;
}
bool OutputMetafileHeader(FILE *handle, bool WXUNUSED(isWinHelp), int userWidth, int userHeight)
{
int Width, Height;
if (!GetMetafileHeader(handle, &Width, &Height))
return FALSE;
return false;
scanLineWidth = 64;
int goalW = Width;
@@ -207,12 +208,12 @@ bool OutputMetafileHeader(FILE *handle, bool WXUNUSED(isWinHelp), int userWidth,
TexOutput(_T("\\wmetafile8"));
wxChar buf[50];
TexOutput(_T("\\picw")); wxSprintf(buf, _T("%d"), Width); TexOutput(buf);
TexOutput(_T("\\pich")); wxSprintf(buf, _T("%d"), Height); TexOutput(buf);
TexOutput(_T("\\picwgoal")); wxSprintf(buf, _T("%d"), goalW); TexOutput(buf);
TexOutput(_T("\\pichgoal")); wxSprintf(buf, _T("%d"), goalH); TexOutput(buf);
TexOutput(_T("\\picw")); wxSnprintf(buf, sizeof(buf), _T("%d"), Width); TexOutput(buf);
TexOutput(_T("\\pich")); wxSnprintf(buf, sizeof(buf), _T("%d"), Height); TexOutput(buf);
TexOutput(_T("\\picwgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalW); TexOutput(buf);
TexOutput(_T("\\pichgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalH); TexOutput(buf);
TexOutput(_T("\n"));
return TRUE;
return true;
}
bool OutputMetafileData(FILE *handle)
@@ -236,7 +237,7 @@ bool OutputMetafileData(FILE *handle)
}
} while (ch != EOF);
TexOutput(_T("\n}\n"));
return TRUE;
return true;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,8 @@
// reverse-engineering
// and guesswork at its best.
// Author: Petr Smilauer
// Modified by:
// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
// Ron Lee
// Created: 01/01/99
// RCS-ID: $Id$
// Copyright: (c) Petr Smilauer
@@ -116,10 +117,10 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
HotSpot *hotspots = NULL;
int n = ParseSHG(filename, &hotspots);
if (n == 0)
return FALSE;
return false;
wxChar buf[100];
wxSprintf(buf, _T("Converting .SHG file to HTML map file: there are %d hotspots in %s."), n, filename);
wxSnprintf(buf, sizeof(buf), _T("Converting .SHG file to HTML map file: there are %d hotspots in %s."), n, filename);
OnInform(buf);
wxChar outBuf[256];
@@ -132,7 +133,7 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
{
OnError(_T("Could not open .map file for writing."));
delete[] hotspots;
return FALSE;
return false;
}
wxFprintf(fd, _T("default %s\n"), defaultFile);
@@ -146,7 +147,7 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
else
{
wxChar buf[300];
wxSprintf(buf, _T("Warning: could not find hotspot reference %s"), hotspots[i].szHlpTopic_Macro);
wxSnprintf(buf, sizeof(buf), _T("Warning: could not find hotspot reference %s"), hotspots[i].szHlpTopic_Macro);
OnInform(buf);
}
wxFprintf(fd, _T("rect %s %d %d %d %d\n"), refFilename, (int)hotspots[i].left, (int)hotspots[i].top,
@@ -157,6 +158,6 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
fclose(fd);
delete[] hotspots;
return TRUE;
return true;
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,8 @@
// Name: table.cpp
// Purpose: Utilities for manipulating tables
// Author: Julian Smart
// Modified by:
// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
// Ron Lee
// Created: 01/01/99
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
@@ -42,11 +43,11 @@
#include "table.h"
ColumnData TableData[40];
bool inTabular = FALSE;
bool inTabular = false;
bool startRows = FALSE;
bool tableVerticalLineLeft = FALSE;
bool tableVerticalLineRight = FALSE;
bool startRows = false;
bool tableVerticalLineLeft = false;
bool tableVerticalLineRight = false;
int noColumns = 0; // Current number of columns in table
int ruleTop = 0;
int ruleBottom = 0;
@@ -62,50 +63,50 @@ bool ParseTableArgument(wxChar *value)
noColumns = 0;
int i = 0;
int len = wxStrlen(value);
bool isBorder = FALSE;
bool isBorder = false;
while (i < len)
{
int ch = value[i];
if (ch == '|')
{
i ++;
isBorder = TRUE;
isBorder = true;
}
else if (ch == 'l')
{
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].rightBorder = false;
TableData[noColumns].justification = 'l';
TableData[noColumns].width = 2000; // Estimate
TableData[noColumns].absWidth = FALSE;
TableData[noColumns].absWidth = false;
// TableData[noColumns].spacing = ??
noColumns ++;
i ++;
isBorder = FALSE;
isBorder = false;
}
else if (ch == 'c')
{
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].rightBorder = false;
TableData[noColumns].justification = 'c';
TableData[noColumns].width = defaultTableColumnWidth; // Estimate
TableData[noColumns].absWidth = FALSE;
TableData[noColumns].absWidth = false;
// TableData[noColumns].spacing = ??
noColumns ++;
i ++;
isBorder = FALSE;
isBorder = false;
}
else if (ch == 'r')
{
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].rightBorder = false;
TableData[noColumns].justification = 'r';
TableData[noColumns].width = 2000; // Estimate
TableData[noColumns].absWidth = FALSE;
TableData[noColumns].absWidth = false;
// TableData[noColumns].spacing = ??
noColumns ++;
i ++;
isBorder = FALSE;
isBorder = false;
}
else if (ch == 'p')
{
@@ -118,7 +119,7 @@ bool ParseTableArgument(wxChar *value)
i++;
ch = value[i];
}
while ((i < len) && (isdigit(ch) || ch == '.'))
{
numberBuf[j] = ch;
@@ -133,26 +134,26 @@ bool ParseTableArgument(wxChar *value)
j ++; i++;
numberBuf[j] = 0;
if (value[i] == '}') i++;
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].rightBorder = false;
TableData[noColumns].justification = 'l';
TableData[noColumns].width = 20*ParseUnitArgument(numberBuf);
TableData[noColumns].absWidth = TRUE;
TableData[noColumns].absWidth = true;
// TableData[noColumns].spacing = ??
noColumns ++;
isBorder = FALSE;
isBorder = false;
}
else
{
wxChar *buf = new wxChar[wxStrlen(value) + 80];
wxSprintf(buf, _T("Tabular first argument \"%s\" too complex!"), value);
wxSnprintf(buf, wxStrlen(value) + 80, _T("Tabular first argument \"%s\" too complex!"), value);
OnError(buf);
delete[] buf;
return FALSE;
return false;
}
}
if (isBorder)
TableData[noColumns-1].rightBorder = TRUE;
return TRUE;
TableData[noColumns-1].rightBorder = true;
return true;
}

File diff suppressed because it is too large Load Diff

View File

@@ -147,20 +147,20 @@ extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.t
bool read_a_line(wxChar *buf);
bool TexLoadFile(wxChar *filename);
int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos,
wxChar *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL);
wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args,
wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL);
wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
void TraverseDocument(void);
void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = FALSE);
#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, TRUE)
void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = false);
#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, true)
void SetCurrentOutput(FILE *fd);
void SetCurrentOutputs(FILE *fd1, FILE *fd2);
extern FILE *CurrentOutput1;
extern FILE *CurrentOutput2;
void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = FALSE, bool forbidden = FALSE);
void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = false, bool forbidden = false);
void TexInitialize(int bufSize);
void TexCleanUp(void);
void TexOutput(const wxChar *s, bool ordinaryText = FALSE);
void TexOutput(const wxChar *s, bool ordinaryText = false);
wxChar *GetArgData(TexChunk *chunk);
wxChar *GetArgData(void); // Get the string for the current argument
int GetNoArgs(void); // Get the number of arguments for the current macro
@@ -174,11 +174,11 @@ wxChar *ConvertCase(wxChar *s); // Convert case, according to upperCaseN
extern wxPathList TexPathList; // Path list, can be used for file searching.
#if !WXWIN_COMPATIBILITY_2
extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = TRUE, bool exact = FALSE);
extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = true, bool exact = false);
#endif
// Define a variable value from the .ini file
wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interactive = TRUE);
wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interactive = true);
// Major document styles
#define LATEX_REPORT 1
@@ -324,7 +324,7 @@ extern void OutputCurrentSectionToString(wxChar *buf);
extern void OutputChunkToString(TexChunk *chunk, wxChar *buf);
// Called by Tex2Any to simulate a section
extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = TRUE);
extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = true);
/*
* Local to Tex2Any library
@@ -362,7 +362,7 @@ void OnError(const wxChar *msg);
void OnInform(const wxChar *msg);
// Special yield wrapper
void Tex2RTFYield(bool force = FALSE);
void Tex2RTFYield(bool force = false);
/*
* Useful utilities

View File

@@ -2,7 +2,8 @@
// Name: tex2rtf.cpp
// Purpose: Converts Latex to linear/WinHelp RTF, HTML, wxHelp.
// 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
@@ -34,7 +35,6 @@
#include "wx/timer.h"
#endif
#if defined(NO_GUI) || defined(__UNIX__)
#if wxUSE_IOSTREAMH
#include <iostream.h>
#include <fstream.h>
@@ -42,7 +42,6 @@
#include <iostream>
#include <fstream>
#endif
#endif
#include <ctype.h>
#include <stdlib.h>
@@ -63,10 +62,10 @@ static inline wxChar* copystring(const wxChar* s)
const float versionNo = TEX2RTF_VERSION_NUMBER;
TexChunk *currentMember = NULL;
bool startedSections = FALSE;
bool startedSections = false;
wxChar *contentsString = NULL;
bool suppressNameDecoration = FALSE;
bool OkToClose = TRUE;
bool suppressNameDecoration = false;
bool OkToClose = true;
int passNumber = 1;
unsigned long errorCount = 0;
@@ -127,18 +126,16 @@ void ShowOptions(void);
wxChar wxTex2RTFBuffer[1500];
#ifdef NO_GUI
int main(int argc, char **argv)
IMPLEMENT_APP_CONSOLE(MyApp)
#else
wxMenuBar *menuBar = NULL;
MyFrame *frame = NULL;
// DECLARE_APP(MyApp)
IMPLEMENT_APP(MyApp)
wxMenuBar *menuBar = NULL;
MyFrame *frame = NULL;
// DECLARE_APP(MyApp)
IMPLEMENT_APP(MyApp)
#endif
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
#endif
{
// Use default list of macros defined in tex2any.cc
DefineDefaultMacros();
@@ -151,7 +148,7 @@ bool MyApp::OnInit()
WinHelpContentsFileName = new wxChar[300];
RefFileName = new wxChar[300];
ColourTable.DeleteContents(TRUE);
ColourTable.DeleteContents(true);
int n = 1;
@@ -181,14 +178,14 @@ bool MyApp::OnInit()
ShowOptions();
exit(1);
}
#endif
if (InputFile)
{
TexPathList.EnsureFileAccessible(InputFile);
}
if (!InputFile || !OutputFile)
isInteractive = TRUE;
isInteractive = true;
int i;
for (i = n; i < argc;)
@@ -197,19 +194,19 @@ bool MyApp::OnInit()
{
i ++;
convertMode = TEX_RTF;
winHelp = TRUE;
winHelp = true;
}
#ifndef NO_GUI
else if (wxStrcmp(argv[i], _T("-interactive")) == 0)
{
i ++;
isInteractive = TRUE;
isInteractive = true;
}
#endif
else if (wxStrcmp(argv[i], _T("-sync")) == 0) // Don't yield
{
i ++;
isSync = TRUE;
isSync = true;
}
else if (wxStrcmp(argv[i], _T("-rtf")) == 0)
{
@@ -229,7 +226,7 @@ bool MyApp::OnInit()
else if (wxStrcmp(argv[i], _T("-twice")) == 0)
{
i ++;
runTwice = TRUE;
runTwice = true;
}
else if (wxStrcmp(argv[i], _T("-macros")) == 0)
{
@@ -262,19 +259,19 @@ bool MyApp::OnInit()
else
{
OnError(_T("Incorrect argument for -charset"));
return FALSE;
return false;
}
}
}
else if (wxStrcmp(argv[i], _T("-checkcurleybraces")) == 0)
{
i ++;
checkCurleyBraces = TRUE;
checkCurleyBraces = true;
}
else if (wxStrcmp(argv[i], _T("-checksyntax")) == 0)
{
i ++;
checkSyntax = TRUE;
checkSyntax = true;
}
else
{
@@ -285,7 +282,7 @@ bool MyApp::OnInit()
ShowOptions();
exit(1);
#endif
return FALSE;
return false;
}
}
@@ -311,7 +308,7 @@ bool MyApp::OnInit()
wxChar buf[100];
// Create the main frame window
frame = new MyFrame(NULL, -1, _T("Tex2RTF"), wxPoint(-1, -1), wxSize(400, 300));
frame = new MyFrame(NULL, wxID_ANY, _T("Tex2RTF"), wxDefaultPosition, wxSize(400, 300));
frame->CreateStatusBar(2);
// Give it an icon
@@ -320,7 +317,7 @@ bool MyApp::OnInit()
if (InputFile)
{
wxSprintf(buf, _T("Tex2RTF [%s]"), wxFileNameFromPath(InputFile));
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), wxFileNameFromPath(InputFile));
frame->SetTitle(buf);
}
@@ -350,8 +347,8 @@ bool MyApp::OnInit()
wxMenu *options_menu = new wxMenu;
options_menu->Append(TEX_OPTIONS_CURELY_BRACE, _T("Curley brace matching"), _T("Checks for mismatched curley braces"),TRUE);
options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, _T("Syntax checking"), _T("Syntax checking for common errors"),TRUE);
options_menu->Append(TEX_OPTIONS_CURELY_BRACE, _T("Curley brace matching"), _T("Checks for mismatched curley braces"),true);
options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, _T("Syntax checking"), _T("Syntax checking for common errors"),true);
options_menu->Check(TEX_OPTIONS_CURELY_BRACE, checkCurleyBraces);
options_menu->Check(TEX_OPTIONS_SYNTAX_CHECKING, checkSyntax);
@@ -369,7 +366,7 @@ bool MyApp::OnInit()
menuBar->Append(help_menu, _T("&Help"));
frame->SetMenuBar(menuBar);
frame->textWindow = new wxTextCtrl(frame, -1, _T(""), wxPoint(-1, -1), wxSize(-1, -1), wxTE_READONLY|wxTE_MULTILINE);
frame->textWindow = new wxTextCtrl(frame, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE);
(*frame->textWindow) << _T("Welcome to Tex2RTF.\n");
// ShowOptions();
@@ -399,8 +396,8 @@ bool MyApp::OnInit()
wxStrcat(buf, _T(" mode."));
frame->SetStatusText(buf, 1);
frame->Show(TRUE);
return TRUE;
frame->Show(true);
return true;
}
else
#endif // NO_GUI
@@ -420,21 +417,11 @@ bool MyApp::OnInit()
Go();
}
#ifdef NO_GUI
return 0;
return true;
#else
return FALSE;
return false;
#endif
}
#if 0
// it already returned something, no need to cause warning
#ifndef NO_GUI
// Return the main frame window
return TRUE;
#else
return 0;
#endif
#endif
}
#ifndef NO_GUI
@@ -573,7 +560,7 @@ int MyApp::OnExit()
void ShowOptions(void)
{
wxChar buf[100];
wxSprintf(buf, _T("Tex2RTF version %.2f"), versionNo);
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF version %.2f"), versionNo);
OnInform(buf);
OnInform(_T("Usage: tex2rtf [input] [output] [switches]\n"));
OnInform(_T("where valid switches are"));
@@ -625,8 +612,8 @@ void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
if (!stopRunning && !OkToClose)
{
stopRunning = TRUE;
runTwice = FALSE;
stopRunning = true;
runTwice = false;
return;
}
else if (OkToClose)
@@ -645,12 +632,12 @@ void MyFrame::OnGo(wxCommandEvent& WXUNUSED(event))
{
passNumber = 1;
errorCount = 0;
menuBar->EnableTop(0, FALSE);
menuBar->EnableTop(1, FALSE);
menuBar->EnableTop(2, FALSE);
menuBar->EnableTop(3, FALSE);
menuBar->EnableTop(0, false);
menuBar->EnableTop(1, false);
menuBar->EnableTop(2, false);
menuBar->EnableTop(3, false);
textWindow->Clear();
Tex2RTFYield(TRUE);
Tex2RTFYield(true);
Go();
if (stopRunning)
@@ -664,23 +651,23 @@ void MyFrame::OnGo(wxCommandEvent& WXUNUSED(event))
if (runTwice && !stopRunning)
{
Tex2RTFYield(TRUE);
Tex2RTFYield(true);
Go();
}
menuBar->EnableTop(0, TRUE);
menuBar->EnableTop(1, TRUE);
menuBar->EnableTop(2, TRUE);
menuBar->EnableTop(3, TRUE);
menuBar->EnableTop(0, true);
menuBar->EnableTop(1, true);
menuBar->EnableTop(2, true);
menuBar->EnableTop(3, true);
}
void MyFrame::OnSetInput(wxCommandEvent& WXUNUSED(event))
{
ChooseInputFile(TRUE);
ChooseInputFile(true);
}
void MyFrame::OnSetOutput(wxCommandEvent& WXUNUSED(event))
{
ChooseOutputFile(TRUE);
ChooseOutputFile(true);
}
void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
@@ -690,7 +677,7 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
{
textWindow->SaveFile(s);
wxChar buf[350];
wxSprintf(buf, _T("Saved text to %s"), (const wxChar*) s.c_str());
wxSnprintf(buf, sizeof(buf), _T("Saved text to %s"), (const wxChar*) s.c_str());
frame->SetStatusText(buf, 0);
}
}
@@ -703,7 +690,7 @@ void MyFrame::OnViewOutput(wxCommandEvent& WXUNUSED(event))
textWindow->LoadFile(OutputFile);
wxChar buf[300];
wxString str(wxFileNameFromPath(OutputFile));
wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
frame->SetTitle(buf);
}
}
@@ -716,7 +703,7 @@ void MyFrame::OnViewLatex(wxCommandEvent& WXUNUSED(event))
textWindow->LoadFile(InputFile);
wxChar buf[300];
wxString str(wxFileNameFromPath(OutputFile));
wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
frame->SetTitle(buf);
}
}
@@ -736,14 +723,14 @@ void MyFrame::OnLoadMacros(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnShowMacros(wxCommandEvent& WXUNUSED(event))
{
textWindow->Clear();
Tex2RTFYield(TRUE);
Tex2RTFYield(true);
ShowCustomMacros();
}
void MyFrame::OnModeRTF(wxCommandEvent& WXUNUSED(event))
{
convertMode = TEX_RTF;
winHelp = FALSE;
winHelp = false;
InputFile = NULL;
OutputFile = NULL;
SetStatusText(_T("In linear RTF mode."), 1);
@@ -752,7 +739,7 @@ void MyFrame::OnModeRTF(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnModeWinHelp(wxCommandEvent& WXUNUSED(event))
{
convertMode = TEX_RTF;
winHelp = TRUE;
winHelp = true;
InputFile = NULL;
OutputFile = NULL;
SetStatusText(_T("In WinHelp RTF mode."), 1);
@@ -761,7 +748,7 @@ void MyFrame::OnModeWinHelp(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnModeHTML(wxCommandEvent& WXUNUSED(event))
{
convertMode = TEX_HTML;
winHelp = FALSE;
winHelp = false;
InputFile = NULL;
OutputFile = NULL;
SetStatusText(_T("In HTML mode."), 1);
@@ -823,7 +810,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
wxChar *platform = _T("");
#endif
#endif
wxSprintf(buf, _T("Tex2RTF Version %.2f%s\nLaTeX to RTF, WinHelp, and HTML Conversion\n\n(c) Julian Smart, George Tasker and others, 1999-2002"), versionNo, platform);
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF Version %.2f%s\nLaTeX to RTF, WinHelp, and HTML Conversion\n\n(c) Julian Smart, George Tasker and others, 1999-2002"), versionNo, platform);
wxMessageBox(buf, _T("About Tex2RTF"));
}
@@ -905,7 +892,7 @@ bool Go(void)
#endif
if (!InputFile || !OutputFile || stopRunning)
return FALSE;
return false;
#ifndef NO_GUI
if (isInteractive)
@@ -913,7 +900,7 @@ bool Go(void)
wxChar buf[300];
wxString str = wxFileNameFromPath(InputFile);
wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str);
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str);
frame->SetTitle(buf);
}
@@ -936,11 +923,11 @@ bool Go(void)
sName[5] = '\0'; // that should do!
}
wxSprintf(ContentsName, _T("%s.con"), FileRoot);
wxSprintf(TmpContentsName, _T("%s.cn1"), FileRoot);
wxSprintf(TmpFrameContentsName, _T("%s.frc"), FileRoot);
wxSprintf(WinHelpContentsFileName, _T("%s.cnt"), FileRoot);
wxSprintf(RefFileName, _T("%s.ref"), FileRoot);
wxSnprintf(ContentsName, 300, _T("%s.con"), FileRoot);
wxSnprintf(TmpContentsName, 300, _T("%s.cn1"), FileRoot);
wxSnprintf(TmpFrameContentsName, 300, _T("%s.frc"), FileRoot);
wxSnprintf(WinHelpContentsFileName, 300, _T("%s.cnt"), FileRoot);
wxSnprintf(RefFileName, 300, _T("%s.ref"), FileRoot);
TexPathList.EnsureFileAccessible(InputFile);
if (!bulletFile)
@@ -956,7 +943,7 @@ bool Go(void)
if (wxFileExists(RefFileName))
ReadTexReferences(RefFileName);
bool success = FALSE;
bool success = false;
if (InputFile && OutputFile)
{
@@ -964,7 +951,7 @@ bool Go(void)
{
OnError(_T("Cannot open input file!"));
TexCleanUp();
return FALSE;
return false;
}
#ifndef NO_GUI
if (isInteractive)
@@ -974,14 +961,14 @@ bool Go(void)
frame->SetStatusText((wxChar *)buf.c_str());
}
#endif
OkToClose = FALSE;
OkToClose = false;
OnInform(_T("Reading LaTeX file..."));
TexLoadFile(InputFile);
if (stopRunning)
{
OkToClose = TRUE;
return FALSE;
OkToClose = true;
return false;
}
switch (convertMode)
@@ -1006,16 +993,16 @@ bool Go(void)
if (stopRunning)
{
OnInform(_T("*** Aborted by user."));
success = FALSE;
stopRunning = FALSE;
OkToClose = TRUE;
success = false;
stopRunning = false;
OkToClose = true;
}
if (success)
{
WriteTexReferences(RefFileName);
TexCleanUp();
startedSections = FALSE;
startedSections = false;
wxString buf;
#ifndef NO_GUI
@@ -1045,28 +1032,29 @@ bool Go(void)
#endif
passNumber ++;
errorCount = 0;
OkToClose = TRUE;
return TRUE;
OkToClose = true;
return true;
}
TexCleanUp();
startedSections = FALSE;
startedSections = false;
#ifndef NO_GUI
frame->SetStatusText(_T("Aborted by user."));
#endif // GUI
OnInform(_T("Sorry, unsuccessful."));
OkToClose = TRUE;
return FALSE;
OkToClose = true;
return false;
}
void OnError(const wxChar *msg)
{
wxString msg_string = msg;
errorCount++;
#ifdef NO_GUI
wxSTD cerr << "Error: " << msg << "\n";
wxSTD cerr << "Error: " << msg_string.mb_str() << "\n";
wxSTD cerr.flush();
#else
if (isInteractive && frame)
@@ -1074,7 +1062,7 @@ void OnError(const wxChar *msg)
else
#ifdef __UNIX__
{
wxSTD cerr << "Error: " << msg << "\n";
wxSTD cerr << "Error: " << msg_string.mb_str() << "\n";
wxSTD cerr.flush();
}
#endif
@@ -1082,14 +1070,15 @@ void OnError(const wxChar *msg)
#ifdef __WXMSW__
wxLogError(msg);
#endif
Tex2RTFYield(TRUE);
Tex2RTFYield(true);
#endif // NO_GUI
}
void OnInform(const wxChar *msg)
{
wxString msg_string = msg;
#ifdef NO_GUI
wxSTD cout << msg << "\n";
wxSTD cout << msg_string.mb_str() << "\n";
wxSTD cout.flush();
#else
if (isInteractive && frame)
@@ -1102,7 +1091,7 @@ void OnInform(const wxChar *msg)
else
#ifdef __WXMSW__
{
wxSTD cout << msg << "\n";
wxSTD cout << msg_string.mb_str() << "\n";
wxSTD cout.flush();
}
#endif
@@ -1112,7 +1101,7 @@ void OnInform(const wxChar *msg)
*/
if (isInteractive)
{
Tex2RTFYield(TRUE);
Tex2RTFYield(true);
}
#endif // NO_GUI
}
@@ -1159,7 +1148,7 @@ bool OnArgument(int macroId, int arg_no, bool start)
// break;
}
}
return TRUE;
return true;
}
/*
@@ -1201,12 +1190,12 @@ bool SplitCommand(wxChar *data, wxChar *firstArg, wxChar *secondArg)
firstArg[0] = 0;
secondArg[0] = 0;
int i = 0;
bool stop = FALSE;
bool stop = false;
// Find first argument (command name)
while (!stop)
{
if (data[i] == ' ' || data[i] == 0)
stop = TRUE;
stop = true;
else
{
firstArg[i] = data[i];
@@ -1227,7 +1216,7 @@ bool SplitCommand(wxChar *data, wxChar *firstArg, wxChar *secondArg)
}
secondArg[j] = 0;
}
return TRUE;
return true;
}
bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data, int WXUNUSED(size), wxIPCFormat WXUNUSED(format))
@@ -1247,7 +1236,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
{
wxChar buf[100];
wxString str = wxFileNameFromPath(InputFile);
wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str);
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str);
frame->SetTitle(buf);
}
}
@@ -1271,20 +1260,20 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
else if (wxStrcmp(firstArg, _T("MINIMIZE")) == 0 || wxStrcmp(firstArg, _T("ICONIZE")) == 0)
{
if (frame)
frame->Iconize(TRUE);
frame->Iconize(true);
}
else if (wxStrcmp(firstArg, _T("SHOW")) == 0 || wxStrcmp(firstArg, _T("RESTORE")) == 0)
{
if (frame)
{
frame->Iconize(FALSE);
frame->Show(TRUE);
frame->Iconize(false);
frame->Show(true);
}
}
else
{
// Try for a setting
wxStrcpy(Tex2RTFLastStatus, RegisterSetting(firstArg, secondArg, FALSE));
wxStrcpy(Tex2RTFLastStatus, RegisterSetting(firstArg, secondArg, false));
#ifndef NO_GUI
if (frame && wxStrcmp(firstArg, _T("conversionMode")) == 0)
{
@@ -1303,7 +1292,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
#endif
}
}
return TRUE;
return true;
}
wxChar *Tex2RTFConnection::OnRequest(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), int *WXUNUSED(size), wxIPCFormat WXUNUSED(format))

View File

@@ -2,26 +2,43 @@
// Name: tex2any.h
// Purpose: tex2RTF conversion header
// Author: Julian Smart
// Modified by:
// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
// Created: 7.9.93
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef NO_GUI
#include "wx/app.h"
#include "wx/frame.h"
class WXDLLEXPORT wxTextCtrl;
#ifndef NO_GUI
#include "wx/frame.h"
#include "wx/textctrl.h"
#ifdef __WXMSW__
#include "wx/dde.h"
#endif
#endif
// Define a new application type
class MyApp: public wxApp
class MyApp: public
#ifndef NO_GUI
wxApp
#else
wxAppConsole
#endif
{ public:
bool OnInit();
#ifdef NO_GUI
int OnRun() { return EXIT_SUCCESS; }
#else
int OnExit();
#endif
};
#ifndef NO_GUI
// Define a new frame type
class MyFrame: public wxFrame
{ public:
@@ -52,7 +69,6 @@ DECLARE_EVENT_TABLE()
};
#ifdef __WXMSW__
#include "wx/dde.h"
class Tex2RTFConnection: public wxDDEConnection
{
@@ -147,8 +163,8 @@ extern wxChar *RefName; // Reference file name
extern wxChar *bulletFile;
#ifndef NO_GUI
void ChooseOutputFile(bool force = FALSE);
void ChooseInputFile(bool force = FALSE);
void ChooseOutputFile(bool force = false);
void ChooseInputFile(bool force = false);
#endif
void RTFOnMacro(int macroId, int no_args, bool start);

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,8 @@
// Name: xlputils.cpp
// Purpose: Converts Latex to obsolete XLP format
// 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
@@ -37,9 +38,9 @@ static TexChunk *descriptionItemArg = NULL;
static int indentLevel = 0;
static int noColumns = 0;
static int currentTab = 0;
static bool tableVerticalLineLeft = FALSE;
static bool tableVerticalLineRight = FALSE;
static bool inTable = FALSE;
static bool tableVerticalLineLeft = false;
static bool tableVerticalLineRight = false;
static bool inTable = false;
static int citeCount = 1;
wxList hyperLinks(wxKEY_INTEGER);
wxList hyperLabels(wxKEY_STRING);
@@ -53,7 +54,7 @@ void PadToTab(int tabPos)
{
int currentCol = GetCurrentColumn();
for (int i = currentCol; i < tabPos; i++)
TexOutput(_T(" "), TRUE);
TexOutput(_T(" "), true);
}
static long xlpBlockId = 0;
@@ -85,7 +86,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
long id1 = NewBlockId();
currentBlockId = NewBlockId();
startedSections = TRUE;
startedSections = true;
wxFprintf(Contents, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, id1);
wxFprintf(Chapters, _T("\n\\hy-%d{%ld}{"), hyBLOCK_LARGE_VISIBLE_SECTION, currentBlockId);
wxFprintf(Index, _T("%ld %ld\n"), id1, currentBlockId);
@@ -117,7 +118,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
long id1 = NewBlockId();
currentBlockId = NewBlockId();
startedSections = TRUE;
startedSections = true;
if (DocumentStyle == LATEX_ARTICLE)
wxFprintf(Contents, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, id1);
@@ -209,19 +210,19 @@ void XLPOnMacro(int macroId, int no_args, bool start)
}
case ltVOID:
// if (start)
// TexOutput(_T("void"), TRUE);
// TexOutput(_T("void"), true);
break;
case ltBACKSLASHCHAR:
if (start)
TexOutput(_T("\n"), TRUE);
TexOutput(_T("\n"), true);
break;
case ltPAR:
{
if (start)
{
if (ParSkip > 0)
TexOutput(_T("\n"), TRUE);
TexOutput(_T("\n"), TRUE);
TexOutput(_T("\n"), true);
TexOutput(_T("\n"), true);
}
break;
}
@@ -239,7 +240,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
wxChar buf[100];
long id = NewBlockId();
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -253,7 +254,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
wxChar buf[100];
long id = NewBlockId();
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_ITALIC, id);
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_ITALIC, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -266,7 +267,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
if (start)
{
long id = NewBlockId();
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -276,7 +277,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -286,7 +287,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -296,7 +297,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_NORMAL, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_NORMAL, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -306,7 +307,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}\n"));
@@ -316,7 +317,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}\n"));
@@ -372,14 +373,14 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
case LATEX_ENUMERATE:
{
wxSprintf(indentBuf, _T("\\hy-%d{%ld}{%d.} "),
wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{%d.} "),
hyBLOCK_BOLD, NewBlockId(), struc->currentItem);
TexOutput(indentBuf);
break;
}
case LATEX_ITEMIZE:
{
wxSprintf(indentBuf, _T("\\hy-%d{%ld}{o} "),
wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{o} "),
hyBLOCK_BOLD, NewBlockId());
TexOutput(indentBuf);
break;
@@ -389,7 +390,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (descriptionItemArg)
{
wxSprintf(indentBuf, _T("\\hy-%d{%ld}{"),
wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{"),
hyBLOCK_BOLD, NewBlockId());
TexOutput(indentBuf);
TraverseChildrenFromChunk(descriptionItemArg);
@@ -407,11 +408,11 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start && DocumentTitle && DocumentAuthor)
{
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
TexOutput(buf);
TraverseChildrenFromChunk(DocumentTitle);
TexOutput(_T("}\n\n"));
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
TexOutput(buf);
TraverseChildrenFromChunk(DocumentAuthor);
TexOutput(_T("}\n\n"));
@@ -449,13 +450,13 @@ void XLPOnMacro(int macroId, int no_args, bool start)
case ltHARDY:
{
if (start)
TexOutput(_T("HARDY"), TRUE);
TexOutput(_T("HARDY"), true);
break;
}
case ltWXCLIPS:
{
if (start)
TexOutput(_T("wxCLIPS"), TRUE);
TexOutput(_T("wxCLIPS"), true);
break;
}
case ltVERBATIM:
@@ -464,7 +465,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
wxChar buf[100];
long id = NewBlockId();
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -474,7 +475,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
TexOutput(_T("\n------------------------------------------------------------------"), TRUE);
TexOutput(_T("\n------------------------------------------------------------------"), true);
}
break;
}
@@ -482,7 +483,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
TexOutput(_T("--------------------------------------------------------------------------------"), TRUE);
TexOutput(_T("--------------------------------------------------------------------------------"), true);
}
break;
}
@@ -501,7 +502,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
{
if (start)
{
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, NewBlockId());
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, NewBlockId());
TexOutput(buf);
}
else
@@ -511,7 +512,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
case ltNUMBEREDBIBITEM:
{
if (!start)
TexOutput(_T("\n\n"), TRUE);
TexOutput(_T("\n\n"), true);
break;
}
case ltCAPTION:
@@ -523,9 +524,9 @@ void XLPOnMacro(int macroId, int no_args, bool start)
wxChar figBuf[40];
if (DocumentStyle != LATEX_ARTICLE)
wxSprintf(figBuf, _T("Figure %d.%d: "), chapterNo, figureNo);
wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d.%d: "), chapterNo, figureNo);
else
wxSprintf(figBuf, _T("Figure %d: "), figureNo);
wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d: "), figureNo);
TexOutput(figBuf);
}
@@ -568,43 +569,43 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
{
if (!start && (arg_no == 1))
currentSection = GetArgChunk();
return FALSE;
return false;
}
case ltFUNC:
{
if (!start && (arg_no == 1))
TexOutput(_T(" "), TRUE);
TexOutput(_T(" "), true);
if (start && (arg_no == 3))
TexOutput(_T("("), TRUE);
TexOutput(_T("("), true);
if (!start && (arg_no == 3))
TexOutput(_T(")"), TRUE);
TexOutput(_T(")"), true);
break;
}
case ltPFUNC:
{
if (!start && (arg_no == 1))
TexOutput(_T(" "), TRUE);
TexOutput(_T(" "), true);
if (start && (arg_no == 2))
TexOutput(_T("(*"), TRUE);
TexOutput(_T("(*"), true);
if (!start && (arg_no == 2))
TexOutput(_T(")"), TRUE);
TexOutput(_T(")"), true);
if (start && (arg_no == 3))
TexOutput(_T("("), TRUE);
TexOutput(_T("("), true);
if (!start && (arg_no == 3))
TexOutput(_T(")"), TRUE);
TexOutput(_T(")"), true);
break;
}
case ltCLIPSFUNC:
{
if (!start && (arg_no == 1))
TexOutput(_T(" "), TRUE);
TexOutput(_T(" "), true);
if (start && (arg_no == 2))
{
TexOutput(_T("("), TRUE);
TexOutput(_T("("), true);
long id = NewBlockId();
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
if (!start && (arg_no == 2))
@@ -612,7 +613,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
TexOutput(_T("}"));
}
if (!start && (arg_no == 3))
TexOutput(_T(")"), TRUE);
TexOutput(_T(")"), true);
break;
}
case ltPARAM:
@@ -620,7 +621,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
if (start && (arg_no == 2))
{
long id = NewBlockId();
wxSprintf(buf, _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
if (!start && (arg_no == 2))
@@ -634,7 +635,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
if (start && (arg_no == 2))
{
long id = NewBlockId();
wxSprintf(buf, _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
if (!start && (arg_no == 2))
@@ -646,12 +647,12 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
case ltMEMBER:
{
if (!start && (arg_no == 1))
TexOutput(_T(" "), TRUE);
TexOutput(_T(" "), true);
break;
}
case ltLABEL:
{
return FALSE;
return false;
}
case ltREF:
{
@@ -672,7 +673,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
{
TexOutput(sec);
}
return FALSE;
return false;
}
break;
}
@@ -685,7 +686,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
if (start)
{
currentBlockId = NewBlockId();
wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_RED_ITALIC, currentBlockId);
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_RED_ITALIC, currentBlockId);
TexOutput(buf);
}
else TexOutput(_T("}"));
@@ -698,7 +699,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
hyperLinks.Append(currentBlockId, (wxObject *)copystring(label));
}
return FALSE;
return false;
}
break;
}
@@ -706,7 +707,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
{
if (arg_no == 1)
{
return TRUE;
return true;
}
else if (arg_no == 2)
{
@@ -714,7 +715,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
TexOutput(_T(" ("));
else
TexOutput(_T(")"));
return TRUE;
return true;
}
break;
}
@@ -723,7 +724,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
if (start && IsArgOptional())
{
descriptionItemArg = GetArgChunk();
return FALSE;
return false;
}
break;
}
@@ -734,9 +735,9 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
{
if (start)
{
inTable = TRUE;
tableVerticalLineLeft = FALSE;
tableVerticalLineRight = FALSE;
inTable = true;
tableVerticalLineLeft = false;
tableVerticalLineRight = false;
wxChar *alignString = copystring(GetArgData());
@@ -746,9 +747,9 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
if (len > 0)
{
if (alignString[0] == '|')
tableVerticalLineLeft = TRUE;
tableVerticalLineLeft = true;
if (alignString[len-1] == '|')
tableVerticalLineRight = TRUE;
tableVerticalLineRight = true;
}
for (int i = 0; i < len; i++)
@@ -768,15 +769,15 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
// int tabPos = 80/noColumns;
currentTab = 0;
return FALSE;
return false;
}
}
else if (arg_no == 2 && !start)
{
inTable = FALSE;
inTable = false;
}
else if (arg_no == 2 && start)
return TRUE;
return true;
break;
}
case ltMARGINPAR:
@@ -787,11 +788,11 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
{
if (start)
{
TexOutput(_T("----------------------------------------------------------------------\n"), TRUE);
return TRUE;
TexOutput(_T("----------------------------------------------------------------------\n"), true);
return true;
}
else
TexOutput(_T("\n----------------------------------------------------------------------\n"), TRUE);
TexOutput(_T("\n----------------------------------------------------------------------\n"), true);
break;
}
case ltBIBITEM:
@@ -804,16 +805,16 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
if (ref)
{
if (ref->sectionNumber) delete[] ref->sectionNumber;
wxSprintf(buf, _T("[%d]"), citeCount);
wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
ref->sectionNumber = copystring(buf);
}
wxSprintf(buf, _T("\\hy-%d{%ld}{[%d]} "), hyBLOCK_BOLD, NewBlockId(), citeCount);
wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{[%d]} "), hyBLOCK_BOLD, NewBlockId(), citeCount);
TexOutput(buf);
citeCount ++;
return FALSE;
return false;
}
return TRUE;
return true;
}
case ltTHEBIBLIOGRAPHY:
{
@@ -831,12 +832,12 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
wxFprintf(Index, _T("%ld %ld\n"), id1, id2);
SetCurrentOutput(Chapters);
return FALSE;
return false;
}
if (!start && (arg_no == 2))
{
}
return TRUE;
return true;
}
case ltTWOCOLITEM:
case ltTWOCOLITEMRULED:
@@ -846,7 +847,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
if (!start && (arg_no == 2))
TexOutput(_T("\n"));
return TRUE;
return true;
}
/*
* Accents
@@ -896,7 +897,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
}
}
}
return FALSE;
return false;
}
case ltACCENT_ACUTE:
{
@@ -948,7 +949,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
}
}
}
return FALSE;
return false;
}
case ltACCENT_CARET:
{
@@ -994,7 +995,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
}
}
}
return FALSE;
return false;
}
case ltACCENT_TILDE:
{
@@ -1031,7 +1032,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
}
}
}
return FALSE;
return false;
}
case ltACCENT_UMLAUT:
{
@@ -1083,7 +1084,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
}
}
}
return FALSE;
return false;
}
case ltACCENT_DOT:
{
@@ -1105,7 +1106,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
}
}
}
return FALSE;
return false;
}
case ltACCENT_CADILLA:
{
@@ -1127,14 +1128,14 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
}
}
}
return FALSE;
return false;
}
default:
{
return DefaultOnArgument(macroId, arg_no, start);
}
}
return TRUE;
return true;
}
bool XLPGo(void)
@@ -1208,8 +1209,8 @@ bool XLPGo(void)
wxRemoveFile(_T("subsections.xlp"));
wxRemoveFile(_T("subsubsections.xlp"));
wxRemoveFile(_T("index.xlp"));
return TRUE;
return true;
}
return FALSE;
return false;
}