X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8552e6f031ded8ae61b4a5b489fbf06962365da7..1215ec07d82d1b70402fe32293752f77d3d593fd:/contrib/src/ogl/divided.cpp?ds=sidebyside diff --git a/contrib/src/ogl/divided.cpp b/contrib/src/ogl/divided.cpp index 41e62564d3..a84d56973e 100644 --- a/contrib/src/ogl/divided.cpp +++ b/contrib/src/ogl/divided.cpp @@ -6,13 +6,9 @@ // Created: 12/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "divided.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -21,11 +17,11 @@ #endif #ifndef WX_PRECOMP -#include +#include "wx/wx.h" #endif #if wxUSE_PROLOGIO -#include +#include "wx/deprecated/wxexpr.h" #endif #include "wx/ogl/ogl.h" @@ -81,7 +77,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc) if (m_pen) dc.SetPen(* m_pen); - if (m_textColour) dc.SetTextForeground(* m_textColour); + dc.SetTextForeground(m_textColour); #ifdef __WXMSW__ // For efficiency, don't do this under X - doesn't make @@ -93,7 +89,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc) if (!formatted) { FormatRegionText(); - formatted = TRUE; + formatted = true; } */ if (GetDisableLabel()) return; @@ -102,12 +98,12 @@ void wxDividedShape::OnDrawContents(wxDC& dc) double yMargin = 2; dc.SetBackgroundMode(wxTRANSPARENT); - wxNode *node = GetRegions().GetFirst(); + wxObjectList::compatibility_iterator node = GetRegions().GetFirst(); while (node) { wxShapeRegion *region = (wxShapeRegion *)node->GetData(); dc.SetFont(* region->GetFont()); - dc.SetTextForeground(* region->GetActualColourObject()); + dc.SetTextForeground(region->GetActualColourObject()); double proportion = region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY; @@ -157,7 +153,7 @@ void wxDividedShape::SetRegionSizes() // double leftX = (double)(m_xpos - (m_width / 2.0)); // double rightX = (double)(m_xpos + (m_width / 2.0)); - wxNode *node = GetRegions().GetFirst(); + wxObjectList::compatibility_iterator node = GetRegions().GetFirst(); while (node) { wxShapeRegion *region = (wxShapeRegion *)node->GetData(); @@ -245,7 +241,7 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, double *x, double *y, { bool isLeft = !(attachment < (n+1)); int i = (isLeft) ? (totalNumberAttachments - attachment - 1) : (attachment-1); - wxNode *node = GetRegions().Item(i); + wxObjectList::compatibility_iterator node = GetRegions().Item(i); if (node) { wxShapeRegion *region = (wxShapeRegion *)node->GetData(); @@ -285,10 +281,10 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, double *x, double *y, { *x = m_xpos; *y = m_ypos; - return FALSE; + return false; } } - return TRUE; + return true; } int wxDividedShape::GetNumberOfAttachments() const @@ -298,7 +294,7 @@ int wxDividedShape::GetNumberOfAttachments() const int n = (GetRegions().GetCount() * 2) + 2; int maxN = n - 1; - wxNode *node = m_attachmentPoints.GetFirst(); + wxObjectList::compatibility_iterator node = m_attachmentPoints.GetFirst(); while (node) { wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); @@ -317,9 +313,9 @@ bool wxDividedShape::AttachmentIsValid(int attachment) const return wxShape::AttachmentIsValid(attachment); } else if (attachment >= 0) - return TRUE; + return true; else - return FALSE; + return false; } void wxDividedShape::Copy(wxShape& copy) @@ -341,7 +337,7 @@ void wxDividedShape::MakeMandatoryControlPoints() double currentY = (double)(GetY() - (m_height / 2.0)); double maxY = (double)(GetY() + (m_height / 2.0)); - wxNode *node = GetRegions().GetFirst(); + wxObjectList::compatibility_iterator node = GetRegions().GetFirst(); int i = 0; while (node) { @@ -379,14 +375,14 @@ void wxDividedShape::ResetMandatoryControlPoints() double currentY = (double)(GetY() - (m_height / 2.0)); double maxY = (double)(GetY() + (m_height / 2.0)); - wxNode *node = m_controlPoints.GetFirst(); + wxObjectList::compatibility_iterator node = m_controlPoints.GetFirst(); int i = 0; while (node) { wxControlPoint *controlPoint = (wxControlPoint *)node->GetData(); if (controlPoint->IsKindOf(CLASSINFO(wxDividedShapeControlPoint))) { - wxNode *node1 = GetRegions().Item(i); + wxObjectList::compatibility_iterator node1 = GetRegions().Item(i); wxShapeRegion *region = (wxShapeRegion *)node1->GetData(); double proportion = region->m_regionProportionY; @@ -524,7 +520,7 @@ void wxDividedShape::EditRegions() wxEndBusyCursor(); - dialog->Show(TRUE); + dialog->Show(true); node = GetRegions().GetFirst(); i = 0; @@ -585,7 +581,7 @@ void wxDividedShapeControlPoint::OnDragLeft(bool WXUNUSED(draw), double WXUNUSED GetCanvas()->PrepareDC(dc); dc.SetLogicalFunction(OGLRBLF); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); + wxPen dottedPen(*wxBLACK, 1, wxDOT); dc.SetPen(dottedPen); dc.SetBrush((* wxTRANSPARENT_BRUSH)); @@ -604,7 +600,7 @@ void wxDividedShapeControlPoint::OnBeginDragLeft(double WXUNUSED(x), double y, i wxDividedShape *dividedObject = (wxDividedShape *)m_shape; dc.SetLogicalFunction(OGLRBLF); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); + wxPen dottedPen(*wxBLACK, 1, wxDOT); dc.SetPen(dottedPen); dc.SetBrush((* wxTRANSPARENT_BRUSH)); @@ -622,7 +618,7 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int GetCanvas()->PrepareDC(dc); wxDividedShape *dividedObject = (wxDividedShape *)m_shape; - wxNode *node = dividedObject->GetRegions().Item(regionId); + wxObjectList::compatibility_iterator node = dividedObject->GetRegions().Item(regionId); if (!node) return; @@ -642,10 +638,6 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int // Save values double thisRegionTop = 0.0; - #if 0 - // this variable is not readed later - double thisRegionBottom = 0.0; - #endif double nextRegionBottom = 0.0; node = dividedObject->GetRegions().GetFirst(); @@ -660,10 +652,6 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int if (region == thisRegion) { thisRegionTop = currentY; - #if 0 - // no need for assignment if value is not used later - thisRegionBottom = actualY; - #endif if (node->GetNext()) nextRegion = (wxShapeRegion *)node->GetNext()->GetData(); } @@ -700,9 +688,8 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int wxShapeRegion *region = (wxShapeRegion *)node->GetData(); if (region->GetText()) { - wxChar *s = copystring(region->GetText()); - dividedObject->FormatText(dc, s, i); - delete[] s; + wxString s(region->GetText()); + dividedObject->FormatText(dc, s.c_str(), i); } node = node->GetNext(); i++;