X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8552e6f031ded8ae61b4a5b489fbf06962365da7..16c587ca765d00a17eb4fe83f6d94901a08801a4:/contrib/src/ogl/basic.cpp diff --git a/contrib/src/ogl/basic.cpp b/contrib/src/ogl/basic.cpp index 3a7abc3fa1..9c403af840 100644 --- a/contrib/src/ogl/basic.cpp +++ b/contrib/src/ogl/basic.cpp @@ -276,7 +276,7 @@ wxShape::wxShape(wxShapeCanvas *can) m_pen = g_oglBlackPen; m_brush = wxWHITE_BRUSH; m_font = g_oglNormalFont; - m_textColour = wxBLACK; + m_textColour = wxT("BLACK"); m_textColourName = wxT("BLACK"); m_visible = FALSE; m_selected = FALSE; @@ -604,7 +604,7 @@ void wxShape::FormatText(wxDC& dc, const wxString& s, int i) region->GetSize(&w, &h); - wxStringList *stringList = oglFormatText(dc, s, (w-5), (h-5), region->GetFormatMode()); + wxStringList *stringList = oglFormatText(dc, s, (w-2*m_textMarginX), (h-2*m_textMarginY), region->GetFormatMode()); node = (wxNode*)stringList->GetFirst(); while (node) { @@ -623,7 +623,7 @@ void wxShape::FormatText(wxDC& dc, const wxString& s, int i) (m_regions.GetCount() == 1) && !GraphicsInSizeToContents) { oglGetCentredTextExtent(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w, h, &actualW, &actualH); - if ((actualW+m_textMarginX != w ) || (actualH+m_textMarginY != h)) + if ((actualW+2*m_textMarginX != w ) || (actualH+2*m_textMarginY != h)) { // If we are a descendant of a composite, must make sure the composite gets // resized properly @@ -636,7 +636,7 @@ void wxShape::FormatText(wxDC& dc, const wxString& s, int i) wxCompositeShape *composite = (wxCompositeShape *)topAncestor; composite->Erase(dc); - SetSize(actualW+m_textMarginX, actualH+m_textMarginY); + SetSize(actualW+2*m_textMarginX, actualH+2*m_textMarginY); Move(dc, m_xpos, m_ypos); composite->CalculateSize(); if (composite->Selected()) @@ -653,15 +653,15 @@ void wxShape::FormatText(wxDC& dc, const wxString& s, int i) else { Erase(dc); - SetSize(actualW+m_textMarginX, actualH+m_textMarginY); + SetSize(actualW+2*m_textMarginX, actualH+2*m_textMarginY); Move(dc, m_xpos, m_ypos); } - SetSize(actualW+m_textMarginX, actualH+m_textMarginY); + SetSize(actualW+2*m_textMarginX, actualH+2*m_textMarginY); Move(dc, m_xpos, m_ypos); EraseContents(dc); } } - oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, actualW, actualH, region->GetFormatMode()); + oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, actualW-2*m_textMarginX, actualH-2*m_textMarginY, region->GetFormatMode()); m_formatted = TRUE; } @@ -677,7 +677,7 @@ void wxShape::Recentre(wxDC& dc) if (node) { wxShapeRegion *region = (wxShapeRegion *)node->GetData(); - oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w, h, region->GetFormatMode()); + oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w-2*m_textMarginX, h-2*m_textMarginY, region->GetFormatMode()); } } } @@ -753,8 +753,7 @@ int wxShape::GetFormatMode(int regionId) const void wxShape::SetTextColour(const wxString& the_colour, int regionId) { - wxColour *wxcolour = wxTheColourDatabase->FindColour(the_colour); - m_textColour = wxcolour; + m_textColour = wxTheColourDatabase->Find(the_colour); m_textColourName = the_colour; wxNode *node = m_regions.Item(regionId); @@ -920,16 +919,16 @@ void wxShape::OnDrawContents(wxDC& dc) wxShapeRegion *region = (wxShapeRegion *)m_regions.GetFirst()->GetData(); if (region->GetFont()) dc.SetFont(* region->GetFont()); - dc.SetTextForeground(* (region->GetActualColourObject())); + dc.SetTextForeground(region->GetActualColourObject()); dc.SetBackgroundMode(wxTRANSPARENT); if (!m_formatted) { - oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, bound_x, bound_y, region->GetFormatMode()); + oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, bound_x-2*m_textMarginX, bound_y-2*m_textMarginY, region->GetFormatMode()); m_formatted = TRUE; } if (!GetDisableLabel()) { - oglDrawFormattedText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, bound_x, bound_y, region->GetFormatMode()); + oglDrawFormattedText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, bound_x-2*m_textMarginX, bound_y-2*m_textMarginY, region->GetFormatMode()); } }