#endif
#ifndef NO_GUI
-#include <wx/help.h>
-#include <wx/timer.h>
+#include "wx/help.h"
+#include "wx/timer.h"
#endif
#if defined(NO_GUI) || defined(__UNIX__)
#include "tex2rtf.h"
#include "rtfutils.h"
-#if (defined(__WXGTK__) || defined(__WXMOTIF__)) && !defined(NO_GUI)
+#if (defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)) && !defined(NO_GUI)
#include "tex2rtf.xpm"
#endif
char *TmpContentsName = NULL; // Current contents page
char *TmpFrameContentsName = NULL; // Current frame contents page
char *WinHelpContentsFileName = NULL; // WinHelp .cnt file
-char *RefName = NULL; // Reference file name
+char *RefFileName = NULL; // Reference file name
char *RTFCharset = copystring("ansi");
TmpContentsName = new char[300];
TmpFrameContentsName = new char[300];
WinHelpContentsFileName = new char[300];
- RefName = new char[300];
+ RefFileName = new char[300];
ColourTable.DeleteContents(TRUE);
if (!InputFile || !OutputFile)
{
- cout << "Tex2RTF: input or output file is missing.\n";
+ wxSTD cout << "Tex2RTF: input or output file is missing.\n";
ShowOptions();
exit(1);
}
delete WinHelpContentsFileName;
WinHelpContentsFileName = NULL;
}
- if (RefName)
+ if (RefFileName)
{
- delete RefName;
- RefName = NULL;
+ delete RefFileName;
+ RefFileName = NULL;
}
if (TopLevel)
{
OnInform(buf);
OnInform("Usage: tex2rtf [input] [output] [switches]\n");
OnInform("where valid switches are");
+#ifndef NO_GUI
OnInform(" -interactive");
+#endif
OnInform(" -bufsize <size in K>");
OnInform(" -charset <pc | pca | ansi | mac> (default ansi)");
OnInform(" -twice");
Tex2RTFYield(TRUE);
Go();
- if (runTwice)
+ if (stopRunning)
+ {
+ SetStatusText("Build aborted!");
+ wxString errBuf;
+ errBuf.Printf("\nErrors encountered during this pass: %lu\n", errorCount);
+ OnInform((char *)errBuf.c_str());
+ }
+
+
+ if (runTwice && !stopRunning)
{
Tex2RTFYield(TRUE);
Go();
ChooseOutputFile();
#endif
- if (!InputFile || !OutputFile)
+ if (!InputFile || !OutputFile || stopRunning)
return FALSE;
#ifndef NO_GUI
sprintf(TmpContentsName, "%s.cn1", FileRoot);
sprintf(TmpFrameContentsName, "%s.frc", FileRoot);
sprintf(WinHelpContentsFileName, "%s.cnt", FileRoot);
- sprintf(RefName, "%s.ref", FileRoot);
+ sprintf(RefFileName, "%s.ref", FileRoot);
TexPathList.EnsureFileAccessible(InputFile);
if (!bulletFile)
}
}
- if (wxFileExists(RefName))
- ReadTexReferences(RefName);
+ if (wxFileExists(RefFileName))
+ ReadTexReferences(RefFileName);
bool success = FALSE;
OnInform("Reading LaTeX file...");
TexLoadFile(InputFile);
+ if (stopRunning)
+ {
+ OkToClose = TRUE;
+ return FALSE;
+ }
+
switch (convertMode)
{
case TEX_RTF:
OnInform("*** Aborted by user.");
success = FALSE;
stopRunning = FALSE;
+ OkToClose = TRUE;
}
if (success)
{
- WriteTexReferences(RefName);
+ WriteTexReferences(RefFileName);
TexCleanUp();
startedSections = FALSE;
return FALSE;
}
-void OnError(char *msg)
+void OnError(const char *msg)
{
errorCount++;
#ifdef NO_GUI
- cerr << "Error: " << msg << "\n";
- cerr.flush();
+ wxSTD cerr << "Error: " << msg << "\n";
+ wxSTD cerr.flush();
#else
if (isInteractive && frame)
(*frame->textWindow) << "Error: " << msg << "\n";
else
#ifdef __UNIX__
{
- cerr << "Error: " << msg << "\n";
- cerr.flush();
+ wxSTD cerr << "Error: " << msg << "\n";
+ wxSTD cerr.flush();
}
#endif
#endif // NO_GUI
}
-void OnInform(char *msg)
+void OnInform(const char *msg)
{
#ifdef NO_GUI
- cout << msg << "\n";
- cout.flush();
+ wxSTD cout << msg << "\n";
+ wxSTD cout.flush();
#else
if (isInteractive && frame)
(*frame->textWindow) << msg << "\n";
else
#ifdef __WXMSW__
{
- cout << msg << "\n";
- cout.flush();
+ wxSTD cout << msg << "\n";
+ wxSTD cout.flush();
}
#endif
#ifdef __WXMSW__
#ifndef NO_GUI
#ifndef __WXGTK__
-//void wxObject::Dump(ostream& str)
+//void wxObject::Dump(wxSTD ostream& str)
//{
// if (GetClassInfo() && GetClassInfo()->GetClassName())
// str << GetClassInfo()->GetClassName();