]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/ogl/src/composit.cpp
Added test for sprintf and vsnprintf to fix string.cpp for non-GNU systems.
[wxWidgets.git] / utils / ogl / src / composit.cpp
index 2ce5273e41915ae359e920ce5e482ec256f404ae..366777b25f873e1ce60d3cc1c8c10f449c7a4fc8 100644 (file)
@@ -24,9 +24,7 @@
 #include <wx/wx.h>
 #endif
 
 #include <wx/wx.h>
 #endif
 
-#ifdef PROLOGIO
 #include <wx/wxexpr.h>
 #include <wx/wxexpr.h>
-#endif
 
 #include "basic.h"
 #include "basicp.h"
 
 #include "basic.h"
 #include "basicp.h"
@@ -80,7 +78,7 @@ wxCompositeShape::~wxCompositeShape()
   wxNode *node = m_constraints.First();
   while (node)
   {
   wxNode *node = m_constraints.First();
   while (node)
   {
-    OGLConstraint *constraint = (OGLConstraint *)node->Data();
+    wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
     delete constraint;
     node = node->Next();
   }
     delete constraint;
     node = node->Next();
   }
@@ -323,7 +321,7 @@ void wxCompositeShape::DeleteConstraintsInvolvingChild(wxShape *child)
   wxNode *node = m_constraints.First();
   while (node)
   {
   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) ||
     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)
   {
   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))
     wxNode *nextNode = node->Next();
 
     if (constraint->m_constrainedObjects.Member(child))
@@ -396,7 +394,7 @@ void wxCompositeShape::Copy(wxShape& copy)
   node = m_constraints.First();
   while (node)
   {
   node = m_constraints.First();
   while (node)
   {
-    OGLConstraint *constraint = (OGLConstraint *)node->Data();
+    wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
 
     wxShape *newConstraining = (wxShape *)(oglObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data());
 
 
     wxShape *newConstraining = (wxShape *)(oglObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data());
 
@@ -410,7 +408,7 @@ void wxCompositeShape::Copy(wxShape& copy)
       node2 = node2->Next(); 
     }
 
       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)
                                             newConstrainedList);
     newConstraint->m_constraintId = constraint->m_constraintId;
     if (constraint->m_constraintName)
@@ -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)
 {
   m_constraints.Append(constraint);
   if (constraint->m_constraintId == 0)
@@ -465,32 +463,32 @@ OGLConstraint *wxCompositeShape::AddConstraint(OGLConstraint *constraint)
   return 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;
 }
 
   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);
 {
   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;
 }
 
   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)
   {
 {
   wxNode *node = m_constraints.First();
   while (node)
   {
-    OGLConstraint *constraint = (OGLConstraint *)node->Data();
+    wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
     if (constraint->m_constraintId == cId)
     {
       if (actualComposite)
     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)))
     {
     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)
       if (constraint)
       {
         if (actualComposite)
@@ -519,7 +517,7 @@ OGLConstraint *wxCompositeShape::FindConstraint(long cId, wxCompositeShape **act
   return NULL;
 }
 
   return NULL;
 }
 
-void wxCompositeShape::DeleteConstraint(OGLConstraint *constraint)
+void wxCompositeShape::DeleteConstraint(wxOGLConstraint *constraint)
 {
   m_constraints.DeleteObject(constraint);
   delete constraint;
 {
   m_constraints.DeleteObject(constraint);
   delete constraint;
@@ -595,7 +593,7 @@ bool wxCompositeShape::Constrain()
   node = m_constraints.First();
   while (node)
   {
   node = m_constraints.First();
   while (node)
   {
-    OGLConstraint *constraint = (OGLConstraint *)node->Data();
+    wxOGLConstraint *constraint = (wxOGLConstraint *)node->Data();
     if (constraint->Evaluate()) changed = TRUE;
     node = node->Next();
   }
     if (constraint->Evaluate()) changed = TRUE;
     node = node->Next();
   }
@@ -603,9 +601,9 @@ bool wxCompositeShape::Constrain()
 }
 
 #ifdef PROLOGIO
 }
 
 #ifdef PROLOGIO
-void wxCompositeShape::WritePrologAttributes(wxExpr *clause)
+void wxCompositeShape::WriteAttributes(wxExpr *clause)
 {
 {
-  wxRectangleShape::WritePrologAttributes(clause);
+  wxRectangleShape::WriteAttributes(clause);
 
 //  clause->AddAttributeValue("selectable", (long)selectable);
 
 
 //  clause->AddAttributeValue("selectable", (long)selectable);
 
@@ -615,20 +613,20 @@ void wxCompositeShape::WritePrologAttributes(wxExpr *clause)
   wxNode *node = m_constraints.First();
   while (node)
   {
   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)
     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((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()));
 
     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)
     {
     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
   }
 
   // Write the ids of all the child images
-  wxExpr *childrenExpr = new wxExpr(PrologList);
+  wxExpr *childrenExpr = new wxExpr(wxExprList);
   node = m_children.First();
   while (node)
   {
   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)
   {
   // 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)
     {
     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.
 // 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);
 }
 
 //  clause->GetAttributeValue("selectable", selectable);
 }
@@ -747,7 +745,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
       i ++;
       currentIdExpr = constrainedExpr->Nth(i);
     }
       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;
     newConstraint->SetSpacing(cXSpacing, cYSpacing);
     newConstraint->m_constraintId = cId;
     newConstraint->m_constraintName = (const char*) cName;
@@ -989,9 +987,9 @@ void wxDivisionShape::Copy(wxShape& copy)
 }
 
 #ifdef PROLOGIO
 }
 
 #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());
 
   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);
 }
 
   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);
 
   clause->GetAttributeValue("handle_side", m_handleSide);
   clause->GetAttributeValue("left_colour", m_leftSideColour);
@@ -1716,7 +1714,7 @@ void wxDivisionShape::EditEdge(int side)
 // Popup menu
 void wxDivisionShape::PopupMenu(double x, double y)
 {
 // Popup menu
 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
   if (m_leftSide)
     oglPopupDivisionMenu->Enable(DIVISION_MENU_EDIT_LEFT_EDGE, TRUE);
   else
@@ -1735,8 +1733,8 @@ void wxDivisionShape::PopupMenu(double x, double y)
   wxClientDC dc(GetCanvas());
   GetCanvas()->PrepareDC(dc);
 
   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);
 }
 
   m_canvas->PopupMenu(oglPopupDivisionMenu, mouse_x, mouse_y);
 }