X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bb0cd285ac73fb25396d53f7f52db6f3ca77b63..35c9d9582be4ebea40251378e95fdbbfe6b8ce73:/utils/ogl/src/composit.cpp?ds=sidebyside diff --git a/utils/ogl/src/composit.cpp b/utils/ogl/src/composit.cpp index a977800f70..366777b25f 100644 --- a/utils/ogl/src/composit.cpp +++ b/utils/ogl/src/composit.cpp @@ -24,9 +24,7 @@ #include #endif -#ifdef PROLOGIO #include -#endif #include "basic.h" #include "basicp.h" @@ -51,12 +49,12 @@ class wxDivisionControlPoint: public wxControlPoint DECLARE_DYNAMIC_CLASS(wxDivisionControlPoint) public: wxDivisionControlPoint() {} - wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, float size, float the_xoffset, float the_yoffset, int the_type); + wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, double size, double the_xoffset, double the_yoffset, int the_type); ~wxDivisionControlPoint(); - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); + void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); + void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0); + void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0); }; IMPLEMENT_DYNAMIC_CLASS(wxDivisionControlPoint, wxControlPoint) @@ -80,7 +78,7 @@ wxCompositeShape::~wxCompositeShape() wxNode *node = m_constraints.First(); while (node) { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); + wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data(); delete constraint; node = node->Next(); } @@ -97,20 +95,20 @@ wxCompositeShape::~wxCompositeShape() void wxCompositeShape::OnDraw(wxDC& dc) { - float x1 = (float)(m_xpos - m_width/2.0); - float y1 = (float)(m_ypos - m_height/2.0); + double x1 = (double)(m_xpos - m_width/2.0); + double y1 = (double)(m_ypos - m_height/2.0); if (m_shadowMode != SHADOW_NONE) { if (m_shadowBrush) dc.SetBrush(m_shadowBrush); - dc.SetPen(transparent_pen); + dc.SetPen(g_oglTransparentPen); if (m_cornerRadius != 0.0) - dc.DrawRoundedRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY, - m_width, m_height, m_cornerRadius); + dc.DrawRoundedRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY), + WXROUND(m_width), WXROUND(m_height), m_cornerRadius); else - dc.DrawRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY, m_width, m_height); + dc.DrawRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY), WXROUND(m_width), WXROUND(m_height)); } } @@ -127,10 +125,10 @@ void wxCompositeShape::OnDrawContents(wxDC& dc) wxShape::OnDrawContents(dc); } -bool wxCompositeShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float oldy, bool display) +bool wxCompositeShape::OnMovePre(wxDC& dc, double x, double y, double oldx, double oldy, bool display) { - float diffX = x - oldx; - float diffY = y - oldy; + double diffX = x - oldx; + double diffY = y - oldy; wxNode *node = m_children.First(); while (node) { @@ -156,16 +154,16 @@ void wxCompositeShape::OnErase(wxDC& dc) } } -static float objectStartX = 0.0; -static float objectStartY = 0.0; +static double objectStartX = 0.0; +static double objectStartY = 0.0; -void wxCompositeShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment) +void wxCompositeShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment) { - float xx = x; - float yy = y; + double xx = x; + double yy = y; m_canvas->Snap(&xx, &yy); - float offsetX = xx - objectStartX; - float offsetY = yy - objectStartY; + double offsetX = xx - objectStartX; + double offsetY = yy - objectStartY; wxClientDC dc(GetCanvas()); GetCanvas()->PrepareDC(dc); @@ -179,7 +177,7 @@ void wxCompositeShape::OnDragLeft(bool draw, float x, float y, int keys, int att // wxShape::OnDragLeft(draw, x, y, keys, attachment); } -void wxCompositeShape::OnBeginDragLeft(float x, float y, int keys, int attachment) +void wxCompositeShape::OnBeginDragLeft(double x, double y, int keys, int attachment) { objectStartX = x; objectStartY = y; @@ -196,18 +194,18 @@ void wxCompositeShape::OnBeginDragLeft(float x, float y, int keys, int attachmen dc.SetBrush((* wxTRANSPARENT_BRUSH)); m_canvas->CaptureMouse(); - float xx = x; - float yy = y; + double xx = x; + double yy = y; m_canvas->Snap(&xx, &yy); - float offsetX = xx - objectStartX; - float offsetY = yy - objectStartY; + double offsetX = xx - objectStartX; + double offsetY = yy - objectStartY; GetEventHandler()->OnDrawOutline(dc, GetX() + offsetX, GetY() + offsetY, GetWidth(), GetHeight()); // wxShape::OnBeginDragLeft(x, y, keys, attachment); } -void wxCompositeShape::OnEndDragLeft(float x, float y, int keys, int attachment) +void wxCompositeShape::OnEndDragLeft(double x, double y, int keys, int attachment) { // wxShape::OnEndDragLeft(x, y, keys, attachment); @@ -223,18 +221,18 @@ void wxCompositeShape::OnEndDragLeft(float x, float y, int keys, int attachment) } dc.SetLogicalFunction(wxCOPY); - float xx = x; - float yy = y; + double xx = x; + double yy = y; m_canvas->Snap(&xx, &yy); - float offsetX = xx - objectStartX; - float offsetY = yy - objectStartY; + double offsetX = xx - objectStartX; + double offsetY = yy - objectStartY; Move(dc, GetX() + offsetX, GetY() + offsetY); if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); } -void wxCompositeShape::OnRightClick(float x, float y, int keys, int attachment) +void wxCompositeShape::OnRightClick(double x, double y, int keys, int 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. @@ -246,7 +244,7 @@ void wxCompositeShape::OnRightClick(float x, float y, int keys, int attachment) wxDivisionShape *division = (wxDivisionShape *)node->Data(); wxNode *next = node->Next(); int attach = 0; - float dist = 0.0; + double dist = 0.0; if (division->HitTest(x, y, &attach, &dist)) { division->GetEventHandler()->OnRightClick(x, y, keys, attach); @@ -258,12 +256,12 @@ void wxCompositeShape::OnRightClick(float x, float y, int keys, int attachment) } } -void wxCompositeShape::SetSize(float w, float h, bool recursive) +void wxCompositeShape::SetSize(double w, double h, bool recursive) { SetAttachmentSize(w, h); - float xScale = (float)(w/(wxMax(1.0, GetWidth()))); - float yScale = (float)(h/(wxMax(1.0, GetHeight()))); + double xScale = (double)(w/(wxMax(1.0, GetWidth()))); + double yScale = (double)(h/(wxMax(1.0, GetHeight()))); m_width = w; m_height = h; @@ -275,14 +273,14 @@ void wxCompositeShape::SetSize(float w, float h, bool recursive) wxClientDC dc(GetCanvas()); GetCanvas()->PrepareDC(dc); - float xBound, yBound; + double xBound, yBound; while (node) { wxShape *object = (wxShape *)node->Data(); // Scale the position first - float newX = (float)(((object->GetX() - GetX())*xScale) + GetX()); - float newY = (float)(((object->GetY() - GetY())*yScale) + GetY()); + double newX = (double)(((object->GetX() - GetX())*xScale) + GetX()); + double newY = (double)(((object->GetY() - GetY())*yScale) + GetY()); object->Show(FALSE); object->Move(dc, newX, newY); object->Show(TRUE); @@ -323,7 +321,7 @@ void wxCompositeShape::DeleteConstraintsInvolvingChild(wxShape *child) wxNode *node = m_constraints.First(); while (node) { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); + wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data(); wxNode *nextNode = node->Next(); if ((constraint->m_constrainingObject == child) || @@ -341,7 +339,7 @@ void wxCompositeShape::RemoveChildFromConstraints(wxShape *child) wxNode *node = m_constraints.First(); while (node) { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); + wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data(); wxNode *nextNode = node->Next(); if (constraint->m_constrainedObjects.Member(child)) @@ -369,7 +367,7 @@ void wxCompositeShape::Copy(wxShape& copy) wxCompositeShape& compositeCopy = (wxCompositeShape&) copy; // Associate old and new copies for compositeCopying constraints and division geometry - wxObjectCopyMapping.Append((long)this, &compositeCopy); + oglObjectCopyMapping.Append((long)this, &compositeCopy); // Copy the children wxNode *node = m_children.First(); @@ -387,7 +385,7 @@ void wxCompositeShape::Copy(wxShape& copy) if (m_divisions.Member(object)) compositeCopy.m_divisions.Append(newObject); - wxObjectCopyMapping.Append((long)object, newObject); + oglObjectCopyMapping.Append((long)object, newObject); node = node->Next(); } @@ -396,21 +394,21 @@ void wxCompositeShape::Copy(wxShape& copy) node = m_constraints.First(); while (node) { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); + wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data(); - wxShape *newConstraining = (wxShape *)(wxObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data()); + wxShape *newConstraining = (wxShape *)(oglObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data()); wxList newConstrainedList; wxNode *node2 = constraint->m_constrainedObjects.First(); while (node2) { wxShape *constrainedObject = (wxShape *)node2->Data(); - wxShape *newConstrained = (wxShape *)(wxObjectCopyMapping.Find((long)constrainedObject)->Data()); + wxShape *newConstrained = (wxShape *)(oglObjectCopyMapping.Find((long)constrainedObject)->Data()); newConstrainedList.Append(newConstrained); node2 = node2->Next(); } - OGLConstraint *newConstraint = new OGLConstraint(constraint->m_constraintType, newConstraining, + wxOGLConstraint *newConstraint = new wxOGLConstraint(constraint->m_constraintType, newConstraining, newConstrainedList); newConstraint->m_constraintId = constraint->m_constraintId; if (constraint->m_constraintName) @@ -428,19 +426,19 @@ void wxCompositeShape::Copy(wxShape& copy) while (node) { wxDivisionShape *division = (wxDivisionShape *)node->Data(); - wxNode *node1 = wxObjectCopyMapping.Find((long)division); + wxNode *node1 = oglObjectCopyMapping.Find((long)division); wxNode *leftNode = NULL; wxNode *topNode = NULL; wxNode *rightNode = NULL; wxNode *bottomNode = NULL; if (division->GetLeftSide()) - leftNode = wxObjectCopyMapping.Find((long)division->GetLeftSide()); + leftNode = oglObjectCopyMapping.Find((long)division->GetLeftSide()); if (division->GetTopSide()) - topNode = wxObjectCopyMapping.Find((long)division->GetTopSide()); + topNode = oglObjectCopyMapping.Find((long)division->GetTopSide()); if (division->GetRightSide()) - rightNode = wxObjectCopyMapping.Find((long)division->GetRightSide()); + rightNode = oglObjectCopyMapping.Find((long)division->GetRightSide()); if (division->GetBottomSide()) - bottomNode = wxObjectCopyMapping.Find((long)division->GetBottomSide()); + bottomNode = oglObjectCopyMapping.Find((long)division->GetBottomSide()); if (node1) { wxDivisionShape *newDivision = (wxDivisionShape *)node1->Data(); @@ -457,7 +455,7 @@ void wxCompositeShape::Copy(wxShape& copy) } } -OGLConstraint *wxCompositeShape::AddConstraint(OGLConstraint *constraint) +wxOGLConstraint *wxCompositeShape::AddConstraint(wxOGLConstraint *constraint) { m_constraints.Append(constraint); if (constraint->m_constraintId == 0) @@ -465,32 +463,32 @@ OGLConstraint *wxCompositeShape::AddConstraint(OGLConstraint *constraint) return constraint; } -OGLConstraint *wxCompositeShape::AddConstraint(int type, wxShape *constraining, wxList& constrained) +wxOGLConstraint *wxCompositeShape::AddConstraint(int type, wxShape *constraining, wxList& constrained) { - OGLConstraint *constraint = new OGLConstraint(type, constraining, constrained); + wxOGLConstraint *constraint = new wxOGLConstraint(type, constraining, constrained); if (constraint->m_constraintId == 0) constraint->m_constraintId = NewId(); m_constraints.Append(constraint); return constraint; } -OGLConstraint *wxCompositeShape::AddConstraint(int type, wxShape *constraining, wxShape *constrained) +wxOGLConstraint *wxCompositeShape::AddConstraint(int type, wxShape *constraining, wxShape *constrained) { wxList l; l.Append(constrained); - OGLConstraint *constraint = new OGLConstraint(type, constraining, l); + wxOGLConstraint *constraint = new wxOGLConstraint(type, constraining, l); if (constraint->m_constraintId == 0) constraint->m_constraintId = NewId(); m_constraints.Append(constraint); return constraint; } -OGLConstraint *wxCompositeShape::FindConstraint(long cId, wxCompositeShape **actualComposite) +wxOGLConstraint *wxCompositeShape::FindConstraint(long cId, wxCompositeShape **actualComposite) { wxNode *node = m_constraints.First(); while (node) { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); + wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data(); if (constraint->m_constraintId == cId) { if (actualComposite) @@ -506,7 +504,7 @@ OGLConstraint *wxCompositeShape::FindConstraint(long cId, wxCompositeShape **act wxShape *child = (wxShape *)node->Data(); if (child->IsKindOf(CLASSINFO(wxCompositeShape))) { - OGLConstraint *constraint = ((wxCompositeShape *)child)->FindConstraint(cId, actualComposite); + wxOGLConstraint *constraint = ((wxCompositeShape *)child)->FindConstraint(cId, actualComposite); if (constraint) { if (actualComposite) @@ -519,7 +517,7 @@ OGLConstraint *wxCompositeShape::FindConstraint(long cId, wxCompositeShape **act return NULL; } -void wxCompositeShape::DeleteConstraint(OGLConstraint *constraint) +void wxCompositeShape::DeleteConstraint(wxOGLConstraint *constraint) { m_constraints.DeleteObject(constraint); delete constraint; @@ -527,12 +525,12 @@ void wxCompositeShape::DeleteConstraint(OGLConstraint *constraint) void wxCompositeShape::CalculateSize() { - float maxX = (float) -999999.9; - float maxY = (float) -999999.9; - float minX = (float) 999999.9; - float minY = (float) 999999.9; + double maxX = (double) -999999.9; + double maxY = (double) -999999.9; + double minX = (double) 999999.9; + double minY = (double) 999999.9; - float w, h; + double w, h; wxNode *node = m_children.First(); while (node) { @@ -544,20 +542,20 @@ void wxCompositeShape::CalculateSize() object->GetBoundingBoxMax(&w, &h); if ((object->GetX() + (w/2.0)) > maxX) - maxX = (float)(object->GetX() + (w/2.0)); + maxX = (double)(object->GetX() + (w/2.0)); if ((object->GetX() - (w/2.0)) < minX) - minX = (float)(object->GetX() - (w/2.0)); + minX = (double)(object->GetX() - (w/2.0)); if ((object->GetY() + (h/2.0)) > maxY) - maxY = (float)(object->GetY() + (h/2.0)); + maxY = (double)(object->GetY() + (h/2.0)); if ((object->GetY() - (h/2.0)) < minY) - minY = (float)(object->GetY() - (h/2.0)); + minY = (double)(object->GetY() - (h/2.0)); node = node->Next(); } m_width = maxX - minX; m_height = maxY - minY; - m_xpos = (float)(m_width/2.0 + minX); - m_ypos = (float)(m_height/2.0 + minY); + m_xpos = (double)(m_width/2.0 + minX); + m_ypos = (double)(m_height/2.0 + minY); } bool wxCompositeShape::Recompute() @@ -595,7 +593,7 @@ bool wxCompositeShape::Constrain() node = m_constraints.First(); while (node) { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); + wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data(); if (constraint->Evaluate()) changed = TRUE; node = node->Next(); } @@ -603,9 +601,9 @@ bool wxCompositeShape::Constrain() } #ifdef PROLOGIO -void wxCompositeShape::WritePrologAttributes(wxExpr *clause) +void wxCompositeShape::WriteAttributes(wxExpr *clause) { - wxRectangleShape::WritePrologAttributes(clause); + wxRectangleShape::WriteAttributes(clause); // clause->AddAttributeValue("selectable", (long)selectable); @@ -615,20 +613,20 @@ void wxCompositeShape::WritePrologAttributes(wxExpr *clause) wxNode *node = m_constraints.First(); while (node) { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); + wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data(); sprintf(m_constraintNameBuf, "constraint%d", constraintNo); // Each constraint is stored in the form // (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList) - wxExpr *constraintExpr = new wxExpr(PrologList); + wxExpr *constraintExpr = new wxExpr(wxExprList); constraintExpr->Append(new wxExpr((long)constraint->m_constraintType)); - constraintExpr->Append(new wxExpr(PrologString, constraint->m_constraintName)); + constraintExpr->Append(new wxExpr(wxExprString, constraint->m_constraintName)); constraintExpr->Append(new wxExpr(constraint->m_constraintId)); constraintExpr->Append(new wxExpr(constraint->m_xSpacing)); constraintExpr->Append(new wxExpr(constraint->m_ySpacing)); constraintExpr->Append(new wxExpr(constraint->m_constrainingObject->GetId())); - wxExpr *objectList = new wxExpr(PrologList); + wxExpr *objectList = new wxExpr(wxExprList); wxNode *node1 = constraint->m_constrainedObjects.First(); while (node1) { @@ -645,7 +643,7 @@ void wxCompositeShape::WritePrologAttributes(wxExpr *clause) } // Write the ids of all the child images - wxExpr *childrenExpr = new wxExpr(PrologList); + wxExpr *childrenExpr = new wxExpr(wxExprList); node = m_children.First(); while (node) { @@ -658,7 +656,7 @@ void wxCompositeShape::WritePrologAttributes(wxExpr *clause) // Write the ids of all the division images if (m_divisions.Number() > 0) { - wxExpr *divisionsExpr = new wxExpr(PrologList); + wxExpr *divisionsExpr = new wxExpr(wxExprList); node = m_divisions.First(); while (node) { @@ -674,9 +672,9 @@ void wxCompositeShape::WritePrologAttributes(wxExpr *clause) // so as to be able to link up to parent. So we may not be able // to find the constraint participants until we've read everything // in. Need to have another pass for composites. -void wxCompositeShape::ReadPrologAttributes(wxExpr *clause) +void wxCompositeShape::ReadAttributes(wxExpr *clause) { - wxRectangleShape::ReadPrologAttributes(clause); + wxRectangleShape::ReadAttributes(clause); // clause->GetAttributeValue("selectable", selectable); } @@ -699,8 +697,8 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database) break; } int cType = 0; - float cXSpacing = 0.0; - float cYSpacing = 0.0; + double cXSpacing = 0.0; + double cYSpacing = 0.0; wxString cName(""); long cId = 0; wxShape *m_constrainingObject = NULL; @@ -747,7 +745,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database) i ++; currentIdExpr = constrainedExpr->Nth(i); } - OGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects); + wxOGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects); newConstraint->SetSpacing(cXSpacing, cYSpacing); newConstraint->m_constraintId = cId; newConstraint->m_constraintName = (const char*) cName; @@ -846,25 +844,25 @@ void wxDivisionShape::OnDraw(wxDC& dc) dc.SetBrush(wxTRANSPARENT_BRUSH); dc.SetBackgroundMode(wxTRANSPARENT); - float x1 = (float)(GetX() - (GetWidth()/2.0)); - float y1 = (float)(GetY() - (GetHeight()/2.0)); - float x2 = (float)(GetX() + (GetWidth()/2.0)); - float y2 = (float)(GetY() + (GetHeight()/2.0)); + double x1 = (double)(GetX() - (GetWidth()/2.0)); + double y1 = (double)(GetY() - (GetHeight()/2.0)); + double x2 = (double)(GetX() + (GetWidth()/2.0)); + double y2 = (double)(GetY() + (GetHeight()/2.0)); // Should subtract 1 pixel if drawing under Windows #ifdef __WXMSW__ - y2 -= (float)1.0; + y2 -= (double)1.0; #endif if (m_leftSide) { dc.SetPen(m_leftSidePen); - dc.DrawLine(x1, y2, x1, y1); + dc.DrawLine(WXROUND(x1), WXROUND(y2), WXROUND(x1), WXROUND(y1)); } if (m_topSide) { dc.SetPen(m_topSidePen); - dc.DrawLine(x1, y1, x2, y1); + dc.DrawLine(WXROUND(x1), WXROUND(y1), WXROUND(x2), WXROUND(y1)); } // For testing purposes, draw a rectangle so we know @@ -878,10 +876,10 @@ void wxDivisionShape::OnDrawContents(wxDC& dc) wxCompositeShape::OnDrawContents(dc); } -bool wxDivisionShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float oldy, bool display) +bool wxDivisionShape::OnMovePre(wxDC& dc, double x, double y, double oldx, double oldy, bool display) { - float diffX = x - oldx; - float diffY = y - oldy; + double diffX = x - oldx; + double diffY = y - oldy; wxNode *node = m_children.First(); while (node) { @@ -893,12 +891,12 @@ bool wxDivisionShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float ol return TRUE; } -void wxDivisionShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment) +void wxDivisionShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment) { if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) { attachment = 0; - float dist; + double dist; if (m_parent) { m_parent->HitTest(x, y, &attachment, &dist); @@ -909,12 +907,12 @@ void wxDivisionShape::OnDragLeft(bool draw, float x, float y, int keys, int atta wxShape::OnDragLeft(draw, x, y, keys, attachment); } -void wxDivisionShape::OnBeginDragLeft(float x, float y, int keys, int attachment) +void wxDivisionShape::OnBeginDragLeft(double x, double y, int keys, int attachment) { if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) { attachment = 0; - float dist; + double dist; if (m_parent) { m_parent->HitTest(x, y, &attachment, &dist); @@ -926,13 +924,13 @@ void wxDivisionShape::OnBeginDragLeft(float x, float y, int keys, int attachment wxShape::OnBeginDragLeft(x, y, keys, attachment); } -void wxDivisionShape::OnEndDragLeft(float x, float y, int keys, int attachment) +void wxDivisionShape::OnEndDragLeft(double x, double y, int keys, int attachment) { m_canvas->ReleaseMouse(); if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) { attachment = 0; - float dist; + double dist; if (m_parent) { m_parent->HitTest(x, y, &attachment, &dist); @@ -957,7 +955,7 @@ void wxDivisionShape::OnEndDragLeft(float x, float y, int keys, int attachment) if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); } -void wxDivisionShape::SetSize(float w, float h, bool recursive) +void wxDivisionShape::SetSize(double w, double h, bool recursive) { m_width = w; m_height = h; @@ -989,9 +987,9 @@ void wxDivisionShape::Copy(wxShape& copy) } #ifdef PROLOGIO -void wxDivisionShape::WritePrologAttributes(wxExpr *clause) +void wxDivisionShape::WriteAttributes(wxExpr *clause) { - wxCompositeShape::WritePrologAttributes(clause); + wxCompositeShape::WriteAttributes(clause); if (m_leftSide) clause->AddAttributeValue("left_side", (long)m_leftSide->GetId()); @@ -1009,9 +1007,9 @@ void wxDivisionShape::WritePrologAttributes(wxExpr *clause) clause->AddAttributeValueString("top_style", m_topSideStyle); } -void wxDivisionShape::ReadPrologAttributes(wxExpr *clause) +void wxDivisionShape::ReadAttributes(wxExpr *clause) { - wxCompositeShape::ReadPrologAttributes(clause); + wxCompositeShape::ReadAttributes(clause); clause->GetAttributeValue("handle_side", m_handleSide); clause->GetAttributeValue("left_colour", m_leftSideColour); @@ -1022,7 +1020,7 @@ void wxDivisionShape::ReadPrologAttributes(wxExpr *clause) #endif // Experimental -void wxDivisionShape::OnRightClick(float x, float y, int keys, int attachment) +void wxDivisionShape::OnRightClick(double x, double y, int keys, int attachment) { if (keys & KEY_CTRL) { @@ -1046,7 +1044,7 @@ void wxDivisionShape::OnRightClick(float x, float y, int keys, int attachment) else { attachment = 0; - float dist; + double dist; if (m_parent) { m_parent->HitTest(x, y, &attachment, &dist); @@ -1061,11 +1059,11 @@ void wxDivisionShape::OnRightClick(float x, float y, int keys, int attachment) bool wxDivisionShape::Divide(int direction) { // Calculate existing top-left, bottom-right - float x1 = (float)(GetX() - (GetWidth()/2.0)); - float y1 = (float)(GetY() - (GetHeight()/2.0)); + double x1 = (double)(GetX() - (GetWidth()/2.0)); + double y1 = (double)(GetY() - (GetHeight()/2.0)); wxCompositeShape *compositeParent = (wxCompositeShape *)GetParent(); - float oldWidth = GetWidth(); - float oldHeight = GetHeight(); + double oldWidth = GetWidth(); + double oldHeight = GetHeight(); if (Selected()) Select(FALSE); @@ -1076,10 +1074,10 @@ bool wxDivisionShape::Divide(int direction) { // Dividing vertically means notionally putting a horizontal line through it. // Break existing piece into two. - float newXPos1 = GetX(); - float newYPos1 = (float)(y1 + (GetHeight()/4.0)); - float newXPos2 = GetX(); - float newYPos2 = (float)(y1 + (3.0*GetHeight()/4.0)); + double newXPos1 = GetX(); + double newYPos1 = (double)(y1 + (GetHeight()/4.0)); + double newXPos2 = GetX(); + double newYPos2 = (double)(y1 + (3.0*GetHeight()/4.0)); wxDivisionShape *newDivision = compositeParent->OnCreateDivision(); newDivision->Show(TRUE); @@ -1117,20 +1115,20 @@ bool wxDivisionShape::Divide(int direction) m_handleSide = DIVISION_SIDE_BOTTOM; newDivision->SetHandleSide(DIVISION_SIDE_TOP); - SetSize(oldWidth, (float)(oldHeight/2.0)); + SetSize(oldWidth, (double)(oldHeight/2.0)); Move(dc, newXPos1, newYPos1); - newDivision->SetSize(oldWidth, (float)(oldHeight/2.0)); + newDivision->SetSize(oldWidth, (double)(oldHeight/2.0)); newDivision->Move(dc, newXPos2, newYPos2); } else { // Dividing horizontally means notionally putting a vertical line through it. // Break existing piece into two. - float newXPos1 = (float)(x1 + (GetWidth()/4.0)); - float newYPos1 = GetY(); - float newXPos2 = (float)(x1 + (3.0*GetWidth()/4.0)); - float newYPos2 = GetY(); + double newXPos1 = (double)(x1 + (GetWidth()/4.0)); + double newYPos1 = GetY(); + double newXPos2 = (double)(x1 + (3.0*GetWidth()/4.0)); + double newYPos2 = GetY(); wxDivisionShape *newDivision = compositeParent->OnCreateDivision(); newDivision->Show(TRUE); @@ -1158,10 +1156,10 @@ bool wxDivisionShape::Divide(int direction) m_handleSide = DIVISION_SIDE_RIGHT; newDivision->SetHandleSide(DIVISION_SIDE_LEFT); - SetSize((float)(oldWidth/2.0), oldHeight); + SetSize((double)(oldWidth/2.0), oldHeight); Move(dc, newXPos1, newYPos1); - newDivision->SetSize((float)(oldWidth/2.0), oldHeight); + newDivision->SetSize((double)(oldWidth/2.0), oldHeight); newDivision->Move(dc, newXPos2, newYPos2); } if (compositeParent->Selected()) @@ -1182,15 +1180,15 @@ void wxDivisionShape::MakeControlPoints() void wxDivisionShape::MakeMandatoryControlPoints() { - float maxX, maxY; + double maxX, maxY; GetBoundingBoxMax(&maxX, &maxY); - float x, y; + double x, y; int direction; /* if (m_leftSide) { - x = (float)(-maxX/2.0); + x = (double)(-maxX/2.0); y = 0.0; wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y, CONTROL_POINT_HORIZONTAL); @@ -1200,7 +1198,7 @@ void wxDivisionShape::MakeMandatoryControlPoints() if (m_topSide) { x = 0.0; - y = (float)(-maxY/2.0); + y = (double)(-maxY/2.0); wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y, CONTROL_POINT_VERTICAL); m_canvas->AddShape(control); @@ -1211,7 +1209,7 @@ void wxDivisionShape::MakeMandatoryControlPoints() { case DIVISION_SIDE_LEFT: { - x = (float)(-maxX/2.0); + x = (double)(-maxX/2.0); y = 0.0; direction = CONTROL_POINT_HORIZONTAL; break; @@ -1219,13 +1217,13 @@ void wxDivisionShape::MakeMandatoryControlPoints() case DIVISION_SIDE_TOP: { x = 0.0; - y = (float)(-maxY/2.0); + y = (double)(-maxY/2.0); direction = CONTROL_POINT_VERTICAL; break; } case DIVISION_SIDE_RIGHT: { - x = (float)(maxX/2.0); + x = (double)(maxX/2.0); y = 0.0; direction = CONTROL_POINT_HORIZONTAL; break; @@ -1233,7 +1231,7 @@ void wxDivisionShape::MakeMandatoryControlPoints() case DIVISION_SIDE_BOTTOM: { x = 0.0; - y = (float)(maxY/2.0); + y = (double)(maxY/2.0); direction = CONTROL_POINT_VERTICAL; break; } @@ -1259,7 +1257,7 @@ void wxDivisionShape::ResetMandatoryControlPoints() if (m_controlPoints.Number() < 1) return; - float maxX, maxY; + double maxX, maxY; GetBoundingBoxMax(&maxX, &maxY); /* @@ -1269,11 +1267,11 @@ void wxDivisionShape::ResetMandatoryControlPoints() wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); if (control->type == CONTROL_POINT_HORIZONTAL) { - control->xoffset = (float)(-maxX/2.0); control->m_yoffset = 0.0; + control->xoffset = (double)(-maxX/2.0); control->m_yoffset = 0.0; } else if (control->type == CONTROL_POINT_VERTICAL) { - control->xoffset = 0.0; control->m_yoffset = (float)(-maxY/2.0); + control->xoffset = 0.0; control->m_yoffset = (double)(-maxY/2.0); } node = node->Next(); } @@ -1282,40 +1280,40 @@ void wxDivisionShape::ResetMandatoryControlPoints() if ((m_handleSide == DIVISION_SIDE_LEFT) && node) { wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = (float)(-maxX/2.0); control->m_yoffset = 0.0; + control->m_xoffset = (double)(-maxX/2.0); control->m_yoffset = 0.0; } if ((m_handleSide == DIVISION_SIDE_TOP) && node) { wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = 0.0; control->m_yoffset = (float)(-maxY/2.0); + control->m_xoffset = 0.0; control->m_yoffset = (double)(-maxY/2.0); } if ((m_handleSide == DIVISION_SIDE_RIGHT) && node) { wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = (float)(maxX/2.0); control->m_yoffset = 0.0; + control->m_xoffset = (double)(maxX/2.0); control->m_yoffset = 0.0; } if ((m_handleSide == DIVISION_SIDE_BOTTOM) && node) { wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = 0.0; control->m_yoffset = (float)(maxY/2.0); + control->m_xoffset = 0.0; control->m_yoffset = (double)(maxY/2.0); } } // Adjust a side, returning FALSE if it's not physically possible. -bool wxDivisionShape::AdjustLeft(float left, bool test) +bool wxDivisionShape::AdjustLeft(double left, bool test) { - float x2 = (float)(GetX() + (GetWidth()/2.0)); + double x2 = (double)(GetX() + (GetWidth()/2.0)); if (left >= x2) return FALSE; if (test) return TRUE; - float newW = x2 - left; - float newX = (float)(left + newW/2.0); + double newW = x2 - left; + double newX = (double)(left + newW/2.0); SetSize(newW, GetHeight()); wxClientDC dc(GetCanvas()); @@ -1326,17 +1324,17 @@ bool wxDivisionShape::AdjustLeft(float left, bool test) return TRUE; } -bool wxDivisionShape::AdjustTop(float top, bool test) +bool wxDivisionShape::AdjustTop(double top, bool test) { - float y2 = (float)(GetY() + (GetHeight()/2.0)); + double y2 = (double)(GetY() + (GetHeight()/2.0)); if (top >= y2) return FALSE; if (test) return TRUE; - float newH = y2 - top; - float newY = (float)(top + newH/2.0); + double newH = y2 - top; + double newY = (double)(top + newH/2.0); SetSize(GetWidth(), newH); wxClientDC dc(GetCanvas()); @@ -1347,17 +1345,17 @@ bool wxDivisionShape::AdjustTop(float top, bool test) return TRUE; } -bool wxDivisionShape::AdjustRight(float right, bool test) +bool wxDivisionShape::AdjustRight(double right, bool test) { - float x1 = (float)(GetX() - (GetWidth()/2.0)); + double x1 = (double)(GetX() - (GetWidth()/2.0)); if (right <= x1) return FALSE; if (test) return TRUE; - float newW = right - x1; - float newX = (float)(x1 + newW/2.0); + double newW = right - x1; + double newX = (double)(x1 + newW/2.0); SetSize(newW, GetHeight()); wxClientDC dc(GetCanvas()); @@ -1368,17 +1366,17 @@ bool wxDivisionShape::AdjustRight(float right, bool test) return TRUE; } -bool wxDivisionShape::AdjustBottom(float bottom, bool test) +bool wxDivisionShape::AdjustBottom(double bottom, bool test) { - float y1 = (float)(GetY() - (GetHeight()/2.0)); + double y1 = (double)(GetY() - (GetHeight()/2.0)); if (bottom <= y1) return FALSE; if (test) return TRUE; - float newH = bottom - y1; - float newY = (float)(y1 + newH/2.0); + double newH = bottom - y1; + double newY = (double)(y1 + newH/2.0); SetSize(GetWidth(), newH); wxClientDC dc(GetCanvas()); @@ -1389,7 +1387,7 @@ bool wxDivisionShape::AdjustBottom(float bottom, bool test) return TRUE; } -wxDivisionControlPoint::wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, float size, float the_xoffset, float the_yoffset, int the_type): +wxDivisionControlPoint::wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, double size, double the_xoffset, double the_yoffset, int the_type): wxControlPoint(the_canvas, object, size, the_xoffset, the_yoffset, the_type) { SetEraseObject(FALSE); @@ -1399,18 +1397,18 @@ wxDivisionControlPoint::~wxDivisionControlPoint() { } -static float originalX = 0.0; -static float originalY = 0.0; -static float originalW = 0.0; -static float originalH = 0.0; +static double originalX = 0.0; +static double originalY = 0.0; +static double originalW = 0.0; +static double originalH = 0.0; // Implement resizing of canvas object -void wxDivisionControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment) +void wxDivisionControlPoint::OnDragLeft(bool draw, double x, double y, int keys, int attachment) { wxControlPoint::OnDragLeft(draw, x, y, keys, attachment); } -void wxDivisionControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment) +void wxDivisionControlPoint::OnBeginDragLeft(double x, double y, int keys, int attachment) { wxDivisionShape *division = (wxDivisionShape *)m_shape; originalX = division->GetX(); @@ -1421,7 +1419,7 @@ void wxDivisionControlPoint::OnBeginDragLeft(float x, float y, int keys, int att wxControlPoint::OnBeginDragLeft(x, y, keys, attachment); } -void wxDivisionControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment) +void wxDivisionControlPoint::OnEndDragLeft(double x, double y, int keys, int attachment) { wxControlPoint::OnEndDragLeft(x, y, keys, attachment); @@ -1432,16 +1430,16 @@ void wxDivisionControlPoint::OnEndDragLeft(float x, float y, int keys, int attac wxCompositeShape *divisionParent = (wxCompositeShape *)division->GetParent(); // Need to check it's within the bounds of the parent composite. - float x1 = (float)(divisionParent->GetX() - (divisionParent->GetWidth()/2.0)); - float y1 = (float)(divisionParent->GetY() - (divisionParent->GetHeight()/2.0)); - float x2 = (float)(divisionParent->GetX() + (divisionParent->GetWidth()/2.0)); - float y2 = (float)(divisionParent->GetY() + (divisionParent->GetHeight()/2.0)); + double x1 = (double)(divisionParent->GetX() - (divisionParent->GetWidth()/2.0)); + double y1 = (double)(divisionParent->GetY() - (divisionParent->GetHeight()/2.0)); + double x2 = (double)(divisionParent->GetX() + (divisionParent->GetWidth()/2.0)); + double y2 = (double)(divisionParent->GetY() + (divisionParent->GetHeight()/2.0)); // Need to check it has not made the division zero or negative width/height - float dx1 = (float)(division->GetX() - (division->GetWidth()/2.0)); - float dy1 = (float)(division->GetY() - (division->GetHeight()/2.0)); - float dx2 = (float)(division->GetX() + (division->GetWidth()/2.0)); - float dy2 = (float)(division->GetY() + (division->GetHeight()/2.0)); + double dx1 = (double)(division->GetX() - (division->GetWidth()/2.0)); + double dy1 = (double)(division->GetY() - (division->GetHeight()/2.0)); + double dx2 = (double)(division->GetX() + (division->GetWidth()/2.0)); + double dy2 = (double)(division->GetY() + (division->GetHeight()/2.0)); bool success = TRUE; switch (division->GetHandleSide()) @@ -1512,7 +1510,7 @@ void wxDivisionControlPoint::OnEndDragLeft(float x, float y, int keys, int attac If size goes to zero or end position is other side of start position, resize to original size and return. */ -bool wxDivisionShape::ResizeAdjoining(int side, float newPos, bool test) +bool wxDivisionShape::ResizeAdjoining(int side, double newPos, bool test) { wxCompositeShape *divisionParent = (wxCompositeShape *)GetParent(); wxNode *node = divisionParent->GetDivisions().First(); @@ -1714,9 +1712,9 @@ void wxDivisionShape::EditEdge(int side) } // Popup menu -void wxDivisionShape::PopupMenu(float x, float y) +void wxDivisionShape::PopupMenu(double x, double y) { - oglPopupDivisionMenu->SetClientData((char *)this); + oglPopupDivisionMenu->SetClientData((void *)this); if (m_leftSide) oglPopupDivisionMenu->Enable(DIVISION_MENU_EDIT_LEFT_EDGE, TRUE); else @@ -1735,8 +1733,8 @@ void wxDivisionShape::PopupMenu(float x, float y) wxClientDC dc(GetCanvas()); GetCanvas()->PrepareDC(dc); - int mouse_x = (int)(dc.LogicalToDeviceX(x - x1*unit_x)); - int mouse_y = (int)(dc.LogicalToDeviceY(y - y1*unit_y)); + int mouse_x = (int)(dc.LogicalToDeviceX((long)(x - x1*unit_x))); + int mouse_y = (int)(dc.LogicalToDeviceY((long)(y - y1*unit_y))); m_canvas->PopupMenu(oglPopupDivisionMenu, mouse_x, mouse_y); }