X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd657b8a5907c8584db84c85535ce281bdd65193..29b53ef977fd6c50da7915a659ed2e81a6e3c9bc:/contrib/src/ogl/constrnt.cpp?ds=sidebyside diff --git a/contrib/src/ogl/constrnt.cpp b/contrib/src/ogl/constrnt.cpp index f62585c931..6d5268bec4 100644 --- a/contrib/src/ogl/constrnt.cpp +++ b/contrib/src/ogl/constrnt.cpp @@ -6,7 +6,7 @@ // Created: 12/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -24,13 +24,12 @@ #include #endif -#if wxUSE_DEPRECATED +#if wxUSE_PROLOGIO #include #endif -#include -#include -#include +#include "wx/ogl/ogl.h" + wxList *wxOGLConstraintTypes = NULL; @@ -161,7 +160,7 @@ bool wxOGLConstraint::Equals(double a, double b) return eq; } -// Return TRUE if anything changed +// Return true if anything changed bool wxOGLConstraint::Evaluate() { double maxWidth, maxHeight, minWidth, minHeight, x, y; @@ -205,7 +204,7 @@ bool wxOGLConstraint::Evaluate() } // Now position the objects - bool changed = FALSE; + bool changed = false; node = m_constrainedObjects.GetFirst(); while (node) { @@ -215,8 +214,8 @@ bool wxOGLConstraint::Evaluate() startY += (double)(spacingY + (height2/2.0)); if (!Equals(startY, constrainedObject->GetY())) { - constrainedObject->Move(dc, constrainedObject->GetX(), startY, FALSE); - changed = TRUE; + constrainedObject->Move(dc, constrainedObject->GetX(), startY, false); + changed = true; } startY += (double)(height2/2.0); node = node->GetNext(); @@ -253,7 +252,7 @@ bool wxOGLConstraint::Evaluate() } // Now position the objects - bool changed = FALSE; + bool changed = false; node = m_constrainedObjects.GetFirst(); while (node) { @@ -263,8 +262,8 @@ bool wxOGLConstraint::Evaluate() startX += (double)(spacingX + (width2/2.0)); if (!Equals(startX, constrainedObject->GetX())) { - constrainedObject->Move(dc, startX, constrainedObject->GetY(), FALSE); - changed = TRUE; + constrainedObject->Move(dc, startX, constrainedObject->GetY(), false); + changed = true; } startX += (double)(width2/2.0); node = node->GetNext(); @@ -319,7 +318,7 @@ bool wxOGLConstraint::Evaluate() } // Now position the objects - bool changed = FALSE; + bool changed = false; node = m_constrainedObjects.GetFirst(); while (node) { @@ -330,10 +329,10 @@ bool wxOGLConstraint::Evaluate() startY += (double)(spacingY + (height2/2.0)); if ((!Equals(startX, constrainedObject->GetX())) || (!Equals(startY, constrainedObject->GetY()))) - { - constrainedObject->Move(dc, startX, startY, FALSE); - changed = TRUE; - } + { + constrainedObject->Move(dc, startX, startY, false); + changed = true; + } startX += (double)(width2/2.0); startY += (double)(height2/2.0); @@ -344,7 +343,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_LEFT_OF: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -356,10 +355,10 @@ bool wxOGLConstraint::Evaluate() double x3 = (double)(x - (minWidth/2.0) - (width2/2.0) - m_xSpacing); if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } + { + changed = true; + constrainedObject->Move(dc, x3, constrainedObject->GetY(), false); + } node = node->GetNext(); } @@ -367,7 +366,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_RIGHT_OF: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -379,20 +378,18 @@ bool wxOGLConstraint::Evaluate() double x3 = (double)(x + (minWidth/2.0) + (width2/2.0) + m_xSpacing); if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } + { + changed = true; + constrainedObject->Move(dc, x3, constrainedObject->GetY(), false); + } node = node->GetNext(); } return changed; - - return FALSE; } case gyCONSTRAINT_ABOVE: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -404,10 +401,10 @@ bool wxOGLConstraint::Evaluate() double y3 = (double)(y - (minHeight/2.0) - (height2/2.0) - m_ySpacing); if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } + { + changed = true; + constrainedObject->Move(dc, constrainedObject->GetX(), y3, false); + } node = node->GetNext(); } @@ -415,7 +412,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_BELOW: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -427,10 +424,10 @@ bool wxOGLConstraint::Evaluate() double y3 = (double)(y + (minHeight/2.0) + (height2/2.0) + m_ySpacing); if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } + { + changed = true; + constrainedObject->Move(dc, constrainedObject->GetX(), y3, false); + } node = node->GetNext(); } @@ -438,7 +435,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_ALIGNED_LEFT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -450,10 +447,10 @@ bool wxOGLConstraint::Evaluate() double x3 = (double)(x - (minWidth/2.0) + (width2/2.0) + m_xSpacing); if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } + { + changed = true; + constrainedObject->Move(dc, x3, constrainedObject->GetY(), false); + } node = node->GetNext(); } @@ -461,7 +458,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_ALIGNED_RIGHT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -473,20 +470,22 @@ bool wxOGLConstraint::Evaluate() double x3 = (double)(x + (minWidth/2.0) - (width2/2.0) - m_xSpacing); if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } + { + changed = true; + constrainedObject->Move(dc, x3, constrainedObject->GetY(), false); + } node = node->GetNext(); } return changed; - - return FALSE; + #if 0 + // two returned values ? + return false; + #endif } case gyCONSTRAINT_ALIGNED_TOP: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -498,10 +497,10 @@ bool wxOGLConstraint::Evaluate() double y3 = (double)(y - (minHeight/2.0) + (height2/2.0) + m_ySpacing); if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } + { + changed = true; + constrainedObject->Move(dc, constrainedObject->GetX(), y3, false); + } node = node->GetNext(); } @@ -509,7 +508,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_ALIGNED_BOTTOM: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -521,10 +520,10 @@ bool wxOGLConstraint::Evaluate() double y3 = (double)(y + (minHeight/2.0) - (height2/2.0) - m_ySpacing); if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } + { + changed = true; + constrainedObject->Move(dc, constrainedObject->GetX(), y3, false); + } node = node->GetNext(); } @@ -532,7 +531,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_MIDALIGNED_LEFT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -541,10 +540,10 @@ bool wxOGLConstraint::Evaluate() double x3 = (double)(x - (minWidth/2.0)); if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } + { + changed = true; + constrainedObject->Move(dc, x3, constrainedObject->GetY(), false); + } node = node->GetNext(); } @@ -552,7 +551,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_MIDALIGNED_RIGHT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -561,20 +560,22 @@ bool wxOGLConstraint::Evaluate() double x3 = (double)(x + (minWidth/2.0)); if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } + { + changed = true; + constrainedObject->Move(dc, x3, constrainedObject->GetY(), false); + } node = node->GetNext(); } return changed; - - return FALSE; + #if 0 + // two returned values ? + return false; + #endif } case gyCONSTRAINT_MIDALIGNED_TOP: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -583,10 +584,10 @@ bool wxOGLConstraint::Evaluate() double y3 = (double)(y - (minHeight/2.0)); if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } + { + changed = true; + constrainedObject->Move(dc, constrainedObject->GetX(), y3, false); + } node = node->GetNext(); } @@ -594,7 +595,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_MIDALIGNED_BOTTOM: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -603,19 +604,21 @@ bool wxOGLConstraint::Evaluate() double y3 = (double)(y + (minHeight/2.0)); if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } + { + changed = true; + constrainedObject->Move(dc, constrainedObject->GetX(), y3, false); + } node = node->GetNext(); } return changed; } - + #if 0 + // default value handled in main function body default: - return FALSE; + return false; + #endif } - return FALSE; + return false; }