]> git.saurik.com Git - wxWidgets.git/commitdiff
wxPalette unified. Source cleaning.
authorWłodzimierz Skiba <abx@abx.art.pl>
Thu, 6 Oct 2005 14:37:43 +0000 (14:37 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Thu, 6 Oct 2005 14:37:43 +0000 (14:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

20 files changed:
docs/latex/wx/palette.tex
include/wx/generic/paletteg.h
include/wx/mac/carbon/palette.h
include/wx/mac/classic/palette.h
include/wx/mgl/palette.h
include/wx/motif/palette.h
include/wx/msw/palette.h
include/wx/os2/palette.h
include/wx/palette.h
include/wx/palmos/palette.h
include/wx/x11/palette.h
src/generic/paletteg.cpp
src/mac/carbon/palette.cpp
src/mac/classic/palette.cpp
src/mgl/palette.cpp
src/motif/palette.cpp
src/msw/palette.cpp
src/os2/palette.cpp
src/palmos/palette.cpp
src/x11/palette.cpp

index bf6c5e0994c1aaad15b8ebdda80de8d321f43513..f46329e085bc4f31b8f9b51caf240aa872b595ea 100644 (file)
@@ -1,3 +1,14 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Name:        palette.tex
+%% Purpose:     wxPalette docs
+%% Author:
+%% Modified by:
+%% Created:
+%% RCS-ID:      $Id$
+%% Copyright:   (c) wxWidgets
+%% License:     wxWindows license
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 \section{\class{wxPalette}}\label{wxpalette}
 
 A palette is a table that maps pixel values to RGB colours. It allows the colours
@@ -100,8 +111,8 @@ Returns number of entries in palette.
 
 \membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
 
-\constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp
- \param{const unsigned char }{blue}}
+\constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp
+ \param{unsigned char }{blue}}
 
 Returns a pixel value (index into the palette) for the given RGB values.
 
@@ -115,7 +126,7 @@ Returns a pixel value (index into the palette) for the given RGB values.
 
 \wxheading{Return value}
 
-The nearest palette index.
+The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors.
 
 \wxheading{See also}
 
@@ -177,5 +188,3 @@ fail the test.
 
 Inequality operator. Two palettes are not equal if they contain pointers
 to different underlying palette data. It does not compare each attribute.
-
-
index 4f1ee46384b3c2abc3fe441728b9b0afe4a85f4f..0c0f7547dd3a7b5a26ccf2522c18dd52c42bb6fb 100644 (file)
@@ -1,9 +1,9 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/generic/paletteg.h
 // Purpose:
 // Author:      Robert Roebling
 // Created:     01/02/97
-// Id:
+// RCS-ID:      $Id$
 // Copyright:   (c) 1998 Robert Roebling and Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -43,7 +43,7 @@ class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase
     virtual bool Ok() const;
 
     bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-    int GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const;
+    int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const;
     bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const;
 
     // no data
index 04368cb846e2e320fbf306b37f8113ee313fee9a..96222de640f33e9689479fa92a05d1af2eebfe52 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/mac/carbon/palette.h
 // Purpose:     wxPalette class
 // Author:      Stefan Csomor
 // Modified by:
@@ -45,7 +45,7 @@ public:
   wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
   ~wxPalette();
   bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-  int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
+  int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
   bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
 
   virtual bool Ok() const { return (m_refData != NULL) ; }
index 04368cb846e2e320fbf306b37f8113ee313fee9a..c888113b88c385e6b54023a9d3b1ea6dd9abb9a6 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/mac/classic/palette.h
 // Purpose:     wxPalette class
 // Author:      Stefan Csomor
 // Modified by:
@@ -45,7 +45,7 @@ public:
   wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
   ~wxPalette();
   bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-  int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
+  int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
   bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
 
   virtual bool Ok() const { return (m_refData != NULL) ; }
index 00c12217d6aff07a7c7b4cf6edd966098dd2acbe..a9878d2676adc5711704a2e0b0951729c95665a0 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/mgl/palette.h
 // Purpose:
 // Author:      Vaclav Slavik
 // Created:     2001/03/11
