X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/223d09f6b523aac674ef9b72a883dfa8d37c5d4e..270a909e20a2c652fd816ad14407113ad0319c9d:/src/common/gdicmn.cpp diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 106d32a3ef..4f33ad414b 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -41,7 +41,13 @@ #endif #ifdef __WXMOTIF__ +#ifdef __VMS__ +#pragma message disable nosimpint +#endif #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif #endif #if !USE_SHARED_LIBRARY @@ -493,7 +499,8 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style) for (wxNode * node = First (); node; node = node->Next ()) { wxPen *each_pen = (wxPen *) node->Data (); - if (each_pen && each_pen->GetVisible() && + if (each_pen && + each_pen->GetVisible() && each_pen->GetWidth () == width && each_pen->GetStyle () == style && each_pen->GetColour ().Red () == colour.Red () && @@ -508,6 +515,7 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style) // returning a pointer to an automatic variable and hanging on to it // (dangling pointer). pen->SetVisible(TRUE); + return pen; } @@ -536,19 +544,23 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style) for (wxNode * node = First (); node; node = node->Next ()) { wxBrush *each_brush = (wxBrush *) node->Data (); - if (each_brush && each_brush->GetVisible() && + if (each_brush && + each_brush->GetVisible() && each_brush->GetStyle () == style && each_brush->GetColour ().Red () == colour.Red () && each_brush->GetColour ().Green () == colour.Green () && each_brush->GetColour ().Blue () == colour.Blue ()) return each_brush; } + // Yes, we can return a pointer to this in a later FindOrCreateBrush call, // because we created it within FindOrCreateBrush. Safeguards against // returning a pointer to an automatic variable and hanging on to it // (dangling pointer). wxBrush *brush = new wxBrush (colour, style); + brush->SetVisible(TRUE); + return brush; } @@ -559,19 +571,19 @@ void wxBrushList::RemoveBrush (wxBrush * brush) wxFontList::~wxFontList () { - wxNode *node = First (); - while (node) + wxNode *node = First (); + while (node) { - // Only delete objects that are 'visible', i.e. - // that have been created using FindOrCreate..., - // where the pointers are expected to be shared - // (and therefore not deleted by any one part of an app). - wxFont *font = (wxFont *) node->Data (); - wxNode *next = node->Next (); - if (font->GetVisible()) - delete font; - node = next; -} + // Only delete objects that are 'visible', i.e. + // that have been created using FindOrCreate..., + // where the pointers are expected to be shared + // (and therefore not deleted by any one part of an app). + wxFont *font = (wxFont *) node->Data (); + wxNode *next = node->Next (); + if (font->GetVisible()) + delete font; + node = next; + } } void wxFontList::AddFont (wxFont * font) @@ -585,31 +597,32 @@ void wxFontList::RemoveFont (wxFont * font) } wxFont *wxFontList:: - FindOrCreateFont (int PointSize, int FamilyOrFontId, int Style, int Weight, bool underline, const wxString& Face) + FindOrCreateFont (int PointSize, int FamilyOrFontId, int Style, int Weight, bool underline, const wxString& Face, wxFontEncoding encoding) { for (wxNode * node = First (); node; node = node->Next ()) { wxFont *each_font = (wxFont *) node->Data (); - if (each_font && each_font->GetVisible() && each_font->Ok() && + if (each_font && + each_font->GetVisible() && + each_font->Ok() && each_font->GetPointSize () == PointSize && each_font->GetStyle () == Style && each_font->GetWeight () == Weight && each_font->GetUnderlined () == underline && - //#if defined(__X__) - // each_font->GetFontId () == FamilyOrFontId) /* New font system */ - //#else #if defined(__WXGTK__) (each_font->GetFamily() == FamilyOrFontId || - (each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) && + (each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) && #else each_font->GetFamily() == FamilyOrFontId && #endif - ((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face)) - //#endif + ((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face) && + (encoding == wxFONTENCODING_DEFAULT || each_font->GetEncoding() == encoding)) return each_font; } - wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face); + wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face, encoding); + font->SetVisible(TRUE); + return font; }