]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/colour.cpp
Ensure that the native font is initialized so the face name and such
[wxWidgets.git] / src / x11 / colour.cpp
index 058c00d84dddbe030d27c67fa3a0fd44f7d1ed6b..d9ef08580817ffa92c598c118a4f137bdcaaccfb 100644 (file)
@@ -10,7 +10,7 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "colour.h"
 #endif
 
@@ -92,9 +92,9 @@ void wxColourRefData::FreeColour()
 {
     if (!m_colormap)
         return;
-        
-    if ((wxTheApp->m_visualType == GrayScale) ||
-        (wxTheApp->m_visualType == PseudoColor))
+#if !wxUSE_NANOX        
+    if ((wxTheApp->m_visualInfo->m_visualType == GrayScale) ||
+        (wxTheApp->m_visualInfo->m_visualType == PseudoColor))
     {
         int idx = m_color.pixel;
         colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] - 1;
@@ -105,6 +105,7 @@ void wxColourRefData::FreeColour()
             XFreeColors( wxGlobalDisplay(), (Colormap) m_colormap, &pixel, 1, 0 );
         }
     }
+#endif
 }
 
 void wxColourRefData::AllocColour( WXColormap cmap )
@@ -114,14 +115,16 @@ void wxColourRefData::AllocColour( WXColormap cmap )
 
     FreeColour();
 
-    if ((wxTheApp->m_visualType == GrayScale) ||
-        (wxTheApp->m_visualType == PseudoColor))
+#if !wxUSE_NANOX
+    if ((wxTheApp->m_visualInfo->m_visualType == GrayScale) ||
+        (wxTheApp->m_visualInfo->m_visualType == PseudoColor))
     {
         m_hasPixel = XAllocColor( wxGlobalDisplay(), (Colormap) cmap, &m_color );
         int idx = m_color.pixel;
         colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] + 1;
     }
     else
+#endif
     {
         m_hasPixel = XAllocColor( wxGlobalDisplay(), (Colormap) cmap, &m_color );
     }
@@ -154,10 +157,9 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
 
 void wxColour::InitFromName( const wxString &colourName )
 {
-    wxNode *node = (wxNode *) NULL;
-    if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
+    wxColour* col;
+    if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
     {
-        wxColour *col = (wxColour*)node->Data();
         UnRef();
         if (col) Ref( *col );
     }