@@ -42,7 +42,7 @@ public:
     virtual bool Ok() const;
 
     bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-    int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
+    int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
     bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
 
     // implementation
index 9cd7318a8b30826f7801d8667d389fcfe9107d6e..2ba91c323ada9f4f7c7776241668a55c9d414d26 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/motif/palette.h
 // Purpose:     wxPalette class
 // Author:      Julian Smart
 // Modified by:
@@ -56,7 +56,7 @@ public:
     wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
     ~wxPalette();
     bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-    int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
+    int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
     bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
 
     virtual bool Ok() const { return (m_refData != NULL) ; }
index aadbd85938ca825857a312149e5afdc13f67978b..748d14b9ecf31403ba92a2b098881a4ef76d27b0 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/msw/palette.h
 // Purpose:     wxPalette class
 // Author:      Julian Smart
 // Modified by:
@@ -39,7 +39,7 @@ public:
   wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
   ~wxPalette(void);
   bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-  int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
+  int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
   bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
 
   virtual bool Ok(void) const { return (m_refData != NULL) ; }
index 1926409552aa405b884b92158458559273f57e0f..3e90e0568234a640491b32fd3c7543bce69bd5a8 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/os2/palette.h
 // Purpose:     wxPalette class
 // Author:      David Webster
 // Modified by:
@@ -50,9 +50,9 @@ public:
                 ,const unsigned char* pGreen
                 ,const unsigned char* pBlue
                );
