X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a29912f608e082001ee53b9873323c4bcd71f21..d9f39e09e82e99c422619f4e3df536d0a9e87987:/utils/tex2rtf/src/tex2rtf.cpp?ds=inline diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index 2ad1a396f5..cc22a9c52d 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -101,6 +101,9 @@ bool Go(void); void ShowOptions(void); #ifdef NO_GUI + +extern char *wxBuffer; // we must init it, otherwise tex2rtf will crash + int main(int argc, char **argv) #else wxMenuBar *menuBar = NULL; @@ -146,12 +149,16 @@ bool MyApp::OnInit() } #ifdef NO_GUI + wxBuffer = new char[1500]; + // this is done in wxApp, but NO_GUI version doesn't call it :-( + if (!InputFile || !OutputFile) { cout << "Tex2RTF: input or output file is missing.\n"; ShowOptions(); exit(1); } + #endif if (InputFile) { @@ -374,10 +381,12 @@ bool MyApp::OnInit() // Return the main frame window return TRUE; #else + delete[] wxBuffer; return FALSE; #endif } +#ifndef NO_GUI int MyApp::OnExit() { wxNode *node = CustomMacroList.First(); @@ -399,16 +408,19 @@ int MyApp::OnExit() MacroDefs.Clear(); #ifdef __WXMSW__ delete TheTex2RTFServer; + wxDDECleanUp(); #endif delete HelpInstance; // TODO: this simulates zero-memory leaks! // Otherwise there are just too many... +#ifndef __WXGTK__ wxDebugContext::SetCheckpoint(); +#endif return 0; } - +#endif void ShowOptions(void) { char buf[100]; @@ -464,10 +476,6 @@ void MyFrame::OnCloseWindow(wxCloseEvent& event) } else if (OkToClose) { -#ifdef __WXMSW__ - delete TheTex2RTFServer; - wxDDECleanUp(); -#endif this->Destroy(); } } @@ -648,7 +656,7 @@ void ChooseOutputFile(bool force) char extensionBuf[10]; char wildBuf[10]; strcpy(wildBuf, "*."); - char *path = NULL; + wxString path; if (OutputFile) path = wxPathOnly(OutputFile); else if (InputFile) @@ -1027,8 +1035,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& topic, char *data, int size, i } else if (strcmp(firstArg, "EXIT") == 0) { - if (frame && frame->OnClose()) - delete frame; + if (frame) frame->Close(); } else if (strcmp(firstArg, "MINIMIZE") == 0 || strcmp(firstArg, "ICONIZE") == 0) { @@ -1075,3 +1082,14 @@ char *Tex2RTFConnection::OnRequest(const wxString& topic, const wxString& item, #endif +#ifndef NO_GUI +#ifndef __WXGTK__ +//void wxObject::Dump(ostream& str) +//{ +// if (GetClassInfo() && GetClassInfo()->GetClassName()) +// str << GetClassInfo()->GetClassName(); +// else +// str << "unknown object class"; +//} +#endif +#endif