X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/67d54b58cb92e83364b39c7534079c3699b9b6ea..6ee3c06421446908fabe9de45b8e0c7519c28c24:/contrib/src/ogl/lines.cpp diff --git a/contrib/src/ogl/lines.cpp b/contrib/src/ogl/lines.cpp index fb159d7b83..ebdb997d07 100644 --- a/contrib/src/ogl/lines.cpp +++ b/contrib/src/ogl/lines.cpp @@ -25,18 +25,14 @@ #include #endif -#include +#if wxUSE_DEPRECATED +#include +#endif #ifdef new #undef new #endif -#if wxUSE_IOSTREAMH -#include -#else -#include -#endif - #include #include @@ -77,17 +73,17 @@ wxLineShape::wxLineShape() // and make the three line regions. ClearRegions(); wxShapeRegion *newRegion = new wxShapeRegion; - newRegion->SetName("Middle"); + newRegion->SetName(wxT("Middle")); newRegion->SetSize(150, 50); m_regions.Append((wxObject *)newRegion); newRegion = new wxShapeRegion; - newRegion->SetName("Start"); + newRegion->SetName(wxT("Start")); newRegion->SetSize(150, 50); m_regions.Append((wxObject *)newRegion); newRegion = new wxShapeRegion; - newRegion->SetName("End"); + newRegion->SetName(wxT("End")); newRegion->SetSize(150, 50); m_regions.Append((wxObject *)newRegion); @@ -137,10 +133,10 @@ wxNode *wxLineShape::InsertLineControlPoint(wxDC* dc) if (dc) Erase(*dc); - wxNode *last = m_lineControlPoints->Last(); - wxNode *second_last = last->Previous(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); - wxRealPoint *second_last_point = (wxRealPoint *)second_last->Data(); + wxNode *last = m_lineControlPoints->GetLast(); + wxNode *second_last = last->GetPrevious(); + wxRealPoint *last_point = (wxRealPoint *)last->GetData(); + wxRealPoint *second_last_point = (wxRealPoint *)second_last->GetData(); // Choose a point half way between the last and penultimate points double line_x = ((last_point->x + second_last_point->x)/2); @@ -153,13 +149,13 @@ wxNode *wxLineShape::InsertLineControlPoint(wxDC* dc) bool wxLineShape::DeleteLineControlPoint() { - if (m_lineControlPoints->Number() < 3) + if (m_lineControlPoints->GetCount() < 3) return FALSE; - wxNode *last = m_lineControlPoints->Last(); - wxNode *second_last = last->Previous(); + wxNode *last = m_lineControlPoints->GetLast(); + wxNode *second_last = last->GetPrevious(); - wxRealPoint *second_last_point = (wxRealPoint *)second_last->Data(); + wxRealPoint *second_last_point = (wxRealPoint *)second_last->GetData(); delete second_last_point; delete second_last; @@ -171,19 +167,19 @@ void wxLineShape::Initialise() if (m_lineControlPoints) { // Just move the first and last control points - wxNode *first = m_lineControlPoints->First(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); + wxNode *first = m_lineControlPoints->GetFirst(); + wxRealPoint *first_point = (wxRealPoint *)first->GetData(); - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); + wxNode *last = m_lineControlPoints->GetLast(); + wxRealPoint *last_point = (wxRealPoint *)last->GetData(); // If any of the line points are at -999, we must // initialize them by placing them half way between the first // and the last. - wxNode *node = first->Next(); + wxNode *node = first->GetNext(); while (node) { - wxRealPoint *point = (wxRealPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)node->GetData(); if (point->x == -999) { double x1, y1, x2, y2; @@ -200,7 +196,7 @@ void wxLineShape::Initialise() point->x = ((x2 - x1)/2 + x1); point->y = ((y2 - y1)/2 + y1); } - node = node->Next(); + node = node->GetNext(); } } } @@ -212,32 +208,32 @@ void wxLineShape::FormatText(wxDC& dc, const wxString& s, int i) double w, h; ClearText(i); - if (m_regions.Number() < 1) + if (m_regions.GetCount() < 1) return; - wxNode *node = m_regions.Nth(i); + wxNode *node = m_regions.Item(i); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->SetText(s); dc.SetFont(* region->GetFont()); region->GetSize(&w, &h); // Initialize the size if zero - if (((w == 0) || (h == 0)) && (strlen(s) > 0)) + if (((w == 0) || (h == 0)) && (s.Length() > 0)) { w = 100; h = 50; region->SetSize(w, h); } wxStringList *string_list = oglFormatText(dc, s, (w-5), (h-5), region->GetFormatMode()); - node = string_list->First(); + node = (wxNode*)string_list->GetFirst(); while (node) { - char *s = (char *)node->Data(); + wxChar *s = (wxChar *)node->GetData(); wxShapeTextLine *line = new wxShapeTextLine(0.0, 0.0, s); region->GetFormattedText().Append((wxObject *)line); - node = node->Next(); + node = node->GetNext(); } delete string_list; double actualW = w; @@ -286,7 +282,7 @@ void wxLineShape::DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y double yp = yy + y; // First, clear a rectangle for the text IF there is any - if (region->GetFormattedText().Number() > 0) + if (region->GetFormattedText().GetCount() > 0) { dc.SetPen(GetBackgroundPen()); dc.SetBrush(GetBackgroundBrush()); @@ -322,7 +318,7 @@ void wxLineShape::EraseRegion(wxDC& dc, wxShapeRegion *region, double x, double double xp = xx + x; double yp = yy + y; - if (region->GetFormattedText().Number() > 0) + if (region->GetFormattedText().GetCount() > 0) { dc.SetPen(GetBackgroundPen()); dc.SetBrush(GetBackgroundBrush()); @@ -341,14 +337,14 @@ void wxLineShape::GetLabelPosition(int position, double *x, double *y) case 0: { // Want to take the middle section for the label - int n = m_lineControlPoints->Number(); + int n = m_lineControlPoints->GetCount(); int half_way = (int)(n/2); // Find middle of this line - wxNode *node = m_lineControlPoints->Nth(half_way - 1); - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxNode *next_node = node->Next(); - wxRealPoint *next_point = (wxRealPoint *)next_node->Data(); + wxNode *node = m_lineControlPoints->Item(half_way - 1); + wxRealPoint *point = (wxRealPoint *)node->GetData(); + wxNode *next_node = node->GetNext(); + wxRealPoint *next_point = (wxRealPoint *)next_node->GetData(); double dx = (next_point->x - point->x); double dy = (next_point->y - point->y); @@ -358,16 +354,16 @@ void wxLineShape::GetLabelPosition(int position, double *x, double *y) } case 1: { - wxNode *node = m_lineControlPoints->First(); - *x = ((wxRealPoint *)node->Data())->x; - *y = ((wxRealPoint *)node->Data())->y; + wxNode *node = m_lineControlPoints->GetFirst(); + *x = ((wxRealPoint *)node->GetData())->x; + *y = ((wxRealPoint *)node->GetData())->y; break; } case 2: { - wxNode *node = m_lineControlPoints->Last(); - *x = ((wxRealPoint *)node->Data())->x; - *y = ((wxRealPoint *)node->Data())->y; + wxNode *node = m_lineControlPoints->GetLast(); + *x = ((wxRealPoint *)node->GetData())->x; + *y = ((wxRealPoint *)node->GetData())->y; break; } default: @@ -396,29 +392,29 @@ void GraphicsStraightenLine(wxRealPoint *point1, wxRealPoint *point2) void wxLineShape::Straighten(wxDC *dc) { - if (!m_lineControlPoints || m_lineControlPoints->Number() < 3) + if (!m_lineControlPoints || m_lineControlPoints->GetCount() < 3) return; if (dc) Erase(* dc); - wxNode *first_point_node = m_lineControlPoints->First(); - wxNode *last_point_node = m_lineControlPoints->Last(); - wxNode *second_last_point_node = last_point_node->Previous(); + wxNode *first_point_node = m_lineControlPoints->GetFirst(); + wxNode *last_point_node = m_lineControlPoints->GetLast(); + wxNode *second_last_point_node = last_point_node->GetPrevious(); - wxRealPoint *last_point = (wxRealPoint *)last_point_node->Data(); - wxRealPoint *second_last_point = (wxRealPoint *)second_last_point_node->Data(); + wxRealPoint *last_point = (wxRealPoint *)last_point_node->GetData(); + wxRealPoint *second_last_point = (wxRealPoint *)second_last_point_node->GetData(); GraphicsStraightenLine(last_point, second_last_point); wxNode *node = first_point_node; while (node && (node != second_last_point_node)) { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *next_point = (wxRealPoint *)(node->Next()->Data()); + wxRealPoint *point = (wxRealPoint *)node->GetData(); + wxRealPoint *next_point = (wxRealPoint *)(node->GetNext()->GetData()); GraphicsStraightenLine(point, next_point); - node = node->Next(); + node = node->GetNext(); } if (dc) @@ -439,10 +435,10 @@ void wxLineShape::Unlink() void wxLineShape::SetEnds(double x1, double y1, double x2, double y2) { // Find centre point - wxNode *first_point_node = m_lineControlPoints->First(); - wxNode *last_point_node = m_lineControlPoints->Last(); - wxRealPoint *first_point = (wxRealPoint *)first_point_node->Data(); - wxRealPoint *last_point = (wxRealPoint *)last_point_node->Data(); + wxNode *first_point_node = m_lineControlPoints->GetFirst(); + wxNode *last_point_node = m_lineControlPoints->GetLast(); + wxRealPoint *first_point = (wxRealPoint *)first_point_node->GetData(); + wxRealPoint *last_point = (wxRealPoint *)last_point_node->GetData(); first_point->x = x1; first_point->y = y1; @@ -456,10 +452,10 @@ void wxLineShape::SetEnds(double x1, double y1, double x2, double y2) // Get absolute positions of ends void wxLineShape::GetEnds(double *x1, double *y1, double *x2, double *y2) { - wxNode *first_point_node = m_lineControlPoints->First(); - wxNode *last_point_node = m_lineControlPoints->Last(); - wxRealPoint *first_point = (wxRealPoint *)first_point_node->Data(); - wxRealPoint *last_point = (wxRealPoint *)last_point_node->Data(); + wxNode *first_point_node = m_lineControlPoints->GetFirst(); + wxNode *last_point_node = m_lineControlPoints->GetLast(); + wxRealPoint *first_point = (wxRealPoint *)first_point_node->GetData(); + wxRealPoint *last_point = (wxRealPoint *)last_point_node->GetData(); *x1 = first_point->x; *y1 = first_point->y; *x2 = last_point->x; *y2 = last_point->y; @@ -480,11 +476,11 @@ bool wxLineShape::HitTest(double x, double y, int *attachment, double *distance) bool inLabelRegion = FALSE; for (int i = 0; i < 3; i ++) { - wxNode *regionNode = m_regions.Nth(i); + wxNode *regionNode = m_regions.Item(i); if (regionNode) { - wxShapeRegion *region = (wxShapeRegion *)regionNode->Data(); - if (region->m_formattedText.Number() > 0) + wxShapeRegion *region = (wxShapeRegion *)regionNode->GetData(); + if (region->m_formattedText.GetCount() > 0) { double xp, yp, cx, cy, cw, ch; GetLabelPosition(i, &xp, &yp); @@ -506,12 +502,12 @@ bool wxLineShape::HitTest(double x, double y, int *attachment, double *distance) } } - wxNode *node = m_lineControlPoints->First(); + wxNode *node = m_lineControlPoints->GetFirst(); - while (node && node->Next()) + while (node && node->GetNext()) { - wxRealPoint *point1 = (wxRealPoint *)node->Data(); - wxRealPoint *point2 = (wxRealPoint *)node->Next()->Data(); + wxRealPoint *point1 = (wxRealPoint *)node->GetData(); + wxRealPoint *point2 = (wxRealPoint *)node->GetNext()->GetData(); // Allow for inaccurate mousing or vert/horiz lines int extra = 4; @@ -532,7 +528,7 @@ bool wxLineShape::HitTest(double x, double y, int *attachment, double *distance) return TRUE; } - node = node->Next(); + node = node->GetNext(); } return FALSE; } @@ -544,10 +540,10 @@ void wxLineShape::DrawArrows(wxDC& dc) double endArrowPos = 0.0; double middleArrowPos = 0.0; - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); switch (arrow->GetArrowEnd()) { case ARROW_POSITION_START: @@ -586,21 +582,21 @@ void wxLineShape::DrawArrows(wxDC& dc) break; } } - node = node->Next(); + node = node->GetNext(); } } void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool proportionalOffset) { - wxNode *first_line_node = m_lineControlPoints->First(); - wxRealPoint *first_line_point = (wxRealPoint *)first_line_node->Data(); - wxNode *second_line_node = first_line_node->Next(); - wxRealPoint *second_line_point = (wxRealPoint *)second_line_node->Data(); + wxNode *first_line_node = m_lineControlPoints->GetFirst(); + wxRealPoint *first_line_point = (wxRealPoint *)first_line_node->GetData(); + wxNode *second_line_node = first_line_node->GetNext(); + wxRealPoint *second_line_point = (wxRealPoint *)second_line_node->GetData(); - wxNode *last_line_node = m_lineControlPoints->Last(); - wxRealPoint *last_line_point = (wxRealPoint *)last_line_node->Data(); - wxNode *second_last_line_node = last_line_node->Previous(); - wxRealPoint *second_last_line_point = (wxRealPoint *)second_last_line_node->Data(); + wxNode *last_line_node = m_lineControlPoints->GetLast(); + wxRealPoint *last_line_point = (wxRealPoint *)last_line_node->GetData(); + wxNode *second_last_line_node = last_line_node->GetPrevious(); + wxRealPoint *second_last_line_point = (wxRealPoint *)second_last_line_node->GetData(); // Position where we want to start drawing double positionOnLineX, positionOnLineY; @@ -820,7 +816,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p else { - wxFatalError("Unknown arrowhead rotation case in lines.cc"); + wxLogFatalError(wxT("Unknown arrowhead rotation case in lines.cc")); } // Rotate about the centre of the object, then place @@ -865,11 +861,11 @@ void wxLineShape::OnErase(wxDC& dc) // Undraw text regions for (int i = 0; i < 3; i++) { - wxNode *node = m_regions.Nth(i); + wxNode *node = m_regions.Item(i); if (node) { double x, y; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); GetLabelPosition(i, &x, &y); EraseRegion(dc, region, x, y); } @@ -905,17 +901,17 @@ void wxLineShape::GetBoundingBoxMin(double *w, double *h) double x2 = -10000; double y2 = -10000; - wxNode *node = m_lineControlPoints->First(); + wxNode *node = m_lineControlPoints->GetFirst(); while (node) { - wxRealPoint *point = (wxRealPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)node->GetData(); if (point->x < x1) x1 = point->x; if (point->y < y1) y1 = point->y; if (point->x > x2) x2 = point->x; if (point->y > y2) y2 = point->y; - node = node->Next(); + node = node->GetNext(); } *w = (double)(x2 - x1); *h = (double)(y2 - y1); @@ -930,7 +926,7 @@ void wxLineShape::FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming) { int n = -1; int num = 0; - wxNode *node = image->GetLines().First(); + wxNode *node = image->GetLines().GetFirst(); int this_attachment; if (image == m_to) this_attachment = m_attachmentTo; @@ -940,7 +936,7 @@ void wxLineShape::FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming) // Find number of lines going into/out of this particular attachment point while (node) { - wxLineShape *line = (wxLineShape *)node->Data(); + wxLineShape *line = (wxLineShape *)node->GetData(); if (line->m_from == image) { @@ -964,7 +960,7 @@ void wxLineShape::FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming) num ++; } - node = node->Next(); + node = node->GetNext(); } *nth = n; *no_arcs = num; @@ -994,13 +990,13 @@ bool wxLineShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double o if (m_lineControlPoints && !(x_offset == 0.0 && y_offset == 0.0)) { - wxNode *node = m_lineControlPoints->First(); + wxNode *node = m_lineControlPoints->GetFirst(); while (node) { - wxRealPoint *point = (wxRealPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)node->GetData(); point->x += x_offset; point->y += y_offset; - node = node->Next(); + node = node->GetNext(); } } @@ -1013,10 +1009,10 @@ bool wxLineShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double o m_labelObjects[i]->Erase(dc); double xp, yp, xr, yr; GetLabelPosition(i, &xp, &yp); - wxNode *node = m_regions.Nth(i); + wxNode *node = m_regions.Item(i); if (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->GetPosition(&xr, &yr); } else @@ -1035,7 +1031,7 @@ void wxLineShape::OnMoveLink(wxDC& dc, bool moveControlPoints) if (!m_from || !m_to) return; - if (m_lineControlPoints->Number() > 2) + if (m_lineControlPoints->GetCount() > 2) Initialise(); // Do each end - nothing in the middle. User has to move other points @@ -1045,10 +1041,10 @@ void wxLineShape::OnMoveLink(wxDC& dc, bool moveControlPoints) FindLineEndPoints(&end_x, &end_y, &other_end_x, &other_end_y); - wxNode *first = m_lineControlPoints->First(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); + wxNode *first = m_lineControlPoints->GetFirst(); + wxRealPoint *first_point = (wxRealPoint *)first->GetData(); + wxNode *last = m_lineControlPoints->GetLast(); + wxRealPoint *last_point = (wxRealPoint *)last->GetData(); /* This is redundant, surely? Done by SetEnds. first_point->x = end_x; first_point->y = end_y; @@ -1072,16 +1068,16 @@ void wxLineShape::OnMoveLink(wxDC& dc, bool moveControlPoints) // Only move control points if it's a self link. And only works if attachment mode is ON. if ((m_from == m_to) && (m_from->GetAttachmentMode() != ATTACHMENT_MODE_NONE) && moveControlPoints && m_lineControlPoints && !(x_offset == 0.0 && y_offset == 0.0)) { - wxNode *node = m_lineControlPoints->First(); + wxNode *node = m_lineControlPoints->GetFirst(); while (node) { - if ((node != m_lineControlPoints->First()) && (node != m_lineControlPoints->Last())) + if ((node != m_lineControlPoints->GetFirst()) && (node != m_lineControlPoints->GetLast())) { - wxRealPoint *point = (wxRealPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)node->GetData(); point->x += x_offset; point->y += y_offset; } - node = node->Next(); + node = node->GetNext(); } } @@ -1102,18 +1098,18 @@ void wxLineShape::FindLineEndPoints(double *fromX, double *fromY, double *toX, d double end_x, end_y; double other_end_x, other_end_y; - wxNode *first = m_lineControlPoints->First(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); + wxNode *first = m_lineControlPoints->GetFirst(); + wxRealPoint *first_point = (wxRealPoint *)first->GetData(); + wxNode *last = m_lineControlPoints->GetLast(); + wxRealPoint *last_point = (wxRealPoint *)last->GetData(); - wxNode *second = first->Next(); - wxRealPoint *second_point = (wxRealPoint *)second->Data(); + wxNode *second = first->GetNext(); + wxRealPoint *second_point = (wxRealPoint *)second->GetData(); - wxNode *second_last = last->Previous(); - wxRealPoint *second_last_point = (wxRealPoint *)second_last->Data(); + wxNode *second_last = last->GetPrevious(); + wxRealPoint *second_last_point = (wxRealPoint *)second_last->GetData(); - if (m_lineControlPoints->Number() > 2) + if (m_lineControlPoints->GetCount() > 2) { if (m_from->GetAttachmentMode() != ATTACHMENT_MODE_NONE) { @@ -1187,12 +1183,12 @@ void wxLineShape::OnDraw(wxDC& dc) if (m_brush) dc.SetBrush(* m_brush); - int n = m_lineControlPoints->Number(); + int n = m_lineControlPoints->GetCount(); wxPoint *points = new wxPoint[n]; int i; for (i = 0; i < n; i++) { - wxRealPoint* point = (wxRealPoint*) m_lineControlPoints->Nth(i)->Data(); + wxRealPoint* point = (wxRealPoint*) m_lineControlPoints->Item(i)->GetData(); points[i].x = WXROUND(point->x); points[i].y = WXROUND(point->y); } @@ -1290,10 +1286,10 @@ void wxLineShape::OnDrawContents(wxDC& dc) for (int i = 0; i < 3; i++) { - wxNode *node = m_regions.Nth(i); + wxNode *node = m_regions.Item(i); if (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); double x, y; GetLabelPosition(i, &x, &y); DrawRegion(dc, region, x, y); @@ -1315,10 +1311,10 @@ void wxLineShape::MakeControlPoints() { if (m_canvas && m_lineControlPoints) { - wxNode *first = m_lineControlPoints->First(); - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); + wxNode *first = m_lineControlPoints->GetFirst(); + wxNode *last = m_lineControlPoints->GetLast(); + wxRealPoint *first_point = (wxRealPoint *)first->GetData(); + wxRealPoint *last_point = (wxRealPoint *)last->GetData(); wxLineControlPoint *control = new wxLineControlPoint(m_canvas, this, CONTROL_POINT_SIZE, first_point->x, first_point->y, @@ -1328,10 +1324,10 @@ void wxLineShape::MakeControlPoints() m_controlPoints.Append(control); - wxNode *node = first->Next(); + wxNode *node = first->GetNext(); while (node != last) { - wxRealPoint *point = (wxRealPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)node->GetData(); control = new wxLineControlPoint(m_canvas, this, CONTROL_POINT_SIZE, point->x, point->y, @@ -1341,7 +1337,7 @@ void wxLineShape::MakeControlPoints() m_canvas->AddShape(control); m_controlPoints.Append(control); - node = node->Next(); + node = node->GetNext(); } control = new wxLineControlPoint(m_canvas, this, CONTROL_POINT_SIZE, last_point->x, last_point->y, @@ -1356,24 +1352,24 @@ void wxLineShape::MakeControlPoints() void wxLineShape::ResetControlPoints() { - if (m_canvas && m_lineControlPoints && m_controlPoints.Number() > 0) + if (m_canvas && m_lineControlPoints && m_controlPoints.GetCount() > 0) { - wxNode *node = m_controlPoints.First(); - wxNode *control_node = m_lineControlPoints->First(); + wxNode *node = m_controlPoints.GetFirst(); + wxNode *control_node = m_lineControlPoints->GetFirst(); while (node && control_node) { - wxRealPoint *point = (wxRealPoint *)control_node->Data(); - wxLineControlPoint *control = (wxLineControlPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)control_node->GetData(); + wxLineControlPoint *control = (wxLineControlPoint *)node->GetData(); control->SetX(point->x); control->SetY(point->y); - node = node->Next(); - control_node = control_node->Next(); + node = node->GetNext(); + control_node = control_node->GetNext(); } } } -#ifdef PROLOGIO +#if wxUSE_PROLOGIO void wxLineShape::WriteAttributes(wxExpr *clause) { wxShape::WriteAttributes(clause); @@ -1399,10 +1395,10 @@ void wxLineShape::WriteAttributes(wxExpr *clause) // Make a list of lists for the (sp)line controls wxExpr *list = new wxExpr(wxExprList); - wxNode *node = m_lineControlPoints->First(); + wxNode *node = m_lineControlPoints->GetFirst(); while (node) { - wxRealPoint *point = (wxRealPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)node->GetData(); wxExpr *point_list = new wxExpr(wxExprList); wxExpr *x_expr = new wxExpr((double) point->x); wxExpr *y_expr = new wxExpr((double) point->y); @@ -1410,20 +1406,20 @@ void wxLineShape::WriteAttributes(wxExpr *clause) point_list->Append(y_expr); list->Append(point_list); - node = node->Next(); + node = node->GetNext(); } clause->AddAttributeValue("controls", list); // Write arc arrows in new OGL format, if there are any. // This is a list of lists. Each sublist comprises: // (arrowType arrowEnd xOffset arrowSize) - if (m_arcArrows.Number() > 0) + if (m_arcArrows.GetCount() > 0) { wxExpr *arrow_list = new wxExpr(wxExprList); - node = m_arcArrows.First(); + node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *head = (wxArrowHead *)node->Data(); + wxArrowHead *head = (wxArrowHead *)node->GetData(); wxExpr *head_list = new wxExpr(wxExprList); head_list->Append(new wxExpr((long)head->_GetType())); head_list->Append(new wxExpr((long)head->GetArrowEnd())); @@ -1438,7 +1434,7 @@ void wxLineShape::WriteAttributes(wxExpr *clause) arrow_list->Append(head_list); - node = node->Next(); + node = node->GetNext(); } clause->AddAttributeValue("arrows", arrow_list); } @@ -1449,31 +1445,31 @@ void wxLineShape::ReadAttributes(wxExpr *clause) wxShape::ReadAttributes(clause); int iVal = (int) m_isSpline; - clause->AssignAttributeValue("is_spline", &iVal); + clause->AssignAttributeValue(wxT("is_spline"), &iVal); m_isSpline = (iVal != 0); iVal = (int) m_maintainStraightLines; - clause->AssignAttributeValue("keep_lines_straight", &iVal); + clause->AssignAttributeValue(wxT("keep_lines_straight"), &iVal); m_maintainStraightLines = (iVal != 0); - clause->AssignAttributeValue("align_start", &m_alignmentStart); - clause->AssignAttributeValue("align_end", &m_alignmentEnd); + clause->AssignAttributeValue(wxT("align_start"), &m_alignmentStart); + clause->AssignAttributeValue(wxT("align_end"), &m_alignmentEnd); // Compatibility: check for no regions. - if (m_regions.Number() == 0) + if (m_regions.GetCount() == 0) { wxShapeRegion *newRegion = new wxShapeRegion; newRegion->SetName("Middle"); newRegion->SetSize(150, 50); m_regions.Append((wxObject *)newRegion); - if (m_text.Number() > 0) + if (m_text.GetCount() > 0) { newRegion->ClearText(); - wxNode *node = m_text.First(); + wxNode *node = m_text.GetFirst(); while (node) { - wxShapeTextLine *textLine = (wxShapeTextLine *)node->Data(); - wxNode *next = node->Next(); + wxShapeTextLine *textLine = (wxShapeTextLine *)node->GetData(); + wxNode *next = node->GetNext(); newRegion->GetFormattedText().Append((wxObject *)textLine); delete node; node = next; @@ -1481,12 +1477,12 @@ void wxLineShape::ReadAttributes(wxExpr *clause) } newRegion = new wxShapeRegion; - newRegion->SetName("Start"); + newRegion->SetName(wxT("Start")); newRegion->SetSize(150, 50); m_regions.Append((wxObject *)newRegion); newRegion = new wxShapeRegion; - newRegion->SetName("End"); + newRegion->SetName(wxT("End")); newRegion->SetSize(150, 50); m_regions.Append((wxObject *)newRegion); } @@ -1494,14 +1490,14 @@ void wxLineShape::ReadAttributes(wxExpr *clause) m_attachmentTo = 0; m_attachmentFrom = 0; - clause->AssignAttributeValue("attachment_to", &m_attachmentTo); - clause->AssignAttributeValue("attachment_from", &m_attachmentFrom); + clause->AssignAttributeValue(wxT("attachment_to"), &m_attachmentTo); + clause->AssignAttributeValue(wxT("attachment_from"), &m_attachmentFrom); wxExpr *line_list = NULL; // When image is created, there are default control points. Override // them if there are some in the file. - clause->AssignAttributeValue("controls", &line_list); + clause->AssignAttributeValue(wxT("controls"), &line_list); if (line_list) { @@ -1533,7 +1529,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause) // Read arrow list, for new OGL code wxExpr *arrow_list = NULL; - clause->AssignAttributeValue("arrows", &arrow_list); + clause->AssignAttributeValue(wxT("arrows"), &arrow_list); if (arrow_list) { wxExpr *node = arrow_list->value.first; @@ -1544,7 +1540,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause) int arrowEnd = 0; double xOffset = 0.0; double arrowSize = 0.0; - wxString arrowName(""); + wxString arrowName; long arrowId = -1; wxExpr *type_expr = node->Nth(0); @@ -1576,7 +1572,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause) else wxRegisterId(arrowId); - wxArrowHead *arrowHead = AddArrow(arrowType, arrowEnd, arrowSize, xOffset, (char*) (const char*) arrowName, NULL, arrowId); + wxArrowHead *arrowHead = AddArrow(arrowType, arrowEnd, arrowSize, xOffset, arrowName, NULL, arrowId); if (yOffsetExpr) arrowHead->SetYOffset(yOffsetExpr->RealValue()); if (spacingExpr) @@ -1606,11 +1602,11 @@ void wxLineShape::Copy(wxShape& copy) lineCopy.m_maintainStraightLines = m_maintainStraightLines; lineCopy.m_lineOrientations.Clear(); - wxNode *node = m_lineOrientations.First(); + wxNode *node = m_lineOrientations.GetFirst(); while (node) { - lineCopy.m_lineOrientations.Append(node->Data()); - node = node->Next(); + lineCopy.m_lineOrientations.Append(node->GetData()); + node = node->GetNext(); } if (lineCopy.m_lineControlPoints) @@ -1621,23 +1617,23 @@ void wxLineShape::Copy(wxShape& copy) lineCopy.m_lineControlPoints = new wxList; - node = m_lineControlPoints->First(); + node = m_lineControlPoints->GetFirst(); while (node) { - wxRealPoint *point = (wxRealPoint *)node->Data(); + wxRealPoint *point = (wxRealPoint *)node->GetData(); wxRealPoint *new_point = new wxRealPoint(point->x, point->y); lineCopy.m_lineControlPoints->Append((wxObject*) new_point); - node = node->Next(); + node = node->GetNext(); } // Copy arrows lineCopy.ClearArrowsAtPosition(-1); - node = m_arcArrows.First(); + node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); lineCopy.m_arcArrows.Append(new wxArrowHead(*arrow)); - node = node->Next(); + node = node->GetNext(); } } @@ -1649,11 +1645,11 @@ void wxLineShape::Select(bool select, wxDC* dc) { for (int i = 0; i < 3; i++) { - wxNode *node = m_regions.Nth(i); + wxNode *node = m_regions.Item(i); if (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - if (region->m_formattedText.Number() > 0) + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); + if (region->m_formattedText.GetCount() > 0) { double w, h, x, y, xx, yy; region->GetSize(&w, &h); @@ -1880,8 +1876,8 @@ void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, in // Needed? #if 0 int i = 0; - for (i = 0; i < lineShape->GetLineControlPoints()->Number(); i++) - if (((wxRealPoint *)(lineShape->GetLineControlPoints()->Nth(i)->Data())) == lpt->m_point) + for (i = 0; i < lineShape->GetLineControlPoints()->GetCount(); i++) + if (((wxRealPoint *)(lineShape->GetLineControlPoints()->Item(i)->GetData())) == lpt->m_point) break; // N.B. in OnMoveControlPoint, an event handler in Hardy could have deselected @@ -1987,8 +1983,8 @@ void wxLineControlPoint::OnEndDragRight(double x, double y, int keys, int attach } } int i = 0; - for (i = 0; i < lineShape->GetLineControlPoints()->Number(); i++) - if (((wxRealPoint *)(lineShape->GetLineControlPoints()->Nth(i)->Data())) == m_point) + for (i = 0; i < lineShape->GetLineControlPoints()->GetCount(); i++) + if (((wxRealPoint *)(lineShape->GetLineControlPoints()->Item(i)->GetData())) == m_point) break; lineShape->OnMoveControlPoint(i+1, x, y); if (!m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); @@ -2029,15 +2025,15 @@ wxArrowHead *wxLineShape::AddArrow(WXTYPE type, int end, double size, double xOf */ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int end) { - wxNode *refNode = referenceList.First(); - wxNode *currNode = m_arcArrows.First(); + wxNode *refNode = referenceList.GetFirst(); + wxNode *currNode = m_arcArrows.GetFirst(); wxString targetName(arrow->GetName()); if (!refNode) return FALSE; // First check whether we need to insert in front of list, // because this arrowhead is the first in the reference // list and should therefore be first in the current list. - wxArrowHead *refArrow = (wxArrowHead *)refNode->Data(); + wxArrowHead *refArrow = (wxArrowHead *)refNode->GetData(); if (refArrow->GetName() == targetName) { m_arcArrows.Insert(arrow); @@ -2046,16 +2042,16 @@ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int while (refNode && currNode) { - wxArrowHead *currArrow = (wxArrowHead *)currNode->Data(); - refArrow = (wxArrowHead *)refNode->Data(); + wxArrowHead *currArrow = (wxArrowHead *)currNode->GetData(); + refArrow = (wxArrowHead *)refNode->GetData(); // Matching: advance current arrow pointer if ((currArrow->GetArrowEnd() == end) && (currArrow->GetName() == refArrow->GetName())) { - currNode = currNode->Next(); // Could be NULL now + currNode = currNode->GetNext(); // Could be NULL now if (currNode) - currArrow = (wxArrowHead *)currNode->Data(); + currArrow = (wxArrowHead *)currNode->GetData(); } // Check if we're at the correct position in the @@ -2068,7 +2064,7 @@ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int m_arcArrows.Append(arrow); return TRUE; } - refNode = refNode->Next(); + refNode = refNode->GetNext(); } m_arcArrows.Append(arrow); return TRUE; @@ -2076,11 +2072,11 @@ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int void wxLineShape::ClearArrowsAtPosition(int end) { - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - wxNode *next = node->Next(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); + wxNode *next = node->GetNext(); switch (end) { case -1: @@ -2123,17 +2119,17 @@ void wxLineShape::ClearArrowsAtPosition(int end) bool wxLineShape::ClearArrow(const wxString& name) { - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); if (arrow->GetName() == name) { delete arrow; delete node; return TRUE; } - node = node->Next(); + node = node->GetNext(); } return FALSE; } @@ -2145,27 +2141,27 @@ bool wxLineShape::ClearArrow(const wxString& name) wxArrowHead *wxLineShape::FindArrowHead(int position, const wxString& name) { - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); if (((position == -1) || (position == arrow->GetArrowEnd())) && (arrow->GetName() == name)) return arrow; - node = node->Next(); + node = node->GetNext(); } return NULL; } wxArrowHead *wxLineShape::FindArrowHead(long arrowId) { - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); if (arrowId == arrow->GetId()) return arrow; - node = node->Next(); + node = node->GetNext(); } return NULL; } @@ -2177,10 +2173,10 @@ wxArrowHead *wxLineShape::FindArrowHead(long arrowId) bool wxLineShape::DeleteArrowHead(int position, const wxString& name) { - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); if (((position == -1) || (position == arrow->GetArrowEnd())) && (arrow->GetName() == name)) { @@ -2188,7 +2184,7 @@ bool wxLineShape::DeleteArrowHead(int position, const wxString& name) delete node; return TRUE; } - node = node->Next(); + node = node->GetNext(); } return FALSE; } @@ -2196,17 +2192,17 @@ bool wxLineShape::DeleteArrowHead(int position, const wxString& name) // Overloaded DeleteArrowHead: pass arrowhead id. bool wxLineShape::DeleteArrowHead(long id) { - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); + wxArrowHead *arrow = (wxArrowHead *)node->GetData(); if (arrow->GetId() == id) { delete arrow; delete node; return TRUE; } - node = node->Next(); + node = node->GetNext(); } return FALSE; } @@ -2220,15 +2216,15 @@ bool wxLineShape::DeleteArrowHead(long id) double wxLineShape::FindMinimumWidth() { double minWidth = 0.0; - wxNode *node = m_arcArrows.First(); + wxNode *node = m_arcArrows.GetFirst(); while (node) { - wxArrowHead *arrowHead = (wxArrowHead *)node->Data(); + wxArrowHead *arrowHead = (wxArrowHead *)node->GetData(); minWidth += arrowHead->GetSize(); - if (node->Next()) + if (node->GetNext()) minWidth += arrowHead->GetSpacing(); - node = node->Next(); + node = node->GetNext(); } // We have ABSOLUTE minimum now. So // scale it to give it reasonable aesthetics @@ -2325,7 +2321,7 @@ int wxLineShape::GetAlignmentType(bool isEnd) wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject) { - int n = m_lineControlPoints->Number(); + int n = m_lineControlPoints->GetCount(); int nn = 0; if (m_to == nodeObject) { @@ -2334,10 +2330,10 @@ wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject) nn = n - 2; } else nn = 1; - wxNode *node = m_lineControlPoints->Nth(nn); + wxNode *node = m_lineControlPoints->Item(nn); if (node) { - return (wxRealPoint *)node->Data(); + return (wxRealPoint *)node->GetData(); } else return FALSE; @@ -2477,14 +2473,14 @@ bool wxLineShape::OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, d // Find position in line's region list int i = 0; - wxNode *node = GetRegions().First(); + wxNode *node = GetRegions().GetFirst(); while (node) { - if (labelShape->m_shapeRegion == (wxShapeRegion *)node->Data()) + if (labelShape->m_shapeRegion == (wxShapeRegion *)node->GetData()) node = NULL; else { - node = node->Next(); + node = node->GetNext(); i ++; } }