/////////////////////////////////////////////////////////////////////////////
-// Name: app.cpp
+// Name: src/mgl/app.cpp
// Author: Vaclav Slavik
// based on GTK and MSW implementations
// Id: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "app.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#pragma hdrstop
#endif
+#include "wx/app.h"
#ifndef WX_PRECOMP
#include "wx/settings.h"
#include "wx/dialog.h"
#include "wx/log.h"
#include "wx/intl.h"
+ #include "wx/module.h"
#endif
-#include "wx/app.h"
#include "wx/evtloop.h"
-#include "wx/module.h"
#include "wx/fontutil.h"
#include "wx/univ/theme.h"
#include "wx/univ/renderer.h"
#include "wx/univ/colschem.h"
#include "wx/sysopt.h"
#include "wx/mgl/private.h"
+#include "wx/private/fontmgr.h"
//-----------------------------------------------------------------------------
// wxApp::Exit()
exit(0);
}
-//-----------------------------------------------------------------------------
-// wxYield
-//-----------------------------------------------------------------------------
-
-static bool gs_inYield = false;
-
-bool wxApp::Yield(bool onlyIfNeeded)
-{
- if ( gs_inYield )
- {
- if ( !onlyIfNeeded )
- {
- wxFAIL_MSG( wxT("wxYield called recursively" ) );
- }
-
- return false;
- }
-
-#if wxUSE_THREADS
- if ( !wxThread::IsMain() )
- {
- // can't process events from other threads, MGL is thread-unsafe
- return true;
- }
-#endif // wxUSE_THREADS
-
- gs_inYield = true;
-
- wxLog::Suspend();
-
- if ( wxEventLoop::GetActive() )
- {
- while (wxEventLoop::GetActive()->Pending())
- wxEventLoop::GetActive()->Dispatch();
- }
-
- /* it's necessary to call ProcessIdle() to update the frames sizes which
- might have been changed (it also will update other things set from
- OnUpdateUI() which is a nice (and desired) side effect) */
- while (wxTheApp->ProcessIdle()) { }
-
- wxLog::Resume();
-
- gs_inYield = false;
-
- return true;
-}
-
//-----------------------------------------------------------------------------
// wxWakeUpIdle
SetMGLwindow_t(MGL_wmGetRootWindow(g_winMng));
SetBackgroundColour(wxTHEME_COLOUR(DESKTOP));
}
- ~wxRootWindow()
+ virtual ~wxRootWindow()
{
// we don't want to delete MGL_WM's rootWnd
m_wnd = NULL;
IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
-BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
- EVT_IDLE(wxAppBase::OnIdle)
-END_EVENT_TABLE()
-
-
wxApp::wxApp()
{
}
if ( !wxAppBase::OnInitGui() )
return false;
-#ifdef __WXDEBUG__
// MGL redirects stdout and stderr to physical console, so lets redirect
- // it to file in debug build. Do it only when WXSTDERR environment variable is set
+ // it to file if WXSTDERR environment variable is set to be able to see
+ // wxLogDebug() output
wxString redirect;
if ( wxGetEnv(wxT("WXSTDERR"), &redirect) )
freopen(redirect.mb_str(), "wt", stderr);
-#endif // __WXDEBUG__
wxLog *oldLog = wxLog::SetActiveTarget(new wxLogGui);
if ( oldLog ) delete oldLog;
return false;
}
- // must do it before calling wxAppBase::Initialize(), because fonts are
- // needed by stock lists which are created there
- wxTheFontsManager = new wxFontsManager;
-
if ( !wxAppBase::Initialize(argc, argv) )
{
- delete wxTheFontsManager;
- wxTheFontsManager = NULL;
MGL_exit();
return false;
}
void OnExit()
{
- delete wxTheFontsManager;
- wxTheFontsManager = (wxFontsManager*) NULL;
+ wxFontsManager::CleanUp();
wxDestroyMGL_WM();
MGL_exit();
wxModule::RegisterModule(new wxMGLFinalCleanup);
}
-