X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1dde66dda68a3d712d2f4de0388c4bb3a3375b36..209f3e1453dd576919bf1cc8f696218dae23c34b:/contrib/src/ogl/lines.cpp diff --git a/contrib/src/ogl/lines.cpp b/contrib/src/ogl/lines.cpp index 76f10c4aeb..5db7a49046 100644 --- a/contrib/src/ogl/lines.cpp +++ b/contrib/src/ogl/lines.cpp @@ -6,7 +6,7 @@ // Created: 12/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -25,7 +25,7 @@ #include #endif -#if wxUSE_DEPRECATED +#if wxUSE_PROLOGIO #include #endif @@ -34,15 +34,9 @@ #endif #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "wx/ogl/ogl.h" + // Line shape IMPLEMENT_DYNAMIC_CLASS(wxLineShape, wxShape) @@ -50,7 +44,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxLineShape, wxShape) wxLineShape::wxLineShape() { m_sensitivity = OP_CLICK_LEFT | OP_CLICK_RIGHT; - m_draggable = FALSE; + m_draggable = false; m_attachmentTo = 0; m_attachmentFrom = 0; /* @@ -59,11 +53,11 @@ wxLineShape::wxLineShape() */ m_from = NULL; m_to = NULL; - m_erasing = FALSE; + m_erasing = false; m_arrowSpacing = 5.0; // For the moment, don't bother saving this to file. - m_ignoreArrowOffsets = FALSE; - m_isSpline = FALSE; - m_maintainStraightLines = FALSE; + m_ignoreArrowOffsets = false; + m_isSpline = false; + m_maintainStraightLines = false; m_alignmentStart = 0; m_alignmentEnd = 0; @@ -102,7 +96,7 @@ wxLineShape::~wxLineShape() { if (m_labelObjects[i]) { - m_labelObjects[i]->Select(FALSE); + m_labelObjects[i]->Select(false); m_labelObjects[i]->RemoveFromCanvas(m_canvas); delete m_labelObjects[i]; m_labelObjects[i] = NULL; @@ -120,8 +114,7 @@ void wxLineShape::MakeLineControlPoints(int n) } m_lineControlPoints = new wxList; - int i = 0; - for (i = 0; i < n; i++) + for (int i = 0; i < n; i++) { wxRealPoint *point = new wxRealPoint(-999, -999); m_lineControlPoints->Append((wxObject*) point); @@ -150,7 +143,7 @@ wxNode *wxLineShape::InsertLineControlPoint(wxDC* dc) bool wxLineShape::DeleteLineControlPoint() { if (m_lineControlPoints->GetCount() < 3) - return FALSE; + return false; wxNode *last = m_lineControlPoints->GetLast(); wxNode *second_last = last->GetPrevious(); @@ -159,7 +152,7 @@ bool wxLineShape::DeleteLineControlPoint() delete second_last_point; delete second_last; - return TRUE; + return true; } void wxLineShape::Initialise() @@ -248,7 +241,7 @@ void wxLineShape::FormatText(wxDC& dc, const wxString& s, int i) EraseRegion(dc, region, xx, yy); if (m_labelObjects[i]) { - m_labelObjects[i]->Select(FALSE, &dc); + m_labelObjects[i]->Select(false, &dc); m_labelObjects[i]->Erase(dc); m_labelObjects[i]->SetSize(actualW, actualH); } @@ -257,13 +250,13 @@ void wxLineShape::FormatText(wxDC& dc, const wxString& s, int i) if (m_labelObjects[i]) { - m_labelObjects[i]->Select(TRUE, & dc); + m_labelObjects[i]->Select(true, & dc); m_labelObjects[i]->Draw(dc); } } } oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, actualW, actualH, region->GetFormatMode()); - m_formatted = TRUE; + m_formatted = true; } void wxLineShape::DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y) @@ -293,7 +286,7 @@ void wxLineShape::DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y dc.DrawRectangle((long)(xp - w/2.0), (long)(yp - h/2.0), (long)w, (long)h); if (m_pen) dc.SetPen(* m_pen); - dc.SetTextForeground(* region->GetActualColourObject()); + dc.SetTextForeground(region->GetActualColourObject()); #ifdef __WXMSW__ dc.SetTextBackground(GetBackgroundBrush().GetColour()); @@ -470,10 +463,10 @@ void wxLineShape::SetAttachments(int from_attach, int to_attach) bool wxLineShape::HitTest(double x, double y, int *attachment, double *distance) { if (!m_lineControlPoints) - return FALSE; + return false; // Look at label regions in case mouse is over a label - bool inLabelRegion = FALSE; + bool inLabelRegion = false; for (int i = 0; i < 3; i ++) { wxNode *regionNode = m_regions.Item(i); @@ -495,7 +488,7 @@ bool wxLineShape::HitTest(double x, double y, int *attachment, double *distance) double rBottom = (double)(cy + (ch/2.0)); if (x > rLeft && x < rRight && y > rTop && y < rBottom) { - inLabelRegion = TRUE; + inLabelRegion = true; i = 3; } } @@ -519,19 +512,19 @@ bool wxLineShape::HitTest(double x, double y, int *attachment, double *distance) seg_len*((x-point1->x)*dy-(y-point1->y)*dx)/(dy*dy+dx*dx); double distance_from_prev = seg_len*((y-point1->y)*dy+(x-point1->x)*dx)/(dy*dy+dx*dx); - + if ((fabs(distance_from_seg) < extra && distance_from_prev >= 0 && distance_from_prev <= seg_len) || inLabelRegion) { *attachment = 0; *distance = distance_from_seg; - return TRUE; + return true; } node = node->GetNext(); } - return FALSE; + return false; } void wxLineShape::DrawArrows(wxDC& dc) @@ -551,10 +544,10 @@ void wxLineShape::DrawArrows(wxDC& dc) { if ((arrow->GetXOffset() != 0.0) && !m_ignoreArrowOffsets) // If specified, x offset is proportional to line length - DrawArrow(dc, arrow, arrow->GetXOffset(), TRUE); + DrawArrow(dc, arrow, arrow->GetXOffset(), true); else { - DrawArrow(dc, arrow, startArrowPos, FALSE); // Absolute distance + DrawArrow(dc, arrow, startArrowPos, false); // Absolute distance startArrowPos += arrow->GetSize() + arrow->GetSpacing(); } break; @@ -562,10 +555,10 @@ void wxLineShape::DrawArrows(wxDC& dc) case ARROW_POSITION_END: { if ((arrow->GetXOffset() != 0.0) && !m_ignoreArrowOffsets) - DrawArrow(dc, arrow, arrow->GetXOffset(), TRUE); + DrawArrow(dc, arrow, arrow->GetXOffset(), true); else { - DrawArrow(dc, arrow, endArrowPos, FALSE); + DrawArrow(dc, arrow, endArrowPos, false); endArrowPos += arrow->GetSize() + arrow->GetSpacing(); } break; @@ -574,10 +567,10 @@ void wxLineShape::DrawArrows(wxDC& dc) { arrow->SetXOffset(middleArrowPos); if ((arrow->GetXOffset() != 0.0) && !m_ignoreArrowOffsets) - DrawArrow(dc, arrow, arrow->GetXOffset(), TRUE); + DrawArrow(dc, arrow, arrow->GetXOffset(), true); else { - DrawArrow(dc, arrow, middleArrowPos, FALSE); + DrawArrow(dc, arrow, middleArrowPos, false); middleArrowPos += arrow->GetSize() + arrow->GetSpacing(); } break; @@ -600,10 +593,10 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p wxRealPoint *second_last_line_point = (wxRealPoint *)second_last_line_node->GetData(); // Position where we want to start drawing - double positionOnLineX, positionOnLineY; + double positionOnLineX = 0.0, positionOnLineY = 0.0; // Position of start point of line, at the end of which we draw the arrow. - double startPositionX, startPositionY; + double startPositionX = 0.0 , startPositionY = 0.0; switch (arrow->GetPosition()) { @@ -674,7 +667,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p * Add yOffset to arrow, if any */ - const double myPi = (double) 3.14159265; + const double myPi = (double) M_PI; // The translation that the y offset may give double deltaX = 0.0; double deltaY = 0.0; @@ -696,7 +689,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p double y3 = positionOnLineY; double d = -arrow->GetYOffset(); // Negate so +offset is above line - double theta = 0.0; + double theta; if (x3 == x1) theta = (double)(myPi/2.0); else @@ -751,7 +744,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p dc.SetPen(* m_pen); if (arrow->_GetType() == ARROW_HOLLOW_CIRCLE) - dc.SetBrush(* g_oglWhiteBackgroundBrush); + dc.SetBrush(GetBackgroundBrush()); else dc.SetBrush(* m_brush); @@ -885,10 +878,10 @@ void wxLineShape::OnErase(wxDC& dc) } else { - m_erasing = TRUE; + m_erasing = true; GetEventHandler()->OnDraw(dc); GetEventHandler()->OnEraseControlPoints(dc); - m_erasing = FALSE; + m_erasing = false; } if (old_pen) SetPen(old_pen); @@ -967,12 +960,12 @@ void wxLineShape::FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming) *no_arcs = num; } -void wxLineShape::OnDrawOutline(wxDC& dc, double x, double y, double w, double h) +void wxLineShape::OnDrawOutline(wxDC& dc, double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(w), double WXUNUSED(h)) { wxPen *old_pen = m_pen; wxBrush *old_brush = m_brush; - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); + wxPen dottedPen(*wxBLACK, 1, wxDOT); SetPen(& dottedPen); SetBrush( wxTRANSPARENT_BRUSH ); @@ -984,7 +977,7 @@ void wxLineShape::OnDrawOutline(wxDC& dc, double x, double y, double w, double h else SetBrush(NULL); } -bool wxLineShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display) +bool wxLineShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool WXUNUSED(display)) { double x_offset = x - old_x; double y_offset = y - old_y; @@ -1024,7 +1017,7 @@ bool wxLineShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double o m_labelObjects[i]->Move(dc, xp+xr, yp+yr); } } - return TRUE; + return true; } void wxLineShape::OnMoveLink(wxDC& dc, bool moveControlPoints) @@ -1043,9 +1036,9 @@ void wxLineShape::OnMoveLink(wxDC& dc, bool moveControlPoints) FindLineEndPoints(&end_x, &end_y, &other_end_x, &other_end_y); wxNode *first = m_lineControlPoints->GetFirst(); - wxRealPoint *first_point = (wxRealPoint *)first->GetData(); + /* wxRealPoint *first_point = */ (wxRealPoint *)first->GetData(); wxNode *last = m_lineControlPoints->GetLast(); - wxRealPoint *last_point = (wxRealPoint *)last->GetData(); + /* wxRealPoint *last_point = */ (wxRealPoint *)last->GetData(); /* This is redundant, surely? Done by SetEnds. first_point->x = end_x; first_point->y = end_y; @@ -1096,13 +1089,13 @@ void wxLineShape::FindLineEndPoints(double *fromX, double *fromY, double *toX, d // Do each end - nothing in the middle. User has to move other points // manually if necessary. - double end_x, end_y; - double other_end_x, other_end_y; + double end_x = 0.0, end_y = 0.0; + double other_end_x = 0.0, other_end_y = 0.0; wxNode *first = m_lineControlPoints->GetFirst(); - wxRealPoint *first_point = (wxRealPoint *)first->GetData(); + /* wxRealPoint *first_point = */ (wxRealPoint *)first->GetData(); wxNode *last = m_lineControlPoints->GetLast(); - wxRealPoint *last_point = (wxRealPoint *)last->GetData(); + /* wxRealPoint *last_point = */ (wxRealPoint *)last->GetData(); wxNode *second = first->GetNext(); wxRealPoint *second_point = (wxRealPoint *)second->GetData(); @@ -1115,7 +1108,7 @@ void wxLineShape::FindLineEndPoints(double *fromX, double *fromY, double *toX, d if (m_from->GetAttachmentMode() != ATTACHMENT_MODE_NONE) { int nth, no_arcs; - FindNth(m_from, &nth, &no_arcs, FALSE); // Not incoming + FindNth(m_from, &nth, &no_arcs, false); // Not incoming m_from->GetAttachmentPosition(m_attachmentFrom, &end_x, &end_y, nth, no_arcs, this); } else @@ -1126,7 +1119,7 @@ void wxLineShape::FindLineEndPoints(double *fromX, double *fromY, double *toX, d if (m_to->GetAttachmentMode() != ATTACHMENT_MODE_NONE) { int nth, no_arcs; - FindNth(m_to, &nth, &no_arcs, TRUE); // Incoming + FindNth(m_to, &nth, &no_arcs, true); // Incoming m_to->GetAttachmentPosition(m_attachmentTo, &other_end_x, &other_end_y, nth, no_arcs, this); } else @@ -1144,7 +1137,7 @@ void wxLineShape::FindLineEndPoints(double *fromX, double *fromY, double *toX, d if (m_from->GetAttachmentMode() != ATTACHMENT_MODE_NONE) { int nth, no_arcs; - FindNth(m_from, &nth, &no_arcs, FALSE); + FindNth(m_from, &nth, &no_arcs, false); m_from->GetAttachmentPosition(m_attachmentFrom, &end_x, &end_y, nth, no_arcs, this); fromX = end_x; fromY = end_y; @@ -1153,7 +1146,7 @@ void wxLineShape::FindLineEndPoints(double *fromX, double *fromY, double *toX, d if (m_to->GetAttachmentMode() != ATTACHMENT_MODE_NONE) { int nth, no_arcs; - FindNth(m_to, &nth, &no_arcs, TRUE); + FindNth(m_to, &nth, &no_arcs, true); m_to->GetAttachmentPosition(m_attachmentTo, &other_end_x, &other_end_y, nth, no_arcs, this); toX = other_end_x; toY = other_end_y; @@ -1245,15 +1238,15 @@ void wxLineShape::OnEraseControlPoints(wxDC& dc) wxShape::OnEraseControlPoints(dc); } -void wxLineShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment) +void wxLineShape::OnDragLeft(bool WXUNUSED(draw), double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys), int WXUNUSED(attachment)) { } -void wxLineShape::OnBeginDragLeft(double x, double y, int keys, int attachment) +void wxLineShape::OnBeginDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys), int WXUNUSED(attachment)) { } -void wxLineShape::OnEndDragLeft(double x, double y, int keys, int attachment) +void wxLineShape::OnEndDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys), int WXUNUSED(attachment)) { } @@ -1376,23 +1369,23 @@ void wxLineShape::WriteAttributes(wxExpr *clause) wxShape::WriteAttributes(clause); if (m_from) - clause->AddAttributeValue("from", m_from->GetId()); + clause->AddAttributeValue(_T("from"), m_from->GetId()); if (m_to) - clause->AddAttributeValue("to", m_to->GetId()); + clause->AddAttributeValue(_T("to"), m_to->GetId()); if (m_attachmentTo != 0) - clause->AddAttributeValue("attachment_to", (long)m_attachmentTo); + clause->AddAttributeValue(_T("attachment_to"), (long)m_attachmentTo); if (m_attachmentFrom != 0) - clause->AddAttributeValue("attachment_from", (long)m_attachmentFrom); + clause->AddAttributeValue(_T("attachment_from"), (long)m_attachmentFrom); if (m_alignmentStart != 0) - clause->AddAttributeValue("align_start", (long)m_alignmentStart); + clause->AddAttributeValue(_T("align_start"), (long)m_alignmentStart); if (m_alignmentEnd != 0) - clause->AddAttributeValue("align_end", (long)m_alignmentEnd); + clause->AddAttributeValue(_T("align_end"), (long)m_alignmentEnd); - clause->AddAttributeValue("is_spline", (long)m_isSpline); + clause->AddAttributeValue(_T("is_spline"), (long)m_isSpline); if (m_maintainStraightLines) - clause->AddAttributeValue("keep_lines_straight", (long)m_maintainStraightLines); + clause->AddAttributeValue(_T("keep_lines_straight"), (long)m_maintainStraightLines); // Make a list of lists for the (sp)line controls wxExpr *list = new wxExpr(wxExprList); @@ -1409,7 +1402,7 @@ void wxLineShape::WriteAttributes(wxExpr *clause) node = node->GetNext(); } - clause->AddAttributeValue("controls", list); + clause->AddAttributeValue(_T("controls"), list); // Write arc arrows in new OGL format, if there are any. // This is a list of lists. Each sublist comprises: @@ -1437,7 +1430,7 @@ void wxLineShape::WriteAttributes(wxExpr *clause) node = node->GetNext(); } - clause->AddAttributeValue("arrows", arrow_list); + clause->AddAttributeValue(_T("arrows"), arrow_list); } } @@ -1460,7 +1453,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause) if (m_regions.GetCount() == 0) { wxShapeRegion *newRegion = new wxShapeRegion; - newRegion->SetName("Middle"); + newRegion->SetName(_T("Middle")); newRegion->SetSize(150, 50); m_regions.Append((wxObject *)newRegion); if (m_text.GetCount() > 0) @@ -1556,7 +1549,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause) wxExpr *spacingExpr = node->Nth(7); if (type_expr) - arrowType = (int)type_expr->IntegerValue(); + arrowType = (WXTYPE)type_expr->IntegerValue(); if (end_expr) arrowEnd = (int)end_expr->IntegerValue(); if (dist_expr) @@ -1658,16 +1651,16 @@ void wxLineShape::Select(bool select, wxDC* dc) GetLabelPosition(i, &xx, &yy); if (m_labelObjects[i]) { - m_labelObjects[i]->Select(FALSE); + m_labelObjects[i]->Select(false); m_labelObjects[i]->RemoveFromCanvas(m_canvas); delete m_labelObjects[i]; } m_labelObjects[i] = OnCreateLabelShape(this, region, w, h); m_labelObjects[i]->AddToCanvas(m_canvas); - m_labelObjects[i]->Show(TRUE); + m_labelObjects[i]->Show(true); if (dc) m_labelObjects[i]->Move(*dc, (double)(x + xx), (double)(y + yy)); - m_labelObjects[i]->Select(TRUE, dc); + m_labelObjects[i]->Select(true, dc); } } } @@ -1678,7 +1671,7 @@ void wxLineShape::Select(bool select, wxDC* dc) { if (m_labelObjects[i]) { - m_labelObjects[i]->Select(FALSE, dc); + m_labelObjects[i]->Select(false, dc); m_labelObjects[i]->Erase(*dc); m_labelObjects[i]->RemoveFromCanvas(m_canvas); delete m_labelObjects[i]; @@ -1731,7 +1724,7 @@ void wxLineControlPoint::OnEndDragLeft(double x, double y, int keys, int attachm // Control points ('handles') redirect control to the actual shape, to make it easier // to override sizing behaviour. -void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys, int attachment) +void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool WXUNUSED(draw), double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment)) { wxLineControlPoint* lpt = (wxLineControlPoint*) pt; @@ -1740,7 +1733,7 @@ void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, doub dc.SetLogicalFunction(OGLRBLF); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); + wxPen dottedPen(*wxBLACK, 1, wxDOT); dc.SetPen(dottedPen); dc.SetBrush((* wxTRANSPARENT_BRUSH)); @@ -1756,11 +1749,11 @@ void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, doub wxPen *old_pen = lineShape->GetPen(); wxBrush *old_brush = lineShape->GetBrush(); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); + wxPen dottedPen(*wxBLACK, 1, wxDOT); lineShape->SetPen(& dottedPen); lineShape->SetBrush(wxTRANSPARENT_BRUSH); - lineShape->GetEventHandler()->OnMoveLink(dc, FALSE); + lineShape->GetEventHandler()->OnMoveLink(dc, false); lineShape->SetPen(old_pen); lineShape->SetBrush(old_brush); @@ -1773,7 +1766,7 @@ void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, doub } -void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys, int attachment) +void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment)) { wxLineControlPoint* lpt = (wxLineControlPoint*) pt; @@ -1795,7 +1788,7 @@ void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, lineShape->GetTo()->OnDraw(dc); lineShape->GetTo()->OnDrawContents(dc); - this->SetDisableLabel(TRUE); + this->SetDisableLabel(true); dc.SetLogicalFunction(OGLRBLF); lpt->m_xpos = x; lpt->m_ypos = y; @@ -1804,11 +1797,11 @@ void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, wxPen *old_pen = lineShape->GetPen(); wxBrush *old_brush = lineShape->GetBrush(); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); + wxPen dottedPen(*wxBLACK, 1, wxDOT); lineShape->SetPen(& dottedPen); lineShape->SetBrush(wxTRANSPARENT_BRUSH); - lineShape->GetEventHandler()->OnMoveLink(dc, FALSE); + lineShape->GetEventHandler()->OnMoveLink(dc, false); lineShape->SetPen(old_pen); lineShape->SetBrush(old_brush); @@ -1821,14 +1814,14 @@ void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, } } -void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys, int attachment) +void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment)) { wxLineControlPoint* lpt = (wxLineControlPoint*) pt; wxClientDC dc(GetCanvas()); GetCanvas()->PrepareDC(dc); - this->SetDisableLabel(FALSE); + this->SetDisableLabel(false); wxLineShape *lineShape = (wxLineShape *)this; if (lpt->m_type == CONTROL_POINT_LINE) @@ -1897,7 +1890,7 @@ bool wxLineShape::OnMoveMiddleControlPoint(wxDC& dc, wxLineControlPoint* lpt, co GetEventHandler()->OnMoveLink(dc); - return TRUE; + return true; } // Implement movement of endpoint to a new attachment @@ -2029,7 +2022,7 @@ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int wxNode *refNode = referenceList.GetFirst(); wxNode *currNode = m_arcArrows.GetFirst(); wxString targetName(arrow->GetName()); - if (!refNode) return FALSE; + if (!refNode) return false; // First check whether we need to insert in front of list, // because this arrowhead is the first in the reference @@ -2038,12 +2031,12 @@ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int if (refArrow->GetName() == targetName) { m_arcArrows.Insert(arrow); - return TRUE; + return true; } + wxArrowHead *currArrow = (wxArrowHead *)currNode->GetData(); while (refNode && currNode) { - wxArrowHead *currArrow = (wxArrowHead *)currNode->GetData(); refArrow = (wxArrowHead *)refNode->GetData(); // Matching: advance current arrow pointer @@ -2063,12 +2056,12 @@ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int m_arcArrows.Insert(currNode, arrow); else m_arcArrows.Append(arrow); - return TRUE; + return true; } refNode = refNode->GetNext(); } m_arcArrows.Append(arrow); - return TRUE; + return true; } void wxLineShape::ClearArrowsAtPosition(int end) @@ -2128,11 +2121,11 @@ bool wxLineShape::ClearArrow(const wxString& name) { delete arrow; delete node; - return TRUE; + return true; } node = node->GetNext(); } - return FALSE; + return false; } /* @@ -2183,11 +2176,11 @@ bool wxLineShape::DeleteArrowHead(int position, const wxString& name) { delete arrow; delete node; - return TRUE; + return true; } node = node->GetNext(); } - return FALSE; + return false; } // Overloaded DeleteArrowHead: pass arrowhead id. @@ -2201,11 +2194,11 @@ bool wxLineShape::DeleteArrowHead(long id) { delete arrow; delete node; - return TRUE; + return true; } node = node->GetNext(); } - return FALSE; + return false; } /* @@ -2323,7 +2316,7 @@ int wxLineShape::GetAlignmentType(bool isEnd) wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject) { int n = m_lineControlPoints->GetCount(); - int nn = 0; + int nn; if (m_to == nodeObject) { // Must be END of line, so we want (n - 1)th control point. @@ -2337,7 +2330,7 @@ wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject) return (wxRealPoint *)node->GetData(); } else - return FALSE; + return NULL; } /* @@ -2362,7 +2355,7 @@ wxArrowHead::wxArrowHead(WXTYPE type, int end, double size, double dist, const w m_id = wxNewId(); } -wxArrowHead::wxArrowHead(wxArrowHead& toCopy) +wxArrowHead::wxArrowHead(wxArrowHead& toCopy):wxObject() { m_arrowType = toCopy.m_arrowType; m_arrowEnd = toCopy.GetArrowEnd(); m_arrowSize = toCopy.m_arrowSize; @@ -2414,7 +2407,7 @@ wxLabelShape::wxLabelShape(wxLineShape *parent, wxShapeRegion *region, double w, { m_lineShape = parent; m_shapeRegion = region; - SetPen(wxThePenList->FindOrCreatePen(wxColour(0, 0, 0), 1, wxDOT)); + SetPen(wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxDOT)); } wxLabelShape::~wxLabelShape() @@ -2444,7 +2437,7 @@ void wxLabelShape::OnDraw(wxDC& dc) dc.DrawRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height)); } -void wxLabelShape::OnDrawContents(wxDC& dc) +void wxLabelShape::OnDrawContents(wxDC& WXUNUSED(dc)) { } @@ -2468,7 +2461,7 @@ bool wxLabelShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double return m_lineShape->OnLabelMovePre(dc, this, x, y, old_x, old_y, display); } -bool wxLineShape::OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, double y, double old_x, double old_y, bool display) +bool wxLineShape::OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, double y, double WXUNUSED(old_x), double WXUNUSED(old_y), bool WXUNUSED(display)) { labelShape->m_shapeRegion->SetSize(labelShape->GetWidth(), labelShape->GetHeight()); @@ -2502,7 +2495,7 @@ bool wxLineShape::OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, d labelShape->FormatText(dc, s, i); DrawRegion(dc, labelShape->m_shapeRegion, xx, yy); } - return TRUE; + return true; } // Divert left and right clicks to line object