X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f8bd8dd50626511cd00a2677cbfa7c3fe38d53ea..e18c3e02072753d45643316005bfd022a9d3d7cd:/utils/tex2rtf/src/tex2rtf.cpp diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index 92076a3a00..83b624cab4 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -27,6 +27,7 @@ #include "wx/textctrl.h" #include "wx/filedlg.h" #include "wx/msgdlg.h" + #include "wx/icon.h" #endif #endif @@ -66,7 +67,7 @@ static inline wxChar* copystring(const wxChar* s) { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); } #endif -const float versionNo = (float)TEX2RTF_VERSION_NUMBER; +const float versionNo = float(TEX2RTF_VERSION_NUMBER); TexChunk *currentMember = NULL; bool startedSections = false; @@ -154,7 +155,7 @@ bool MyApp::OnInit() WinHelpContentsFileName = new wxChar[300]; RefFileName = new wxChar[300]; - ColourTable.DeleteContents(true); + WX_CLEAR_LIST(wxList,ColourTable); int n = 1; @@ -269,10 +270,17 @@ bool MyApp::OnInit() } } } + else if (wxStrcmp(argv[i], _T("-checkcurlybraces")) == 0) + { + i ++; + checkCurlyBraces = true; + } else if (wxStrcmp(argv[i], _T("-checkcurleybraces")) == 0) { + // Support the old, incorrectly spelled version of -checkcurlybraces + // so that old scripts which run tex2rtf -checkcurleybraces still work. i ++; - checkCurleyBraces = true; + checkCurlyBraces = true; } else if (wxStrcmp(argv[i], _T("-checksyntax")) == 0) { @@ -351,10 +359,10 @@ bool MyApp::OnInit() wxMenu *options_menu = new wxMenu; - options_menu->Append(TEX_OPTIONS_CURLEY_BRACE, _T("Curley brace matching"), _T("Checks for mismatched curley braces"),true); + options_menu->Append(TEX_OPTIONS_CURLY_BRACE, _T("Curly brace matching"), _T("Checks for mismatched curly braces"),true); options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, _T("Syntax checking"), _T("Syntax checking for common errors"),true); - options_menu->Check(TEX_OPTIONS_CURLEY_BRACE, checkCurleyBraces); + options_menu->Check(TEX_OPTIONS_CURLY_BRACE, checkCurlyBraces); options_menu->Check(TEX_OPTIONS_SYNTAX_CHECKING, checkSyntax); wxMenu *help_menu = new wxMenu; @@ -390,7 +398,7 @@ bool MyApp::OnInit() */ wxString path = TexPathList.FindValidPath(MacroFile); - if (path != _T("")) + if (!path.empty()) ReadCustomMacros((wxChar *)path.c_str()); #if wxUSE_STATUSBAR @@ -426,11 +434,11 @@ bool MyApp::OnInit() */ wxString path = TexPathList.FindValidPath(MacroFile); - if (path != _T("")) + if (!path.empty()) ReadCustomMacros((wxChar*)path.c_str()); Go(); - if (runTwice) + if (runTwice) { Go(); } @@ -590,7 +598,7 @@ void ShowOptions(void) OnInform(_T(" -charset (default ansi)")); OnInform(_T(" -twice")); OnInform(_T(" -sync")); - OnInform(_T(" -checkcurleybraces")); + OnInform(_T(" -checkcurlybraces")); OnInform(_T(" -checksyntax")); OnInform(_T(" -macros ")); OnInform(_T(" -winhelp")); @@ -616,7 +624,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) 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_CURLEY_BRACE, MyFrame::OnOptionsCurleyBrace) + EVT_MENU(TEX_OPTIONS_CURLY_BRACE, MyFrame::OnOptionsCurlyBrace) EVT_MENU(TEX_OPTIONS_SYNTAX_CHECKING, MyFrame::OnOptionsSyntaxChecking) EVT_MENU(TEX_HELP, MyFrame::OnHelp) EVT_MENU(TEX_ABOUT, MyFrame::OnAbout) @@ -735,7 +743,7 @@ void MyFrame::OnLoadMacros(wxCommandEvent& WXUNUSED(event)) { textWindow->Clear(); wxString s = wxFileSelector(_T("Choose custom macro file"), wxPathOnly(MacroFile), wxFileNameFromPath(MacroFile), _T("ini"), _T("*.ini")); - if (s != _T("") && wxFileExists(s)) + if (!s.empty() && wxFileExists(s)) { MacroFile = copystring(s); ReadCustomMacros((wxChar *)s.c_str()); @@ -793,17 +801,17 @@ void MyFrame::OnModeXLP(wxCommandEvent& WXUNUSED(event)) #endif // wxUSE_STATUSBAR } -void MyFrame::OnOptionsCurleyBrace(wxCommandEvent& WXUNUSED(event)) +void MyFrame::OnOptionsCurlyBrace(wxCommandEvent& WXUNUSED(event)) { - checkCurleyBraces = !checkCurleyBraces; + checkCurlyBraces = !checkCurlyBraces; #if wxUSE_STATUSBAR - if (checkCurleyBraces) + if (checkCurlyBraces) { - SetStatusText(_T("Checking curley braces: YES"), 1); + SetStatusText(_T("Checking curly braces: YES"), 1); } else { - SetStatusText(_T("Checking curley braces: NO"), 1); + SetStatusText(_T("Checking curly braces: NO"), 1); } #endif // wxUSE_STATUSBAR } @@ -854,7 +862,7 @@ void ChooseInputFile(bool force) if (force || !InputFile) { wxString s = wxFileSelector(_T("Choose LaTeX input file"), wxPathOnly(InputFile), wxFileNameFromPath(InputFile), _T("tex"), _T("*.tex")); - if (s != _T("")) + if (!s.empty()) { // Different file, so clear index entries. ClearKeyWordTable(); @@ -908,7 +916,7 @@ void ChooseOutputFile(bool force) { wxString s = wxFileSelector(_T("Choose output file"), path, wxFileNameFromPath(OutputFile), extensionBuf, wildBuf); - if (s != _T("")) + if (!s.empty()) OutputFile = copystring(s); } } @@ -963,7 +971,7 @@ bool Go(void) if (!bulletFile) { wxString s = TexPathList.FindValidPath(_T("bullet.bmp")); - if (s != _T("")) + if (!s.empty()) { wxString str = wxFileNameFromPath(s); bulletFile = copystring(str); @@ -1118,7 +1126,7 @@ void OnInform(const wxChar *msg) /* 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 + 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__ @@ -1213,10 +1221,6 @@ Tex2RTFConnection::Tex2RTFConnection(wxChar *buf, int size):wxDDEConnection(buf, { } -Tex2RTFConnection::~Tex2RTFConnection(void) -{ -} - bool SplitCommand(wxChar *data, wxChar *firstArg, wxChar *secondArg) { firstArg[0] = 0;