// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "basicp.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
else
{
m_originalPoints = the_points;
-
+
// Duplicate the list of points
m_points = new wxList;
-
- wxNode *node = the_points->GetFirst();
+
+ wxObjectList::compatibility_iterator node = the_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
{
if (m_points)
{
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
delete point;
- delete node;
+ m_points->Erase(node);
node = m_points->GetFirst();
}
delete m_points;
}
if (m_originalPoints)
{
- wxNode *node = m_originalPoints->GetFirst();
+ wxObjectList::compatibility_iterator node = m_originalPoints->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
delete point;
- delete node;
+ m_originalPoints->Erase(node);
node = m_originalPoints->GetFirst();
}
delete m_originalPoints;
double top = 10000;
double bottom = -10000;
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
double top = 10000;
double bottom = -10000;
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
bool PolylineHitTest(double n, double xvec[], double yvec[],
double x1, double y1, double x2, double y2)
{
- bool isAHit = FALSE;
+ bool isAHit = false;
int i;
double lastx = xvec[0];
double lasty = yvec[0];
oglCheckLineIntersection(x1, y1, x2, y2, lastx, lasty, xvec[i], yvec[i],
&line_ratio, &other_ratio);
if (line_ratio != 1.0)
- isAHit = TRUE;
+ isAHit = true;
lastx = xvec[i];
lasty = yvec[i];
oglCheckLineIntersection(x1, y1, x2, y2, lastx, lasty, xvec[0], yvec[0],
&line_ratio, &other_ratio);
if (line_ratio != 1.0)
- isAHit = TRUE;
+ isAHit = true;
}
return isAHit;
int np = m_points->GetCount();
double *xpoints = new double[np];
double *ypoints = new double[np];
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
int i = 0;
while (node)
{
// We assume it's inside the polygon UNLESS one or more
// lines don't hit the outline.
- bool isContained = TRUE;
+ bool isContained = true;
int noPoints = 4;
for (i = 0; i < noPoints; i++)
{
if (!PolylineHitTest(np, xpoints, ypoints, x, y, endPointsX[i], endPointsY[i]))
- isContained = FALSE;
+ isContained = false;
}
/*
if (isContained)
delete[] ypoints;
if (!isContained)
- return FALSE;
+ return false;
int nearest_attachment = 0;
}
*attachment = nearest_attachment;
*distance = nearest;
- return TRUE;
+ return true;
}
// Really need to be able to reset the shape! Otherwise, if the
double x_proportion = (double)(fabs(new_width/m_originalWidth));
double y_proportion = (double)(fabs(new_height/m_originalHeight));
- wxNode *node = m_points->GetFirst();
- wxNode *original_node = m_originalPoints->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator original_node = m_originalPoints->GetFirst();
while (node && original_node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
void wxPolygonShape::UpdateOriginalPoints()
{
if (!m_originalPoints) m_originalPoints = new wxList;
- wxNode *original_node = m_originalPoints->GetFirst();
+ wxObjectList::compatibility_iterator original_node = m_originalPoints->GetFirst();
while (original_node)
{
- wxNode *next_node = original_node->GetNext();
+ wxObjectList::compatibility_iterator next_node = original_node->GetNext();
wxRealPoint *original_point = (wxRealPoint *)original_node->GetData();
delete original_point;
- delete original_node;
+ m_originalPoints->Erase(original_node);
original_node = next_node;
}
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
void wxPolygonShape::AddPolygonPoint(int pos)
{
- wxNode *node = m_points->Item(pos);
+ wxObjectList::compatibility_iterator node = m_points->Item(pos);
if (!node) node = m_points->GetFirst();
wxRealPoint *firstPoint = (wxRealPoint *)node->GetData();
- wxNode *node2 = m_points->Item(pos + 1);
+ wxObjectList::compatibility_iterator node2 = m_points->Item(pos + 1);
if (!node2) node2 = m_points->GetFirst();
wxRealPoint *secondPoint = (wxRealPoint *)node2->GetData();
void wxPolygonShape::DeletePolygonPoint(int pos)
{
- wxNode *node = m_points->Item(pos);
+ wxObjectList::compatibility_iterator node = m_points->Item(pos);
if (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
delete point;
- delete node;
+ m_points->Erase(node);
UpdateOriginalPoints();
if (m_selected)
{
{
// Look for the point we'd be connecting to. This is
// a heuristic...
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
{
*x3 = point->x + m_xpos;
*y3 = point->y + m_ypos;
- return TRUE;
+ return true;
}
else if ((y2 < y1) && (point->y < 0.0))
{
*x3 = point->x + m_xpos;
*y3 = point->y + m_ypos;
- return TRUE;
+ return true;
}
}
node = node->GetNext();
double *xpoints = new double[n];
double *ypoints = new double[n];
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
int i = 0;
while (node)
{
delete[] xpoints;
delete[] ypoints;
- return TRUE;
+ return true;
}
void wxPolygonShape::OnDraw(wxDC& dc)
// Make as many control points as there are vertices.
void wxPolygonShape::MakeControlPoints()
{
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
void wxPolygonShape::ResetControlPoints()
{
- wxNode *node = m_points->GetFirst();
- wxNode *controlPointNode = m_controlPoints.GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator controlPointNode = m_controlPoints.GetFirst();
while (node && controlPointNode)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
// Make a list of lists for the coordinates
wxExpr *list = new wxExpr(wxExprList);
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
polyCopy.m_points = new wxList;
polyCopy.m_originalPoints = new wxList;
- wxNode *node = m_points->GetFirst();
+ wxObjectList::compatibility_iterator node = m_points->GetFirst();
while (node)
{
wxRealPoint *point = (wxRealPoint *)node->GetData();
int wxPolygonShape::GetNumberOfAttachments() const
{
int maxN = (m_points ? (m_points->GetCount() - 1) : 0);
- wxNode *node = m_attachmentPoints.GetFirst();
+ wxObjectList::compatibility_iterator node = m_attachmentPoints.GetFirst();
while (node)
{
wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData();
wxRealPoint *point = (wxRealPoint *)m_points->Item(attachment)->GetData();
*x = point->x + m_xpos;
*y = point->y + m_ypos;
- return TRUE;
+ return true;
}
else
{ return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs, line); }
bool wxPolygonShape::AttachmentIsValid(int attachment) const
{
if (!m_points)
- return FALSE;
+ return false;
if ((attachment >= 0) && (attachment < (int) m_points->GetCount()))
- return TRUE;
+ return true;
- wxNode *node = m_attachmentPoints.GetFirst();
+ wxObjectList::compatibility_iterator node = m_attachmentPoints.GetFirst();
while (node)
{
wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData();
if (point->m_id == attachment)
- return TRUE;
+ return true;
node = node->GetNext();
}
- return FALSE;
+ return false;
}
// Rotate about the given axis by the given amount in radians
// Rotate attachment points
double sinTheta = (double)sin(actualTheta);
double cosTheta = (double)cos(actualTheta);
- wxNode *node = m_attachmentPoints.GetFirst();
+ wxObjectList::compatibility_iterator node = m_attachmentPoints.GetFirst();
while (node)
{
wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData();
GetBoundingBoxMax(&bound_x, &bound_y);
oglFindEndForBox(bound_x, bound_y, m_xpos, m_ypos, x2, y2, x3, y3);
- return TRUE;
+ return true;
}
#if wxUSE_PROLOGIO
// oglFindEndForBox(bound_x, bound_y, m_xpos, m_ypos, x2, y2, x3, y3);
oglDrawArcToEllipse(m_xpos, m_ypos, bound_x, bound_y, x2, y2, x1, y1, x3, y3);
- return TRUE;
+ return true;
}
void wxEllipseShape::OnDraw(wxDC& dc)
return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs, line);
}
}
- return TRUE;
+ return true;
}
else
- { *x = m_xpos; *y = m_ypos; return TRUE; }
+ { *x = m_xpos; *y = m_ypos; return true; }
}
wxCircleShape::wxCircleShape(double diameter):wxEllipseShape(diameter, diameter)
{
- SetMaintainAspectRatio(TRUE);
+ SetMaintainAspectRatio(true);
}
void wxCircleShape::Copy(wxShape& copy)
x2, y2, // Other end of line
x3, y3);
- return TRUE;
+ return true;
}
// Control points
SetPen(g_oglBlackForegroundPen);
SetBrush(wxBLACK_BRUSH);
m_oldCursor = NULL;
- m_visible = TRUE;
- m_eraseObject = TRUE;
+ m_visible = true;
+ m_eraseObject = true;
}
wxControlPoint::~wxControlPoint()
int WXUNUSED(nth), int WXUNUSED(no_arcs), wxLineShape *WXUNUSED(line))
{
*x = m_xpos; *y = m_ypos;
- return TRUE;
+ return true;
}
// Control points ('handles') redirect control to the actual shape, to make it easier
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
pt->sm_controlPointDragStartWidth = bound_x;
pt->sm_controlPointDragStartHeight = bound_y;
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
this->Erase(dc);
/*
if (!pt->m_eraseObject)
- this->Show(FALSE);
+ this->Show(false);
*/
this->SetSize(pt->sm_controlPointDragEndWidth, pt->sm_controlPointDragEndHeight);
/*
if (!eraseIt)
- theObject->Show(TRUE);
+ theObject->Show(true);
*/
// Recursively redraw links if we have a composite.
if (theObject->GetChildren().GetCount() > 0)
- theObject->DrawLinks(dc, -1, TRUE);
+ theObject->DrawLinks(dc, -1, true);
double width, height;
theObject->GetBoundingBoxMax(&width, &height);
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
if (ppt->m_originalDistance == 0.0) ppt->m_originalDistance = (double) 0.0001;
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
m_actualPenObject = NULL;
}
-wxShapeRegion::wxShapeRegion(wxShapeRegion& region)
+wxShapeRegion::wxShapeRegion(wxShapeRegion& region):wxObject()
{
m_regionText = region.m_regionText;
m_regionName = region.m_regionName;
m_penColour = region.m_penColour;
ClearText();
- wxNode *node = region.m_formattedText.GetFirst();
+ wxObjectList::compatibility_iterator node = region.m_formattedText.GetFirst();
while (node)
{
wxShapeTextLine *line = (wxShapeTextLine *)node->GetData();
void wxShapeRegion::ClearText()
{
- wxNode *node = m_formattedText.GetFirst();
+ wxObjectList::compatibility_iterator node = m_formattedText.GetFirst();
while (node)
{
wxShapeTextLine *line = (wxShapeTextLine *)node->GetData();
- wxNode *next = node->GetNext();
+ wxObjectList::compatibility_iterator next = node->GetNext();
delete line;
- delete node;
+ m_formattedText.Erase(node);
node = next;
}
}