]> git.saurik.com Git - wxWidgets.git/commitdiff
extracted common initialization/cleanup functions in common/init.cpp; standardized...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Jun 2003 18:43:09 +0000 (18:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Jun 2003 18:43:09 +0000 (18:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

34 files changed:
include/wx/app.h
include/wx/apptrait.h
include/wx/cocoa/app.h
include/wx/gtk/app.h
include/wx/gtk1/app.h
include/wx/init.h [new file with mode: 0644]
include/wx/mac/app.h
include/wx/mgl/app.h
include/wx/motif/app.h
include/wx/msw/app.h
include/wx/os2/app.h
include/wx/x11/app.h
src/cocoa/app.mm
src/common/appbase.cpp
src/common/appcmn.cpp
src/common/fs_mem.cpp
src/common/init.cpp
src/gtk/app.cpp
src/gtk1/app.cpp
src/mac/app.cpp
src/mac/carbon/app.cpp
src/mgl/app.cpp
src/motif/app.cpp
src/msw/app.cpp
src/msw/frame.cpp
src/msw/main.cpp
src/msw/mdi.cpp
src/msw/utils.cpp
src/msw/window.cpp
src/os2/app.cpp
src/wxBase.dsp
src/wxMSW.dsp
src/wxWindows.dsp
src/x11/app.cpp

index a9bf03c28740b61c33893292ddb388fec4d42771..5ed82cebefc75afde670663bd462938a131c9ded 100644 (file)
@@ -24,6 +24,7 @@
 #endif // wxUSE_GUI
 
 #include "wx/build.h"
+#include "wx/init.h"
 
 class WXDLLEXPORT wxApp;
 class WXDLLEXPORT wxAppTraits;
@@ -89,12 +90,22 @@ public:
     // the virtual functions which may/must be overridden in the derived class
     // -----------------------------------------------------------------------
 
+    // This is the very first function called for a newly created wxApp object,
+    // it is used by the library to do the global initialization. If, for some
+    // reason, you must override it (instead of just overriding OnInit(), as
+    // usual, for app-specific initializations), do not forget to call the base
+    // class version!
+    virtual bool Initialize(int argc, wxChar **argv);
+
     // Called before OnRun(), this is a good place to do initialization -- if
     // anything fails, return false from here to prevent the program from
     // continuing. The command line is normally parsed here, call the base
     // class OnInit() to do it.
     virtual bool OnInit();
 
+    // this is here only temproary hopefully (FIXME)
+    virtual bool OnInitGui() { return true; }
+
     // This is the replacement for the normal main(): all program work should
     // be done here. When OnRun() returns, the programs starts shutting down.
     virtual int OnRun() = 0;
@@ -103,6 +114,11 @@ public:
     // any cleanup matching the initializations done there.
     virtual int OnExit();
 
+    // This is the very last function called on wxApp object before it is
+    // destroyed. If you override it (instead of overriding OnExit() as usual)
+    // do not forget to call the base class version!
+    virtual void CleanUp();
+
     // Called when a fatal exception occurs, this function should take care not
     // to do anything which might provoke a nested exception! It may be
     // overridden if you wish to react somehow in non-default way (core dump
@@ -295,6 +311,11 @@ public:
     // the virtual functions which may/must be overridden in the derived class
     // -----------------------------------------------------------------------
 
+        // very first initialization function
+        //
+        // Override: very rarely
+    virtual bool Initialize(int argc, wxChar **argv);
+
         // a platform-dependent version of OnInit(): the code here is likely to
         // depend on the toolkit. default version does nothing.
         //
@@ -310,8 +331,10 @@ public:
         // Override: rarely in GUI applications, always in console ones.
     virtual int OnRun();
 
-        // exit the main loop thus terminating the application
-    virtual void Exit();
+        // very last clean up function
+        //
+        // Override: very rarely
+    virtual void CleanUp();
 
 
     // the worker functions - usually not used directly by the user code
@@ -320,6 +343,9 @@ public:
         // execute the main GUI loop, the function returns when the loop ends
     virtual int MainLoop() = 0;
 
+        // exit the main loop thus terminating the application
+    virtual void Exit();
+
         // exit the main GUI loop during the next iteration (i.e. it does not
         // stop the program immediately!)
     virtual void ExitMainLoop() = 0;
@@ -419,6 +445,9 @@ public:
 
 
 protected:
+    // delete all objects in wxPendingDelete list
+    void DeletePendingObjects();
+
     // override base class method to use GUI traits
     virtual wxAppTraits *CreateTraits();
 
@@ -505,44 +534,6 @@ extern bool WXDLLEXPORT wxYield();
 // Yield to other apps/messages
 extern void WXDLLEXPORT wxWakeUpIdle();
 
-
-// console applications may avoid using DECLARE_APP and IMPLEMENT_APP macros
-// and call these functions instead at the program startup and termination
-// -------------------------------------------------------------------------
-
-#if !wxUSE_GUI
-
-// initialize the library (may be called as many times as needed, but each
-// call to wxInitialize() must be matched by wxUninitialize())
-extern bool WXDLLEXPORT wxInitialize();
-
-// clean up - the library can't be used any more after the last call to
-// wxUninitialize()
-extern void WXDLLEXPORT wxUninitialize();
-
-// create an object of this class on stack to initialize/cleanup thel ibrary
-// automatically
-class WXDLLEXPORT wxInitializer
-{
-public:
-    // initialize the library
-    wxInitializer() { m_ok = wxInitialize(); }
-
-    // has the initialization been successful? (explicit test)
-    bool IsOk() const { return m_ok; }
-
-    // has the initialization been successful? (implicit test)
-    operator bool() const { return m_ok; }
-
-    // dtor only does clean up if we initialized the library properly
-    ~wxInitializer() { if ( m_ok ) wxUninitialize(); }
-
-private:
-    bool m_ok;
-};
-
-#endif // !wxUSE_GUI
-
 // ----------------------------------------------------------------------------
 // macros for dynamic creation of the application object
 // ----------------------------------------------------------------------------
@@ -572,22 +563,17 @@ public:
         extern int wxEntry( int argc, char **argv, bool enterLoop = TRUE ); \
         int main(int argc, char **argv) { return wxEntry(argc, argv); }
 #elif defined(__WXMSW__) && defined(WXUSINGDLL)
-    // NT defines APIENTRY, 3.x not
-    #if !defined(WXAPIENTRY)
-        #define WXAPIENTRY WXFAR wxSTDCALL
-    #endif
-
-    #include <windows.h>
-    #include "wx/msw/winundef.h"
-
     #define IMPLEMENT_WXWIN_MAIN \
-        extern "C" int WXAPIENTRY WinMain(HINSTANCE hInstance,\
-                                          HINSTANCE hPrevInstance,\
-                                          LPSTR m_lpCmdLine, int nCmdShow)\
-        {\
-            return wxEntry((WXHINSTANCE) hInstance,\
-                           (WXHINSTANCE) hPrevInstance,\
-                           m_lpCmdLine, nCmdShow);\
+        extern int wxEntry(WXHINSTANCE hInstance,                             \
+                           WXHINSTANCE hPrevInstance,                         \
+                           char *pCmdLine,                                    \
+                           int nCmdShow);                                     \
+        extern "C" int wxSTDCALL WinMain(WXHINSTANCE hInstance,               \
+                                         WXHINSTANCE hPrevInstance,           \
+                                         char *lpCmdLine,                     \
+                                         int nCmdShow)                        \
+        {                                                                     \
+            return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow);    \
         }
 #else
     #define IMPLEMENT_WXWIN_MAIN
@@ -605,13 +591,14 @@ public:
 
 // Use this macro if you want to define your own main() or WinMain() function
 // and call wxEntry() from there.
-#define IMPLEMENT_APP_NO_MAIN(appname)                   \
-    wxApp *wxCreateApp()                                 \
-    {                                                    \
-        wxApp::CheckBuildOptions(wxBuildOptions());      \
-        return new appname;                              \
-    }                                                    \
-    wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
+#define IMPLEMENT_APP_NO_MAIN(appname)                                      \
+    wxApp *wxCreateApp()                                                    \
+    {                                                                       \
+        wxApp::CheckBuildOptions(wxBuildOptions());                         \
+        return new appname;                                                 \
+    }                                                                       \
+    wxAppInitializer                                                        \
+        wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp);        \
     appname& wxGetApp() { return *(appname *)wxTheApp; }
 
 // Same as IMPLEMENT_APP() normally but doesn't include themes support in
@@ -630,5 +617,5 @@ public:
 // function
 #define DECLARE_APP(appname) extern appname& wxGetApp();
 
-#endif
-    // _WX_APP_H_BASE_
+#endif // _WX_APP_H_BASE_
+
index 488645e1b1315592989b6d0f55ed73c4d706abdc..dff9f3fdfc990d545640e180932bbe1cc15ec6a0 100644 (file)
@@ -116,7 +116,7 @@ public:
 // wxConsoleAppTraitsBase: wxAppTraits implementation for the console apps
 // ----------------------------------------------------------------------------
 
-class wxConsoleAppTraitsBase : public wxAppTraits
+class WXDLLEXPORT wxConsoleAppTraitsBase : public wxAppTraits
 {
 public:
 #if wxUSE_LOG
@@ -142,7 +142,7 @@ public:
 
 #if wxUSE_GUI
 
-class wxGUIAppTraitsBase : public wxAppTraits
+class WXDLLEXPORT wxGUIAppTraitsBase : public wxAppTraits
 {
 public:
 #if wxUSE_LOG
index 357fda54f4124e1519142caff13d87c3c1058c3b..ffb6b3d82c703d34281de4cb65629f4fff570b89 100644 (file)
@@ -66,12 +66,11 @@ public:
     // Returns TRUE if more idle time is requested.
     bool SendIdleEvents(wxWindowCocoa* win);
     
-    static bool Initialize();
-    static void CleanUp();
+    virtual bool Initialize(int argc, wxChar **argv);
+    virtual void CleanUp();
     
     virtual bool OnInit();
     virtual bool OnInitGui();
-    void DeletePendingObjects();
 };
 
 #endif // _WX_COCOA_APP_H_
index fbd5a55e6a485a4b5fdc5060d5a73f98e18ad264..fea48cf032eb2829df87aa165a316b328a07a54e 100644 (file)
@@ -58,11 +58,10 @@ public:
     bool SendIdleEvents();
     bool SendIdleEvents( wxWindow* win );
 
-    static bool Initialize();
-    static bool InitialzeVisual();
-    static void CleanUp();
+    virtual bool Initialize(int argc, wxChar **argv);
+    virtual void CleanUp();
 
-    void DeletePendingObjects();
+    static bool InitialzeVisual();
 
 #ifdef __WXDEBUG__
     virtual void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg);
index fbd5a55e6a485a4b5fdc5060d5a73f98e18ad264..fea48cf032eb2829df87aa165a316b328a07a54e 100644 (file)
@@ -58,11 +58,10 @@ public:
     bool SendIdleEvents();
     bool SendIdleEvents( wxWindow* win );
 
-    static bool Initialize();
-    static bool InitialzeVisual();
-    static void CleanUp();
+    virtual bool Initialize(int argc, wxChar **argv);
+    virtual void CleanUp();
 
-    void DeletePendingObjects();
+    static bool InitialzeVisual();
 
 #ifdef __WXDEBUG__
     virtual void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg);
diff --git a/include/wx/init.h b/include/wx/init.h
new file mode 100644 (file)
index 0000000..f973e9b
--- /dev/null
@@ -0,0 +1,83 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/init.h
+// Purpose:     wxWindows initialization and finalization functions
+// Author:      Vadim Zeitlin
+// Modified by:
+// Created:     29.06.2003
+// RCS-ID:      $Id$
+// Copyright:   (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_INIT_H_
+#define _WX_INIT_H_
+
+#include "wx/wxchar.h"
+
+// ----------------------------------------------------------------------------
+// wxEntry helper functions which allow to have more fine grained control
+// ----------------------------------------------------------------------------
+
+// do common initialization, return true if ok (in this case wxEntryCleanup
+// must be called later), otherwise the program can't use wxWindows at all
+//
+// this function also creates wxTheApp as a side effect, if IMPLEMENT_APP
+// hadn't been used a dummy default application object is created
+//
+// note that the parameters may be modified
+extern bool WXDLLEXPORT wxEntryStart(int argc, wxChar **argv);
+
+// free the resources allocated by the library in wxEntryStart() and shut it
+// down (wxEntryStart() may be called again afterwards if necessary)
+extern void WXDLLEXPORT wxEntryCleanup();
+
+
+// ----------------------------------------------------------------------------
+// wxEntry: this function initializes the library, runs the main event loop
+//          and cleans it up
+// ----------------------------------------------------------------------------
+
+// note that other, platform-specific, overloads of wxEntry may exist as well
+// but this one always exists under all platforms
+//
+// returns the program exit code
+extern int WXDLLEXPORT wxEntry(int argc, wxChar **argv);
+
+
+// ----------------------------------------------------------------------------
+// Using the library without (explicit) application object: you may avoid using
+// DECLARE_APP and IMPLEMENT_APP macros and call the functions below instead at
+// the program startup and termination
+// ----------------------------------------------------------------------------
+
+// initialize the library (may be called as many times as needed, but each
+// call to wxInitialize() must be matched by wxUninitialize())
+extern bool WXDLLEXPORT wxInitialize(int argc = 0, wxChar **argv = NULL);
+
+// clean up -- the library can't be used any more after the last call to
+// wxUninitialize()
+extern void WXDLLEXPORT wxUninitialize();
+
+// create an object of this class on stack to initialize/cleanup the library
+// automatically
+class WXDLLEXPORT wxInitializer
+{
+public:
+    // initialize the library
+    wxInitializer() { m_ok = wxInitialize(); }
+
+    // has the initialization been successful? (explicit test)
+    bool IsOk() const { return m_ok; }
+
+    // has the initialization been successful? (implicit test)
+    operator bool() const { return m_ok; }
+
+    // dtor only does clean up if we initialized the library properly
+    ~wxInitializer() { if ( m_ok ) wxUninitialize(); }
+
+private:
+    bool m_ok;
+};
+
+#endif // _WX_INIT_H_
+
index 389d6b0d8a5706969404932c3bf638e594d2743e..592e797f3f57deacfb708016c74aba203ca7f4c1 100644 (file)
@@ -91,10 +91,9 @@ protected:
 public:
 
     // Implementation
