// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
{
ClearPoints();
- m_originalPoints = the_points;
-
- // Duplicate the list of points
- m_points = new wxList;
-
- wxNode *node = the_points->GetFirst();
- while (node)
+ if (!the_points)
{
- wxRealPoint *point = (wxRealPoint *)node->GetData();
- wxRealPoint *new_point = new wxRealPoint(point->x, point->y);
- m_points->Append((wxObject*) new_point);
- node = node->GetNext();
+ m_originalPoints = new wxList;
+ m_points = new wxList;
+ }
+ else
+ {
+ m_originalPoints = the_points;
+
+ // Duplicate the list of points
+ m_points = new wxList;
+
+ wxNode *node = the_points->GetFirst();
+ while (node)
+ {
+ wxRealPoint *point = (wxRealPoint *)node->GetData();
+ wxRealPoint *new_point = new wxRealPoint(point->x, point->y);
+ m_points->Append((wxObject*) new_point);
+ node = node->GetNext();
+ }
+ CalculateBoundingBox();
+ m_originalWidth = m_boundWidth;
+ m_originalHeight = m_boundHeight;
+ SetDefaultRegionSize();
}
- CalculateBoundingBox();
- m_originalWidth = m_boundWidth;
- m_originalHeight = m_boundHeight;
- SetDefaultRegionSize();
}
wxPolygonShape::~wxPolygonShape()
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;
// 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
{
*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();
delete[] xpoints;
delete[] ypoints;
- return TRUE;
+ return true;
}
void wxPolygonShape::OnDraw(wxDC& dc)
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();
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
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
double bound_x;
double bound_y;
this->GetBoundingBoxMin(&bound_x, &bound_y);
+ this->GetEventHandler()->OnBeginSize(bound_x, bound_y);
// Choose the 'opposite corner' of the object as the stationary
// point in case this is non-centring resizing.
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);
m_textColour = wxT("BLACK");
m_penColour = wxT("BLACK");
m_penStyle = wxSOLID;
- m_actualColourObject = NULL;
+ m_actualColourObject = wxTheColourDatabase->Find(wxT("BLACK"));
m_actualPenObject = NULL;
}
m_regionProportionX = region.m_regionProportionX;
m_regionProportionY = region.m_regionProportionY;
m_formatMode = region.m_formatMode;
- m_actualColourObject = NULL;
+ m_actualColourObject = region.m_actualColourObject;
m_actualPenObject = NULL;
m_penStyle = region.m_penStyle;
m_penColour = region.m_penColour;
void wxShapeRegion::SetColour(const wxString& col)
{
m_textColour = col;
- m_actualColourObject = NULL;
+ m_actualColourObject = col;
}
-wxColour *wxShapeRegion::GetActualColourObject()
+wxColour wxShapeRegion::GetActualColourObject()
{
- if (!m_actualColourObject)
- m_actualColourObject = wxTheColourDatabase->FindColour(GetColour());
- if (!m_actualColourObject)
- m_actualColourObject = wxBLACK;
+ m_actualColourObject = wxTheColourDatabase->Find(GetColour());
return m_actualColourObject;
}