X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1de8d512b7c844d67b2dab36addc89868e68c9b6..77a1771911ed222ba6861ead327c3735fc16a0b1:/src/common/gdicmn.cpp?ds=sidebyside diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index cbc45edf1f..61f6525035 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -17,11 +17,19 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif -#include "wx/event.h" #include "wx/gdicmn.h" + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/event.h" + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/dc.h" +#endif + #include "wx/brush.h" #include "wx/pen.h" #include "wx/bitmap.h" @@ -29,13 +37,9 @@ #include "wx/cursor.h" #include "wx/font.h" #include "wx/palette.h" -#include "wx/app.h" -#include "wx/dc.h" -#include "wx/utils.h" #include "wx/settings.h" #include "wx/hashmap.h" -#include "wx/log.h" #include #ifdef __WXMOTIF__ @@ -400,8 +404,6 @@ wxColour wxColourDatabase::Find(const wxString& colour) const wxColourDatabase * const self = wxConstCast(this, wxColourDatabase); self->Initialize(); - // first look among the existing colours - // make the comparaison case insensitive and also match both grey and gray wxString colName = colour; colName.MakeUpper(); @@ -415,48 +417,12 @@ wxColour wxColourDatabase::Find(const wxString& colour) const if ( it != m_map->end() ) return *(it->second); - // if we didn't find it, query the system, maybe it knows about it -#if defined(__WXGTK__) || defined(__X__) - wxColour col = wxColour::CreateByName(colour); - - if ( col.Ok() ) - { - // cache it - self->AddColour(colour, col); - } - - return col; -#elif defined(__X__) - // TODO: move this to wxColour::CreateByName() - XColor xcolour; - -#ifdef __WXMOTIF__ - Display *display = XtDisplay((Widget) wxTheApp->GetTopLevelWidget()) ; -#endif -#ifdef __WXX11__ - Display* display = (Display*) wxGetDisplay(); -#endif - /* MATTHEW: [4] Use wxGetMainColormap */ - if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour.ToAscii() ,&xcolour)) - return NULL; - -#if wxUSE_NANOX - unsigned char r = (unsigned char)(xcolour.red); - unsigned char g = (unsigned char)(xcolour.green); - unsigned char b = (unsigned char)(xcolour.blue); -#else - unsigned char r = (unsigned char)(xcolour.red >> 8); - unsigned char g = (unsigned char)(xcolour.green >> 8); - unsigned char b = (unsigned char)(xcolour.blue >> 8); -#endif - - wxColour col(r, g, b); - AddColour(colour, col); - - return col; -#else // other platform + // we did not find any result in existing colours: + // we won't use wxString -> wxColour conversion because the + // wxColour::Set(const wxString &) function which does that conversion + // internally uses this function (wxColourDatabase::Find) and we want + // to avoid infinite recursion ! return wxNullColour; -#endif // platforms } wxString wxColourDatabase::FindName(const wxColour& colour) const