-#ifdef MGL_DEBUG
- // That damn MGL redirects stdin and stdout to physical console
- FILE *file = fopen("stderr", "wt");
- wxLog::SetActiveTarget(new wxLogStderr(file));
+ m_displayMode = mode;
+
+ return TRUE;
+}
+
+bool wxApp::OnInitGui()
+{
+ if ( !wxAppBase::OnInitGui() )
+ return FALSE;
+
+#ifdef __WXDEBUG__
+ // MGL redirects stdout and stderr to physical console, so lets redirect
+ // it to file. Do it only when WXDEBUG environment variable is set
+ if ( wxGetEnv(wxT("WXDEBUG"), NULL) )
+ freopen("output.err", "wt", stderr);