#include <wx/wx.h>
#endif
-#include <wx/wxexpr.h>
+#if wxUSE_PROLOGIO
+#include <wx/deprecated/wxexpr.h>
+#endif
#ifdef new
#undef new
#endif
-#if wxUSE_IOSTREAMH
-#include <iostream.h>
-#else
-#include <iostream>
-#endif
-
#include <ctype.h>
#include <math.h>
-#include <wx/ogl/basic.h>
-#include <wx/ogl/basicp.h>
-#include <wx/ogl/lines.h>
-#include <wx/ogl/linesp.h>
-#include <wx/ogl/drawn.h>
-#include <wx/ogl/misc.h>
-#include <wx/ogl/canvas.h>
+#include "wx/ogl/ogl.h"
+
// Line shape
IMPLEMENT_DYNAMIC_CLASS(wxLineShape, wxShape)
// 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);
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);
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;
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;
point->x = ((x2 - x1)/2 + x1);
point->y = ((y2 - y1)/2 + y1);
}
- node = node->Next();
+ node = node->GetNext();
}
}
}
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());
}
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;
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());
double xp = xx + x;
double yp = yy + y;
- if (region->GetFormattedText().Number() > 0)
+ if (region->GetFormattedText().GetCount() > 0)
{
dc.SetPen(GetBackgroundPen());
dc.SetBrush(GetBackgroundBrush());
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);
}
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:
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)
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;
// 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;
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);
}
}
- 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
+ // For inaccurate mousing allow 8 pixel corridor
int extra = 4;
- double left = wxMin(point1->x, point2->x) - extra;
- double right = wxMax(point1->x, point2->x) + extra;
-
- double bottom = wxMin(point1->y, point2->y) - extra;
- double top = wxMax(point1->y, point2->y) + extra;
- if ((x > left && x < right && y > bottom && y < top) || inLabelRegion)
+ double dx = point2->x - point1->x;
+ double dy = point2->y - point1->y;
+ double seg_len = sqrt(dx*dx+dy*dy);
+ double distance_from_seg =
+ 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)
{
- // Work out distance from centre of line
- double centre_x = (double)(left + (right - left)/2.0);
- double centre_y = (double)(bottom + (top - bottom)/2.0);
-
*attachment = 0;
- *distance = (double)sqrt((centre_x - x)*(centre_x - x) + (centre_y - y)*(centre_y - y));
+ *distance = distance_from_seg;
return TRUE;
}
- node = node->Next();
+ node = node->GetNext();
}
return FALSE;
}
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:
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;
// 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);
}
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);
{
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;
// 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)
{
num ++;
}
- node = node->Next();
+ node = node->GetNext();
}
*nth = n;
*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;
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;
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();
}
}
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
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
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;
// 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();
}
}
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)
{
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);
}
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))
{
}
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);
{
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,
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,
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,
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();
}
}
}
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);
- 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);
point_list->Append(y_expr);
list->Append(point_list);
- node = node->Next();
+ 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:
// (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()));
arrow_list->Append(head_list);
- node = node->Next();
+ node = node->GetNext();
}
- clause->AddAttributeValue("arrows", arrow_list);
+ clause->AddAttributeValue(_T("arrows"), arrow_list);
}
}
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->SetName(_T("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;
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)
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();
}
}
{
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);
// 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;
}
-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;
}
}
-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;
// 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
}
}
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);
*/
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);
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
m_arcArrows.Append(arrow);
return TRUE;
}
- refNode = refNode->Next();
+ refNode = refNode->GetNext();
}
m_arcArrows.Append(arrow);
return TRUE;
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:
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;
}
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;
}
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))
{
delete node;
return TRUE;
}
- node = node->Next();
+ node = node->GetNext();
}
return FALSE;
}
// 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;
}
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
wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject)
{
- int n = m_lineControlPoints->Number();
+ int n = m_lineControlPoints->GetCount();
int nn = 0;
if (m_to == 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;
dc.DrawRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height));
}
-void wxLabelShape::OnDrawContents(wxDC& dc)
+void wxLabelShape::OnDrawContents(wxDC& WXUNUSED(dc))
{
}
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());
// 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 ++;
}
}