-    int  GetPixel( const unsigned char cRed
-                  ,const unsigned char cGreen
-                  ,const unsigned char cBlue
+    int  GetPixel( unsigned char cRed
+                  ,unsigned char cGreen
+                  ,unsigned char cBlue
                  ) const;
     bool GetRGB( int            nPixel
                 ,unsigned char* pRed
@@ -77,4 +77,3 @@ public:
 
 #endif
     // _WX_PALETTE_H_
-
index ec364de2bb6ddf01fb55a4762c275e8b50795331..28951a21cee56c20bc7801746f0e614c44814a60 100644 (file)
@@ -19,7 +19,7 @@
 #include "wx/object.h"
 #include "wx/gdiobj.h"
 
-// wxBrushBase
+// wxPaletteBase
 class WXDLLEXPORT wxPaletteBase: public wxGDIObject
 {
 public:
index 090a9b6a203e6b69ccf8a4b24487e4d632275bed..602d0f28f92ccf5ba9ea50979c44a8986ea8da64 100644 (file)
@@ -39,7 +39,7 @@ public:
   wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
   ~wxPalette(void);
   bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-  int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
+  int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
   bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
 
   virtual bool Ok(void) const { return (m_refData != NULL) ; }
index 0a73faea34e51301760e3aecdf760ce090de9908..c36269fbba7bb68fec2a1e804fe7e08c8ee05d99 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.h
+// Name:        wx/x11/palette.h
 // Purpose:     wxPalette class
 // Author:      Julian Smart
 // Modified by:
@@ -56,7 +56,7 @@ public:
     wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
     ~wxPalette();
     bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
-    int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
+    int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
     bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
 
     virtual bool Ok() const { return (m_refData != NULL) ; }
index bc604731437693b6a4cfdbc8653458883f4e1fc3..24900fc538548721c72e8a08ed153ee9fd6a67a6 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:
 // Author:      Robert Roebling
 // Created:     01/02/97
-// Id:
+// RCS-ID:      $Id$
 // Copyright:   (c) 1998 Robert Roebling and Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -120,11 +120,11 @@ bool wxPalette::Create(int n,
     return true;
 }
 
-int wxPalette::GetPixel( const unsigned char red,
-                         const unsigned char green,
-                         const unsigned char blue ) const
+int wxPalette::GetPixel( unsigned char red,
+                         unsigned char green,
+                         unsigned char blue ) const
 {
-    if (!m_refData) return false;
+    if (!m_refData) return wxNOT_FOUND;
 
     int closest = 0;
     double d,distance = 1000.0; // max. dist is 256
@@ -158,5 +158,3 @@ bool wxPalette::GetRGB(int pixel,
 }
 
 #endif // wxUSE_PALETTE
-
-
index 33cd9b972dee43dd32be8e6e29a7c2598d9f58a2..642af2b89bbbb2c374a7a901982f6c0ad3099110 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/mac/carbon/palette.cpp
 // Purpose:     wxPalette
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -52,29 +52,29 @@ wxPalette::~wxPalette()
 bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
 {
     UnRef();
-    
+
     m_refData = new wxPaletteRefData;
-    
+
     M_PALETTEDATA->m_count = n ;
     M_PALETTEDATA->m_palette = new wxColour[n] ;
-    
+
     for ( int i = 0 ; i < n ; ++i)
     {
         M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
     }
-    
-    return FALSE;
+
+    return false;
 }
 
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char blue) const
 {
     if ( !m_refData )
-        return -1;
-    
+        return wxNOT_FOUND;
+
     long bestdiff = 3 * 256 ;
     long bestpos = 0 ;
     long currentdiff ;
-    
+
     for ( int i = 0  ; i < M_PALETTEDATA->m_count ; ++i )
     {
         const wxColour& col = M_PALETTEDATA->m_palette[i] ;
@@ -84,29 +84,28 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
             bestdiff = currentdiff ;
             bestpos = i ;
             if ( bestdiff == 0 )
-                break ; 
+                break ;
         }
     }
-    
+
     return bestpos;
 }
 
 bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
 {
     if ( !m_refData )
-        return FALSE;
-    
+        return false;
+
     if (index < 0 || index >= M_PALETTEDATA->m_count)
-        return FALSE;
-    
+        return false;
+
     const wxColour& col = M_PALETTEDATA->m_palette[index] ;
     *red = col.Red() ;
     *green = col.Green() ;
     *blue = col.Blue() ;
-    
-    return TRUE;
+
+    return true;
 }
 
 #endif
 // wxUSE_PALETTE
-
index c8760b0e79028f48d06bb5cb96dfbd03cafa587c..02720f58d47154ef338c4f85546d3de20c83ddb9 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/mac/classic/palette.cpp
 // Purpose:     wxPalette
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/defs.h"
@@ -52,29 +52,29 @@ wxPalette::~wxPalette()
 bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
 {
     UnRef();
-    
+
     m_refData = new wxPaletteRefData;
-    
+
     M_PALETTEDATA->m_count = n ;
     M_PALETTEDATA->m_palette = new wxColour[n] ;
-    
+
     for ( int i = 0 ; i < n ; ++i)
     {
         M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
     }
-    
-    return FALSE;
+
+    return false;
 }
 
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char blue) const
 {
     if ( !m_refData )
-        return -1;
-    
+        return wxNOT_FOUND;
+
     long bestdiff = 3 * 256 ;
     long bestpos = 0 ;
     long currentdiff ;
-    
+
     for ( int i = 0  ; i < M_PALETTEDATA->m_count ; ++i )
     {
         const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
@@ -84,29 +84,28 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
             bestdiff = currentdiff ;
             bestpos = i ;
             if ( bestdiff == 0 )
-                break ; 
+                break ;
         }
     }
-    
+
     return bestpos;
 }
 
 bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
 {
     if ( !m_refData )
-        return FALSE;
-    
+        return false;
+
     if (index < 0 || index >= M_PALETTEDATA->m_count)
-        return FALSE;
-    
+        return false;
+
     const wxColour& col = &M_PALETTEDATA->m_palette[index] ;
     *red = col.Red() ;
     *green = col.Green() ;
     *blue = col.Blue() ;
-    
-    return TRUE;
+
+    return true;
 }
 
 #endif
 // wxUSE_PALETTE
-
index 4414b2d587c922296c7ccd5bd5d5c430296de5e8..a21e74e10434475dcaf44711e95b96efa66ce999 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/mgl/palette.cpp
 // Author:      Vaclav Slavik
 // Created:     2001/03/11
 // Id:          $Id$