-    static bool Initialize();
-    static void CleanUp();
+    virtual bool Initialize(int argc, wxChar **argv);
+    virtual void CleanUp();
     
-    void DeletePendingObjects();
     bool IsExiting() { return !m_keepGoing ; }
 #if TARGET_CARBON
     WXEVENTHANDLERREF    MacGetEventHandler() { return m_macEventHandler ; }
index 43bec77767d13ac76a7cba940e079a96c2c3b956..ea3a377ab6108add13969d676584e80dadc27a89 100644 (file)
@@ -54,10 +54,8 @@ public:
     bool SendIdleEvents();
     bool SendIdleEvents(wxWindow* win);
 
-    static bool Initialize();
-    static void CleanUp();
-
-    void DeletePendingObjects();
+    virtual bool Initialize(int argc, wxChar **argv);
+    virtual void CleanUp();
 
     virtual bool Yield(bool onlyIfNeeded = FALSE);
 
index 1e24fb47ceba33b2c72cd930ba6793ca1b563a9b..8f8b632ba82f3bcf57d1cab6ddcef49a66da23c7 100644 (file)
@@ -82,10 +82,8 @@ protected:
     
 public:
     // Implementation
-    static bool Initialize();
-    static void CleanUp();
-    
-    void DeletePendingObjects();
+    virtual bool Initialize(int argc, wxChar **argv);
+    virtual void CleanUp();
     
     // Motif-specific
     WXAppContext   GetAppContext() const { return m_appContext; }
index 8f384d947b70fa00f83c088933c39356f6915648..756430f73c2ab452e8a650673d69fc8a8d676fbd 100644 (file)
@@ -36,6 +36,9 @@ public:
     virtual ~wxApp();
 
     // override base class (pure) virtuals
+    virtual bool Initialize(int argc, wxChar **argv);
+    virtual void CleanUp();
+
     virtual int MainLoop();
     virtual void ExitMainLoop();
     virtual bool Initialized();
@@ -62,28 +65,17 @@ public:
     // Returns TRUE if more idle time is requested.
     bool SendIdleEvents(wxWindow* win);
 
-    void SetAuto3D(bool flag) { m_auto3D = flag; }
-    bool GetAuto3D() const { return m_auto3D; }
-
 protected:
-    bool   m_showOnInit;
     int    m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
-    bool   m_auto3D ;   // Always use 3D controls, except where overriden
 
     /* Windows-specific wxApp definitions */
 
 public:
 
     // Implementation
-    static bool Initialize();
-    static void CleanUp();
-
     static bool RegisterWindowClasses();
     static bool UnregisterWindowClasses();
 
-    // Convert Windows to argc, argv style
-    void ConvertToStandardCommandArgs(const char* p);
-
     // message processing
     // ------------------
 
@@ -99,8 +91,6 @@ public:
     // idle processing
     // ---------------
 
-    void DeletePendingObjects();
-
 #if wxUSE_RICHEDIT
     // initialize the richedit DLL of (at least) given version, return TRUE if
     // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3)
@@ -112,21 +102,19 @@ public:
     static int GetComCtl32Version();
 
 public:
-    int               m_nCmdShow;
+    // the SW_XXX value to be used for the frames opened by the application
+    // (currently seems unused which is a bug -- TODO)
+    static int m_nCmdShow;
 
 protected:
-    bool              m_keepGoing;
+    // we exit the main event loop when this flag becomes false
+    bool m_keepGoing;
 
     DECLARE_EVENT_TABLE()
 };
 
-#if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL))
 int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance,
-                        char *lpszCmdLine, int nCmdShow, bool enterLoop = TRUE);
-#else
-int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance);
-#endif
+                        char *lpszCmdLine, int nCmdShow);
 
-#endif
-    // _WX_APP_H_
+#endif // _WX_APP_H_
 
index db41f62a49ddd93140a18bc26f8dc8bd6f288f0f..915e1a12678053a276a9db218db77b9ed698e1e1 100644 (file)
@@ -126,14 +126,13 @@ private:
 public:
 
     // Implementation
-    static bool  Initialize(HAB vHab);
-    static void  CleanUp(void);
+    virtual bool  Initialize(int argc, wxChar **argv);
+    virtual void  CleanUp(void);
 
     static bool  RegisterWindowClasses(HAB vHab);
     virtual void DoMessage(WXMSG *pMsg);
     virtual bool DoMessage(void);
     virtual bool ProcessMessage(WXMSG* pMsg);
-    void         DeletePendingObjects(void);
 
 public:
     int                             m_nCmdShow;
index 20e3dfb2b506c9a8a65cab2a4dabac99ecd232e5..d8d709a77a6975db3e16595e1be00ab07f5a6e5c 100644 (file)
@@ -89,8 +89,8 @@ protected:
     
 public:
     // Implementation
-    static bool Initialize();
-    static void CleanUp();
+    virtual bool Initialize();
+    virtual void CleanUp();
     
     void DeletePendingObjects();
     
index d25e9d3230b0794f4142de624c50533df98be4f6..8532a12f941933b42343f14907fd109d22438faa 100644 (file)
@@ -231,84 +231,23 @@ END_EVENT_TABLE()
 // ----------------------------------------------------------------------------
 // wxApp static functions
 // ----------------------------------------------------------------------------
-/*static*/ bool wxApp::Initialize()
+
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
+    // VZ: apparently this needs to be done a.s.a.p., right? it is done after
+    //     wxClassInfo::InitializeClasses() now but usd to be done before, I
+    //     hope it's not a problem -- if it is, please let me know, David (if
+    //     it isn't, just remove this comment :-)
     wxPoseAsInitializer::InitializePosers();
-    wxClassInfo::InitializeClasses();
-
-#if wxUSE_THREADS
-    wxPendingEventsLocker = new wxCriticalSection;
-#endif
 
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-#if wxUSE_WX_RESOURCES
-    wxInitializeResourceSystem();
-#endif
-
-    wxBitmap::InitStandardHandlers();
-
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules()) {
-        return FALSE;
-    }
-    return TRUE;
+    return wxAppBase::Initialize(argc, argv);
 }
 
-/*static*/ void wxApp::CleanUp()
+void wxApp::CleanUp()
 {
-    wxModule::CleanUpModules();
-
-#if wxUSE_WX_RESOURCES
-    wxCleanUpResourceSystem();
-#endif
-
-    wxDeleteStockObjects() ;
-
-    // Destroy all GDI lists, etc.
-    wxDeleteStockLists();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = NULL;
-
-    wxBitmap::CleanUpHandlers();
-
-    delete wxPendingEvents;
-
-#if wxUSE_THREADS
-    delete wxPendingEventsLocker;
-    // If we don't do the following, we get an apparent memory leak.
-    ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
-#endif
-
-    wxClassInfo::CleanUpClasses();
-
-    delete wxTheApp;
-    wxTheApp = NULL;
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_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.
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks."));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-    //  wxDebugContext::SetStream(NULL, NULL);
-#endif
-
     wxDC::CocoaShutdownTextSystem();
-#if wxUSE_LOG
-    // do it as the very last thing because everything else can log messages
-    delete wxLog::SetActiveTarget(NULL);
-#endif // wxUSE_LOG
+
+    wxAppBase::CleanUp();
 }
 
 // ----------------------------------------------------------------------------
@@ -521,21 +460,3 @@ bool wxApp::Yield(bool onlyIfNeeded)
     return true;
 }
 
-void wxApp::DeletePendingObjects()
-{
-    wxNode *node = wxPendingDelete.GetFirst();
-    while (node)
-    {
-        wxObject *obj = (wxObject *)node->GetData();
-
-        delete obj;
-
-        if (wxPendingDelete.Find(obj))
-            delete node;
-
-        node = wxPendingDelete.GetFirst();
-    }
-}
-
-// platform specifics
-
index 271e3cd7e584cba012dd631213d2ff8f01114893..99708fd85e0f7fdd4aaaee8cadfa79d56cfa14a2 100644 (file)
@@ -36,6 +36,9 @@
 #include "wx/apptrait.h"
 #include "wx/cmdline.h"
 #include "wx/confbase.h"
+#if wxUSE_FILENAME
+    #include "wx/filename.h"
+#endif // wxUSE_FILENAME
 #if wxUSE_FONTMAP
     #include "wx/fontmap.h"
 #endif // wxUSE_FONTMAP
@@ -114,6 +117,33 @@ wxAppConsole::~wxAppConsole()
     delete m_traits;
 }
 
+// ----------------------------------------------------------------------------
+// initilization/cleanup
+// ----------------------------------------------------------------------------
+
+bool wxAppConsole::Initialize(int argc, wxChar **argv)
+{
+    // remember the command line arguments
+    this->argc = argc;
+    this->argv = argv;
+
+    if ( m_appName.empty() )
+    {
+        // the application name is, by default, the name of its executable file
+#if wxUSE_FILENAME
+        wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL);
+#else // !wxUSE_FILENAME
+        m_appName = argv[0];
+#endif // wxUSE_FILENAME/!wxUSE_FILENAME
+    }
+
+    return true;
+}
+
+void wxAppConsole::CleanUp()
+{
+}
+
 // ----------------------------------------------------------------------------
 // OnXXX() callbacks
 // ----------------------------------------------------------------------------
index b17928422393ea1621d49ed2064a63a06943f57c..21466c15ecceef29315124ec0677085a9c25b631 100644 (file)
@@ -49,7 +49,7 @@
 // ============================================================================
 
 // ----------------------------------------------------------------------------
-// initialization and termination
+// initialization
 // ----------------------------------------------------------------------------
 
 wxAppBase::wxAppBase()
@@ -73,11 +73,75 @@ wxAppBase::wxAppBase()
     m_exitOnFrameDelete = Later;
 }
 
+bool wxAppBase::Initialize(int argc, wxChar **argv)
+{
+    if ( !wxAppConsole::Initialize(argc, argv) )
+        return false;
+
+    // for compatibility call the old initialization function too
+    if ( !OnInitGui() )
+    {
+        wxAppConsole::CleanUp();
+
+        return false;
+    }
+
+#if wxUSE_THREADS
+    wxPendingEventsLocker = new wxCriticalSection;
+#endif
+
+    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
+    wxTheColourDatabase->Initialize();
+
+    wxInitializeStockLists();
+    wxInitializeStockObjects();
+
+    wxBitmap::InitStandardHandlers();
+
+    return true;
+}
+
+// ----------------------------------------------------------------------------
+// cleanup
+// ----------------------------------------------------------------------------
+
 wxAppBase::~wxAppBase()
 {
     // this destructor is required for Darwin
 }
 
+void wxAppBase::CleanUp()
+{
+    // one last chance for pending objects to be cleaned up
+    DeletePendingObjects();
+
+    wxBitmap::CleanUpHandlers();
+
+    wxDeleteStockObjects();
+
+    wxDeleteStockLists();
+
+    delete wxTheColourDatabase;
+    wxTheColourDatabase = NULL;
+
+#if wxUSE_THREADS
+    delete wxPendingEvents;
+    wxPendingEvents = NULL;
+
+    delete wxPendingEventsLocker;
+    wxPendingEventsLocker = NULL;
+
+#if wxUSE_VALIDATORS
+    // If we don't do the following, we get an apparent memory leak.
+    ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
+#endif // wxUSE_VALIDATORS
+#endif // wxUSE_THREADS
+}
+
+// ----------------------------------------------------------------------------
+// OnXXX() hooks
+// ----------------------------------------------------------------------------
+
 bool wxAppBase::OnInitGui()
 {
 #ifdef __WXUNIVERSAL__
@@ -128,6 +192,24 @@ void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus))
     (void)ProcessEvent(event);
 }
 
+void wxAppBase::DeletePendingObjects()
+{
+    wxNode *node = wxPendingDelete.GetFirst();
+    while (node)
+    {
+        wxObject *obj = node->GetData();
+
+        delete obj;
+
+        if (wxPendingDelete.Member(obj))
+            delete node;
+
+        // Deleting one object may have deleted other pending
+        // objects, so start from beginning of list again.
+        node = wxPendingDelete.GetFirst();
+    }
+}
+
 // ----------------------------------------------------------------------------
 // wxGUIAppTraitsBase
 // ----------------------------------------------------------------------------
index d6b020b2ab52688bf6e9c62db7683f075ba38f2b..a1013b5bde1dc6d87f02590ffecd8dd526ebcb44 100644 (file)
 
 #if wxUSE_FILESYSTEM && wxUSE_STREAMS
 
-#include "wx/image.h"
-#include "wx/bitmap.h"
 #include "wx/fs_mem.h"
 
+#if wxUSE_GUI
+    #include "wx/image.h"
+    #include "wx/bitmap.h"
+#endif // wxUSE_GUI
 
 #ifndef WXPRECOMP
     #include "wx/intl.h"
index b3cd9aa66df9f2d0b3c8a681d90d283a394457d3..e696eacb12421a36b85b3fc96e3e1e828689fd74 100644 (file)
     #include "wx/debug.h"
     #include "wx/filefn.h"
     #include "wx/log.h"
+    #include "wx/thread.h"
 #endif
 
+#include "wx/ptr_scpd.h"
 #include "wx/module.h"
 
+#if defined(__WXMSW__) && defined(__WXDEBUG__)
+    #include "wx/msw/msvcrt.h"
+
+    static struct EnableMemLeakChecking
+    {
+        EnableMemLeakChecking()
+        {
+            // do check for memory leaks on program exit (another useful flag
+            // is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free deallocated
+            // memory which may be used to simulate low-memory condition)
+            wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
+        }
+    } gs_enableLeakChecks;
+#endif // __WXMSW__ && __WXDEBUG__
+
 // ----------------------------------------------------------------------------
 // private classes
 // ----------------------------------------------------------------------------
 
 // we need a dummy app object if the user doesn't want to create a real one
-class wxDummyConsoleApp : public wxApp
+class wxDummyConsoleApp : public wxAppConsole
 {
 public:
     virtual int OnRun() { wxFAIL_MSG( _T("unreachable code") ); return 0; }
 };
 
-// ----------------------------------------------------------------------------
-// private functions
-// ----------------------------------------------------------------------------
+// we need a special kind of auto pointer to wxApp which not only deletes the
+// pointer it holds in its dtor but also resets wxTheApp
+wxDECLARE_SCOPED_PTR(wxApp, wxAppPtrBase);
+wxDEFINE_SCOPED_PTR(wxApp, wxAppPtrBase);
 
