#include "tex2rtf.xpm"
#endif
-#if !WXWIN_COMPATIBILITY_2_4
static inline wxChar* copystring(const wxChar* s)
{ return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); }
-#endif
const float versionNo = float(TEX2RTF_VERSION_NUMBER);
{
wxString buf;
buf.Printf(_T("Invalid switch %s.\n"), argv[i]);
- OnError((wxChar *)buf.c_str());
+ OnError(buf);
#ifdef NO_GUI
ShowOptions();
exit(1);
#endif // wxUSE_STATUSBAR
wxString errBuf;
errBuf.Printf(_T("\nErrors encountered during this pass: %lu\n"), errorCount);
- OnInform((wxChar *)errBuf.c_str());
+ OnInform(errBuf);
}
wxString str = wxFileNameFromPath(InputFile);
wxString buf;
buf.Printf(_T("Tex2RTF [%s]"), str.c_str());
- frame->SetTitle((wxChar *)buf.c_str());
+ frame->SetTitle(buf);
OutputFile = wxEmptyString;
}
}
{
wxString buf;
buf.Printf(_T("Working, pass %d...Click CLOSE to abort"), passNumber);
- frame->SetStatusText((wxChar *)buf.c_str());
+ frame->SetStatusText(buf);
}
#endif
OkToClose = false;
#ifndef NO_GUI
wxLongLong elapsed = wxGetLocalTimeMillis() - localTime;
buf.Printf(_T("Finished PASS #%d in %ld seconds.\n"), passNumber, (long)(elapsed.GetLo()/1000.0));
- OnInform((wxChar *)buf.c_str());
+ OnInform(buf);
if (errorCount)
{
buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount);
- OnInform((wxChar *)buf.c_str());
+ OnInform(buf);
}
#if wxUSE_STATUSBAR
if (isInteractive)
{
buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
- frame->SetStatusText((wxChar *)buf.c_str());
+ frame->SetStatusText(buf);
}
#endif // wxUSE_STATUSBAR
#else
buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
- OnInform((wxChar *)buf.c_str());
+ OnInform(buf);
if (errorCount)
{
buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount);
- OnInform((wxChar *)buf.c_str());
+ OnInform(buf.c_str());
}
#endif
passNumber ++;
return false;
}
-void OnError(const wxChar *msg)
+void OnError(const wxString& msg)
{
- wxString msg_string = msg;
errorCount++;
#ifdef NO_GUI
- wxSTD cerr << "Error: " << msg_string.mb_str() << "\n";
+ wxSTD cerr << "Error: " << msg.mb_str() << "\n";
wxSTD cerr.flush();
#else
if (isInteractive && frame)
else
{
#if defined(__UNIX__)
- wxSTD cerr << "Error: " << msg_string.mb_str() << "\n";
+ wxSTD cerr << "Error: " << msg.mb_str() << "\n";
wxSTD cerr.flush();
#elif defined(__WXMSW__)
wxLogError(msg);
#endif // NO_GUI
}
-void OnInform(const wxChar *msg)
+void OnInform(const wxString& msg)
{
- wxString msg_string = msg;
#ifdef NO_GUI
- wxSTD cout << msg_string.mb_str() << "\n";
+ wxSTD cout << msg.mb_str() << "\n";
wxSTD cout.flush();
#else
if (isInteractive && frame)
else
{
#if defined(__UNIX__)
- wxSTD cout << msg_string.mb_str() << "\n";
+ wxSTD cout << msg.mb_str() << "\n";
wxSTD cout.flush();
#elif defined(__WXMSW__)
wxLogInfo(msg);