X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0cf2cb360f2ed60757a7c135f216495c3cc7b29b..9c039d08bfbb59c0abcbc705fb49f9b2cb321edf:/src/gtk1/app.cpp diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 11ab9c284f..501e625977 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -25,7 +25,7 @@ #include "unistd.h" -#ifdef USE_GDK_IMLIB +#ifdef wxUSE_GDK_IMLIB #include "../gdk_imlib/gdk_imlib.h" #endif @@ -33,7 +33,7 @@ // global data //----------------------------------------------------------------------------- -wxApp *wxTheApp = NULL; +wxApp *wxTheApp = (wxApp *) NULL; wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL; extern wxList wxPendingDelete; @@ -80,7 +80,7 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) ) wxApp::wxApp() { m_idleTag = 0; - m_topWindow = NULL; + m_topWindow = (wxWindow *) NULL; m_exitOnFrameDelete = TRUE; wxTheApp = this; } @@ -230,7 +230,7 @@ wxWindow *wxApp::GetTopWindow(void) { if (m_topWindow) return m_topWindow; wxNode *node = wxTopLevelWindows.First(); - if (!node) return NULL; + if (!node) return (wxWindow *) NULL; return (wxWindow*)node->Data(); } @@ -243,7 +243,7 @@ void wxApp::CommonInit(void) { /* -#if USE_RESOURCES +#if wxUSE_RESOURCES (void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion); #endif */ @@ -262,7 +262,7 @@ void wxApp::CommonInit(void) wxInitializeResourceSystem(); // For PostScript printing -#if USE_POSTSCRIPT +#if wxUSE_POSTSCRIPT wxInitializePrintSetupData(); wxThePrintPaperDatabase = new wxPrintPaperDatabase; wxThePrintPaperDatabase->CreateDatabase(); @@ -310,13 +310,9 @@ int wxEntry( int argc, char *argv[] ) wxClassInfo::InitializeClasses(); -#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT +#if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT -#if !defined(_WINDLL) streambuf* sBuf = new wxDebugStreamBuf; -#else - streambuf* sBuf = NULL; -#endif ostream* oStr = new ostream(sBuf) ; wxDebugContext::SetStream(oStr, sBuf); @@ -326,7 +322,7 @@ int wxEntry( int argc, char *argv[] ) { if (!wxApp::GetInitializerFunction()) { - printf( _("wxWindows error: No initializer - use IMPLEMENT_APP macro.\n") ); + printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); return 0; } @@ -339,16 +335,24 @@ int wxEntry( int argc, char *argv[] ) if (!wxTheApp) { - printf( _("wxWindows error: wxTheApp == NULL\n") ); + printf( "wxWindows error: wxTheApp == NULL\n" ); return 0; } wxTheApp->argc = argc; wxTheApp->argv = argv; + char name[200]; + strcpy( name, argv[0] ); + strcpy( name, wxFileNameFromPath(name) ); + wxStripExtension( name ); + wxTheApp->SetAppName( name ); + + gtk_set_locale(); + gtk_init( &argc, &argv ); -#ifdef USE_GDK_IMLIB +#ifdef wxUSE_GDK_IMLIB gdk_imlib_init(); @@ -382,11 +386,15 @@ int wxEntry( int argc, char *argv[] ) wxDELETE(wxTheApp); -#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT - // At this point we want to check if there are any memory - // blocks that aren't part of the wxDebugContext itself, - // as a special case. Then when dumping we need to ignore - // wxDebugContext, too. + wxLog *oldLog = wxLog::SetActiveTarget( NULL ); + if (oldLog) delete oldLog; + + wxClassInfo::CleanUpClasses(); + + delete[] wxBuffer; + +#if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + if (wxDebugContext::CountObjectsLeft() > 0) { wxTrace("There were memory leaks.\n"); @@ -394,6 +402,7 @@ int wxEntry( int argc, char *argv[] ) wxDebugContext::PrintStatistics(); } wxDebugContext::SetStream(NULL, NULL); + #endif return retValue;