-static bool DoInit();
-static void DoCleanUp();
+class wxAppPtr : public wxAppPtrBase
+{
+public:
+    wxEXPLICIT wxAppPtr(wxApp *ptr = NULL) : wxAppPtrBase(ptr) { }
+    ~wxAppPtr()
+    {
+        if ( get() )
+        {
+            // the pointer is going to be deleted in the base class dtor, don't
+            // leave the dangling pointer!
+            wxTheApp = NULL;
+        }
+    }
+
+    void Set(wxApp *ptr)
+    {
+        reset(ptr);
+
+        wxTheApp = ptr;
+    }
+};
+
+// another tiny class which simply exists to ensure that wxEntryCleanup is
+// always called
+class wxCleanupOnExit
+{
+public:
+    ~wxCleanupOnExit() { wxEntryCleanup(); }
+};
 
 // ----------------------------------------------------------------------------
-// private vars
+// initialization data
 // ----------------------------------------------------------------------------
 
-static size_t gs_nInitCount = 0;
+static struct InitData
+{
+    InitData()
+    {
+        nInitCount = 0;
+
+#if wxUSE_UNICODE
+        argc = 0;
+        // argv = NULL; -- not even really needed
+#endif // wxUSE_UNICODE
+    }
+
+    // critical section protecting this struct
+    wxCRIT_SECT_DECLARE_MEMBER(csInit);
+
+    // number of times wxInitialize() was called minus the number of times
+    // wxUninitialize() was
+    size_t nInitCount;
+
+#if wxUSE_UNICODE
+    int argc;
+
+    // if we receive the command line arguments as ASCII and have to convert
+    // them to Unicode ourselves (this is the case under Unix but not Windows,
+    // for example), we remember the converted argv here because we'll have to
+    // free it when doing cleanup to avoid memory leaks
+    wchar_t *argv;
+#endif // wxUSE_UNICODE
+} gs_initData;
 
 // ============================================================================
 // implementation
 // ============================================================================
 
 // ----------------------------------------------------------------------------
-// wxBase-specific functions
+// command line arguments ANSI -> Unicode conversion
 // ----------------------------------------------------------------------------
 
-bool WXDLLEXPORT wxInitialize()
+#if wxUSE_UNICODE
+
+static void ConvertArgsToUnicode(int argc, char **argv)
 {
-    if ( gs_nInitCount )
+    gs_initData.argv = new wchar_t *[argc + 1];
+    for ( int i = 0; i < argc; i++ )
     {
-        // already initialized
-        return TRUE;
+        gs_initData.argv[i] = wxStrdup(wxConvLocal.cMB2WX(argv[i]));
     }
 
-    wxASSERT_MSG( !wxTheApp,
-                  wxT("either call wxInitialize or create app, not both!") );
+    gs_initData.argv[argc] = NULL;
+}
 
-    if ( !DoInit() )
+static void FreeConvertedArgs()
+{
+    for ( int mb_argc = 0; mb_argc < wxTheApp->argc; mb_argc++ )
     {
-        return FALSE;
+        free(wxTheApp->argv[mb_argc]);
     }
+}
 
-    wxTheApp = new wxDummyConsoleApp;
+#endif // wxUSE_UNICODE
 
-    if ( !wxTheApp )
-    {
-        return FALSE;
-    }
+// ----------------------------------------------------------------------------
+// start up
+// ----------------------------------------------------------------------------
 
-    gs_nInitCount++;
+// initialization which is always done (not customizable) before wxApp creation
+static bool DoCommonPreInit()
+{
+    wxClassInfo::InitializeClasses();
 
-    return TRUE;
+    return true;
 }
 
-void WXDLLEXPORT wxUninitialize()
+// non customizable initialization done after wxApp creation and initialization
+static bool DoCommonPostInit()
 {
-    if ( !--gs_nInitCount )
-    {
-        DoCleanUp();
-    }
+    wxModule::RegisterModules();
+
+    return wxModule::InitializeModules();
 }
 
-int wxEntry(int argc, char **argv)
+bool wxEntryStart(int argc, wxChar **argv)
 {
-    // library initialization
-    if ( !DoInit() )
+    // do minimal, always necessary, initialization
+    // --------------------------------------------
+
+    // initialize wxRTTI
+    if ( !DoCommonPreInit() )
     {
-        return -1;
+        return false;
     }
 
-    // create the app
-    if ( !wxTheApp )
-    {
-        wxCHECK_MSG( wxApp::GetInitializerFunction(), -1,
-                wxT("No application object: use IMPLEMENT_APP macro.") );
 
+    // first of all, we need an application object
+    // -------------------------------------------
+
+    // the user might have already created it himself somehow
+    wxAppPtr app(wxTheApp);
+    if ( !app.get() )
+    {
+        // if not, he might have used IMPLEMENT_APP() to give us a function to
+        // create it
         wxAppInitializerFunction fnCreate = wxApp::GetInitializerFunction();
 
-        wxTheApp = (wxApp *)fnCreate();
+        if ( fnCreate )
+        {
+            // he did, try to create the custom wxApp object
+            app.Set((*fnCreate)());
+        }
+    }
+
+    if ( !app.get() )
+    {
+        // either IMPLEMENT_APP() was not used at all or it failed -- in any
+        // case we still need something
+        //
+        // NB: cast is needed because for the backwards-compatibility reasons
+        //     wxTheApp is really a wxApp and not just wxAppConsole...
+        app.Set((wxApp *)new wxDummyConsoleApp);
     }
 
-    wxCHECK_MSG( wxTheApp, -1, wxT("wxWindows error: no application object") );
 
-    // app preinitialization
-    wxTheApp->argc = argc;
+    // wxApp initialization: this can be customized
+    // --------------------------------------------
 
-#if wxUSE_UNICODE
-    wxTheApp->argv = new wxChar*[argc+1];
-    for ( int mb_argc = 0; mb_argc < argc; mb_argc++ )
+    if ( !wxTheApp->Initialize(argc, argv) )
     {
-        wxTheApp->argv[mb_argc] = wxStrdup(wxConvLocal.cMB2WX(argv[mb_argc]));
+        return false;
     }
-    wxTheApp->argv[mb_argc] = (wxChar *)NULL;
-#else
-    wxTheApp->argv = argv;
-#endif
 
-    wxString name = wxFileNameFromPath(wxTheApp->argv[0]);
-    wxStripExtension(name);
-    wxTheApp->SetAppName(name);
 
-    int retValue = 0;
-
-    // app initialization
-    if ( !wxTheApp->OnInit() )
-        retValue = -1;
+    // common initialization after wxTheApp creation
+    // ---------------------------------------------
 
-    // app execution
-    if ( retValue == 0 )
+    if ( !DoCommonPostInit() )
     {
-        retValue = wxTheApp->OnRun();
-
-        // app clean up
-        wxTheApp->OnExit();
+        return false;
     }
 
-    // library clean up
-    DoCleanUp();
 
-    return retValue;
+    // prevent the smart pointer from destroying its contents
+    app.release();
+
+    return true;
 }
 
-// ----------------------------------------------------------------------------
-// private functions
-// ----------------------------------------------------------------------------
+#if wxUSE_UNICODE
 
-static bool DoInit()
+// we provide a wxEntryStart() wrapper taking "char *" pointer too
+bool wxEntryStart(int argc, char **argv)
 {
-    wxClassInfo::InitializeClasses();
+    ConvertArgsToUnicode(argc, argv);
 
-    wxModule::RegisterModules();
-    if ( !wxModule::InitializeModules() )
+    if ( !wxEntryStart(argc, gs_initData.argv) )
     {
-        return FALSE;
+        FreeConvertedArgs();
+
+        return false;
     }
 
-    return TRUE;
+    return true;
 }
 
-static void DoCleanUp()
+#endif // wxUSE_UNICODE
+
+// ----------------------------------------------------------------------------
+// clean up
+// ----------------------------------------------------------------------------
+
+// cleanup done before destroying wxTheApp 
+static void DoCommonPreCleanup()
 {
 #if wxUSE_LOG
-    // flush the logged messages if any
-    wxLog *log = wxLog::GetActiveTarget();
-    if (log != NULL && log->HasPendingMessages())
-        log->Flush();
-
-    // continuing to use user defined log target is unsafe from now on because
-    // some resources may be already unavailable, so replace it by something
-    // more safe
+    // flush the logged messages if any and install a 'safer' log target: the
+    // default one (wxLogGui) can't be used after the resources are freed just
+    // below and the user supplied one might be even more unsafe (using any
+    // wxWindows GUI function is unsafe starting from now)
     wxLog::DontCreateOnDemand();
+
+    // this will flush the old messages if any
     delete wxLog::SetActiveTarget(new wxLogStderr);
 #endif // wxUSE_LOG
 
     wxModule::CleanUpModules();
+}
 
+// cleanup done after destroying wxTheApp
+static void DoCommonPostCleanup()
+{
     wxClassInfo::CleanUpClasses();
 
-    // TODO: this should really be done in ~wxApp
+    // we can't do this in wxApp itself because it doesn't know if argv had
+    // been allocated
 #if wxUSE_UNICODE
-    for ( int mb_argc = 0; mb_argc < wxTheApp->argc; mb_argc++ )
-    {
-        free(wxTheApp->argv[mb_argc]);
-    }
+    FreeConvertedArgs();
 #endif // wxUSE_UNICODE
 
-    // delete the application object
-    delete wxTheApp;
-    wxTheApp = (wxApp *)NULL;
-
 #if wxUSE_LOG
     // and now delete the last logger as well
     delete wxLog::SetActiveTarget(NULL);
 #endif // wxUSE_LOG
 }
 
+void wxEntryCleanup()
+{
+    DoCommonPreCleanup();
+
+
+    // delete the application object
+    if ( wxTheApp )
+    {
+        wxTheApp->CleanUp();
+
+        delete wxTheApp;
+        wxTheApp = NULL;
+    }
+
+
+    DoCommonPostCleanup();
+
+    // check for memory leaks
+#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
+    {
+        wxLogDebug(wxT("There were memory leaks.\n"));
+        wxDebugContext::Dump();
+        wxDebugContext::PrintStatistics();
+    }
+#endif // Debug
+
+}
+
+// ----------------------------------------------------------------------------
+// wxEntry
+// ----------------------------------------------------------------------------
+
+#if !defined(__WXMSW__) || !wxUSE_ON_FATAL_EXCEPTION
+    #define wxEntryReal wxEntry
+#endif // !(__WXMSW__ && wxUSE_ON_FATAL_EXCEPTION)
+
+int wxEntryReal(int argc, wxChar **argv)
+{
+    // library initialization
+    if ( !wxEntryStart(argc, argv) )
+    {
+        return -1;
+    }
+
+    // if wxEntryStart succeeded, we must call wxEntryCleanup even if the code
+    // below returns or throws
+    wxCleanupOnExit cleanupOnExit;
+
+    // app initialization
+    if ( !wxTheApp->OnInit() )
+    {
+        // don't call OnExit() if OnInit() failed
+        return -1;
+    }
+
+    // app execution
+    int retValue = wxTheApp->OnRun();
+
+    // why should we do this? it doesn't close all window, just one of them and
+    // this shouldn't be necessary anyhow...
+#if 0
+    // close any remaining windows
+    wxWindow *topWindow = wxTheApp->GetTopWindow();
+    if ( topWindow )
+    {
+        // forcibly delete the window.
+        topWindow->Destroy();
+
+        // collect the dead objects
+        wxTheApp->DeletePendingObjects();
+    }
+#endif // 0
+
+    // app clean up
+    wxTheApp->OnExit();
+
+    return retValue;
+}
+
+// wrap real wxEntry in a try-except block to be able to call
+// OnFatalException() if necessary
+#if defined(__WXMSW__) && wxUSE_ON_FATAL_EXCEPTION
+
+extern unsigned long wxGlobalSEHandler();
+
+int wxEntry(int argc, wxChar **argv)
+{
+    __try
+    {
+        return wxEntryReal(argc, argv);
+    }
+    __except ( wxGlobalSEHandler() )
+    {
+        ::ExitProcess(3); // the same exit code as abort()
+
+        // this code is unreachable but put it here to suppress warnings
+        return -1;
+    }
+}
+
+#endif // __WXMSW__ && wxUSE_ON_FATAL_EXCEPTION
+
+#if wxUSE_UNICODE
+
+// as with wxEntryStart, we provide an ANSI wrapper
+int wxEntry(int argc, char **argv)
+{
+    ConvertArgsToUnicode(argc, argv);
+
+    return wxEntry(argc, gs_initData.argv);
+}
+
+#endif // wxUSE_UNICODE
+
+// ----------------------------------------------------------------------------
+// wxInitialize/wxUninitialize
+// ----------------------------------------------------------------------------
+
+bool wxInitialize(int argc, wxChar **argv)
+{
+    wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);
+
+    if ( gs_initData.nInitCount++ )
+    {
+        // already initialized
+        return true;
+    }
+
+    return wxEntryStart(argc, argv);
+}
+
+void wxUninitialize()
+{
+    wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);
+
+    if ( !--gs_initData.nInitCount )
+    {
+        wxEntryCleanup();
+    }
+}
+
index a7b0428703c90edab79b8ac3a52a40e409df7f98..a062fd79bf70d437ad7b9027e6c0d2463cbf72e3 100644 (file)
@@ -671,91 +671,21 @@ void wxApp::Dispatch()
     gtk_main_iteration();
 }
 
-void wxApp::DeletePendingObjects()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
-    wxNode *node = wxPendingDelete.GetFirst();
-    while (node)
-    {
-        wxObject *obj = (wxObject *)node->GetData();
-
-        delete obj;
-
-        if (wxPendingDelete.Find(obj))
-            delete node;
-
-        node = wxPendingDelete.GetFirst();
-    }
-}
-
-bool wxApp::Initialize()
-{
-    wxClassInfo::InitializeClasses();
-
-    // GL: I'm annoyed ... I don't know where to put this and I don't want to
-    // create a module for that as it's part of the core.
-#if wxUSE_THREADS
-    wxPendingEvents = new wxList();
-    wxPendingEventsLocker = new wxCriticalSection();
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase( wxKEY_STRING );
-    wxTheColourDatabase->Initialize();
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules())
-        return FALSE;
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
 
 #if wxUSE_INTL
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
 
