X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e05364039a615196ff8c6e222e116f96892a172..31d7fc0f9cb3f5913ecd4a039a816487a6753a93:/contrib/src/ogl/constrnt.cpp?ds=sidebyside diff --git a/contrib/src/ogl/constrnt.cpp b/contrib/src/ogl/constrnt.cpp index e79d3ed4d0..ddd736d643 100644 --- a/contrib/src/ogl/constrnt.cpp +++ b/contrib/src/ogl/constrnt.cpp @@ -24,11 +24,12 @@ #include #endif -#include +#if wxUSE_PROLOGIO +#include +#endif + +#include "wx/ogl/ogl.h" -#include -#include -#include wxList *wxOGLConstraintTypes = NULL; @@ -110,12 +111,12 @@ void OGLCleanUpConstraintTypes() if (!wxOGLConstraintTypes) return; - wxNode* node = wxOGLConstraintTypes->First(); + wxNode* node = wxOGLConstraintTypes->GetFirst(); while (node) { - wxOGLConstraintType* ct = (wxOGLConstraintType*) node->Data(); + wxOGLConstraintType* ct = (wxOGLConstraintType*) node->GetData(); delete ct; - node = node->Next(); + node = node->GetNext(); } delete wxOGLConstraintTypes; wxOGLConstraintTypes = NULL; @@ -139,11 +140,11 @@ wxOGLConstraint::wxOGLConstraint(int type, wxShape *constraining, wxList& constr m_constraintId = 0; m_constraintName = wxT("noname"); - wxNode *node = constrained.First(); + wxNode *node = constrained.GetFirst(); while (node) { - m_constrainedObjects.Append(node->Data()); - node = node->Next(); + m_constrainedObjects.Append(node->GetData()); + node = node->GetNext(); } } @@ -175,17 +176,17 @@ bool wxOGLConstraint::Evaluate() { case gyCONSTRAINT_CENTRED_VERTICALLY: { - int n = m_constrainedObjects.Number(); + int n = m_constrainedObjects.GetCount(); double totalObjectHeight = 0.0; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); totalObjectHeight += height2; - node = node->Next(); + node = node->GetNext(); } double startY; double spacingY; @@ -204,10 +205,10 @@ bool wxOGLConstraint::Evaluate() // Now position the objects bool changed = FALSE; - node = m_constrainedObjects.First(); + node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); startY += (double)(spacingY + (height2/2.0)); @@ -217,23 +218,23 @@ bool wxOGLConstraint::Evaluate() changed = TRUE; } startY += (double)(height2/2.0); - node = node->Next(); + node = node->GetNext(); } return changed; } case gyCONSTRAINT_CENTRED_HORIZONTALLY: { - int n = m_constrainedObjects.Number(); + int n = m_constrainedObjects.GetCount(); double totalObjectWidth = 0.0; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); totalObjectWidth += width2; - node = node->Next(); + node = node->GetNext(); } double startX; double spacingX; @@ -252,10 +253,10 @@ bool wxOGLConstraint::Evaluate() // Now position the objects bool changed = FALSE; - node = m_constrainedObjects.First(); + node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); startX += (double)(spacingX + (width2/2.0)); @@ -265,25 +266,25 @@ bool wxOGLConstraint::Evaluate() changed = TRUE; } startX += (double)(width2/2.0); - node = node->Next(); + node = node->GetNext(); } return changed; } case gyCONSTRAINT_CENTRED_BOTH: { - int n = m_constrainedObjects.Number(); + int n = m_constrainedObjects.GetCount(); double totalObjectWidth = 0.0; double totalObjectHeight = 0.0; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); totalObjectWidth += width2; totalObjectHeight += height2; - node = node->Next(); + node = node->GetNext(); } double startX; double spacingX; @@ -318,10 +319,10 @@ bool wxOGLConstraint::Evaluate() // Now position the objects bool changed = FALSE; - node = m_constrainedObjects.First(); + node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); startX += (double)(spacingX + (width2/2.0)); @@ -336,7 +337,7 @@ bool wxOGLConstraint::Evaluate() startX += (double)(width2/2.0); startY += (double)(height2/2.0); - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -344,10 +345,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -359,7 +360,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -367,10 +368,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -382,20 +383,18 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; - - return FALSE; } case gyCONSTRAINT_ABOVE: { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -407,7 +406,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -415,10 +414,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -430,7 +429,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -438,10 +437,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -453,7 +452,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -461,10 +460,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -476,20 +475,22 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; - + #if 0 + // two returned values ? return FALSE; + #endif } case gyCONSTRAINT_ALIGNED_TOP: { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -501,7 +502,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -509,10 +510,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double width2, height2; constrainedObject->GetBoundingBoxMax(&width2, &height2); @@ -524,7 +525,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -532,10 +533,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double x3 = (double)(x - (minWidth/2.0)); if (!Equals(x3, constrainedObject->GetX())) @@ -544,7 +545,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -552,10 +553,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double x3 = (double)(x + (minWidth/2.0)); if (!Equals(x3, constrainedObject->GetX())) @@ -564,20 +565,22 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; - + #if 0 + // two returned values ? return FALSE; + #endif } case gyCONSTRAINT_MIDALIGNED_TOP: { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double y3 = (double)(y - (minHeight/2.0)); if (!Equals(y3, constrainedObject->GetY())) @@ -586,7 +589,7 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } @@ -594,10 +597,10 @@ bool wxOGLConstraint::Evaluate() { bool changed = FALSE; - wxNode *node = m_constrainedObjects.First(); + wxNode *node = m_constrainedObjects.GetFirst(); while (node) { - wxShape *constrainedObject = (wxShape *)node->Data(); + wxShape *constrainedObject = (wxShape *)node->GetData(); double y3 = (double)(y + (minHeight/2.0)); if (!Equals(y3, constrainedObject->GetY())) @@ -606,13 +609,15 @@ bool wxOGLConstraint::Evaluate() constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); } - node = node->Next(); + node = node->GetNext(); } return changed; } - + #if 0 + // default value handled in main function body default: return FALSE; + #endif } return FALSE; }