// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
- #pragma implementation "rowlayoutpl.h"
-#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// In this case we need to check if the pBarNode appears to be inserted
// chain of fixed-bars on the very right or left side of the row,
// then all the white-space, such chain should be eliminated,
- // and the resulting chain justified to the right or the left
+ // and the resulting chain justified to the right or the left
// side of the row
- if ( !pTheBar->IsFixed() || rowInfo.mHasOnlyFixedBars )
+ if ( !pTheBar->IsFixed() || rowInfo.mHasOnlyFixedBars )
return;
do
{
- if ( !pBar->IsFixed() )
+ if ( !pBar->IsFixed() )
break;
wxRect& bounds = pBar->mBounds;
}
while( 1 );
- // slide fixed bars to the left on the left side relative to the pBarNode
+ // slide fixed bars to the left on the left side relative to the pBarNode
pBar = rowInfo.mBars[0];
prevX = 0;
-
+
do
{
- if ( pBar->IsFixed() )
+ if ( pBar->IsFixed() )
break;
{
bar.mLenRatio = bar.mLenRatio/(pcntSum);
- bar.mBounds.width =
-
+ bar.mBounds.width =
+
wxMax( mpPane->mProps.mMinCBarDim.x, int( freeSpc*bar.mLenRatio ) );
}
-
+
bar.mBounds.x = curX;
curX = bar.mBounds.x + bar.mBounds.width;
}
{
pBar->mBounds.width =
wxMax( mpPane->mProps.mMinCBarDim.x,
- int( double(freeSpc) * (pBar->mLenRatio/pcntSum) )
+ (int)( ((double)freeSpc) * (pBar->mLenRatio/pcntSum) )
);
}
pBar = pBar->mpNext;
pBar = pFromBar;
int prevX = from;
- bool hasNotFixedBars = FALSE;
+ bool hasNotFixedBars = false;
while ( pBar != pTillBar )
{
if ( !pBar->IsFixed() )
{
- hasNotFixedBars = TRUE;
+ hasNotFixedBars = true;
freeSpc -= bounds.width;
}
bounds.x = prevX;
prevX = bounds.x + bounds.width;
-
+
pBar = pBar->mpNext;
}
// attach remainder (the result of lost precision) to the
// last not-fixed bar
-#if !defined(__EXPERIMENTAL)
+#if !defined(__EXPERIMENTAL)
if ( pLastNotFixed )
-
+
pLastNotFixed->mLenRatio += pcntLeft;
#endif
/*
pBar = node_to_first_bar_node( pRow );
-
+
while( pBar )
{
cbBarInfo& bar = node_to_bar( pBar );
if ( !bar.IsFixed() )
-
+
bar.mLenRatio = pcntSum / bar.mLenRatio;
pBar = pBar->Next();
// is returned right back to the row - so that it would retain
// it's original dimensions in this row (this is kind of AI...)
//
- // The problem is - when it's remvoed, the sum of
+ // The problem is - when it's remvoed, the sum of
// mLenRatio's is not in "balance", i.e. is < 1.0,
// it's possible to restore balance, but instead of that
- // we artifically ajdust freeSpc value in a way that it would
+ // we artifically ajdust freeSpc value in a way that it would
// look like total of mLetRatio's is 1.0, thus original
// len. ratios are _preserved_:
double unit = freeSpc / pcntSum;
- bool haveSquished = FALSE;
+ bool haveSquished = false;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{
if ( !pRow->mBars[i]->IsFixed() )
{
- cbBarInfo& bar = *pRow->mBars[i];
-
+ cbBarInfo& bar = *pRow->mBars[i];
+
if ( int( unit * bar.mLenRatio ) < mpPane->mProps.mMinCBarDim.x )
{
- haveSquished = TRUE;
+ haveSquished = true;
bar.mBounds.width = -1; // mark as "squished"
else
bar.mBounds.width = int( unit * bar.mLenRatio );
- // a little bit of AI:
- // memorize bar's height and width, when docked in
+ // a little bit of AI:
+ // memorize bar's height and width, when docked in
// the current orientation - by making the current
// dimensions to be "preffered" ones for this docking state
{
// first pass from left to right (detect left-side handles)
- bool foundNotFixed = FALSE;
+ bool foundNotFixed = false;
size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{
cbBarInfo& bar = *pRow->mBars[i];
-
- bar.mHasLeftHandle = FALSE;
+
+ bar.mHasLeftHandle = false;
if ( !bar.IsFixed() )
{
if ( foundNotFixed )
-
+
if ( bar.mpPrev &&
bar.mpPrev->IsFixed() )
-
- bar.mHasLeftHandle = TRUE;
- foundNotFixed = TRUE;
+ bar.mHasLeftHandle = true;
+
+ foundNotFixed = true;
}
}
// pass from right to left (detect right-side handles)
- foundNotFixed = FALSE;
+ foundNotFixed = false;
cbBarInfo* pBar = pRow->mBars[ pRow->mBars.Count() - 1 ];
while( pBar )
{
- pBar->mHasRightHandle = FALSE;
+ pBar->mHasRightHandle = false;
if ( !pBar->IsFixed() )
{
if ( pBar->mpNext )
- pBar->mHasRightHandle = TRUE;
+ pBar->mHasRightHandle = true;
- foundNotFixed = TRUE;
+ foundNotFixed = true;
}
pBar = pBar->mpPrev;
{
if ( !pTheBar->IsFixed() )
{
- // this bar the first in the row, move it's
+ // this bar the first in the row, move it's
// left edge to the very left
pTheBar->mBounds.width += pTheBar->mBounds.x;
pTheBar->mBounds.x = 0;
{
if ( !pTheBar->IsFixed() )
{
- // this bar is the last one, move it's
+ // this bar is the last one, move it's
// right edge to the very right
pTheBar->mBounds.width = mpPane->mPaneWidth - pTheBar->mBounds.x;
size_t i;
for ( i = 0; i != row.mBars.Count(); ++i )
-
+
maxHeight = wxMax( maxHeight, row.mBars[i]->mBounds.height );
return maxHeight;
}
}
- int leftShift = ( rightOverflow > leftFreeSpc )
- ? leftFreeSpc
+ int leftShift = ( rightOverflow > leftFreeSpc )
+ ? leftFreeSpc
: rightOverflow;
theBar.x -= leftShift;
} while(1);
}
-void cbRowLayoutPlugin::InsertBefore( cbBarInfo* pBeforeBar,
+void cbRowLayoutPlugin::InsertBefore( cbBarInfo* pBeforeBar,
cbBarInfo* pTheBar,
cbRowInfo& row )
{
InsertBefore( &bar, pTheBar, row );
return;
}
-
+
else
// if bar hits the right edge
if ( theBar.x <= cur.x + cur.width )
DetectBarHandles( pIntoRow );
- // do proportional resizing of not-fixed bars
+ // do proportional resizing of not-fixed bars
ApplyLengthRatios( pIntoRow );
}
// adjust the bar's docking state
- // a little bit of AI:
- // memorize bar's height and width, when docked in
+ // a little bit of AI:
+ // memorize bar's height and width, when docked in
// the current orientation - by making the current
// dimensions to be "preferred" ones for this docking state
// rest bar information after removing it from the row
pBar->mpRow = NULL;
- pBar->mHasLeftHandle = FALSE;
- pBar->mHasRightHandle = FALSE;
+ pBar->mHasLeftHandle = false;
+ pBar->mHasRightHandle = false;
mpPane->InitLinksForRow( pRow ); // relink "mpNext/mpPrev"s
// force repainting of bars, in the row, from which the bar was removed
// FIXME:: really needed?
- pRow->mBars[0]->mUMgrData.SetDirty(TRUE);
+ pRow->mBars[0]->mUMgrData.SetDirty(true);
// re-setup mHasOnlyFixedBars flag for the row information
event.mpPane->SyncRowFlags( pRow );
if ( !pRow->mHasOnlyFixedBars )
{
- // do proportional resizing of not-fixed bars
+ // do proportional resizing of not-fixed bars
ApplyLengthRatios( pRow );
}
cbRowInfo& row = *mpPane->GetRowList()[ i ];
//mpPane->CalcLengthRatios(& row);
- // setup "has-handle" flags for rows, which depend on the existance
+ // setup "has-handle" flags for rows, which depend on the existence
// of not-fixed bars in the row
if ( !row.mHasOnlyFixedBars )
if ( mpPane->mAlignment == FL_ALIGN_TOP ||
mpPane->mAlignment == FL_ALIGN_LEFT )
{
- row.mHasLowerHandle = TRUE;
+ row.mHasLowerHandle = true;
- row.mHasUpperHandle = FALSE;
+ row.mHasUpperHandle = false;
}
else
{
- row.mHasUpperHandle = TRUE;
+ row.mHasUpperHandle = true;
- row.mHasLowerHandle = FALSE;
+ row.mHasLowerHandle = false;
}
}
else
{
// otherwise, rows with fixed-bars only, have no height-resizing handles
- row.mHasUpperHandle = FALSE;
- row.mHasLowerHandle = FALSE;
+ row.mHasUpperHandle = false;
+ row.mHasLowerHandle = false;
}
// setup vertical positions for items in the row
cbRowInfo* pRow = pTheRow->mpPrev;
- while( pRow )
+ while( pRow )
{
pRow = pRow->mpPrev;
}
cbRowInfo* pRow = pTheRow->mpNext;
- while( pRow )
+ while( pRow )
{
pRow = pRow->mpNext;
}
{
int prevHeight = pRow->mRowHeight;
- int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
+ int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
prevHeight - needed );
if ( newHeight != prevHeight )
{
int prevHeight = pRow->mRowHeight;
- int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
+ int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
prevHeight - needed );
if ( newHeight != prevHeight )
}
if ( forUpperHandle )
-
+
event.mpPane->SetRowHeight( pTheRow, pTheRow->mRowHeight + (-ofs) );
else
event.mpPane->SetRowHeight( pTheRow, pTheRow->mRowHeight + ofs );
- mpLayout->RecalcLayout(FALSE);
+ mpLayout->RecalcLayout(false);
mpLayout->GetUpdatesManager().OnFinishChanges();
mpLayout->GetUpdatesManager().UpdateNow();