-    return TRUE;
+    return true;
 }
 
 void wxApp::CleanUp()
 {
-    wxModule::CleanUpModules();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = (wxColourDatabase*) NULL;
-
-    wxDeleteStockObjects();
-
-    wxDeleteStockLists();
-
-    delete wxTheApp;
-    wxTheApp = (wxApp*) NULL;
-
-    wxClassInfo::CleanUpClasses();
-
-#if wxUSE_THREADS
-    delete wxPendingEvents;
-    wxPendingEvents = NULL;
-    delete wxPendingEventsLocker;
-    wxPendingEventsLocker = NULL;
-#endif
-
-    // check for memory leaks
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks.\n"));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-#endif // Debug
-
-#if wxUSE_LOG
-    // do this as the very last thing because everything else can log messages
-    wxLog::DontCreateOnDemand();
-
-    wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL );
-    if (oldLog)
-        delete oldLog;
-#endif // wxUSE_LOG
+    wxAppBase::CleanUp();
 }
 
 //-----------------------------------------------------------------------------
index a7b0428703c90edab79b8ac3a52a40e409df7f98..a062fd79bf70d437ad7b9027e6c0d2463cbf72e3 100644 (file)
@@ -671,91 +671,21 @@ void wxApp::Dispatch()
     gtk_main_iteration();
 }
 
-void wxApp::DeletePendingObjects()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
-    wxNode *node = wxPendingDelete.GetFirst();
-    while (node)
-    {
-        wxObject *obj = (wxObject *)node->GetData();
-
-        delete obj;
-
-        if (wxPendingDelete.Find(obj))
-            delete node;
-
-        node = wxPendingDelete.GetFirst();
-    }
-}
-
-bool wxApp::Initialize()
-{
-    wxClassInfo::InitializeClasses();
-
-    // GL: I'm annoyed ... I don't know where to put this and I don't want to
-    // create a module for that as it's part of the core.
-#if wxUSE_THREADS
-    wxPendingEvents = new wxList();
-    wxPendingEventsLocker = new wxCriticalSection();
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase( wxKEY_STRING );
-    wxTheColourDatabase->Initialize();
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules())
-        return FALSE;
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
 
 #if wxUSE_INTL
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
 
-    return TRUE;
+    return true;
 }
 
 void wxApp::CleanUp()
 {
-    wxModule::CleanUpModules();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = (wxColourDatabase*) NULL;
-
-    wxDeleteStockObjects();
-
-    wxDeleteStockLists();
-
-    delete wxTheApp;
-    wxTheApp = (wxApp*) NULL;
-
-    wxClassInfo::CleanUpClasses();
-
-#if wxUSE_THREADS
-    delete wxPendingEvents;
-    wxPendingEvents = NULL;
-    delete wxPendingEventsLocker;
-    wxPendingEventsLocker = NULL;
-#endif
-
-    // check for memory leaks
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks.\n"));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-#endif // Debug
-
-#if wxUSE_LOG
-    // do this as the very last thing because everything else can log messages
-    wxLog::DontCreateOnDemand();
-
-    wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL );
-    if (oldLog)
-        delete oldLog;
-#endif // wxUSE_LOG
+    wxAppBase::CleanUp();
 }
 
 //-----------------------------------------------------------------------------
index 39086ddeb8b5f9272e19be06009de2ea3072bcf2..9c3502089d0985bc5f8b76432ac8b0bb2baae516 100644 (file)
@@ -447,7 +447,7 @@ DEFINE_ONE_SHOT_HANDLER_GETTER( wxAppEventHandler )
 WXIMPORT char std::__throws_bad_alloc ;
 #endif
 
-bool wxApp::Initialize()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
     int error = 0 ;
 
@@ -535,37 +535,17 @@ bool wxApp::Initialize()
 
     s_macCursorRgn = ::NewRgn() ;
 
-    wxClassInfo::InitializeClasses();
-
-#if wxUSE_RESOURCES
-//    wxGetResource(wxT("wxWindows"), wxT("OsVersion"), &wxOsVersion);
-#endif
-
-#if wxUSE_THREADS
-    wxPendingEventsLocker = new wxCriticalSection;
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
 
     wxWinMacWindowList = new wxList(wxKEY_INTEGER);
     wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-    wxBitmap::InitStandardHandlers();
-
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules()) {
-        return FALSE;
-    }
-
     wxMacCreateNotifierTable() ;
 
     UMAShowArrowCursor() ;
 
-    return TRUE;
+    return true;
 }
 
 bool wxApp::OnInitGui()
@@ -615,51 +595,17 @@ bool wxApp::OnInitGui()
 void wxApp::CleanUp()
 {
     wxToolTip::RemoveToolTips() ;
-#if wxUSE_LOG
-    // flush the logged messages if any and install a 'safer' log target: the
-    // default one (wxLogGui) can't be used after the resources are freed just
-    // below and the user suppliedo ne might be even more unsafe (using any
-    // wxWindows GUI function is unsafe starting from now)
-    wxLog::DontCreateOnDemand();
-
-    // this will flush the old messages if any
-    delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif // wxUSE_LOG
 
     // One last chance for pending objects to be cleaned up
     wxTheApp->DeletePendingObjects();
 
-    wxModule::CleanUpModules();
-
-    wxDeleteStockObjects() ;
-
-    // Destroy all GDI lists, etc.
-    wxDeleteStockLists();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = NULL;
-
-    wxBitmap::CleanUpHandlers();
-
     wxMacDestroyNotifierTable() ;
-    if (wxWinMacWindowList) {
-        delete wxWinMacWindowList ;
-    }
-    if (wxWinMacControlList) {
-        delete wxWinMacControlList ;
-    }
-    delete wxPendingEvents;
-    wxPendingEvents = NULL;
 
-#if wxUSE_THREADS
-    delete wxPendingEventsLocker;
-    // There is still more cleanup code that will try to use this if not NULL.
-    wxPendingEventsLocker = NULL;
-    // If we don't do the following, we get an apparent memory leak.
-    ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
-#endif
+    delete wxWinMacWindowList ;
+    wxWinMacWindowList = NULL;
 
-    wxClassInfo::CleanUpClasses();
+    delete wxWinMacControlList ;
+    wxWinMacControlList = NULL;
 
 #ifndef __DARWIN__
 #  if __option(profile)
@@ -668,28 +614,6 @@ void wxApp::CleanUp()
 #  endif
 #endif
 
-    delete wxTheApp;
-    wxTheApp = NULL;
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_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.
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks."));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-    //  wxDebugContext::SetStream(NULL, NULL);
-#endif
-
-#if wxUSE_LOG
-    // do it as the very last thing because everything else can log messages
-    delete wxLog::SetActiveTarget(NULL);
-#endif // wxUSE_LOG
-
 #if defined(WXMAKINGDLL) && defined(__DARWIN__)
     // close shared library resources from here since we don't have
     //   __wxterminate in Mach-O shared libraries
@@ -705,6 +629,8 @@ void wxApp::CleanUp()
     #if 0
         TerminateAE() ;
     #endif
+
+    wxAppBase::CleanUp();
 }
 
 //----------------------------------------------------------------------
@@ -1266,24 +1192,6 @@ bool wxApp::SendIdleEvents(wxWindow* win)
     return needMore ;
 }
 
-void wxApp::DeletePendingObjects()
-{
-  wxNode *node = wxPendingDelete.GetFirst();
-  while (node)
-  {
-    wxObject *obj = (wxObject *)node->GetData();
-
-    delete obj;
-
-    if (wxPendingDelete.Member(obj))
-      delete node;
-
-    // Deleting one object may have deleted other pending
-    // objects, so start from beginning of list again.
-    node = wxPendingDelete.GetFirst();
-  }
-}
-
 void wxApp::Exit()
 {
     wxApp::CleanUp();
index 39086ddeb8b5f9272e19be06009de2ea3072bcf2..9c3502089d0985bc5f8b76432ac8b0bb2baae516 100644 (file)
@@ -447,7 +447,7 @@ DEFINE_ONE_SHOT_HANDLER_GETTER( wxAppEventHandler )
 WXIMPORT char std::__throws_bad_alloc ;
 #endif
 
-bool wxApp::Initialize()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
     int error = 0 ;
 
@@ -535,37 +535,17 @@ bool wxApp::Initialize()
 
     s_macCursorRgn = ::NewRgn() ;
 
-    wxClassInfo::InitializeClasses();
-
-#if wxUSE_RESOURCES
-//    wxGetResource(wxT("wxWindows"), wxT("OsVersion"), &wxOsVersion);
-#endif
-
-#if wxUSE_THREADS
-    wxPendingEventsLocker = new wxCriticalSection;
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
 
     wxWinMacWindowList = new wxList(wxKEY_INTEGER);
     wxWinMacControlList = new wxList(wxKEY_INTEGER);
 
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-    wxBitmap::InitStandardHandlers();
-
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules()) {
-        return FALSE;
-    }
-
     wxMacCreateNotifierTable() ;
 
     UMAShowArrowCursor() ;
 
-    return TRUE;
+    return true;
 }
 
 bool wxApp::OnInitGui()
@@ -615,51 +595,17 @@ bool wxApp::OnInitGui()
 void wxApp::CleanUp()
 {
     wxToolTip::RemoveToolTips() ;
-#if wxUSE_LOG
-    // flush the logged messages if any and install a 'safer' log target: the
-    // default one (wxLogGui) can't be used after the resources are freed just
-    // below and the user suppliedo ne might be even more unsafe (using any
-    // wxWindows GUI function is unsafe starting from now)
-    wxLog::DontCreateOnDemand();
-
-    // this will flush the old messages if any
-    delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif // wxUSE_LOG
 
     // One last chance for pending objects to be cleaned up
     wxTheApp->DeletePendingObjects();
 
-    wxModule::CleanUpModules();
-
-    wxDeleteStockObjects() ;
-
-    // Destroy all GDI lists, etc.
-    wxDeleteStockLists();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = NULL;
-
-    wxBitmap::CleanUpHandlers();
-
     wxMacDestroyNotifierTable() ;
-    if (wxWinMacWindowList) {
-        delete wxWinMacWindowList ;
-    }
-    if (wxWinMacControlList) {
-        delete wxWinMacControlList ;
-    }
-    delete wxPendingEvents;
-    wxPendingEvents = NULL;
 
-#if wxUSE_THREADS
-    delete wxPendingEventsLocker;
-    // There is still more cleanup code that will try to use this if not NULL.
-    wxPendingEventsLocker = NULL;
-    // If we don't do the following, we get an apparent memory leak.
-    ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
-#endif
+    delete wxWinMacWindowList ;
+    wxWinMacWindowList = NULL;
 
-    wxClassInfo::CleanUpClasses();
+    delete wxWinMacControlList ;
+    wxWinMacControlList = NULL;
 
 #ifndef __DARWIN__
 #  if __option(profile)
@@ -668,28 +614,6 @@ void wxApp::CleanUp()
 #  endif
 #endif
 
-    delete wxTheApp;
-    wxTheApp = NULL;
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_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.
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks."));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-    //  wxDebugContext::SetStream(NULL, NULL);
-#endif
-
-#if wxUSE_LOG
-    // do it as the very last thing because everything else can log messages
-    delete wxLog::SetActiveTarget(NULL);
-#endif // wxUSE_LOG
-
 #if defined(WXMAKINGDLL) && defined(__DARWIN__)
     // close shared library resources from here since we don't have
     //   __wxterminate in Mach-O shared libraries
@@ -705,6 +629,8 @@ void wxApp::CleanUp()
     #if 0
         TerminateAE() ;
     #endif
+
+    wxAppBase::CleanUp();
 }
 
 //----------------------------------------------------------------------
@@ -1266,24 +1192,6 @@ bool wxApp::SendIdleEvents(wxWindow* win)
     return needMore ;
 }
 
-void wxApp::DeletePendingObjects()
-{
-  wxNode *node = wxPendingDelete.GetFirst();
-  while (node)
-  {
-    wxObject *obj = (wxObject *)node->GetData();
-
-    delete obj;
-
-    if (wxPendingDelete.Member(obj))
-      delete node;
-
-    // Deleting one object may have deleted other pending
-    // objects, so start from beginning of list again.
-    node = wxPendingDelete.GetFirst();
-  }
-}
-
 void wxApp::Exit()
 {
     wxApp::CleanUp();
index 1927ed786983a1e473d7a397d026d4422cbd7665..f21c6a862a3fdccc7c330aa85ca00650dcd47895 100644 (file)
@@ -383,119 +383,41 @@ void wxApp::Dispatch()
     wxEventLoop::GetActive()->Dispatch();
 }
 
-void wxApp::DeletePendingObjects()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
-    wxNode *node = wxPendingDelete.First();
-    while (node)
-    {
-        wxObject *obj = (wxObject *)node->Data();
-
-        delete obj;
+    // must do it before calling wxAppBase::Initialize(), because fonts are
+    // needed by stock lists which are created there
+    wxTheFontsManager = new wxFontsManager;
 
-        if ( wxPendingDelete.Find(obj) )
-            delete node;
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
 
-        node = wxPendingDelete.First();
-    }
-}
-
-bool wxApp::Initialize()
-{
     if ( MGL_init(".", NULL) == 0 )
     {
         wxLogError(_("Cannot initialize SciTech MGL!"));
-        return FALSE;
-    }
 
-    wxClassInfo::InitializeClasses();
+        wxAppBase::CleanUp();
+
+        return false;
+    }
 
 #if wxUSE_INTL
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
 