@@ -27,7 +27,7 @@ class wxPaletteRefData: public wxObjectRefData
     public:
         wxPaletteRefData(void);
         ~wxPaletteRefData(void);
-    
+
         int m_count;
         palette_t *m_entries;
 };
@@ -92,13 +92,13 @@ bool wxPalette::Ok(void) const
 
 bool wxPalette::Create(int n,
                        const unsigned char *red,
-                       const unsigned char *green, 
+                       const unsigned char *green,
                        const unsigned char *blue)
 {
     UnRef();
     m_refData = new wxPaletteRefData();
-    
-    M_PALETTEDATA->m_count = n;    
+
+    M_PALETTEDATA->m_count = n;
     M_PALETTEDATA->m_entries = new palette_t[n];
 
     palette_t *e = M_PALETTEDATA->m_entries;
@@ -110,17 +110,17 @@ bool wxPalette::Create(int n,
         e->alpha = 0;
     }
 
-    return TRUE;
+    return true;
 }
 
-int wxPalette::GetPixel(const unsigned char red,
-                        const unsigned char green,
-                        const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char red,
+                        unsigned char green,
+                        unsigned char blue) const
 {
-    if (!m_refData) return FALSE;
+    if (!m_refData) return wxNOT_FOUND;
 
-       int closest = 0;
-       double d,distance = 1000.0; // max. dist is 256
+    int closest = 0;
+    double d, distance = 1000.0; // max. dist is 256
 
     palette_t *e = M_PALETTEDATA->m_entries;
     for (int i = 0; i < M_PALETTEDATA->m_count; i++, e++)
@@ -132,33 +132,33 @@ int wxPalette::GetPixel(const unsigned char red,
             closest = i;
         }
     }
-       return closest;
+
+    return closest;
 }
 
-bool wxPalette::GetRGB(int pixel, 
+bool wxPalette::GetRGB(int pixel,
                        unsigned char *red,
-                       unsigned char *green, 
+                       unsigned char *green,
                        unsigned char *blue) const
 {
-    if (!m_refData) return FALSE;
-    if (pixel >= M_PALETTEDATA->m_count) return FALSE;
-    
+    if (!m_refData) return false;
+    if (pixel >= M_PALETTEDATA->m_count) return false;
+
     palette_t& p = M_PALETTEDATA->m_entries[pixel];
     if (red) *red = p.red;
     if (green) *green = p.green;
     if (blue) *blue = p.blue;
-    return TRUE;
+    return true;
 }
 
 int wxPalette::GetColoursCount() const
 {
-    wxCHECK_MSG( Ok(), 0, wxT("invalid palette") );   
+    wxCHECK_MSG( Ok(), 0, wxT("invalid palette") );
     return M_PALETTEDATA->m_count;
 }
 
 palette_t *wxPalette::GetMGLpalette_t() const
 {
-    wxCHECK_MSG( Ok(), NULL, wxT("invalid palette") );   
+    wxCHECK_MSG( Ok(), NULL, wxT("invalid palette") );
     return M_PALETTEDATA->m_entries;
 }
-
index 1a203ae82cb97393be4e8f1e8e1311292a7b6dac..6080c475bca6d8c76f86ce43935e892647ba0b32 100644 (file)
@@ -165,15 +165,15 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
     return true;
 }
 
-int wxPalette::GetPixel(const unsigned char WXUNUSED(red),
-                        const unsigned char WXUNUSED(green),
-                        const unsigned char WXUNUSED(blue)) const
+int wxPalette::GetPixel(unsigned char WXUNUSED(red),
+                        unsigned char WXUNUSED(green),
+                        unsigned char WXUNUSED(blue)) const
 {
     if ( !m_refData )
-        return false;
+        return wxNOT_FOUND;
 
     // TODO
-    return false;
+    return wxNOT_FOUND;
 }
 
 bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue)) const
@@ -358,4 +358,3 @@ void wxPalette::PutXColormap(WXDisplay* display, WXColormap cm, bool dp)
 
     M_PALETTEDATA->m_palettes.Append(c);
 }
