#include <wx/wx.h>
#endif
-#include <wx/wxexpr.h>
+#if wxUSE_PROLOGIO
+#include <wx/deprecated/wxexpr.h>
+#endif
+
+#include "wx/ogl/ogl.h"
-#include <wx/ogl/basic.h>
-#include <wx/ogl/basicp.h>
-#include <wx/ogl/constrnt.h>
-#include <wx/ogl/composit.h>
-#include <wx/ogl/misc.h>
-#include <wx/ogl/canvas.h>
#if wxUSE_PROLOGIO
// Sometimes, objects need to access the whole database to
wxCompositeShape::~wxCompositeShape()
{
- wxNode *node = m_constraints.First();
+ wxNode *node = m_constraints.GetFirst();
while (node)
{
- wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
+ wxOGLConstraint *constraint = (wxOGLConstraint *)node->GetData();
delete constraint;
- node = node->Next();
+ node = node->GetNext();
}
- node = m_children.First();
+ node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
- wxNode *next = node->Next();
+ wxShape *object = (wxShape *)node->GetData();
+ wxNode *next = node->GetNext();
object->Unlink();
delete object;
node = next;
void wxCompositeShape::OnDrawContents(wxDC& dc)
{
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
object->Draw(dc);
object->DrawLinks(dc);
- node = node->Next();
+ node = node->GetNext();
}
wxShape::OnDrawContents(dc);
}
{
double diffX = x - oldx;
double diffY = y - oldy;
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
object->Erase(dc);
object->Move(dc, object->GetX() + diffX, object->GetY() + diffY, display);
- node = node->Next();
+ node = node->GetNext();
}
return TRUE;
}
void wxCompositeShape::OnErase(wxDC& dc)
{
wxRectangleShape::OnErase(dc);
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
object->Erase(dc);
- node = node->Next();
+ node = node->GetNext();
}
}
static double objectStartX = 0.0;
static double objectStartY = 0.0;
-void wxCompositeShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment)
+void wxCompositeShape::OnDragLeft(bool WXUNUSED(draw), double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
double xx = x;
double yy = y;
// wxShape::OnDragLeft(draw, x, y, keys, attachment);
}
-void wxCompositeShape::OnBeginDragLeft(double x, double y, int keys, int attachment)
+void wxCompositeShape::OnBeginDragLeft(double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
objectStartX = x;
objectStartY = y;
// wxShape::OnBeginDragLeft(x, y, keys, attachment);
}
-void wxCompositeShape::OnEndDragLeft(double x, double y, int keys, int attachment)
+void wxCompositeShape::OnEndDragLeft(double x, double y, int keys, int WXUNUSED(attachment))
{
// wxShape::OnEndDragLeft(x, y, keys, attachment);
if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc);
}
-void wxCompositeShape::OnRightClick(double x, double y, int keys, int attachment)
+void wxCompositeShape::OnRightClick(double x, double y, int keys, int WXUNUSED(attachment))
{
// If we get a ctrl-right click, this means send the message to
// the division, so we can invoke a user interface for dealing with regions.
if (keys & KEY_CTRL)
{
- wxNode *node = m_divisions.First();
+ wxNode *node = m_divisions.GetFirst();
while (node)
{
- wxDivisionShape *division = (wxDivisionShape *)node->Data();
- wxNode *next = node->Next();
+ wxDivisionShape *division = (wxDivisionShape *)node->GetData();
+ wxNode *next = node->GetNext();
int attach = 0;
double dist = 0.0;
if (division->HitTest(x, y, &attach, &dist))
if (!recursive) return;
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
double xBound, yBound;
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
// Scale the position first
double newX = (double)(((object->GetX() - GetX())*xScale) + GetX());
object->SetSize(object->GetFixedWidth() ? xBound : xScale*xBound,
object->GetFixedHeight() ? yBound : yScale*yBound);
- node = node->Next();
+ node = node->GetNext();
}
SetDefaultRegionSize();
}
void wxCompositeShape::DeleteConstraintsInvolvingChild(wxShape *child)
{
- wxNode *node = m_constraints.First();
+ wxNode *node = m_constraints.GetFirst();
while (node)
{
- wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
- wxNode *nextNode = node->Next();
+ wxOGLConstraint *constraint = (wxOGLConstraint *)node->GetData();
+ wxNode *nextNode = node->GetNext();
if ((constraint->m_constrainingObject == child) ||
constraint->m_constrainedObjects.Member(child))
void wxCompositeShape::RemoveChildFromConstraints(wxShape *child)
{
- wxNode *node = m_constraints.First();
+ wxNode *node = m_constraints.GetFirst();
while (node)
{
- wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
- wxNode *nextNode = node->Next();
+ wxOGLConstraint *constraint = (wxOGLConstraint *)node->GetData();
+ wxNode *nextNode = node->GetNext();
if (constraint->m_constrainedObjects.Member(child))
constraint->m_constrainedObjects.DeleteObject(child);
oglObjectCopyMapping.Append((long)this, &compositeCopy);
// Copy the children
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
wxShape *newObject = object->CreateNewCopy(FALSE, FALSE);
if (newObject->GetId() == 0)
newObject->SetId(wxNewId());
oglObjectCopyMapping.Append((long)object, newObject);
- node = node->Next();
+ node = node->GetNext();
}
// Copy the constraints
- node = m_constraints.First();
+ node = m_constraints.GetFirst();
while (node)
{
- wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
+ wxOGLConstraint *constraint = (wxOGLConstraint *)node->GetData();
- wxShape *newConstraining = (wxShape *)(oglObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data());
+ wxShape *newConstraining = (wxShape *)(oglObjectCopyMapping.Find((long)constraint->m_constrainingObject)->GetData());
wxList newConstrainedList;
- wxNode *node2 = constraint->m_constrainedObjects.First();
+ wxNode *node2 = constraint->m_constrainedObjects.GetFirst();
while (node2)
{
- wxShape *constrainedObject = (wxShape *)node2->Data();
- wxShape *newConstrained = (wxShape *)(oglObjectCopyMapping.Find((long)constrainedObject)->Data());
+ wxShape *constrainedObject = (wxShape *)node2->GetData();
+ wxShape *newConstrained = (wxShape *)(oglObjectCopyMapping.Find((long)constrainedObject)->GetData());
newConstrainedList.Append(newConstrained);
- node2 = node2->Next();
+ node2 = node2->GetNext();
}
wxOGLConstraint *newConstraint = new wxOGLConstraint(constraint->m_constraintType, newConstraining,
newConstraint->SetSpacing(constraint->m_xSpacing, constraint->m_ySpacing);
compositeCopy.m_constraints.Append(newConstraint);
- node = node->Next();
+ node = node->GetNext();
}
// Now compositeCopy the division geometry
- node = m_divisions.First();
+ node = m_divisions.GetFirst();
while (node)
{
- wxDivisionShape *division = (wxDivisionShape *)node->Data();
+ wxDivisionShape *division = (wxDivisionShape *)node->GetData();
wxNode *node1 = oglObjectCopyMapping.Find((long)division);
wxNode *leftNode = NULL;
wxNode *topNode = NULL;
bottomNode = oglObjectCopyMapping.Find((long)division->GetBottomSide());
if (node1)
{
- wxDivisionShape *newDivision = (wxDivisionShape *)node1->Data();
+ wxDivisionShape *newDivision = (wxDivisionShape *)node1->GetData();
if (leftNode)
- newDivision->SetLeftSide((wxDivisionShape *)leftNode->Data());
+ newDivision->SetLeftSide((wxDivisionShape *)leftNode->GetData());
if (topNode)
- newDivision->SetTopSide((wxDivisionShape *)topNode->Data());
+ newDivision->SetTopSide((wxDivisionShape *)topNode->GetData());
if (rightNode)
- newDivision->SetRightSide((wxDivisionShape *)rightNode->Data());
+ newDivision->SetRightSide((wxDivisionShape *)rightNode->GetData());
if (bottomNode)
- newDivision->SetBottomSide((wxDivisionShape *)bottomNode->Data());
+ newDivision->SetBottomSide((wxDivisionShape *)bottomNode->GetData());
}
- node = node->Next();
+ node = node->GetNext();
}
}
wxOGLConstraint *wxCompositeShape::FindConstraint(long cId, wxCompositeShape **actualComposite)
{
- wxNode *node = m_constraints.First();
+ wxNode *node = m_constraints.GetFirst();
while (node)
{
- wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
+ wxOGLConstraint *constraint = (wxOGLConstraint *)node->GetData();
if (constraint->m_constraintId == cId)
{
if (actualComposite)
*actualComposite = this;
return constraint;
}
- node = node->Next();
+ node = node->GetNext();
}
// If not found, try children.
- node = m_children.First();
+ node = m_children.GetFirst();
while (node)
{
- wxShape *child = (wxShape *)node->Data();
+ wxShape *child = (wxShape *)node->GetData();
if (child->IsKindOf(CLASSINFO(wxCompositeShape)))
{
wxOGLConstraint *constraint = ((wxCompositeShape *)child)->FindConstraint(cId, actualComposite);
return constraint;
}
}
- node = node->Next();
+ node = node->GetNext();
}
return NULL;
}
double minY = (double) 999999.9;
double w, h;
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
// Recalculate size of composite objects because may not conform
// to size it was set to - depends on the children.
if ((object->GetY() - (h/2.0)) < minY)
minY = (double)(object->GetY() - (h/2.0));
- node = node->Next();
+ node = node->GetNext();
}
m_width = maxX - minX;
m_height = maxY - minY;
CalculateSize();
bool changed = FALSE;
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
if (object->Constrain())
changed = TRUE;
- node = node->Next();
+ node = node->GetNext();
}
- node = m_constraints.First();
+ node = m_constraints.GetFirst();
while (node)
{
- wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
+ wxOGLConstraint *constraint = (wxOGLConstraint *)node->GetData();
if (constraint->Evaluate()) changed = TRUE;
- node = node->Next();
+ node = node->GetNext();
}
return changed;
}
// Output constraints as constraint1 = (...), constraint2 = (...), etc.
int constraintNo = 1;
- char m_constraintNameBuf[20];
- wxNode *node = m_constraints.First();
+ wxChar m_constraintNameBuf[20];
+ wxNode *node = m_constraints.GetFirst();
while (node)
{
- wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
- sprintf(m_constraintNameBuf, "constraint%d", constraintNo);
+ wxOGLConstraint *constraint = (wxOGLConstraint *)node->GetData();
+ wxSprintf(m_constraintNameBuf, _T("constraint%d"), constraintNo);
// Each constraint is stored in the form
// (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList)
constraintExpr->Append(new wxExpr(constraint->m_constrainingObject->GetId()));
wxExpr *objectList = new wxExpr(wxExprList);
- wxNode *node1 = constraint->m_constrainedObjects.First();
+ wxNode *node1 = constraint->m_constrainedObjects.GetFirst();
while (node1)
{
- wxShape *obj = (wxShape *)node1->Data();
+ wxShape *obj = (wxShape *)node1->GetData();
objectList->Append(new wxExpr(obj->GetId()));
- node1 = node1->Next();
+ node1 = node1->GetNext();
}
constraintExpr->Append(objectList);
clause->AddAttributeValue(m_constraintNameBuf, constraintExpr);
- node = node->Next();
+ node = node->GetNext();
constraintNo ++;
}
// Write the ids of all the child images
wxExpr *childrenExpr = new wxExpr(wxExprList);
- node = m_children.First();
+ node = m_children.GetFirst();
while (node)
{
- wxShape *child = (wxShape *)node->Data();
+ wxShape *child = (wxShape *)node->GetData();
childrenExpr->Append(new wxExpr(child->GetId()));
- node = node->Next();
+ node = node->GetNext();
}
- clause->AddAttributeValue("children", childrenExpr);
+ clause->AddAttributeValue(_T("children"), childrenExpr);
// Write the ids of all the division images
- if (m_divisions.Number() > 0)
+ if (m_divisions.GetCount() > 0)
{
wxExpr *divisionsExpr = new wxExpr(wxExprList);
- node = m_divisions.First();
+ node = m_divisions.GetFirst();
while (node)
{
- wxShape *child = (wxShape *)node->Data();
+ wxShape *child = (wxShape *)node->GetData();
divisionsExpr->Append(new wxExpr(child->GetId()));
- node = node->Next();
+ node = node->GetNext();
}
- clause->AddAttributeValue("divisions", divisionsExpr);
+ clause->AddAttributeValue(_T("divisions"), divisionsExpr);
}
}
{
// Constraints are output as constraint1 = (...), constraint2 = (...), etc.
int constraintNo = 1;
- char m_constraintNameBuf[20];
+ wxChar m_constraintNameBuf[20];
bool haveConstraints = TRUE;
while (haveConstraints)
{
- sprintf(m_constraintNameBuf, "constraint%d", constraintNo);
+ wxSprintf(m_constraintNameBuf, _T("constraint%d"), constraintNo);
wxExpr *constraintExpr = NULL;
clause->GetAttributeValue(m_constraintNameBuf, &constraintExpr);
if (!constraintExpr)
int cType = 0;
double cXSpacing = 0.0;
double cYSpacing = 0.0;
- wxString cName("");
+ wxString cName = wxEmptyString;
long cId = 0;
wxShape *m_constrainingObject = NULL;
wxList m_constrainedObjects;
cName = nameExpr->StringValue();
cId = idExpr->IntegerValue();
- wxExpr *objExpr1 = database->HashFind("node_image", constrainingExpr->IntegerValue());
+ wxExpr *objExpr1 = database->HashFind(_T("node_image"), constrainingExpr->IntegerValue());
if (objExpr1 && objExpr1->GetClientData())
m_constrainingObject = (wxShape *)objExpr1->GetClientData();
else
while (currentIdExpr)
{
long currentId = currentIdExpr->IntegerValue();
- wxExpr *objExpr2 = database->HashFind("node_image", currentId);
+ wxExpr *objExpr2 = database->HashFind(_T("node_image"), currentId);
if (objExpr2 && objExpr2->GetClientData())
{
m_constrainedObjects.Append((wxShape *)objExpr2->GetClientData());
wxShape *wxCompositeShape::FindContainerImage()
{
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *child = (wxShape *)node->Data();
+ wxShape *child = (wxShape *)node->GetData();
if (!m_divisions.Member(child))
return child;
- node = node->Next();
+ node = node->GetNext();
}
return NULL;
}
{
if (m_divisions.Member(division))
return TRUE;
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *child = (wxShape *)node->Data();
+ wxShape *child = (wxShape *)node->GetData();
if (child->IsKindOf(CLASSINFO(wxCompositeShape)))
{
bool ans = ((wxCompositeShape *)child)->ContainsDivision(division);
if (ans)
return TRUE;
}
- node = node->Next();
+ node = node->GetNext();
}
return FALSE;
}
{
double diffX = x - oldx;
double diffY = y - oldy;
- wxNode *node = m_children.First();
+ wxNode *node = m_children.GetFirst();
while (node)
{
- wxShape *object = (wxShape *)node->Data();
+ wxShape *object = (wxShape *)node->GetData();
object->Erase(dc);
object->Move(dc, object->GetX() + diffX, object->GetY() + diffY, display);
- node = node->Next();
+ node = node->GetNext();
}
return TRUE;
}
wxCompositeShape::WriteAttributes(clause);
if (m_leftSide)
- clause->AddAttributeValue("left_side", (long)m_leftSide->GetId());
+ clause->AddAttributeValue(_T("left_side"), (long)m_leftSide->GetId());
if (m_topSide)
- clause->AddAttributeValue("top_side", (long)m_topSide->GetId());
+ clause->AddAttributeValue(_T("top_side"), (long)m_topSide->GetId());
if (m_rightSide)
- clause->AddAttributeValue("right_side", (long)m_rightSide->GetId());
+ clause->AddAttributeValue(_T("right_side"), (long)m_rightSide->GetId());
if (m_bottomSide)
- clause->AddAttributeValue("bottom_side", (long)m_bottomSide->GetId());
+ clause->AddAttributeValue(_T("bottom_side"), (long)m_bottomSide->GetId());
- clause->AddAttributeValue("handle_side", (long)m_handleSide);
- clause->AddAttributeValueString("left_colour", m_leftSideColour);
- clause->AddAttributeValueString("top_colour", m_topSideColour);
- clause->AddAttributeValueString("left_style", m_leftSideStyle);
- clause->AddAttributeValueString("top_style", m_topSideStyle);
+ clause->AddAttributeValue(_T("handle_side"), (long)m_handleSide);
+ clause->AddAttributeValueString(_T("left_colour"), m_leftSideColour);
+ clause->AddAttributeValueString(_T("top_colour"), m_topSideColour);
+ clause->AddAttributeValueString(_T("left_style"), m_leftSideStyle);
+ clause->AddAttributeValueString(_T("top_style"), m_topSideStyle);
}
void wxDivisionShape::ReadAttributes(wxExpr *clause)
{
wxCompositeShape::ReadAttributes(clause);
- clause->GetAttributeValue("handle_side", m_handleSide);
- clause->GetAttributeValue("left_colour", m_leftSideColour);
- clause->GetAttributeValue("top_colour", m_topSideColour);
- clause->GetAttributeValue("left_style", m_leftSideStyle);
- clause->GetAttributeValue("top_style", m_topSideStyle);
+ clause->GetAttributeValue(_T("handle_side"), m_handleSide);
+ clause->GetAttributeValue(_T("left_colour"), m_leftSideColour);
+ clause->GetAttributeValue(_T("top_colour"), m_topSideColour);
+ clause->GetAttributeValue(_T("left_style"), m_leftSideStyle);
+ clause->GetAttributeValue(_T("top_style"), m_topSideStyle);
}
#endif
// Anything adjoining the bottom of this division now adjoins the
// bottom of the new division.
- wxNode *node = compositeParent->GetDivisions().First();
+ wxNode *node = compositeParent->GetDivisions().GetFirst();
while (node)
{
- wxDivisionShape *obj = (wxDivisionShape *)node->Data();
+ wxDivisionShape *obj = (wxDivisionShape *)node->GetData();
if (obj->GetTopSide() == this)
obj->SetTopSide(newDivision);
- node = node->Next();
+ node = node->GetNext();
}
newDivision->SetTopSide(this);
newDivision->SetBottomSide(m_bottomSide);
// Anything adjoining the left of this division now adjoins the
// left of the new division.
- wxNode *node = compositeParent->GetDivisions().First();
+ wxNode *node = compositeParent->GetDivisions().GetFirst();
while (node)
{
- wxDivisionShape *obj = (wxDivisionShape *)node->Data();
+ wxDivisionShape *obj = (wxDivisionShape *)node->GetData();
if (obj->GetLeftSide() == this)
obj->SetLeftSide(newDivision);
- node = node->Next();
+ node = node->GetNext();
}
newDivision->SetTopSide(m_topSide);
newDivision->SetBottomSide(m_bottomSide);
void wxDivisionShape::ResetMandatoryControlPoints()
{
- if (m_controlPoints.Number() < 1)
+ if (m_controlPoints.GetCount() < 1)
return;
double maxX, maxY;
GetBoundingBoxMax(&maxX, &maxY);
/*
- wxNode *node = m_controlPoints.First();
+ wxNode *node = m_controlPoints.GetFirst();
while (node)
{
- wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
+ wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->GetData();
if (control->type == CONTROL_POINT_HORIZONTAL)
{
control->xoffset = (double)(-maxX/2.0); control->m_yoffset = 0.0;
{
control->xoffset = 0.0; control->m_yoffset = (double)(-maxY/2.0);
}
- node = node->Next();
+ node = node->GetNext();
}
*/
- wxNode *node = m_controlPoints.First();
+ wxNode *node = m_controlPoints.GetFirst();
if ((m_handleSide == DIVISION_SIDE_LEFT) && node)
{
- wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
+ wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->GetData();
control->m_xoffset = (double)(-maxX/2.0); control->m_yoffset = 0.0;
}
if ((m_handleSide == DIVISION_SIDE_TOP) && node)
{
- wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
+ wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->GetData();
control->m_xoffset = 0.0; control->m_yoffset = (double)(-maxY/2.0);
}
if ((m_handleSide == DIVISION_SIDE_RIGHT) && node)
{
- wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
+ wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->GetData();
control->m_xoffset = (double)(maxX/2.0); control->m_yoffset = 0.0;
}
if ((m_handleSide == DIVISION_SIDE_BOTTOM) && node)
{
- wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
+ wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->GetData();
control->m_xoffset = 0.0; control->m_yoffset = (double)(maxY/2.0);
}
}
bool wxDivisionShape::ResizeAdjoining(int side, double newPos, bool test)
{
wxCompositeShape *divisionParent = (wxCompositeShape *)GetParent();
- wxNode *node = divisionParent->GetDivisions().First();
+ wxNode *node = divisionParent->GetDivisions().GetFirst();
while (node)
{
- wxDivisionShape *division = (wxDivisionShape *)node->Data();
+ wxDivisionShape *division = (wxDivisionShape *)node->GetData();
switch (side)
{
case DIVISION_SIDE_LEFT:
default:
break;
}
- node = node->Next();
+ node = node->GetNext();
}
return TRUE;
}
}
-void wxDivisionShape::EditEdge(int side)
+void wxDivisionShape::EditEdge(int WXUNUSED(side))
{
wxMessageBox(wxT("EditEdge() not implemented"), wxT("OGL"), wxOK);