X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/74698d3a22d5e611bbcd731a3ade616c66cfaca6..4b26b60fac70f89cf33935f78469e27536d8b614:/src/common/msgout.cpp diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp index c677a6bef1..e6a079969e 100755 --- a/src/common/msgout.cpp +++ b/src/common/msgout.cpp @@ -32,12 +32,14 @@ #include "wx/string.h" #include "wx/ffile.h" #include "wx/app.h" + #include "wx/intl.h" #if wxUSE_GUI #include "wx/msgdlg.h" #endif // wxUSE_GUI #endif #include "wx/msgout.h" +#include "wx/log.h" #include #include @@ -50,6 +52,11 @@ wxMessageOutput* wxMessageOutput::ms_msgOut = 0; wxMessageOutput* wxMessageOutput::Get() { + if ( !ms_msgOut && wxTheApp ) + { + ms_msgOut = wxTheApp->CreateMessageOutput(); + } + return ms_msgOut; } @@ -73,7 +80,7 @@ void wxMessageOutputStderr::Printf(const wxChar* format, ...) out.PrintfV(format, args); va_end(args); - fprintf(stderr, "%s", out.mb_str()); + fprintf(stderr, "%s", (const char*) out.mb_str()); } // ---------------------------------------------------------------------------- @@ -91,10 +98,16 @@ void wxMessageOutputMessageBox::Printf(const wxChar* format, ...) out.PrintfV(format, args); va_end(args); + // the native MSW msg box understands the TABs, others don't #ifndef __WXMSW__ - out.Replace("\t"," "); + out.Replace(wxT("\t"), wxT(" ")); #endif - ::wxMessageBox(out); + + wxString title; + if ( wxTheApp ) + title.Printf(_("%s message"), wxTheApp->GetAppName().c_str()); + + ::wxMessageBox(out, title); } #endif // wxUSE_GUI @@ -103,21 +116,17 @@ void wxMessageOutputMessageBox::Printf(const wxChar* format, ...) // wxMessageOutputLog // ---------------------------------------------------------------------------- -#if wxUSE_GUI && defined(__WXMOTIF__) - void wxMessageOutputLog::Printf(const wxChar* format, ...) { + wxString out; + va_list args; va_start(args, format); - wxString out; out.PrintfV(format, args); va_end(args); - out.Replace("\t"," "); - // under Motif, wxMessageDialog needs a parent window, so we use - // wxLog, which is better than nothing - ::wxLogMessage("%s", out.c_str()); -} + out.Replace(wxT("\t"), wxT(" ")); -#endif // wxUSE_GUI + ::wxLogMessage(wxT("%s"), out.c_str()); +}