-
index dc9dfabf86fdb4c9fe197c705ffdfc659eb207a1..c958a25a2a5dee0d9022a3d04080f0002df552f2 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/msw/palette.cpp
 // Purpose:     wxPalette
 // Author:      Julian Smart
 // Modified by:
@@ -33,7 +33,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
 
 wxPaletteRefData::wxPaletteRefData(void)
 {
-  m_hPalette = 0;
+    m_hPalette = 0;
 }
 
 wxPaletteRefData::~wxPaletteRefData(void)
@@ -67,71 +67,72 @@ bool wxPalette::FreeResource(bool WXUNUSED(force))
 
 bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
 {
-  UnRef();
+    UnRef();
 
 #if defined(__WXMICROWIN__)
 
-  return false;
+    return false;
 
 #else
 
-  m_refData = new wxPaletteRefData;
+    m_refData = new wxPaletteRefData;
 
-  NPLOGPALETTE npPal = (NPLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
-                        (WORD)n * sizeof(PALETTEENTRY));
-  if (!npPal)
-    return false;
+    NPLOGPALETTE npPal = (NPLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
+                          (WORD)n * sizeof(PALETTEENTRY));
+    if (!npPal)
+        return false;
 
-  npPal->palVersion = 0x300;
-  npPal->palNumEntries = (WORD)n;
-
-  int i;
-  for (i = 0; i < n; i ++)
-  {
-    npPal->palPalEntry[i].peRed = red[i];
-    npPal->palPalEntry[i].peGreen = green[i];
-    npPal->palPalEntry[i].peBlue = blue[i];
-    npPal->palPalEntry[i].peFlags = 0;
-  }
-  M_PALETTEDATA->m_hPalette = (WXHPALETTE) CreatePalette((LPLOGPALETTE)npPal);
-  LocalFree((HANDLE)npPal);
-  return true;
+    npPal->palVersion = 0x300;
+    npPal->palNumEntries = (WORD)n;
+
+    int i;
+    for (i = 0; i < n; i ++)
+    {
+        npPal->palPalEntry[i].peRed = red[i];
+        npPal->palPalEntry[i].peGreen = green[i];
+        npPal->palPalEntry[i].peBlue = blue[i];
+        npPal->palPalEntry[i].peFlags = 0;
+    }
+    M_PALETTEDATA->m_hPalette = (WXHPALETTE) CreatePalette((LPLOGPALETTE)npPal);
+    LocalFree((HANDLE)npPal);
+    return true;
 
 #endif
 }
 
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char blue) const
 {
 #ifdef __WXMICROWIN__
-  return 0;
+    return wxNOT_FOUND;
 #else
-  if ( !m_refData )
-    return 0;
+    if ( !m_refData )
+        return wxNOT_FOUND;
 
-  return ::GetNearestPaletteIndex((HPALETTE) M_PALETTEDATA->m_hPalette, PALETTERGB(red, green, blue));
+    return ::GetNearestPaletteIndex((HPALETTE) M_PALETTEDATA->m_hPalette, PALETTERGB(red, green, blue));
 #endif
 }
 
 bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
 {
 #ifdef __WXMICROWIN__
-  return false;
-#else
-  if ( !m_refData )
     return false;
+#else
+    if ( !m_refData )
+        return false;
+
+    if (index < 0 || index > 255)
+        return false;
 
-  if (index < 0 || index > 255)
-         return false;
-
-  PALETTEENTRY entry;
-  if (::GetPaletteEntries((HPALETTE) M_PALETTEDATA->m_hPalette, index, 1, &entry))
-  {
-         *red = entry.peRed;
-         *green = entry.peGreen;
-         *blue = entry.peBlue;
-         return true;
-  } else
-         return false;
+    PALETTEENTRY entry;
+    if (::GetPaletteEntries((HPALETTE) M_PALETTEDATA->m_hPalette, index, 1, &entry))
+    {
+        *red = entry.peRed;
+        *green = entry.peGreen;
+        *blue = entry.peBlue;
+        return true;
+    }
+    else
+        return false;
 #endif
 }
 
