]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/fl/rowlayoutpl.cpp
reSWIGged
[wxWidgets.git] / contrib / src / fl / rowlayoutpl.cpp
index 064a35a67de6d94ab8d0b25fd1fb1ff1a4757caa..e500194447ee971cb957866a3cbe158ca494c1e6 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        No names yet.
-// Purpose:     Contrib. demo
+// Name:        rowlayoutpl.cpp
+// Purpose:     cbRowLayoutPlugin implementation.
 // Author:      Aleksandras Gluchovas
 // Modified by:
 // Created:     09/09/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Aleksandras Gluchovas
 // Author:      Aleksandras Gluchovas
 // Modified by:
 // Created:     09/09/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Aleksandras Gluchovas
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
  
 #ifdef __GNUG__
 /////////////////////////////////////////////////////////////////////////////
  
 #ifdef __GNUG__
@@ -120,9 +120,13 @@ void cbRowLayoutPlugin::ExpandNotFixedBars( cbRowInfo* pRow )
 {
     ApplyLengthRatios( pRow );
 
 {
     ApplyLengthRatios( pRow );
 
+    #if 1
+
    // FIXME:: something's wrong?
    return;
 
    // FIXME:: something's wrong?
    return;
 
+    #else
+
     double freeSpc = (double)GetRowFreeSpace( pRow );
 
     // calculate sum of precents
     double freeSpc = (double)GetRowFreeSpace( pRow );
 
     // calculate sum of precents
@@ -156,14 +160,18 @@ void cbRowLayoutPlugin::ExpandNotFixedBars( cbRowInfo* pRow )
         bar.mBounds.x = curX;
         curX = bar.mBounds.x + bar.mBounds.width;
     }
         bar.mBounds.x = curX;
         curX = bar.mBounds.x + bar.mBounds.width;
     }
+    #endif
 }
 
 }
 
-void cbRowLayoutPlugin::AdjustLengthOfInserted( cbRowInfo* pRow, cbBarInfo* pTheBar )
+void cbRowLayoutPlugin::AdjustLengthOfInserted( cbRowInfo* WXUNUSED(pRow), cbBarInfo* WXUNUSED(pTheBar) )
 {
 {
-    return;  // TBD: Makes following code unreachable
+    return;
 
 
-    // pTheBar is not-fixed
+#if 0
 
 
+    // TBD: Makes following code unreachable
+
+    // pTheBar is not-fixed
 
     // FIXME:: what is this for??
 
 
     // FIXME:: what is this for??
 
@@ -203,13 +211,16 @@ void cbRowLayoutPlugin::AdjustLengthOfInserted( cbRowInfo* pRow, cbBarInfo* pThe
 
         pTheBar->mBounds.width = freeSpc * (1.0 - pcntSum);
 #endif
 
         pTheBar->mBounds.width = freeSpc * (1.0 - pcntSum);
 #endif
+
+#endif
+
 }
 
 void cbRowLayoutPlugin::FitBarsToRange( int from, int till,
                                         cbBarInfo* pTheBar, cbRowInfo* pRow )
 {
 }
 
 void cbRowLayoutPlugin::FitBarsToRange( int from, int till,
                                         cbBarInfo* pTheBar, cbRowInfo* pRow )
 {
-    cbBarInfo* pFromBar = NULL;
-    cbBarInfo* pTillBar = NULL;
+    cbBarInfo* pFromBar;
+    cbBarInfo* pTillBar;
 
     if ( pTheBar->mBounds.x > from )
     {
 
     if ( pTheBar->mBounds.x > from )
     {
@@ -389,11 +400,11 @@ void cbRowLayoutPlugin::RecalcLengthRatios( cbRowInfo* pRow )
 
 void cbRowLayoutPlugin::ApplyLengthRatios( cbRowInfo* pRow )
 {
 
 void cbRowLayoutPlugin::ApplyLengthRatios( cbRowInfo* pRow )
 {
+    size_t i;
     double pcntSum = 0;
 
     // FOR NOW:: all-in-one
 
     double pcntSum = 0;
 
     // FOR NOW:: all-in-one
 
-    size_t i = 0;
     for ( i = 0; i != pRow->mBars.Count(); ++i )
     {
         if ( !pRow->mBars[i]->IsFixed() )
     for ( i = 0; i != pRow->mBars.Count(); ++i )
     {
         if ( !pRow->mBars[i]->IsFixed() )
@@ -433,6 +444,9 @@ void cbRowLayoutPlugin::ApplyLengthRatios( cbRowInfo* pRow )
     // look like total of mLetRatio's is 1.0, thus original
     // len. ratios are _preserved_:
 
     // look like total of mLetRatio's is 1.0, thus original
     // len. ratios are _preserved_:
 
+    if (pcntSum == 0.0)
+        pcntSum = 1.0;
+
     double unit = freeSpc / pcntSum;
 
     bool haveSquished = FALSE;
     double unit = freeSpc / pcntSum;
 
     bool haveSquished = FALSE;
@@ -664,7 +678,7 @@ void cbRowLayoutPlugin::SlideRightSideBars( cbBarInfo* pTheBar )
     }
 }
 
     }
 }
 
-void cbRowLayoutPlugin::ShiftLeftTrashold( cbBarInfo* pTheBar, cbRowInfo& row )
+void cbRowLayoutPlugin::ShiftLeftTrashold( cbBarInfo* WXUNUSED(pTheBar), cbRowInfo& row )
 {
     wxRect& first = row.mBars[0]->mBounds;
 
 {
     wxRect& first = row.mBars[0]->mBounds;
 
@@ -1035,6 +1049,7 @@ void cbRowLayoutPlugin::OnLayoutRows( cbLayoutRowsEvent& event )
     for ( i = 0; i != mpPane->GetRowList().Count(); ++i )
     {
         cbRowInfo& row = *mpPane->GetRowList()[ i ];
     for ( i = 0; i != mpPane->GetRowList().Count(); ++i )
     {
         cbRowInfo& row = *mpPane->GetRowList()[ i ];
+        //mpPane->CalcLengthRatios(& row);
 
         // setup "has-handle" flags for rows, which depend on the existance 
         // of not-fixed bars in the row
 
         // setup "has-handle" flags for rows, which depend on the existance 
         // of not-fixed bars in the row
@@ -1094,8 +1109,6 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
     // FIXME:: Next line not used.
     //int     newHeight      = pTheRow->mRowHeight;
 
     // FIXME:: Next line not used.
     //int     newHeight      = pTheRow->mRowHeight;
 
-    int     freeSpc        = 0;
-
     if ( forUpperHandle )
     {
         // calculate available free space from above,
     if ( forUpperHandle )
     {
         // calculate available free space from above,
@@ -1105,8 +1118,6 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
 
         while( pRow ) 
         {
 
         while( pRow ) 
         {
-            freeSpc += pRow->mRowHeight - event.mpPane->GetMinimalRowHeight( pRow );
-
             pRow = pRow->mpPrev;
         }
     }
             pRow = pRow->mpPrev;
         }
     }
@@ -1119,8 +1130,6 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
 
         while( pRow ) 
         {
 
         while( pRow ) 
         {
-            freeSpc += pRow->mRowHeight - mpPane->GetMinimalRowHeight( pRow );
-
             pRow = pRow->mpNext;
         }
     }
             pRow = pRow->mpNext;
         }
     }