-    // GL: I'm annoyed ... I don't know where to put this and I don't want to
-    // create a module for that as it's part of the core.
-#if wxUSE_THREADS
-    wxPendingEvents = new wxList;
-    wxPendingEventsLocker = new wxCriticalSection;
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
-
-    // Can't do this in wxModule, because fonts are needed by stock lists
-    wxTheFontsManager = new wxFontsManager;
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules()) return FALSE;
-
-    return TRUE;
+    return true;
 }
 
 void wxApp::CleanUp()
 {
-#if wxUSE_LOG
-    // continuing to use user defined log target is unsafe from now on because
-    // some resources may be already unavailable, so replace it by something
-    // more safe
-    wxLog *oldlog = wxLog::SetActiveTarget(new wxLogStderr);
-    if ( oldlog )
-        delete oldlog;
-#endif // wxUSE_LOG
-
     delete gs_rootWindow;
 
-    wxModule::CleanUpModules();
-
-    if (wxTheColourDatabase)
-        delete wxTheColourDatabase;
-
-    wxTheColourDatabase = (wxColourDatabase*) NULL;
-
-    wxDeleteStockObjects();
-    wxDeleteStockLists();
-
-    delete wxTheApp;
-    wxTheApp = (wxApp*) NULL;
-
-
-    // GL: I'm annoyed ... I don't know where to put this and I don't want to
-    // create a module for that as it's part of the core.
-#if wxUSE_THREADS
-    delete wxPendingEvents;
-    delete wxPendingEventsLocker;
-#endif
-
-    wxClassInfo::CleanUpClasses();
+    wxAppBase::CleanUp();
 
-    // Can't do this in wxModule, because fonts are needed by stock lists
-    // (do it after deleting wxTheApp and cleaning modules up, since somebody
-    // may be deleting fonts that lately)
+    // must do this after calling base class CleanUp()
     delete wxTheFontsManager;
     wxTheFontsManager = (wxFontsManager*) NULL;
 
-    // check for memory leaks
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks.\n"));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-#endif // Debug
-
-#if wxUSE_LOG
-    // do this as the very last thing because everything else can log messages
-    wxLog::DontCreateOnDemand();
-
-    wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL );
-    if (oldLog)
-        delete oldLog;
-#endif // wxUSE_LOG
-
     wxDestroyMGL_WM();
     MGL_exit();
 }
index d7a0f97dbbe8400b75b485457604cd173f6b395a..a2e569037cffca52c77e7560f2690e0542cc46bb 100644 (file)
@@ -86,77 +86,22 @@ END_EVENT_TABLE()
     }
 #endif // __WXDEBUG__
 
-bool wxApp::Initialize()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
-    wxClassInfo::InitializeClasses();
-
-    // GL: I'm annoyed ... I don't know where to put this and I don't want to
-    // create a module for that as it's part of the core.
-#if wxUSE_THREADS
-    wxPendingEventsLocker = new wxCriticalSection();
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
 
     wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
 
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules()) return FALSE;
-
-    return TRUE;
+    return true;
 }
 
 void wxApp::CleanUp()
 {
-    wxModule::CleanUpModules();
-
-    wxDeleteStockObjects() ;
-
-    // Destroy all GDI lists, etc.
-
-    wxDeleteStockLists();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = NULL;
-
-    wxClassInfo::CleanUpClasses();
-
-    delete wxTheApp;
-    wxTheApp = NULL;
-
     delete wxWidgetHashTable;
     wxWidgetHashTable = NULL;
 
-    // GL: I'm annoyed ... I don't know where to put this and I don't want to
-    // create a module for that as it's part of the core.
-#if wxUSE_THREADS
-    delete wxPendingEvents;
-    wxPendingEvents = NULL;
-    delete wxPendingEventsLocker;
-    wxPendingEventsLocker = NULL;
-#endif
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_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.
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug("There were memory leaks.\n");
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-#endif
-
-    // do it as the very last thing because everything else can log messages
-    wxLog::DontCreateOnDemand();
-    // do it as the very last thing because everything else can log messages
-    delete wxLog::SetActiveTarget(NULL);
+    wxAppBase::CleanUp();
 }
 
 void wxApp::Exit()
@@ -447,24 +392,6 @@ bool wxApp::SendIdleEvents(wxWindow* win)
     return needMore ;
 }
 
-void wxApp::DeletePendingObjects()
-{
-    wxList::Node *node = wxPendingDelete.GetFirst();
-    while (node)
-    {
-        wxObject *obj = node->GetData();
-
-        delete obj;
-
-        if (wxPendingDelete.Member(obj))
-            delete node;
-
-        // Deleting one object may have deleted other pending
-        // objects, so start from beginning of list again.
-        node = wxPendingDelete.GetFirst();
-    }
-}
-
 static char *fallbackResources[] = {
     "*menuBar.marginHeight: 0",
     "*menuBar.shadowThickness: 1",
index 1b2e4f96baa9477b9c66afc60201dbc190dd4414..d0adf0525b0ae806dbdb1242ad3c188468046a93 100644 (file)
@@ -49,7 +49,6 @@
 #endif
 
 #include "wx/apptrait.h"
-#include "wx/cmdline.h"
 #include "wx/filename.h"
 #include "wx/module.h"
 
     #include <commctrl.h>
 #endif
 
-#ifndef __WXMICROWIN__
-#include "wx/msw/msvcrt.h"
-#endif
-
 // ----------------------------------------------------------------------------
 // conditional compilation
 // ----------------------------------------------------------------------------
@@ -141,31 +136,13 @@ const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR");
 const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass");
 const wxChar *wxMDIChildFrameClassNameNoRedraw = wxT("wxMDIChildFrameClassNR");
 
-HICON wxSTD_FRAME_ICON = (HICON) NULL;
-HICON wxSTD_MDICHILDFRAME_ICON = (HICON) NULL;
-HICON wxSTD_MDIPARENTFRAME_ICON = (HICON) NULL;
-
-HICON wxDEFAULT_FRAME_ICON = (HICON) NULL;
-HICON wxDEFAULT_MDICHILDFRAME_ICON = (HICON) NULL;
-HICON wxDEFAULT_MDIPARENTFRAME_ICON = (HICON) NULL;
-
 HBRUSH wxDisableButtonBrush = (HBRUSH) 0;
 
-LRESULT WXDLLEXPORT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
+// ----------------------------------------------------------------------------
+// private functions
+// ----------------------------------------------------------------------------
 
-// FIXME wxUSE_ON_FATAL_EXCEPTION is only supported for VC++ now because it
-//       needs compiler support for Win32 SEH. Others (especially Borland)
-//       probably have it too, but I'm not sure about how it works
-// JACS: get 'Cannot use __try in functions that require unwinding
-// in Unicode mode, so disabling.
-#if !defined(__VISUALC__) || defined(__WIN16__) || defined(UNICODE)
-    #undef wxUSE_ON_FATAL_EXCEPTION
-    #define wxUSE_ON_FATAL_EXCEPTION 0
-#endif // VC++
-
-#if wxUSE_ON_FATAL_EXCEPTION
-    static bool gs_handleExceptions = FALSE;
-#endif
+LRESULT WXDLLEXPORT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
 
 // ===========================================================================
 // wxGUIAppTraits implementation
@@ -252,6 +229,8 @@ bool wxGUIAppTraits::DoMessageFromThreadWait()
 // wxApp implementation
 // ===========================================================================
 
+int wxApp::m_nCmdShow = SW_SHOWNORMAL;
+
 // ---------------------------------------------------------------------------
 // wxWin macros
 // ---------------------------------------------------------------------------
@@ -264,9 +243,29 @@ BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
     EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
 END_EVENT_TABLE()
 
+// class to ensure that wxAppBase::CleanUp() is called if our Initialize()
+// fails
+class wxCallBaseCleanup
+{
+public:
+    wxCallBaseCleanup(wxApp *app) : m_app(app) { }
+    ~wxCallBaseCleanup() { if ( m_app ) m_app->wxAppBase::CleanUp(); }
+
+    void Dismiss() { m_app = NULL; }
+
+private:
+    wxApp *m_app;
+};
+
 //// Initialize
-bool wxApp::Initialize()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
+
+    // ensure that base cleanup is done if we return too early
+    wxCallBaseCleanup callBaseCleanup(this);
+
     // the first thing to do is to check if we're trying to run an Unicode
     // program under Win9x w/o MSLU emulation layer - if so, abort right now
     // as it has no chance to work
@@ -290,20 +289,6 @@ bool wxApp::Initialize()
 
     wxBuffer = new wxChar[1500]; // FIXME
 
-    wxClassInfo::InitializeClasses();
-
-#if wxUSE_THREADS
-    wxPendingEventsLocker = new wxCriticalSection;
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-    wxBitmap::InitStandardHandlers();
-
 #if defined(__WIN95__) && !defined(__WXMICROWIN__)
     InitCommonControls();
 #endif // __WIN95__
@@ -332,17 +317,6 @@ bool wxApp::Initialize()
     Ctl3dAutoSubclass(wxhInstance);
 #endif // wxUSE_CTL3D
 
-    // VZ: these icons are not in wx.rc anyhow (but should they?)!
-#if 0
-    wxSTD_FRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_FRAME"));
-    wxSTD_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_MDIPARENTFRAME"));
-    wxSTD_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_MDICHILDFRAME"));
-
-    wxDEFAULT_FRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_FRAME"));
-    wxDEFAULT_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_MDIPARENTFRAME"));
-    wxDEFAULT_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_MDICHILDFRAME"));
-#endif // 0
-
     RegisterWindowClasses();
 
 #ifndef __WXMICROWIN__
@@ -377,10 +351,9 @@ bool wxApp::Initialize()
     wxSetKeyboardHook(TRUE);
 #endif
 
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules())
-        return FALSE;
-    return TRUE;
+    callBaseCleanup.Dismiss();
+
+    return true;
 }
 
 // ---------------------------------------------------------------------------
@@ -525,80 +498,11 @@ bool wxApp::UnregisterWindowClasses()
     return retval;
 }
 
-// ---------------------------------------------------------------------------
-// Convert Windows to argc, argv style
-// ---------------------------------------------------------------------------
-
-void wxApp::ConvertToStandardCommandArgs(const char* lpCmdLine)
-{
-    // break the command line in words
-    wxArrayString args =
-        wxCmdLineParser::ConvertStringToArgs(wxConvertMB2WX(lpCmdLine));
-
-    // +1 here for the program name
-    argc = args.GetCount() + 1;
-
-    // and +1 here for the terminating NULL
-    argv = new wxChar *[argc + 1];
-
-    argv[0] = new wxChar[260]; // 260 is MAX_PATH value from windef.h
-    ::GetModuleFileName(wxhInstance, argv[0], 260);
-
-    // also set the app name from argv[0]
-    wxString name;
-    wxFileName::SplitPath(argv[0], NULL, &name, NULL);
-
-    // but don't override the name already set by the user code, if any
-    if ( GetAppName().empty() )
-        SetAppName(name);
-
-    // copy all the other arguments to wxApp::argv[]
-    for ( int i = 1; i < argc; i++ )
-    {
-        argv[i] = copystring(args[i - 1]);
-    }
-
-    // argv[] must be NULL-terminated
-    argv[argc] = NULL;
-}
-
-//// Cleans up any wxWindows internal structures left lying around
-
 void wxApp::CleanUp()
 {
-    //// COMMON CLEANUP
-
-#if wxUSE_LOG
-    // flush the logged messages if any and install a 'safer' log target: the
-    // default one (wxLogGui) can't be used after the resources are freed just
-    // below and the user suppliedo ne might be even more unsafe (using any
-    // wxWindows GUI function is unsafe starting from now)
-    wxLog::DontCreateOnDemand();
-
-    // this will flush the old messages if any
-    delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif // wxUSE_LOG
-
-    // One last chance for pending objects to be cleaned up
-    wxTheApp->DeletePendingObjects();
-
-    wxModule::CleanUpModules();
-
-    wxDeleteStockObjects();
-
-    // Destroy all GDI lists, etc.
-    wxDeleteStockLists();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = NULL;
-
-    wxBitmap::CleanUpHandlers();
-
     delete[] wxBuffer;
     wxBuffer = NULL;
 
-    //// WINDOWS-SPECIFIC CLEANUP
-
 #ifndef __WXMICROWIN__
     wxSetKeyboardHook(FALSE);
 #endif
@@ -607,20 +511,6 @@ void wxApp::CleanUp()
     wxCleanUpPenWin();
 #endif
 
-    if (wxSTD_FRAME_ICON)
-        DestroyIcon(wxSTD_FRAME_ICON);
-    if (wxSTD_MDICHILDFRAME_ICON)
-        DestroyIcon(wxSTD_MDICHILDFRAME_ICON);
-    if (wxSTD_MDIPARENTFRAME_ICON)
-        DestroyIcon(wxSTD_MDIPARENTFRAME_ICON);
-
-    if (wxDEFAULT_FRAME_ICON)
-        DestroyIcon(wxDEFAULT_FRAME_ICON);
-    if (wxDEFAULT_MDICHILDFRAME_ICON)
-        DestroyIcon(wxDEFAULT_MDICHILDFRAME_ICON);
-    if (wxDEFAULT_MDIPARENTFRAME_ICON)
-        DestroyIcon(wxDEFAULT_MDIPARENTFRAME_ICON);
-
     if ( wxDisableButtonBrush )
         ::DeleteObject( wxDisableButtonBrush );
 
@@ -628,275 +518,44 @@ void wxApp::CleanUp()
     ::OleUninitialize();
 #endif
 
-#ifdef WXMAKINGDLL
     // for an EXE the classes are unregistered when it terminates but DLL may
     // be loaded several times (load/unload/load) into the same process in
     // which case the registration will fail after the first time if we don't
     // unregister the classes now
     UnregisterWindowClasses();
-#endif // WXMAKINGDLL
 
 #if wxUSE_CTL3D
     Ctl3dUnregister(wxhInstance);
 #endif
 
     delete wxWinHandleHash;
-    wxWinHandleHash = NULL; // Set to null in case anything later tries to ref it.
-
-    delete wxPendingEvents;
-    wxPendingEvents = NULL; // Set to null because wxAppBase::wxEvtHandler is destroyed later.
-
-#if wxUSE_THREADS
-    delete wxPendingEventsLocker;
-    wxPendingEventsLocker = NULL; // Set to null because wxAppBase::wxEvtHandler is destroyed later.
-    // If we don't do the following, we get an apparent memory leak
-#if wxUSE_VALIDATORS
-    ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
-#endif // wxUSE_VALIDATORS
-#endif // wxUSE_THREADS
-
-    wxClassInfo::CleanUpClasses();
-
-    delete wxTheApp;
-    wxTheApp = NULL;
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_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.
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogMessage(wxT("There were memory leaks."));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-    //  wxDebugContext::SetStream(NULL, NULL);
-#endif
-
-#if wxUSE_LOG
-    // do it as the very last thing because everything else can log messages
-    delete wxLog::SetActiveTarget(NULL);
-#endif // wxUSE_LOG
-}
-
-//----------------------------------------------------------------------
-// Entry point helpers, used by wxPython
-//----------------------------------------------------------------------
-
-int WXDLLEXPORT wxEntryStart( int WXUNUSED(argc), char** WXUNUSED(argv) )
-{
-    return wxApp::Initialize();
-}
-
-int WXDLLEXPORT wxEntryInitGui()
-{
-    return wxTheApp->OnInitGui();
-}
-
-void WXDLLEXPORT wxEntryCleanup()
-{
-    wxApp::CleanUp();
-}
-
-
-#if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL))
-
-// temporarily disable this warning which would be generated in release builds
-// because of __try
-#ifdef __VISUALC__
-    #pragma warning(disable: 4715) // not all control paths return a value
-#endif // Visual C++
+    wxWinHandleHash = NULL;
 
-//----------------------------------------------------------------------
-// Main wxWindows entry point
-//----------------------------------------------------------------------
-int wxEntry(WXHINSTANCE hInstance,
-            WXHINSTANCE WXUNUSED(hPrevInstance),
-            char *lpCmdLine,
-            int nCmdShow,
-            bool enterLoop)
-{
-    // do check for memory leaks on program exit
-    // (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free
-    //  deallocated memory which may be used to simulate low-memory condition)
-#ifndef __WXMICROWIN__
-    wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
-#endif
-
-#ifdef __MWERKS__
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-    // This seems to be necessary since there are 'rogue'
-    // objects present at this point (perhaps global objects?)
-    // Setting a checkpoint will ignore them as far as the
-    // memory checking facility is concerned.
-    // Of course you may argue that memory allocated in globals should be
-    // checked, but this is a reasonable compromise.
-    wxDebugContext::SetCheckpoint();
-#endif
-#endif
-
-    // take everything into a try-except block to be able to call
-    // OnFatalException() if necessary
-#if wxUSE_ON_FATAL_EXCEPTION
-    __try {
-#endif
-        wxhInstance = (HINSTANCE) hInstance;
-
-        if (!wxEntryStart(0,0))
-            return 0;
-
-        // create the application object or ensure that one already exists
-        if (!wxTheApp)
-        {
-            // The app may have declared a global application object, but we recommend
-            // the IMPLEMENT_APP macro is used instead, which sets an initializer
-            // function for delayed, dynamic app object construction.
-            wxCHECK_MSG( wxApp::GetInitializerFunction(), 0,
-                         wxT("No initializer - use IMPLEMENT_APP macro.") );
-
-            wxTheApp = (wxApp*) (*wxApp::GetInitializerFunction()) ();
-        }
-
-        wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
-
-        // save the WinMain() parameters
-        if (lpCmdLine) // MicroWindows passes NULL
-            wxTheApp->ConvertToStandardCommandArgs(lpCmdLine);
-        wxTheApp->m_nCmdShow = nCmdShow;
-
-        // We really don't want timestamps by default, because it means
-        // we can't simply double-click on the error message and get to that
-        // line in the source. So VC++ at least, let's have a sensible default.
-#ifdef __VISUALC__
-#if wxUSE_LOG
-        wxLog::SetTimestamp(NULL);
-#endif // wxUSE_LOG
-#endif // __VISUALC__
-
-        // init the app
-        int retValue = wxEntryInitGui() && wxTheApp->OnInit() ? 0 : -1;
-
-        if ( retValue == 0 )
-        {
-            if ( enterLoop )
-            {
-                // run the main loop
-                wxTheApp->OnRun();
-            }
-            else
-            {
-                // we want to initialize, but not run or exit immediately.
-                return 1;
-            }
-        }
-        //else: app initialization failed, so we skipped OnRun()
-
-        wxWindow *topWindow = wxTheApp->GetTopWindow();
-        if ( topWindow )
-        {
-            // Forcibly delete the window.
-            if ( topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
-                    topWindow->IsKindOf(CLASSINFO(wxDialog)) )
-            {
-                topWindow->Close(TRUE);
-                wxTheApp->DeletePendingObjects();
-            }
-            else
-            {
-                delete topWindow;
-                wxTheApp->SetTopWindow(NULL);
-            }
-        }
-
-        retValue = wxTheApp->OnExit();
-
-        wxEntryCleanup();
-
-        return retValue;
-
-#if wxUSE_ON_FATAL_EXCEPTION
-    }
-    __except ( gs_handleExceptions ? EXCEPTION_EXECUTE_HANDLER
-                                   : EXCEPTION_CONTINUE_SEARCH ) {
-        if ( wxTheApp )
-        {
-           // give the user a chance to do something special about this
-           wxTheApp->OnFatalException();
-        }
-
-        ::ExitProcess(3); // the same exit code as abort()
-
-        // NOTREACHED
-    }
-#endif // wxUSE_ON_FATAL_EXCEPTION
+    wxAppBase::CleanUp();
 }
 
-// restore warning state
-#ifdef __VISUALC__
-    #pragma warning(default: 4715) // not all control paths return a value
-#endif // Visual C++
-
-#else /*  _WINDLL  */
-
-//----------------------------------------------------------------------
-// Entry point for wxWindows + the App in a DLL
-//----------------------------------------------------------------------
-
-int wxEntry(WXHINSTANCE hInstance)
-{
-    wxhInstance = (HINSTANCE) hInstance;
-    wxEntryStart(0, 0);
-
-    // The app may have declared a global application object, but we recommend
-    // the IMPLEMENT_APP macro is used instead, which sets an initializer function
-    // for delayed, dynamic app object construction.
-    if (!wxTheApp)
-    {
-        wxCHECK_MSG( wxApp::GetInitializerFunction(), 0,
-                     "No initializer - use IMPLEMENT_APP macro." );
-
-        wxTheApp = (* wxApp::GetInitializerFunction()) ();
-    }
-
-    wxCHECK_MSG( wxTheApp, 0, "You have to define an instance of wxApp!" );
-
-    wxTheApp->argc = 0;
-    wxTheApp->argv = NULL;
-
-    wxEntryInitGui();
-
-    wxTheApp->OnInit();
-
-    wxWindow *topWindow = wxTheApp->GetTopWindow();
-    if ( topWindow && topWindow->GetHWND())
-    {
-        topWindow->Show(TRUE);
-    }
-
-    return 1;
-}
-#endif // _WINDLL
-
-//// Static member initialization
+// ----------------------------------------------------------------------------
+// wxApp ctor/dtor
+// ----------------------------------------------------------------------------
 
 wxApp::wxApp()
 {
-    argc = 0;
-    argv = NULL;
     m_printMode = wxPRINT_WINDOWS;
-    m_auto3D = TRUE;
 }
 
 wxApp::~wxApp()
 {
-    // Delete command-line args
-    int i;
-    for (i = 0; i < argc; i++)
+    // our cmd line arguments are allocated inside wxEntry(HINSTANCE), they
+    // don't come from main(), so we have to free them
+
+    while ( argc )
     {
-        delete[] argv[i];
+        // m_argv elements were allocated by wxStrdup()
+        free(argv[--argc]);
     }
-    delete[] argv;
+
+    // but m_argv itself -- using new[]
+    delete [] argv;
 }
 
 bool wxApp::Initialized()
@@ -1242,24 +901,6 @@ void wxApp::WakeUpIdle()
     }
 }
 
-void wxApp::DeletePendingObjects()
-{
-    wxNode *node = wxPendingDelete.GetFirst();
-    while (node)
-    {
-        wxObject *obj = node->GetData();
-
-        delete obj;
-
-        if (wxPendingDelete.Member(obj))
-            delete node;
-
-        // Deleting one object may have deleted other pending
-        // objects, so start from beginning of list again.
-        node = wxPendingDelete.GetFirst();
-    }
-}
-
 void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
 {
     if (GetTopWindow())
@@ -1443,25 +1084,3 @@ bool wxApp::Yield(bool onlyIfNeeded)
     return TRUE;
 }
 
-bool wxHandleFatalExceptions(bool doit)
-{
-#if wxUSE_ON_FATAL_EXCEPTION
-    // assume this can only be called from the main thread
-    gs_handleExceptions = doit;
-
-    return TRUE;
-#else
-    wxFAIL_MSG(_T("set wxUSE_ON_FATAL_EXCEPTION to 1 to use this function"));
-
-    (void)doit;
-    return FALSE;
-#endif
-}
-
-//-----------------------------------------------------------------------------
-
-// For some reason, with MSVC++ 1.5, WinMain isn't linked in properly
-// if in a separate file. So include it here to ensure it's linked.
-#if (defined(__VISUALC__) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__WINE__) && !defined(WXMAKINGDLL))
-#include "main.cpp"
-#endif
index 4ed0d984d637d9716210c5bc07fb85ef6a19faa5..9c9dc1d35f9e5aaa0aa13bfb2840e8055a8f963d 100644 (file)
@@ -506,8 +506,8 @@ void wxFrame::IconizeChildFrames(bool bIconize)
 
 WXHICON wxFrame::GetDefaultIcon() const
 {
-    return (WXHICON)(wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON
-                                      : wxDEFAULT_FRAME_ICON);
+    // we don't have any standard icons (any more)
+    return (WXHICON)0;
 }
 
 // ===========================================================================
index 94299293e178c600ebf6bbb223328d29f38a8fba..20a274a5dc2f72d9dc60563f86d8f18f19e8b212 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "wx/event.h"
 #include "wx/app.h"
+#include "wx/cmdline.h"
 
 #include "wx/msw/private.h"
 
@@ -48,6 +49,8 @@
     #define HINSTANCE HANDLE
 #endif
 
+#if wxUSE_GUI
+
 // ----------------------------------------------------------------------------
 // function prototypes
 // ----------------------------------------------------------------------------
 // from src/msw/app.cpp
 extern void WXDLLEXPORT wxEntryCleanup();
 
+static wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc);
+
 // ============================================================================
 // implementation: various entry points
 // ============================================================================
 
+// ----------------------------------------------------------------------------
+// Windows-specific wxEntry
+// ----------------------------------------------------------------------------
+
+int wxEntry(WXHINSTANCE hInstance,
+            WXHINSTANCE WXUNUSED(hPrevInstance),
+            char *pCmdLine,
+            int nCmdShow)
+{
+    // remember the parameters Windows gave us
+    wxSetInstance((HINSTANCE)hInstance);
+    wxApp::m_nCmdShow = nCmdShow;
+
+    // parse the command line
+    int argc;
+    wxChar **argv = ConvertToStandardCommandArgs(wxConvertMB2WX(pCmdLine), argc);
+
+    return wxEntry(argc, argv);
+}
+
 // May wish not to have a DllMain or WinMain, e.g. if we're programming
 // a Netscape plugin or if we're writing a console application
-#if wxUSE_GUI && !defined(NOMAIN)
+#if !defined(NOMAIN)
 
 extern "C"
 {
@@ -104,10 +129,8 @@ DllMain(HANDLE hModule, DWORD fdwReason, LPVOID WXUNUSED(lpReserved))
             return wxEntry((WXHINSTANCE) hModule);
 
         case DLL_PROCESS_DETACH:
-           if ( wxTheApp )
-              wxTheApp->OnExit();
-           wxEntryCleanup();
-           break;
+            wxEntryCleanup();
+            break;
     }
 #else
        (void)hModule;
@@ -123,6 +146,42 @@ DllMain(HANDLE hModule, DWORD fdwReason, LPVOID WXUNUSED(lpReserved))
 
 #endif // !NOMAIN
 
+// ---------------------------------------------------------------------------
+// Convert Windows to argc, argv style
+// ---------------------------------------------------------------------------
+
+wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc)
+{
+    // break the command line in words
+    wxArrayString args;
+    if ( p )
+    {
+        args = wxCmdLineParser::ConvertStringToArgs(p);
+    }
+
+    // +1 here for the program name
+    argc = args.GetCount() + 1;
+
+    // and +1 here for the terminating NULL
+    wxChar **argv = new wxChar *[argc + 1];
+
+    argv[0] = new wxChar[MAX_PATH];
+    ::GetModuleFileName(wxhInstance, argv[0], MAX_PATH);
+
+    // copy all the other arguments to wxApp::argv[]
+    for ( int i = 1; i < argc; i++ )
+    {
+        argv[i] = wxStrdup(args[i - 1]);
+    }
+
+    // argv[] must be NULL-terminated
+    argv[argc] = NULL;
+
+    return argv;
+}
+
+#endif // wxUSE_GUI
+
 // ----------------------------------------------------------------------------
 // global HINSTANCE
 // ----------------------------------------------------------------------------
index a00557187df8b0a61812421a6ab551cb2480ca48..6089dcde74aca6eef0956c8a3bfd18e42385eb63 100644 (file)
@@ -342,8 +342,8 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 
 WXHICON wxMDIParentFrame::GetDefaultIcon() const
 {
-    return (WXHICON)(wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON
-                                               : wxDEFAULT_MDIPARENTFRAME_ICON);
+    // we don't have any standard icons (any more)
+    return (WXHICON)0;
 }
 
 // ---------------------------------------------------------------------------
@@ -811,8 +811,8 @@ void wxMDIChildFrame::InternalSetMenuBar()
 
 WXHICON wxMDIChildFrame::GetDefaultIcon() const
 {
-    return (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON
-                                              : wxDEFAULT_MDICHILDFRAME_ICON);
+    // we don't have any standard icons (any more)
+    return (WXHICON)0;
 }
 
 // ---------------------------------------------------------------------------
index 770ea11fe27f5f0b4bab2ebfd8649d737af5f908..aff561ff85f54d66a661a374628dda2b2259dcac 100644 (file)
     #endif
 #endif
 
+// ----------------------------------------------------------------------------
+// module globals
+// ----------------------------------------------------------------------------
+
+#if wxUSE_ON_FATAL_EXCEPTION
+    static bool gs_handleExceptions = FALSE;
+#endif
+
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
@@ -1191,3 +1199,40 @@ extern long wxCharsetToCodepage(const wxChar *name)
 
 #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP
 
