]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/app.cpp
Removed y_tab.c dependency
[wxWidgets.git] / src / motif / app.cpp
index 096845166fa6ca91936c37b3e5c4a65539bb41d8..63cfd7ab1cc754674a395f19d3ad6ee76d904196 100644 (file)
@@ -37,6 +37,7 @@
 #include "wx/intl.h"
 #include "wx/evtloop.h"
 #include "wx/hash.h"
+#include "wx/hashmap.h"
 
 #if wxUSE_THREADS
     #include "wx/thread.h"
@@ -58,6 +59,8 @@
 
 #include <string.h>
 
+WX_DECLARE_VOIDPTR_HASH_MAP( wxXVisualInfo*, wxXVisualInfoMap );
+
 extern wxList wxPendingDelete;
 extern bool wxAddIdleCallback();
 
@@ -101,17 +104,6 @@ bool wxApp::Initialize()
     wxInitializeStockLists();
     wxInitializeStockObjects();
 
-    // For PostScript printing
-#if wxUSE_POSTSCRIPT
-    /* Done using wxModule now
-    wxInitializePrintSetupData();
-    wxThePrintPaperDatabase = new wxPrintPaperDatabase;
-    wxThePrintPaperDatabase->CreateDatabase();
-    */
-#endif
-
-    wxBitmap::InitStandardHandlers();
-
     wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
 
     wxModule::RegisterModules();
@@ -136,16 +128,6 @@ void wxApp::CleanUp()
     delete wxTheColourDatabase;
     wxTheColourDatabase = NULL;
 
-#if wxUSE_POSTSCRIPT
-    /* Done using wxModule now
-    wxInitializePrintSetupData(FALSE);
-    delete wxThePrintPaperDatabase;
-    wxThePrintPaperDatabase = NULL;
-    */
-#endif
-
-    wxBitmap::CleanUpHandlers();
-
     wxClassInfo::CleanUpClasses();
 
     delete wxTheApp;
@@ -232,8 +214,8 @@ int wxEntry( int argc, char *argv[] )
     if ( pLog != NULL && pLog->HasPendingMessages() )
         pLog->Flush();
 
-    delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
-    // for further messages
+    // So dialog boxes aren't used for further messages
+    delete wxLog::SetActiveTarget(new wxLogStderr);
 
     if (wxTheApp->GetTopWindow())
     {
@@ -264,11 +246,21 @@ wxApp::wxApp()
     m_topLevelWidget = (WXWidget) NULL;
     m_maxRequestSize = 0;
     m_initialDisplay = (WXDisplay*) 0;
+    m_visualInfoMap = new wxXVisualInfoMap;
 }
 
 wxApp::~wxApp()
 {
     delete m_eventLoop;
+
+    for( wxXVisualInfoMap::iterator it  = m_visualInfoMap->begin(),
+                                    end = m_visualInfoMap->end();
+         it != end; ++it )
+    {
+        delete it->second;
+    }
+
+    delete m_visualInfoMap;
 }
 
 bool wxApp::Initialized()
@@ -514,6 +506,20 @@ WXColormap wxApp::GetMainColormap(WXDisplay* display)
     return (WXColormap) c;
 }
 
+wxXVisualInfo* wxApp::GetVisualInfo( WXDisplay* display )
+{
+    wxXVisualInfoMap::iterator it = m_visualInfoMap->find( display );
+
+    if( it != m_visualInfoMap->end() ) return it->second;
+
+    wxXVisualInfo* vi = new wxXVisualInfo;
+    wxFillXVisualInfo( vi, (Display*)display );
+
+    (*m_visualInfoMap)[display] = vi;
+
+    return vi;
+}
+
 void wxExit()
 {
     int retValue = 0;
@@ -522,7 +528,8 @@ void wxExit()
 
     wxApp::CleanUp();
     /*
-    * Exit in some platform-specific way. Not recommended that the app calls this:
+    * Exit in some platform-specific way.
+    * Not recommended that the app calls this:
     * only for emergencies.
     */
     exit(retValue);