#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
}
}
}
+ else if (strcmp(argv[i], "-checkcurleybraces") == 0)
+ {
+ i ++;
+ checkCurleyBraces = TRUE;
+ }
+ else if (strcmp(argv[i], "-checksyntax") == 0)
+ {
+ i ++;
+ checkSyntax = TRUE;
+ }
else
{
wxString buf;
mode_menu->Append(TEX_MODE_HTML, "Output &HTML", "HTML World Wide Web hypertext file");
mode_menu->Append(TEX_MODE_XLP, "Output &XLP", "wxHelp hypertext help file");
+ wxMenu *options_menu = new wxMenu;
+
+ options_menu->Append(TEX_OPTIONS_CURELY_BRACE, "Curley brace matching", "Checks for mismatched curley braces",TRUE);
+ options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, "Syntax checking", "Syntax checking for common errors",TRUE);
+
+ options_menu->Check(TEX_OPTIONS_CURELY_BRACE, checkCurleyBraces);
+ options_menu->Check(TEX_OPTIONS_SYNTAX_CHECKING, checkSyntax);
+
wxMenu *help_menu = new wxMenu;
help_menu->Append(TEX_HELP, "&Help", "Tex2RTF Contents Page");
menuBar->Append(file_menu, "&File");
menuBar->Append(macro_menu, "&Macros");
menuBar->Append(mode_menu, "&Conversion Mode");
+ menuBar->Append(options_menu, "&Options");
menuBar->Append(help_menu, "&Help");
frame->SetMenuBar(menuBar);
// TODO: this simulates zero-memory leaks!
// Otherwise there are just too many...
#ifndef __WXGTK__
+#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
wxDebugContext::SetCheckpoint();
+#endif
#endif
return 0;
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");
OnInform(" -sync");
+ OnInform(" -checkcurleybraces");
+ OnInform(" -checksyntax");
OnInform(" -macros <filename>");
OnInform(" -winhelp");
OnInform(" -rtf");
EVT_MENU(TEX_MODE_WINHELP, MyFrame::OnModeWinHelp)
EVT_MENU(TEX_MODE_HTML, MyFrame::OnModeHTML)
EVT_MENU(TEX_MODE_XLP, MyFrame::OnModeXLP)
+ EVT_MENU(TEX_OPTIONS_CURELY_BRACE, MyFrame::OnOptionsCurleyBrace)
+ EVT_MENU(TEX_OPTIONS_SYNTAX_CHECKING, MyFrame::OnOptionsSyntaxChecking)
EVT_MENU(TEX_HELP, MyFrame::OnHelp)
EVT_MENU(TEX_ABOUT, MyFrame::OnAbout)
END_EVENT_TABLE()
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();
SetStatusText("In XLP mode.", 1);
}
+void MyFrame::OnOptionsCurleyBrace(wxCommandEvent& event)
+{
+ checkCurleyBraces = !checkCurleyBraces;
+ if (checkCurleyBraces)
+ {
+ SetStatusText("Checking curley braces: YES", 1);
+ }
+ else
+ {
+ SetStatusText("Checking curley braces: NO", 1);
+ }
+}
+
+
+void MyFrame::OnOptionsSyntaxChecking(wxCommandEvent& event)
+{
+ checkSyntax = !checkSyntax;
+ if (checkSyntax)
+ {
+ SetStatusText("Checking syntax: YES", 1);
+ }
+ else
+ {
+ SetStatusText("Checking syntax: NO", 1);
+ }
+}
+
+
void MyFrame::OnHelp(wxCommandEvent& event)
{
#if wxUSE_HELP
ChooseOutputFile();
#endif
- if (!InputFile || !OutputFile)
+ if (!InputFile || !OutputFile || stopRunning)
return FALSE;
#ifndef NO_GUI
if (isInteractive)
{
wxString buf;
- buf.Printf("Working, pass %d...", passNumber);
+ buf.Printf("Working, pass %d...Click CLOSE to abort", passNumber);
frame->SetStatusText((char *)buf.c_str());
}
#endif
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)
TexCleanUp();
startedSections = FALSE;
+#ifndef NO_GUI
+ frame->SetStatusText("Aborted by user.");
+#endif // GUI
+
OnInform("Sorry, unsuccessful.");
OkToClose = TRUE;
return FALSE;
#else
if (isInteractive && frame)
(*frame->textWindow) << msg << "\n";
+/* This whole block of code is just wrong I think. It would behave
+ completely wrong under anything other than MSW due to the ELSE
+ with no statement, and the cout calls would fail under MSW, as
+ the code in this block is compiled if !NO_GUI This code has been
+ here since v1.1 of this file too. - gt
else
#ifdef __WXMSW__
{
#ifdef __WXMSW__
{}
#endif
+*/
if (isInteractive)
{
Tex2RTFYield(TRUE);
#ifndef NO_GUI
#ifndef __WXGTK__
-//void wxObject::Dump(ostream& str)
+//void wxObject::Dump(wxSTD ostream& str)
//{
// if (GetClassInfo() && GetClassInfo()->GetClassName())
// str << GetClassInfo()->GetClassName();