+// ----------------------------------------------------------------------------
+// wxApp::OnFatalException() support
+// ----------------------------------------------------------------------------
+
+bool wxHandleFatalExceptions(bool doit)
+{
+#if wxUSE_ON_FATAL_EXCEPTION
+    // assume this can only be called from the main thread
+    gs_handleExceptions = doit;
+
+    return TRUE;
+#else
+    wxFAIL_MSG(_T("set wxUSE_ON_FATAL_EXCEPTION to 1 to use this function"));
+
+    (void)doit;
+    return FALSE;
+#endif
+}
+
+#if wxUSE_ON_FATAL_EXCEPTION
+
+extern unsigned long wxGlobalSEHandler()
+{
+    if ( gs_handleExceptions && wxTheApp )
+    {
+        // give the user a chance to do something special about this
+        wxTheApp->OnFatalException();
+
+        // this will execute our handler and terminate the process
+        return EXCEPTION_EXECUTE_HANDLER;
+    }
+
+    return EXCEPTION_CONTINUE_SEARCH;
+}
+
+#endif // wxUSE_ON_FATAL_EXCEPTION
+
index 45b1156215cf1f625cbe67bb8cdd1a6e307e0fb4..21a1c344cd22b2feec545c9e84c18c30899f602d 100644 (file)
@@ -1035,7 +1035,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
     // is a more neutral term, we don't necessarily get a sunken effect in
     // Windows XP. Instead we get the appropriate style for the theme.
 
