#include "wx/app.h"
#include "wx/intl.h"
#include "wx/list.h"
- #if wxUSE_LOG
- #include "wx/log.h"
- #endif // wxUSE_LOG
+ #include "wx/log.h"
#endif //WX_PRECOMP
#include "wx/utils.h"
#endif //Win/Unix
#if defined(__WXMSW__)
- #include "wx/msw/private.h" // includes windows.h for MessageBox()
+ #include "wx/msw/wrapwin.h" // includes windows.h for MessageBox()
#endif
#if wxUSE_FONTMAP
#include "wx/fontmap.h"
#endif // wxUSE_FONTMAP
-#if wxUSE_SOCKETS
- #include "wx/gsocket.h"
-#endif // wxUSE_SOCKETS
-
#if defined(__WXMAC__)
// VZ: MacTypes.h is enough under Mac OS X (where I could test it) but
// I don't know which headers are needed under earlier systems so
#ifdef __WXDEBUG__
SetTraceMasks();
+#if wxUSE_UNICODE
+ // In unicode mode the SetTraceMasks call can cause an apptraits to be
+ // created, but since we are still in the constructor the wrong kind will
+ // be created for GUI apps. Destroy it so it can be created again later.
+ delete m_traits;
+ m_traits = NULL;
+#endif
#endif
}
bool wxAppConsole::Initialize(int& argc, wxChar **argv)
{
+#if wxUSE_LOG
+ // If some code logged something before wxApp instance was created,
+ // wxLogStderr was set as the target. Undo it here by destroying the
+ // current target. It will be re-created next time logging is needed, but
+ // this time wxAppTraits will be used:
+ delete wxLog::SetActiveTarget(NULL);
+#endif // wxUSE_LOG
+
// remember the command line arguments
this->argc = argc;
this->argv = argv;
return -1;
}
+// ----------------------------------------------------------------------------
+// exception handling
+// ----------------------------------------------------------------------------
+
#if wxUSE_EXCEPTIONS
void
(handler->*func)(event);
}
+bool
+wxAppConsole::OnExceptionInMainLoop()
+{
+ throw;
+
+ // some compilers are too stupid to know that we never return after throw
+#if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200)
+ return false;
+#endif
+}
+
#endif // wxUSE_EXCEPTIONS
// ----------------------------------------------------------------------------
#if wxUSE_LOG
if ( parser.Found(OPTION_VERBOSE) )
{
- wxLog::SetVerbose(TRUE);
+ wxLog::SetVerbose(true);
}
+#else
+ wxUnusedVar(parser);
#endif // wxUSE_LOG
- return TRUE;
+ return true;
}
bool wxAppConsole::OnCmdLineHelp(wxCmdLineParser& parser)
msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."),
lib.c_str(), progName.c_str(), prog.c_str());
- wxLogFatalError(msg);
+ wxLogFatalError(msg.c_str());
// normally wxLogFatalError doesn't return
return FALSE;
{
return NULL;
}
-
-// TODO: Use a different class that only stubs out the event loop functions
-GSocketBSD* wxConsoleAppTraitsBase::CreateGSocket()
-{
-#ifdef wxUSE_GSOCKET_CPLUSPLUS
- return new GSocketBSDGUIShim();
-#else
- return NULL;
-#endif
-}
#endif
// ----------------------------------------------------------------------------
wxT("You can also choose [Cancel] to suppress ")
wxT("further warnings.");
- switch ( ::MessageBox(NULL, msgDlg, _T("wxWindows Debug Alert"),
+ switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"),
MB_YESNOCANCEL | MB_ICONSTOP ) )
{
case IDYES: