X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd657b8a5907c8584db84c85535ce281bdd65193..f5766910b6731eb03e82371416e9778203396ce7:/contrib/src/ogl/constrnt.cpp?ds=sidebyside diff --git a/contrib/src/ogl/constrnt.cpp b/contrib/src/ogl/constrnt.cpp index f62585c931..0e1a104447 100644 --- a/contrib/src/ogl/constrnt.cpp +++ b/contrib/src/ogl/constrnt.cpp @@ -6,13 +6,9 @@ // Created: 12/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "constrnt.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -21,16 +17,15 @@ #endif #ifndef WX_PRECOMP -#include +#include "wx/wx.h" #endif -#if wxUSE_DEPRECATED -#include +#if wxUSE_PROLOGIO +#include "wx/deprecated/wxexpr.h" #endif -#include -#include -#include +#include "wx/ogl/ogl.h" + wxList *wxOGLConstraintTypes = NULL; @@ -161,7 +156,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 +200,7 @@ bool wxOGLConstraint::Evaluate() } // Now position the objects - bool changed = FALSE; + bool changed = false; node = m_constrainedObjects.GetFirst(); while (node) { @@ -215,8 +210,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 +248,7 @@ bool wxOGLConstraint::Evaluate() } // Now position the objects - bool changed = FALSE; + bool changed = false; node = m_constrainedObjects.GetFirst(); while (node) { @@ -263,8 +258,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 +314,7 @@ bool wxOGLConstraint::Evaluate() } // Now position the objects - bool changed = FALSE; + bool changed = false; node = m_constrainedObjects.GetFirst(); while (node) { @@ -330,10 +325,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 +339,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_LEFT_OF: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -356,10 +351,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 +362,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_RIGHT_OF: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -379,20 +374,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 +397,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 +408,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_BELOW: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -427,10 +420,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 +431,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_ALIGNED_LEFT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -450,10 +443,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 +454,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_ALIGNED_RIGHT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -473,20 +466,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 +493,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 +504,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_ALIGNED_BOTTOM: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -521,10 +516,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 +527,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_MIDALIGNED_LEFT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -541,10 +536,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 +547,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_MIDALIGNED_RIGHT: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -561,20 +556,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 +580,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 +591,7 @@ bool wxOGLConstraint::Evaluate() } case gyCONSTRAINT_MIDALIGNED_BOTTOM: { - bool changed = FALSE; + bool changed = false; wxNode *node = m_constrainedObjects.GetFirst(); while (node) @@ -603,19 +600,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; }