-    if (border == wxBORDER_DEFAULT && wxTheApp->GetAuto3D() &&
+    if (border == wxBORDER_DEFAULT &&
         IsKindOf(CLASSINFO(wxControl)) &&
         GetParent() &&
         ((GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) != wxUSER_COLOURS))
index 5db7a6bcfcbebf9d842d2f9ad9e7b96a08537adb..bde40f8e18498da049ef933a12a1d545b26ee9b2 100644 (file)
@@ -226,10 +226,11 @@ void wxApp::HandleSockets()
 //
 // Initialize
 //
-bool wxApp::Initialize(
-  HAB                               vHab
-)
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
+
 #if defined(wxUSE_CONSOLEDEBUG)
   #if wxUSE_CONSOLEDEBUG
 /***********************************************/
@@ -252,31 +253,20 @@ bool wxApp::Initialize(
   #endif //wxUSE_CONSOLEDEBUG
 #endif
 
-    wxBuffer = new wxChar[1500]; // FIXME; why?
-
-    wxClassInfo::InitializeClasses();
-
-#if wxUSE_THREADS
-    wxPendingEventsLocker = new wxCriticalSection;
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
-    wxBitmap::InitStandardHandlers();
-
     //
     // OS2 has to have an anchorblock
     //
-    vHab = WinInitialize(0);
+    vHabmain = WinInitialize(0);
+
+    if (!vHabmain)
+    {
+        // TODO: at least give some error message here...
+        wxAppBase::CleanUp();
 
-    if (!vHab)
         return FALSE;
-    else
-        vHabmain = vHab;
+    }
+
+    wxBuffer = new wxChar[1500]; // FIXME; why?
 
     // Some people may wish to use this, but
     // probably it shouldn't be here by default.
@@ -295,10 +285,8 @@ bool wxApp::Initialize(
 
     // wxSetKeyboardHook(TRUE);
 
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules())
-        return FALSE;
     RegisterWindowClasses(vHab);
+
     return TRUE;
 } // end of wxApp::Initialize
 
@@ -437,45 +425,6 @@ bool wxApp::RegisterWindowClasses(
 //
 void wxApp::CleanUp()
 {
-    //
-    // COMMON CLEANUP
-    //
-
-#if wxUSE_LOG
-
-    //
-    // Flush the logged messages if any and install a 'safer' log target: the
-    // default one (wxLogGui) can't be used after the resources are freed just
-    // below and the user suppliedo ne might be even more unsafe (using any
-    // wxWindows GUI function is unsafe starting from now)
-    //
-    wxLog::DontCreateOnDemand();
-
-    //
-    // This will flush the old messages if any
-    //
-    delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif // wxUSE_LOG
-
-    //
-    // One last chance for pending objects to be cleaned up
-    //
-    wxTheApp->DeletePendingObjects();
-
-    wxModule::CleanUpModules();
-
-    wxDeleteStockObjects();
-
-    //
-    // Destroy all GDI lists, etc.
-    //
-    wxDeleteStockLists();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = NULL;
-
-    wxBitmap::CleanUpHandlers();
-
     delete[] wxBuffer;
     wxBuffer = NULL;
 
@@ -514,33 +463,11 @@ void wxApp::CleanUp()
     ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
 #endif
 
-    wxClassInfo::CleanUpClasses();
-
     // Delete Message queue
     if (wxTheApp->m_hMq)
         ::WinDestroyMsgQueue(wxTheApp->m_hMq);
 
-    delete wxTheApp;
-    wxTheApp = NULL;
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_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.
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug(wxT("There were memory leaks."));
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-    //  wxDebugContext::SetStream(NULL, NULL);
-#endif
-
-#if wxUSE_LOG
-    // do it as the very last thing because everything else can log messages
-    delete wxLog::SetActiveTarget(NULL);
-#endif // wxUSE_LOG
+    wxAppBase::CleanUp();
 } // end of wxApp::CleanUp
 
 //----------------------------------------------------------------------
@@ -1051,27 +978,6 @@ bool wxApp::SendIdleEvents(
     return bNeedMore;
 } // end of wxApp::SendIdleEvents
 
-void wxApp::DeletePendingObjects()
-{
-    wxNode*                         pNode = wxPendingDelete.First();
-
-    while (pNode)
-    {
-        wxObject*                   pObj = (wxObject *)pNode->Data();
-
-        delete pObj;
-
-        if (wxPendingDelete.Member(pObj))
-            delete pNode;
-
-        //
-        // Deleting one object may have deleted other pending
-        // objects, so start from beginning of list again.
-        //
-        pNode = wxPendingDelete.First();
-    }
-} // end of wxApp::DeletePendingObjects
-
 void wxApp::OnEndSession(
   wxCloseEvent&                     WXUNUSED(rEvent))
 {
index db4d2606ab1563ca496622987828c26b36d3634c..96a16adcf2f6be851ff12f1e58fc6919f32a50ce 100644 (file)
@@ -2,8 +2,8 @@
 # Microsoft Developer Studio Generated Build File, Format Version 6.00
 # ** DO NOT EDIT **
 
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
 # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
 
 CFG=wxBase - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
@@ -32,8 +32,6 @@ CFG=wxBase - Win32 Debug
 # PROP AllowPerConfigDependencies 0
 # PROP Scc_ProjName ""
 # PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
 
 !IF  "$(CFG)" == "wxBase - Win32 Release Unicode DLL"
 
@@ -48,10 +46,13 @@ RSC=rc.exe
 # PROP Intermediate_Dir "../BaseReleaseUnicodeDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/basedllu" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/basedllu" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "NDEBUG"
 BSC32=bscmake.exe
@@ -59,7 +60,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../lib/wxbase250u.dll"
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlib.lib ../lib/regex.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250u.dll"
+# ADD LINK32 ../lib/zlib.lib ../lib/regex.lib kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib gdi32.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250u.dll"
 
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Debug Unicode DLL"
 
@@ -74,18 +75,22 @@ LINK32=link.exe
 # PROP Intermediate_Dir "../BaseDebugUnicodeDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/basedllud" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/basedllud" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "_DEBUG"
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase250ud.dll"
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlibd.lib ../lib/regexd.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250ud.dll"
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../lib/wxbase250ud.dll" /pdbtype:sept
+# ADD LINK32 ../lib/zlibd.lib ../lib/regexd.lib kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib gdi32.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250ud.dll"
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Release Unicode"
 
 # PROP BASE Use_MFC 0
@@ -98,8 +103,10 @@ LINK32=link.exe
 # PROP Output_Dir "..\lib"
 # PROP Intermediate_Dir "..\BaseReleaseUnicode"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/baseu" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /D "_UNICODE" /D "UNICODE" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/baseu" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
@@ -121,13 +128,15 @@ LIB32=link.exe -lib
 # PROP Output_Dir "..\lib"
 # PROP Intermediate_Dir "..\BaseDebugUnicode"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/baseud" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D wxUSE_GUI=0 /D "WIN32" /D "__WXDEBUG__" /D WINVER=0x400 /D "_UNICODE" /D "UNICODE" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/baseud" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D "__WXDEBUG__" /D "_UNICODE" /D "UNICODE" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /o"../lib/wxbase.bsc"
+# ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
 # ADD LIB32 /nologo /out:"..\lib\wxbaseud.lib"
@@ -145,10 +154,13 @@ LIB32=link.exe -lib
 # PROP Intermediate_Dir "../BaseReleaseDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/basedll" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/basedll" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D "WXMAKINGDLL" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "NDEBUG"
 BSC32=bscmake.exe
@@ -156,7 +168,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../lib/wxbase250.dll"
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlib.lib ../lib/regex.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250.dll"
+# ADD LINK32 ../lib/zlib.lib ../lib/regex.lib kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib gdi32.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250.dll"
 
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Debug DLL"
 
@@ -171,18 +183,21 @@ LINK32=link.exe
 # PROP Intermediate_Dir "../BaseDebugDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/basedlld" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/basedlld" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D "WXMAKINGDLL" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "_DEBUG"
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase250d.dll"
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlibd.lib ../lib/regexd.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250d.dll"
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../lib/wxbase250d.dll" /pdbtype:sept
+# ADD LINK32 ../lib/zlibd.lib ../lib/regexd.lib kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib gdi32.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxbase250d.dll"
 
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Release"
 
@@ -196,8 +211,10 @@ LINK32=link.exe
 # PROP Output_Dir "..\lib"
 # PROP Intermediate_Dir "..\BaseRelease"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/base" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/base" /I "../include" /I "./regex" /I "./zlib" /D "NDEBUG" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
@@ -205,7 +222,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\lib\wxbase.lib"
+# ADD LIB32 /nologo
 
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Debug"
 
@@ -219,13 +236,15 @@ LIB32=link.exe -lib
 # PROP Output_Dir "..\lib"
 # PROP Intermediate_Dir "..\BaseDebug"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/based" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D wxUSE_GUI=0 /D "WIN32" /D "__WXDEBUG__" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/based" /I "../include" /I "./regex" /I "./zlib" /D "_DEBUG" /D "__WXDEBUG__" /D wxUSE_BASE=1 /D wxUSE_GUI=0 /D "WIN32" /D WINVER=0x400 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /o"../lib/wxbase.bsc"
+# ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
 # ADD LIB32 /nologo /out:"..\lib\wxbased.lib"
@@ -242,7 +261,6 @@ LIB32=link.exe -lib
 # Name "wxBase - Win32 Debug DLL"
 # Name "wxBase - Win32 Release"
 # Name "wxBase - Win32 Debug"
-
 # Begin Group "Common Files"
 
 # PROP Default_Filter ""
@@ -304,6 +322,11 @@ SOURCE=.\common\event.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\common\extended.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
 SOURCE=.\common\ffile.cpp
 # End Source File
 # Begin Source File
@@ -360,6 +383,10 @@ SOURCE=.\common\http.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\common\init.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\common\intl.cpp
 # End Source File
 # Begin Source File
@@ -472,6 +499,11 @@ SOURCE=.\common\txtstrm.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\common\unzip.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
 SOURCE=.\common\url.cpp
 # End Source File
 # Begin Source File
@@ -498,26 +530,22 @@ SOURCE=.\common\zipstrm.cpp
 
 SOURCE=.\common\zstream.cpp
 # End Source File
+# End Group
+# Begin Group "MSW Files"
+
+# PROP Default_Filter ""
 # Begin Source File
 
-SOURCE=.\common\init.cpp
+SOURCE=.\msw\basemsw.cpp
 # End Source File
-
 # Begin Source File
 
-SOURCE=.\common\extended.c
-# SUBTRACT CPP /YX /Yc /Yu
+SOURCE=.\msw\dde.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\common\unzip.c
-# SUBTRACT CPP /YX /Yc /Yu
+SOURCE=.\msw\dir.cpp
 # End Source File
-
-# End Group
-# Begin Group "MSW Files"
-
-# PROP Default_Filter ""
 # Begin Source File
 
 SOURCE=.\msw\dummy.cpp
@@ -525,15 +553,13 @@ SOURCE=.\msw\dummy.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=.\msw\basemsw.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\dde.cpp
+SOURCE=.\msw\gsocket.c
+# SUBTRACT CPP /YX /Yc /Yu
 # End Source File
 # Begin Source File
 
-SOURCE=.\msw\dir.cpp
+SOURCE=.\msw\gsockmsw.c
+# SUBTRACT CPP /YX /Yc /Yu
 # End Source File
 # Begin Source File
 
@@ -575,18 +601,6 @@ SOURCE=.\msw\utilsexc.cpp
 
 SOURCE=.\msw\volume.cpp
 # End Source File
-
-# Begin Source File
-
-SOURCE=.\msw\gsocket.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\gsockmsw.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-
 # End Group
 # Begin Group "Headers"
 
@@ -597,7 +611,9 @@ SOURCE=.\msw\gsockmsw.c
 # Begin Source File
 
 SOURCE=..\include\wx\msw\setup.h
+
 !IF  "$(CFG)" == "wxBase - Win32 Release Unicode DLL"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
@@ -605,14 +621,19 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\basedllu\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Debug Unicode DLL"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
 "../lib/basedllud/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
        copy "$(InputPath)" ..\lib\basedllud\wx\setup.h
+
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Release Unicode"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
@@ -620,7 +641,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\baseu\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Debug Unicode"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
@@ -628,7 +651,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\baseud\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Release DLL"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
@@ -636,14 +661,19 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\basedll\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Debug DLL"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
 "../lib/basedlld/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
        copy "$(InputPath)" ..\lib\basedlld\wx\setup.h
+
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Release"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
@@ -651,7 +681,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\base\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxBase - Win32 Debug"
+
 # Begin Custom Build - Copying $(InputPath) to $(TargetDir)
 InputPath=..\include\wx\msw\setup.h
 
@@ -659,6 +691,7 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\based\wx\setup.h
 
 # End Custom Build
+
 !ENDIF 
 
 # End Source File
@@ -1022,7 +1055,6 @@ SOURCE=..\include\wx\zipstrm.h
 
 SOURCE=..\include\wx\zstream.h
 # End Source File
-
 # End Group
 # Begin Group "MSW"
 
@@ -1051,7 +1083,6 @@ SOURCE=..\include\wx\msw\mimetype.h
 
 SOURCE=..\include\wx\msw\winundef.h
 # End Source File
-
 # End Group
 # End Group
 # End Target
index 97a1ef024fdad653d549c96215de06f1be4828fd..d51eda2bb632f49c189285fb107715bc28cc62d8 100644 (file)
@@ -9,12 +9,12 @@ CFG=wxWindows - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
 !MESSAGE use the Export Makefile command and run
 !MESSAGE 
-!MESSAGE NMAKE /f "wxWindows.mak".
+!MESSAGE NMAKE /f "wxMSW.mak".
 !MESSAGE 
 !MESSAGE You can specify a configuration when running NMAKE
 !MESSAGE by defining the macro CFG on the command line. For example:
 !MESSAGE 
-!MESSAGE NMAKE /f "wxWindows.mak" CFG="wxWindows - Win32 Debug"
+!MESSAGE NMAKE /f "wxMSW.mak" CFG="wxWindows - Win32 Debug"
 !MESSAGE 
 !MESSAGE Possible choices for configuration are:
 !MESSAGE 
@@ -197,7 +197,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /out:"../lib/wxmsw250d.dll" /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxmsw250d.dll"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib ../lib/wxbase250d.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxmsw250d.dll"
 
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Release"
 
@@ -222,7 +222,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\lib\wxmsw.lib"
+# ADD LIB32 /nologo
 
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Debug"
 
index 3c1b42fccc2e6cbd9236194429669f9a7ec761a0..9b0568ed5fa81ace4ab784caa9b5062439cfad74 100644 (file)
@@ -2,8 +2,8 @@
 # Microsoft Developer Studio Generated Build File, Format Version 6.00
 # ** DO NOT EDIT **
 
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
 # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
 
 CFG=wxWindows - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
@@ -32,8 +32,6 @@ CFG=wxWindows - Win32 Debug
 # PROP AllowPerConfigDependencies 0
 # PROP Scc_ProjName ""
 # PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
 
 !IF  "$(CFG)" == "wxWindows - Win32 Release Unicode DLL"
 
@@ -48,10 +46,13 @@ RSC=rc.exe
 # PROP Intermediate_Dir "../ReleaseUnicodeDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/mswdllu" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "WIN32" /D "NDEBUG" /D WINVER=0x0400 /D "STRICT" /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/mswdllu" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "NDEBUG" /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "NDEBUG"
 BSC32=bscmake.exe
@@ -74,17 +75,20 @@ LINK32=link.exe
 # PROP Intermediate_Dir "../DebugUnicodeDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswdllud" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "WIN32" /D "_DEBUG" /D WINVER=0x0400 /D "STRICT" /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswdllud" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "_DEBUG" /D "WXMAKINGDLL" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "_DEBUG"
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw250ud.dll"
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /out:"../lib/wxmsw250ud.dll" /pdbtype:sept
 # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxmsw250ud.dll"
 
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Release Unicode"
@@ -99,8 +103,10 @@ LINK32=link.exe
 # PROP Output_Dir "../lib"
 # PROP Intermediate_Dir "../ReleaseUnicode"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/mswu" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "WIN32" /D "NDEBUG" /D WINVER=0x0400 /D "STRICT" /D "_UNICODE" /D "UNICODE" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/mswu" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
@@ -122,8 +128,10 @@ LIB32=link.exe -lib
 # PROP Output_Dir "../lib"
 # PROP Intermediate_Dir "../DebugUnicode"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswud" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "WIN32" /D "_DEBUG" /D "__WXDEBUG__" /D WINVER=0x0400 /D "STRICT" /D "_UNICODE" /D "UNICODE" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswud" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_DEBUG" /D "__WXDEBUG__" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
@@ -146,10 +154,13 @@ LIB32=link.exe -lib
 # PROP Intermediate_Dir "../ReleaseDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/mswdll" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "WIN32" /D "NDEBUG" /D WINVER=0x0400 /D "STRICT" /D "WXMAKINGDLL" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/mswdll" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "NDEBUG" /D "WXMAKINGDLL" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "NDEBUG"
 BSC32=bscmake.exe
@@ -172,17 +183,20 @@ LINK32=link.exe
 # PROP Intermediate_Dir "../DebugDll"
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswdlld" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "WIN32" /D "_DEBUG" /D WINVER=0x0400 /D "STRICT" /D "WXMAKINGDLL" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswdlld" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_USRDLL" /D "_DEBUG" /D "WXMAKINGDLL" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+MTL=midl.exe
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /i "../include" /d "_DEBUG"
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw250d.dll"
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /out:"../lib/wxmsw250d.dll" /pdbtype:sept
 # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /nologo /version:2.5 /dll /machine:I386 /out:"../lib/wxmsw250d.dll"
 
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Release"
@@ -197,8 +211,10 @@ LINK32=link.exe
 # PROP Output_Dir "../lib"
 # PROP Intermediate_Dir "../Release"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MD /W4 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /O2 /I "../lib/msw" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "WIN32" /D "NDEBUG" /D WINVER=0x0400 /D "STRICT" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../lib/msw" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "NDEBUG" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
@@ -220,8 +236,10 @@ LIB32=link.exe -lib
 # PROP Output_Dir "../lib"
 # PROP Intermediate_Dir "../Debug"
 # PROP Target_Dir ""
+CPP=cl.exe
 # ADD BASE CPP /nologo /MDd /W4 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswd" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "WIN32" /D "_DEBUG" /D "__WXDEBUG__" /D WINVER=0x0400 /D "STRICT" /D "__WXBASE__" /Yu"wx/wxprec.h" /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../lib/mswd" /I "../include" /I "./zlib" /I "./jpeg" /I "./png" /I "./regex" /I "./tiff" /D "_DEBUG" /D "__WXDEBUG__" /D "WIN32" /D WINVER=0x0400 /D "STRICT" /D wxUSE_BASE=1 /Yu"wx/wxprec.h" /FD /c
+RSC=rc.exe
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
@@ -396,6 +414,11 @@ SOURCE=.\common\event.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\common\extended.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
 SOURCE=.\common\fddlgcmn.cpp
 # End Source File
 # Begin Source File
@@ -544,6 +567,10 @@ SOURCE=.\common\imagxpm.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\common\init.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\common\intl.cpp
 # End Source File
 # Begin Source File
@@ -736,6 +763,11 @@ SOURCE=.\common\txtstrm.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\common\unzip.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
 SOURCE=.\common\url.cpp
 # End Source File
 # Begin Source File
@@ -782,18 +814,6 @@ SOURCE=.\common\zipstrm.cpp
 
 SOURCE=.\common\zstream.cpp
 # End Source File
-
-# Begin Source File
-
-SOURCE=.\common\extended.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=.\common\unzip.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-
 # End Group
 # Begin Group "Generic Files"
 
@@ -910,7 +930,6 @@ SOURCE=.\generic\treectlg.cpp
 
 SOURCE=.\generic\wizard.cpp
 # End Source File
-
 # End Group
 # Begin Group "wxHTML Files"
 
@@ -995,16 +1014,42 @@ SOURCE=.\html\m_tables.cpp
 
 SOURCE=.\html\winpars.cpp
 # End Source File
-
 # End Group
 # Begin Group "MSW Files"
 
+# PROP Default_Filter ""
+# Begin Group "OLE Files"
+
 # PROP Default_Filter ""
 # Begin Source File
 
-SOURCE=.\msw\dummy.cpp
-# ADD CPP /Yc"wx/wxprec.h"
+SOURCE=.\msw\ole\access.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\ole\automtn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\ole\dataobj.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\ole\dropsrc.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\ole\droptgt.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\ole\oleutils.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\ole\uuid.cpp
 # End Source File
+# End Group
 # Begin Source File
 
 SOURCE=.\msw\accel.cpp
@@ -1131,6 +1176,11 @@ SOURCE=.\msw\dragimag.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\msw\dummy.cpp
+# ADD CPP /Yc"wx/wxprec.h"
+# End Source File
+# Begin Source File
+
 SOURCE=.\msw\enhmeta.cpp
 # End Source File
 # Begin Source File
@@ -1183,6 +1233,16 @@ SOURCE=.\msw\glcanvas.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\msw\gsocket.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\gsockmsw.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
 SOURCE=.\msw\helpbest.cpp
 # End Source File
 # Begin Source File
@@ -1421,51 +1481,6 @@ SOURCE=.\msw\wave.cpp
 
 SOURCE=.\msw\window.cpp
 # End Source File
-
-# Begin Source File
-
-SOURCE=.\msw\gsocket.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\gsockmsw.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-
-# Begin Group "OLE Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\msw\ole\access.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\ole\automtn.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\ole\dataobj.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\ole\dropsrc.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\ole\droptgt.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\ole\oleutils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\msw\ole\uuid.cpp
-# End Source File
-
-# End Group
 # End Group
 # Begin Group "Headers"
 
@@ -1476,7 +1491,9 @@ SOURCE=.\msw\ole\uuid.cpp
 # Begin Source File
 
 SOURCE=..\include\wx\msw\setup.h
+
 !IF  "$(CFG)" == "wxWindows - Win32 Release Unicode DLL"
+
 # Begin Custom Build - Creating ..\lib\mswdllu\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1484,7 +1501,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\mswdllu\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Debug Unicode DLL"
+
 # Begin Custom Build - Creating ..\lib\mswdllud\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1492,7 +1511,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\mswdllud\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Release Unicode"
+
 # Begin Custom Build - Creating ..\lib\mswu\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1500,7 +1521,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\mswu\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Debug Unicode"
+
 # Begin Custom Build - Creating ..\lib\mswud\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1508,7 +1531,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\mswud\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Release DLL"
+
 # Begin Custom Build - Creating ..\lib\mswdll\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1516,7 +1541,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\mswdll\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Debug DLL"
+
 # Begin Custom Build - Creating ..\lib\mswdlld\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1524,7 +1551,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\mswdlld\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Release"
+
 # Begin Custom Build - Creating ..\lib\msw\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1532,7 +1561,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\msw\wx\setup.h
 
 # End Custom Build
+
 !ELSEIF  "$(CFG)" == "wxWindows - Win32 Debug"
+
 # Begin Custom Build - Creating ..\lib\mswd\wx\setup.h from $(InputPath)
 InputPath=..\include\wx\msw\setup.h
 
@@ -1540,7 +1571,9 @@ InputPath=..\include\wx\msw\setup.h
        copy "$(InputPath)" ..\lib\mswd\wx\setup.h
 
 # End Custom Build
+
 !ENDIF 
+
 # End Source File
 # End Group
 # Begin Group "Common"
@@ -2490,7 +2523,6 @@ SOURCE=..\include\wx\zipstrm.h
 
 SOURCE=..\include\wx\zstream.h
 # End Source File
-
 # End Group
 # Begin Group "MSW"
 
@@ -2867,7 +2899,6 @@ SOURCE=..\include\wx\msw\window.h
 
 SOURCE=..\include\wx\msw\winundef.h
 # End Source File
-
 # End Group
 # Begin Group "Generic"
 
@@ -3028,7 +3059,6 @@ SOURCE=..\include\wx\generic\treectlg.h
 
 SOURCE=..\include\wx\generic\wizard.h
 # End Source File
-
 # End Group
 # Begin Group "HTML"
 
@@ -3085,7 +3115,6 @@ SOURCE=..\include\wx\html\m_templ.h
 
 SOURCE=..\include\wx\html\winpars.h
 # End Source File
-
 # End Group
 # End Group
 # End Target
index a75edfee09942b9abc180c00e352b1b722fd49c1..b24c11fbabaf5092a5c64678d1a1c4066e060273 100644 (file)
@@ -93,33 +93,19 @@ BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
     EVT_IDLE(wxApp::OnIdle)
 END_EVENT_TABLE()
 
-bool wxApp::Initialize()
+bool wxApp::Initialize(int argc, wxChar **argv)
 {
-    wxClassInfo::InitializeClasses();
+    if ( !wxAppBase::Initialize(argc, argv) )
+        return false;
 
 #if wxUSE_INTL
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
 
-    // GL: I'm annoyed ... I don't know where to put this and I don't want to
-    // create a module for that as it's part of the core.
-#if wxUSE_THREADS
-    wxPendingEventsLocker = new wxCriticalSection();
-#endif
-
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
-    wxTheColourDatabase->Initialize();
-
-    wxInitializeStockLists();
-    wxInitializeStockObjects();
-
     wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
     wxClientWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
 
-    wxModule::RegisterModules();
-    if (!wxModule::InitializeModules()) return FALSE;
-
-    return TRUE;
+    return true;
 }
 
 void wxApp::CleanUp()
@@ -129,42 +115,7 @@ void wxApp::CleanUp()
     delete wxClientWidgetHashTable;
     wxClientWidgetHashTable = NULL;
 
-    wxModule::CleanUpModules();
-
-    delete wxTheColourDatabase;
-    wxTheColourDatabase = NULL;
-
-    wxDeleteStockObjects();
-
-    wxDeleteStockLists();
-
-    delete wxTheApp;
-    wxTheApp = NULL;
-
-    wxClassInfo::CleanUpClasses();
-
-#if wxUSE_THREADS
-    delete wxPendingEvents;
-    delete wxPendingEventsLocker;
-#endif
-
-#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_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.
-    if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
-    {
-        wxLogDebug("There were memory leaks.");
-        wxDebugContext::Dump();
-        wxDebugContext::PrintStatistics();
-    }
-#endif
-
-    // do it as the very last thing because everything else can log messages
-    wxLog::DontCreateOnDemand();
-    // do it as the very last thing because everything else can log messages
-    delete wxLog::SetActiveTarget(NULL);
+    wxAppBase::CleanUp();
 }
 
 // NB: argc and argv may be changed here, pass by reference!
@@ -935,24 +886,6 @@ bool wxApp::SendIdleEvents(wxWindow* win)
     return needMore;
 }
 
-void wxApp::DeletePendingObjects()
-{
-    wxNode *node = wxPendingDelete.GetFirst();
-    while (node)
-    {
-        wxObject *obj = (wxObject *)node->GetData();
-
-        delete obj;
-
-        if (wxPendingDelete.Member(obj))
-            delete node;
-
-        // Deleting one object may have deleted other pending
-        // objects, so start from beginning of list again.
-        node = wxPendingDelete.GetFirst();
-    }
-}
-
 // Create display, and other initialization
 bool wxApp::OnInitGui()
 {