@@ -144,4 +145,3 @@ void wxPalette::SetHPALETTE(WXHPALETTE pal)
 }
 
 #endif // wxUSE_PALETTE
-
index dd48397fc91c7cea3d9203de3af09d7fe000b290..b28c4307d2939d54abd2e0f08fefaf60f35370c3 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/os2/palette.cpp
 // Purpose:     wxPalette
 // Author:      AUTHOR
 // Modified by:
@@ -106,22 +106,20 @@ bool wxPalette::Create( int n,
     return true;
 } // end of wxPalette::Create
 
-int wxPalette::GetPixel(
-  const unsigned char               cRed
-, const unsigned char               cGreen
-, const unsigned char               cBlue
-) const
+int wxPalette::GetPixel( unsigned char cRed,
+                         unsigned char cGreen,
+                         unsigned char cBlue) const
 {
-    bool                            bFound = FALSE;
-    PULONG                          pualTable = NULL;
-    ULONG                           ulNumEntries;
-    ULONG                           ulRGB = (PC_RESERVED * 16777216) +
-                                            ((int)cRed * 65536) +
-                                            ((int)cGreen * 256) +
-                                             (int)cBlue;
+    bool    bFound = false;
+    PULONG  pualTable = NULL;
+    ULONG   ulNumEntries;
+    ULONG   ulRGB = (PC_RESERVED * 16777216) +
+                    ((int)cRed * 65536) +
+                    ((int)cGreen * 256) +
+                    (int)cBlue;
 
     if (!m_refData)
-        return FALSE;
+        return wxNOT_FOUND;
 
     //
     // Get number of entries first
@@ -159,26 +157,24 @@ int wxPalette::GetPixel(
         }
     }
     if (!bFound)
-        return 0;
+        return wxNOT_FOUND;
     return (i + 1);
 } // end of wxPalette::GetPixel
 
-bool wxPalette::GetRGB(
-  int                               nIndex
-, unsigned char*                    pRed
-, unsigned char*                    pGreen
-, unsigned char*                    pBlue
-) const
+bool wxPalette::GetRGB( int nIndex,
+                        unsigned char* pRed,
+                        unsigned char* pGreen,
+                        unsigned char* pBlue) const
 {
     PULONG                          pualTable = NULL;
     RGB2                            vRGB;
     ULONG                           ulNumEntries;
 
     if (!m_refData)
-        return FALSE;
+        return false;
 
     if (nIndex < 0 || nIndex > 255)
-        return FALSE;
+        return false;
     //
     // Get number of entries first
     //
@@ -207,7 +203,7 @@ bool wxPalette::GetRGB(
     *pBlue  = vRGB.bBlue;
     *pGreen = vRGB.bGreen;
     *pRed   = vRGB.bRed;
-    return TRUE;
+    return true;
 } // end of wxPalette::GetRGB
 
 void wxPalette::SetHPALETTE(
index db1e28ab4aad63bdc8ba595fe6d30163d8930e4e..f89c8b4eae0bd85380b9c73022e1e1be406a815f 100644 (file)
@@ -61,9 +61,9 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
     return false;
 }
 
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char blue) const
 {
-    return 0;
+    return wxNOT_FOUND;
 }
 
 bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
@@ -76,4 +76,3 @@ void wxPalette::SetHPALETTE(WXHPALETTE pal)
 }
 
 #endif // wxUSE_PALETTE
-
index e03aed5237c314131662a30ffeae121685a83876..5b0ac77201f275268617f72c5ddfbc1d6edc0c3e 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/x11/palette.cpp
 // Purpose:     wxPalette
 // Author:      Julian Smart
 // Modified by:
@@ -164,13 +164,13 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
     return true;
 }
 
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char blue) const
 {
     if ( !m_refData )
-        return FALSE;
+        return wxNOT_FOUND;
 
     // TODO
-    return FALSE;
+    return wxNOT_FOUND;
 }
 
 bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue)) const
@@ -351,4 +351,3 @@ void wxPalette::PutXColormap(WXDisplay* display, WXColormap cm, bool dp)
 
     M_PALETTEDATA->m_palettes.Append(c);
 }
-