Changed all the wxASSERT(0) calls to use wxFAIL_MSG()

Removed the TABs in the source replacing with the standard number of spaces
Removed variable definitions from FOR statements defining the variables before the FOR statement


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2001-12-03 10:54:38 +00:00
parent e6b01b78a3
commit 5515f252cb
3 changed files with 2645 additions and 2654 deletions

View File

@@ -293,8 +293,8 @@ wxFrameLayout::wxFrameLayout(void)
{ {
CreateCursors(); CreateCursors();
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
mPanes[i] = NULL; mPanes[i] = NULL;
mFloatingOn = CanReparent(); mFloatingOn = CanReparent();
@@ -329,8 +329,8 @@ wxFrameLayout::wxFrameLayout( wxWindow* pParentFrame, wxWindow* pFrameClient, bo
{ {
CreateCursors(); CreateCursors();
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
mPanes[i] = new cbDockPane( i, this ); mPanes[i] = new cbDockPane( i, this );
if ( activateNow ) if ( activateNow )
@@ -421,7 +421,8 @@ void wxFrameLayout::DestroyBarWindows()
mBarSpyList.Clear(); mBarSpyList.Clear();
for( size_t i = 0; i != mAllBars.Count(); ++i ) size_t i;
for ( i = 0; i != mAllBars.Count(); ++i )
{ {
if ( mAllBars[i]->mpBarWnd ) if ( mAllBars[i]->mpBarWnd )
{ {
@@ -476,8 +477,7 @@ wxFrameLayout::~wxFrameLayout()
// destroy contents of arrays and lists // destroy contents of arrays and lists
size_t i = 0; size_t i = 0;
for ( i = 0; i != MAX_PANES; ++i )
for( i = 0; i != MAX_PANES; ++i )
{ {
if ( mPanes[i] ) if ( mPanes[i] )
delete mPanes[i]; delete mPanes[i];
@@ -508,8 +508,7 @@ wxFrameLayout::~wxFrameLayout()
pSpy = pSpy->Next(); pSpy = pSpy->Next();
} }
for( i = 0; i != mAllBars.Count(); ++i ) for ( i = 0; i != mAllBars.Count(); ++i )
delete mAllBars[i]; delete mAllBars[i];
} }
@@ -652,10 +651,9 @@ bool wxFrameLayout::RedockBar( cbBarInfo* pBar,
cbBarInfo* wxFrameLayout::FindBarByName( const wxString& name ) cbBarInfo* wxFrameLayout::FindBarByName( const wxString& name )
{ {
for( size_t i = 0; i != mAllBars.Count(); ++i ) size_t i;
for ( i = 0; i != mAllBars.Count(); ++i )
if ( mAllBars[i]->mName == name ) if ( mAllBars[i]->mName == name )
return mAllBars[i]; return mAllBars[i];
return NULL; return NULL;
@@ -663,10 +661,9 @@ cbBarInfo* wxFrameLayout::FindBarByName( const wxString& name )
cbBarInfo* wxFrameLayout::FindBarByWindow( const wxWindow* pWnd ) cbBarInfo* wxFrameLayout::FindBarByWindow( const wxWindow* pWnd )
{ {
for( size_t i = 0; i != mAllBars.Count(); ++i ) size_t i;
for ( i = 0; i != mAllBars.Count(); ++i )
if ( mAllBars[i]->mpBarWnd == pWnd ) if ( mAllBars[i]->mpBarWnd == pWnd )
return mAllBars[i]; return mAllBars[i];
return NULL; return NULL;
@@ -955,7 +952,8 @@ void wxFrameLayout::RemoveBar( cbBarInfo* pBarInfo )
pPane->RemoveBar( pBarInfo ); pPane->RemoveBar( pBarInfo );
} }
for( size_t i = 0; i != mAllBars.Count(); ++i ) size_t i;
for ( i = 0; i != mAllBars.Count(); ++i )
{ {
if ( mAllBars[i] == pBarInfo ) if ( mAllBars[i] == pBarInfo )
{ {
@@ -973,9 +971,7 @@ void wxFrameLayout::RemoveBar( cbBarInfo* pBarInfo )
return; return;
} }
} }
int avoidCompilerWarning = 0; wxFAIL_MSG("bar info should be present in the list of all bars of all panes");
wxASSERT(avoidCompilerWarning); // DBG:: bar info should be present in the list of all bars of all panes
} }
bool wxFrameLayout::LocateBar( cbBarInfo* pBarInfo, bool wxFrameLayout::LocateBar( cbBarInfo* pBarInfo,
@@ -985,11 +981,12 @@ bool wxFrameLayout::LocateBar( cbBarInfo* pBarInfo,
(*ppRow) = NULL; (*ppRow) = NULL;
(*ppPane) = NULL; (*ppPane) = NULL;
for( int n = 0; n != MAX_PANES; ++n ) int n;
for ( n = 0; n != MAX_PANES; ++n )
{ {
wxBarIterator i( mPanes[n]->GetRowList() ); wxBarIterator i( mPanes[n]->GetRowList() );
while( i.Next() ) while ( i.Next() )
if ( &i.BarInfo() == pBarInfo ) if ( &i.BarInfo() == pBarInfo )
{ {
@@ -1146,8 +1143,8 @@ void wxFrameLayout::PositionPanes()
// FOR NOW:: excessive updates! // FOR NOW:: excessive updates!
// reposition bars within all panes // reposition bars within all panes
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
mPanes[i]->SizePaneObjects(); mPanes[i]->SizePaneObjects();
} }
@@ -1162,10 +1159,9 @@ void wxFrameLayout::OnSize( wxSizeEvent& event )
void wxFrameLayout::HideBarWindows() void wxFrameLayout::HideBarWindows()
{ {
for( size_t i = 0; i != mAllBars.Count(); ++i ) size_t i;
for ( i = 0; i != mAllBars.Count(); ++i )
if ( mAllBars[i]->mpBarWnd && mAllBars[i]->mState != wxCBAR_FLOATING ) if ( mAllBars[i]->mpBarWnd && mAllBars[i]->mState != wxCBAR_FLOATING )
mAllBars[i]->mpBarWnd->Show( FALSE ); mAllBars[i]->mpBarWnd->Show( FALSE );
// then floated frames // then floated frames
@@ -1251,9 +1247,10 @@ void wxFrameLayout::HookUpToFrame()
cbDockPane* wxFrameLayout::GetBarPane( cbBarInfo* pBar ) cbDockPane* wxFrameLayout::GetBarPane( cbBarInfo* pBar )
{ {
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
if ( mPanes[i]->BarPresent( pBar ) ) return mPanes[i]; if ( mPanes[i]->BarPresent( pBar ) )
return mPanes[i];
return NULL; return NULL;
} }
@@ -1302,13 +1299,15 @@ cbDockPane* wxFrameLayout::HitTestPanes( const wxRect& rect,
return pCurPane; return pCurPane;
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
{
if ( pCurPane != mPanes[i] && if ( pCurPane != mPanes[i] &&
rect_hits_rect( mPanes[i]->GetRealRect(), rect ) ) rect_hits_rect( mPanes[i]->GetRealRect(), rect ) )
{
return mPanes[i]; return mPanes[i];
}
}
return 0; return 0;
} }
@@ -1319,7 +1318,6 @@ void wxFrameLayout::ForwardMouseEvent( wxMouseEvent& event,
wxPoint pos( event.m_x, event.m_y ); wxPoint pos( event.m_x, event.m_y );
pToPane->FrameToPane( &pos.x, &pos.y ); pToPane->FrameToPane( &pos.x, &pos.y );
#if wxCHECK_VERSION(2,3,0)
if ( eventType == cbEVT_PL_LEFT_DOWN ) if ( eventType == cbEVT_PL_LEFT_DOWN )
{ {
cbLeftDownEvent evt( pos, pToPane ); cbLeftDownEvent evt( pos, pToPane );
@@ -1355,36 +1353,6 @@ void wxFrameLayout::ForwardMouseEvent( wxMouseEvent& event,
int avoidCompilerWarning = 0; int avoidCompilerWarning = 0;
wxASSERT(avoidCompilerWarning); // DBG:: wxASSERT(avoidCompilerWarning); // DBG::
} }
#else
switch ( eventType )
{
case cbEVT_PL_LEFT_DOWN : { cbLeftDownEvent evt( pos, pToPane );
FirePluginEvent( evt ); break;
}
case cbEVT_PL_LEFT_DCLICK:{ cbLeftDClickEvent evt( pos, pToPane );
FirePluginEvent( evt ); break;
}
case cbEVT_PL_LEFT_UP : { cbLeftUpEvent evt( pos, pToPane );
FirePluginEvent( evt ); break;
}
case cbEVT_PL_RIGHT_DOWN: { cbRightDownEvent evt( pos, pToPane );
FirePluginEvent( evt ); break;
}
case cbEVT_PL_RIGHT_UP : { cbRightUpEvent evt( pos, pToPane );
FirePluginEvent( evt ); break;
}
case cbEVT_PL_MOTION : { cbMotionEvent evt( pos, pToPane );
FirePluginEvent( evt ); break;
}
default : wxASSERT(0); // DBG::
}
#endif // #if wxCHECK_VERSION(2,3,0)
} // wxFrameLayout::ForwardMouseEvent() } // wxFrameLayout::ForwardMouseEvent()
@@ -1394,14 +1362,17 @@ void wxFrameLayout::RouteMouseEvent( wxMouseEvent& event, int pluginEvtType )
ForwardMouseEvent( event, mpPaneInFocus, pluginEvtType ); ForwardMouseEvent( event, mpPaneInFocus, pluginEvtType );
else else
for( int i = 0; i != MAX_PANES; ++i ) {
int i;
for ( i = 0; i != MAX_PANES; ++i )
{
if ( HitTestPane( mPanes[i], event.m_x, event.m_y ) ) if ( HitTestPane( mPanes[i], event.m_x, event.m_y ) )
{ {
ForwardMouseEvent( event, mPanes[i], pluginEvtType ); ForwardMouseEvent( event, mPanes[i], pluginEvtType );
return; return;
} }
}
}
} }
/*** event handlers ***/ /*** event handlers ***/
@@ -1437,8 +1408,10 @@ void wxFrameLayout::OnMouseMove( wxMouseEvent& event )
ForwardMouseEvent( event, mpPaneInFocus, cbEVT_PL_MOTION ); ForwardMouseEvent( event, mpPaneInFocus, cbEVT_PL_MOTION );
else else
for( int i = 0; i != MAX_PANES; ++i ) {
int i;
for ( i = 0; i != MAX_PANES; ++i )
{
if ( HitTestPane( mPanes[i], event.m_x, event.m_y ) ) if ( HitTestPane( mPanes[i], event.m_x, event.m_y ) )
{ {
if ( mpLRUPane && mpLRUPane != mPanes[i] ) if ( mpLRUPane && mpLRUPane != mPanes[i] )
@@ -1453,6 +1426,8 @@ void wxFrameLayout::OnMouseMove( wxMouseEvent& event )
return; return;
} }
}
}
if ( mpLRUPane ) if ( mpLRUPane )
{ {
@@ -1465,12 +1440,12 @@ void wxFrameLayout::OnMouseMove( wxMouseEvent& event )
void wxFrameLayout::OnPaint( wxPaintEvent& event ) void wxFrameLayout::OnPaint( wxPaintEvent& event )
{ {
if ( mRecalcPending ) if ( mRecalcPending )
RecalcLayout( TRUE ); RecalcLayout( TRUE );
wxPaintDC dc(mpFrame); wxPaintDC dc(mpFrame);
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
{ {
wxRect& rect = mPanes[i]->mBoundsInParent; wxRect& rect = mPanes[i]->mBoundsInParent;
@@ -1545,17 +1520,19 @@ void wxFrameLayout::GetPaneProperties( cbCommonPaneProperties& props, int alignm
void wxFrameLayout::SetPaneProperties( const cbCommonPaneProperties& props, int paneMask ) void wxFrameLayout::SetPaneProperties( const cbCommonPaneProperties& props, int paneMask )
{ {
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
{
if ( mPanes[i]->MatchesMask( paneMask ) ) if ( mPanes[i]->MatchesMask( paneMask ) )
mPanes[i]->mProps = props; mPanes[i]->mProps = props;
}
} }
void wxFrameLayout::SetMargins( int top, int bottom, int left, int right, void wxFrameLayout::SetMargins( int top, int bottom, int left, int right,
int paneMask ) int paneMask )
{ {
for( int i = 0; i != MAX_PANES; ++i ) int i;
for ( i = 0; i != MAX_PANES; ++i )
{ {
cbDockPane& pane = *mPanes[i]; cbDockPane& pane = *mPanes[i];
@@ -1735,7 +1712,7 @@ void wxFrameLayout::AddPlugin( wxClassInfo* pPlInfo, int paneMask )
void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo, void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo,
int paneMask ) int paneMask )
{ {
wxASSERT( pNextPlInfo != pPlInfo ); // DBG:: no sence wxASSERT( pNextPlInfo != pPlInfo ); // DBG:: no sense
cbPluginBase* pNextPl = FindPlugin( pNextPlInfo ); cbPluginBase* pNextPl = FindPlugin( pNextPlInfo );
@@ -1929,7 +1906,8 @@ cbDimInfo::cbDimInfo()
mIsFixed(TRUE), mIsFixed(TRUE),
mpHandler( NULL ) mpHandler( NULL )
{ {
for( size_t i = 0; i != MAX_BAR_STATES; ++i ) size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
{ {
mSizes[i].x = 20; mSizes[i].x = 20;
mSizes[i].y = 20; mSizes[i].y = 20;
@@ -1953,7 +1931,8 @@ cbDimInfo::cbDimInfo( cbBarDimHandlerBase* pDimHandler,
mpHandler->AddRef(); mpHandler->AddRef();
} }
for( size_t i = 0; i != MAX_BAR_STATES; ++i ) size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
{ {
mSizes[i].x = -1; mSizes[i].x = -1;
mSizes[i].y = -1; mSizes[i].y = -1;
@@ -1990,7 +1969,8 @@ cbDimInfo::cbDimInfo( int dh_x, int dh_y,
mSizes[wxCBAR_FLOATING ].x = f_x; mSizes[wxCBAR_FLOATING ].x = f_x;
mSizes[wxCBAR_FLOATING ].y = f_y; mSizes[wxCBAR_FLOATING ].y = f_y;
for( size_t i = 0; i != MAX_BAR_STATES; ++i ) size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
mBounds[i] = wxRect( -1,-1,-1,-1 ); mBounds[i] = wxRect( -1,-1,-1,-1 );
} }
@@ -2015,7 +1995,8 @@ cbDimInfo::cbDimInfo( int x, int y,
mSizes[wxCBAR_FLOATING ].x = x; mSizes[wxCBAR_FLOATING ].x = x;
mSizes[wxCBAR_FLOATING ].y = y; mSizes[wxCBAR_FLOATING ].y = y;
for( size_t i = 0; i != MAX_BAR_STATES; ++i ) size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
mBounds[i] = wxRect( -1,-1,-1,-1 ); mBounds[i] = wxRect( -1,-1,-1,-1 );
} }
@@ -2028,10 +2009,11 @@ cbDimInfo::~cbDimInfo()
const cbDimInfo& cbDimInfo::operator=( const cbDimInfo& other ) const cbDimInfo& cbDimInfo::operator=( const cbDimInfo& other )
{ {
if ( this == &other ) return *this; if ( this == &other )
return *this;
for( int i = 0; i != MAX_BAR_STATES; ++i )
int i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
mSizes[i] = other.mSizes[i]; mSizes[i] = other.mSizes[i];
mIsFixed = other.mIsFixed; mIsFixed = other.mIsFixed;
@@ -2140,8 +2122,8 @@ cbDockPane::cbDockPane( int alignment, wxFrameLayout* pPanel )
cbDockPane::~cbDockPane() cbDockPane::~cbDockPane()
{ {
for( size_t i = 0; i != mRows.Count(); ++i ) size_t i;
for ( i = 0; i != mRows.Count(); ++i )
delete mRows[i]; delete mRows[i];
mRowShapeData.DeleteContents( TRUE ); mRowShapeData.DeleteContents( TRUE );
@@ -2203,12 +2185,12 @@ void cbDockPane::PaintRowDecorations( cbRowInfo* pRow, wxDC& dc )
size_t i = 0; size_t i = 0;
// decorations first // decorations first
for( i = 0; i != pRow->mBars.Count(); ++i ) for ( i = 0; i != pRow->mBars.Count(); ++i )
PaintBarDecorations( pRow->mBars[i], dc ); PaintBarDecorations( pRow->mBars[i], dc );
// then handles if present // then handles if present
for( i = 0; i != pRow->mBars.Count(); ++i ) for ( i = 0; i != pRow->mBars.Count(); ++i )
PaintBarHandles( pRow->mBars[i], dc ); PaintBarHandles( pRow->mBars[i], dc );
} }
@@ -2241,15 +2223,14 @@ void cbDockPane::PaintPane( wxDC& dc )
size_t i = 0; size_t i = 0;
// first decorations // first decorations
for( i = 0; i != mRows.Count(); ++i ) for ( i = 0; i != mRows.Count(); ++i )
{ {
PaintRowBackground( mRows[i], dc ); PaintRowBackground( mRows[i], dc );
PaintRowDecorations( mRows[i], dc ); PaintRowDecorations( mRows[i], dc );
} }
// than handles // than handles
for( i = 0; i != mRows.Count(); ++i ) for ( i = 0; i != mRows.Count(); ++i )
PaintRowHandles( mRows[i], dc ); PaintRowHandles( mRows[i], dc );
// and finally // and finally
@@ -2266,15 +2247,15 @@ void cbDockPane::SizeBar( cbBarInfo* pBar )
void cbDockPane::SizeRowObjects( cbRowInfo* pRow ) void cbDockPane::SizeRowObjects( cbRowInfo* pRow )
{ {
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
SizeBar( pRow->mBars[i] ); SizeBar( pRow->mBars[i] );
} }
void cbDockPane::SizePaneObjects() void cbDockPane::SizePaneObjects()
{ {
for( size_t i = 0; i != mRows.Count(); ++i ) size_t i;
for ( i = 0; i != mRows.Count(); ++i )
SizeRowObjects( mRows[i] ); SizeRowObjects( mRows[i] );
} }
@@ -2305,9 +2286,12 @@ int cbDockPane::GetNotFixedBarsCount( cbRowInfo* pRow )
{ {
int cnt = 0; int cnt = 0;
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
if ( !pRow->mBars[i]->IsFixed() ) ++cnt; {
if ( !pRow->mBars[i]->IsFixed() )
++cnt;
}
return cnt; return cnt;
} }
@@ -2336,7 +2320,8 @@ void cbDockPane::SyncRowFlags( cbRowInfo* pRow )
pRow->mNotFixedBarsCnt = 0; pRow->mNotFixedBarsCnt = 0;
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{ {
cbBarInfo& bar = *pRow->mBars[i]; cbBarInfo& bar = *pRow->mBars[i];
@@ -2430,13 +2415,14 @@ void cbDockPane::PaneToFrame( wxRect* pRect )
int cbDockPane::GetRowAt( int paneY ) int cbDockPane::GetRowAt( int paneY )
{ {
if ( paneY < 0 ) return -1; if ( paneY < 0 )
return -1;
int curY = 0; int curY = 0;
size_t i = 0; size_t i = 0;
for( ; i != mRows.Count(); ++i ) for ( ; i != mRows.Count(); ++i )
{ {
int rowHeight = mRows[i]->mRowHeight; int rowHeight = mRows[i]->mRowHeight;
@@ -2494,12 +2480,13 @@ int cbDockPane::GetRowAt( int upperY, int lowerY )
int mid = upperY + (lowerY - upperY)/2; int mid = upperY + (lowerY - upperY)/2;
if ( mid < 0 ) return -1; if ( mid < 0 )
return -1;
int curY = 0; int curY = 0;
size_t i = 0; size_t i = 0;
for( ; i != mRows.Count(); ++i ) for ( ; i != mRows.Count(); ++i )
{ {
int rowHeight = mRows[i]->mRowHeight; int rowHeight = mRows[i]->mRowHeight;
@@ -2515,9 +2502,11 @@ int cbDockPane::GetRowY( cbRowInfo* pRow )
{ {
int curY = 0; int curY = 0;
for( size_t i = 0; i != mRows.Count(); ++i ) size_t i;
for ( i = 0; i != mRows.Count(); ++i )
{ {
if ( mRows[i] == pRow ) break; if ( mRows[i] == pRow )
break;
curY += mRows[i]->mRowHeight; curY += mRows[i]->mRowHeight;
} }
@@ -2589,23 +2578,21 @@ void cbDockPane::CalcLengthRatios( cbRowInfo* pInRow )
// clac current-maximal-total-length of all maximized bars // clac current-maximal-total-length of all maximized bars
for( i = 0; i != pInRow->mBars.GetCount(); ++i ) for ( i = 0; i != pInRow->mBars.GetCount(); ++i )
{ {
cbBarInfo& bar = *pInRow->mBars[i]; cbBarInfo& bar = *pInRow->mBars[i];
if ( !bar.IsFixed() ) if ( !bar.IsFixed() )
totalWidth += bar.mBounds.width; totalWidth += bar.mBounds.width;
} }
// set up persentages of occupied space for each maximized bar // set up persentages of occupied space for each maximized bar
for( i = 0; i != pInRow->mBars.Count(); ++i ) for ( i = 0; i != pInRow->mBars.Count(); ++i )
{ {
cbBarInfo& bar = *pInRow->mBars[i]; cbBarInfo& bar = *pInRow->mBars[i];
if ( !bar.IsFixed() ) if ( !bar.IsFixed() )
bar.mLenRatio = double(bar.mBounds.width)/double(totalWidth); bar.mLenRatio = double(bar.mBounds.width)/double(totalWidth);
} }
} }
@@ -2703,18 +2690,17 @@ void cbDockPane::ContractBar( cbBarInfo* pBar )
void cbDockPane::InitLinksForRow( cbRowInfo* pRow ) void cbDockPane::InitLinksForRow( cbRowInfo* pRow )
{ {
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{ {
cbBarInfo& bar = *pRow->mBars[i]; cbBarInfo& bar = *pRow->mBars[i];
if ( i == 0 ) if ( i == 0 )
bar.mpPrev = NULL; bar.mpPrev = NULL;
else else
bar.mpPrev = pRow->mBars[i-1]; bar.mpPrev = pRow->mBars[i-1];
if ( i == pRow->mBars.Count() - 1 ) if ( i == pRow->mBars.Count() - 1 )
bar.mpNext = NULL; bar.mpNext = NULL;
else else
bar.mpNext = pRow->mBars[i+1]; bar.mpNext = pRow->mBars[i+1];
@@ -2723,18 +2709,17 @@ void cbDockPane::InitLinksForRow( cbRowInfo* pRow )
void cbDockPane::InitLinksForRows() void cbDockPane::InitLinksForRows()
{ {
for( size_t i = 0; i != mRows.Count(); ++i ) size_t i;
for ( i = 0; i != mRows.Count(); ++i )
{ {
cbRowInfo& row = *mRows[i]; cbRowInfo& row = *mRows[i];
if ( i == 0 ) if ( i == 0 )
row.mpPrev = NULL; row.mpPrev = NULL;
else else
row.mpPrev = mRows[i-1]; row.mpPrev = mRows[i-1];
if ( i == mRows.Count() - 1 ) if ( i == mRows.Count() - 1 )
row.mpNext = NULL; row.mpNext = NULL;
else else
row.mpNext = mRows[i+1]; row.mpNext = mRows[i+1];
@@ -2825,12 +2810,13 @@ void cbDockPane::InsertBar( cbBarInfo* pBarInfo )
void cbDockPane::RemoveRow( cbRowInfo* pRow ) void cbDockPane::RemoveRow( cbRowInfo* pRow )
{ {
size_t i;
// first, hide all bar-windows in the removed row // first, hide all bar-windows in the removed row
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) for ( i = 0; i != pRow->mBars.Count(); ++i )
{
if ( pRow->mBars[i]->mpBarWnd ) if ( pRow->mBars[i]->mpBarWnd )
pRow->mBars[i]->mpBarWnd->Show( FALSE ); pRow->mBars[i]->mpBarWnd->Show( FALSE );
}
mRows.Remove( pRow ); mRows.Remove( pRow );
@@ -2849,8 +2835,8 @@ void cbDockPane::InsertRow( cbRowInfo* pRow, cbRowInfo* pBeforeRow )
pRow->mUMgrData.SetDirty(TRUE); pRow->mUMgrData.SetDirty(TRUE);
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
pRow->mBars[i]->mUMgrData.SetDirty( TRUE ); pRow->mBars[i]->mUMgrData.SetDirty( TRUE );
SyncRowFlags( pRow ); SyncRowFlags( pRow );
@@ -2859,7 +2845,6 @@ void cbDockPane::InsertRow( cbRowInfo* pRow, cbRowInfo* pBeforeRow )
void cbDockPane::SetPaneWidth(int width) void cbDockPane::SetPaneWidth(int width)
{ {
if ( IsHorizontal() ) if ( IsHorizontal() )
mPaneWidth = width - mLeftMargin - mRightMargin; mPaneWidth = width - mLeftMargin - mRightMargin;
else else
mPaneWidth = width - mTopMargin - mBottomMargin; mPaneWidth = width - mTopMargin - mBottomMargin;
@@ -2868,7 +2853,6 @@ void cbDockPane::SetPaneWidth(int width)
void cbDockPane::SetBoundsInParent( const wxRect& rect ) void cbDockPane::SetBoundsInParent( const wxRect& rect )
{ {
mBoundsInParent = rect; mBoundsInParent = rect;
// set pane dimensions in local coordinates // set pane dimensions in local coordinates
@@ -2972,14 +2956,14 @@ cbRowInfo* cbDockPane::GetRow( int row )
int cbDockPane::GetRowIndex( cbRowInfo* pRow ) int cbDockPane::GetRowIndex( cbRowInfo* pRow )
{ {
for( size_t i = 0; i != mRows.Count(); ++i ) size_t i;
for ( i = 0; i != mRows.Count(); ++i )
{ {
if ( mRows[i] == pRow ) if ( mRows[i] == pRow )
return i; return i;
} }
int avoidCompilerWarning = 0; wxFAIL_MSG("Row must be present to call cbDockPane::GetRowIndex()");
wxASSERT(avoidCompilerWarning); // DBG:: row should be present
return 0; return 0;
} }
@@ -3027,8 +3011,7 @@ bool cbDockPane::MatchesMask( int paneMask )
case FL_ALIGN_RIGHT : thisMask = FL_ALIGN_RIGHT_PANE; break; case FL_ALIGN_RIGHT : thisMask = FL_ALIGN_RIGHT_PANE; break;
default: default:
int avoidCompilerWarning = 0; wxFAIL_MSG("Bad FL alignment type detected in cbDockPane::MatchesMask()");
wxASSERT(avoidCompilerWarning); // DBG:: bogus alignment type
} }
return ( thisMask & paneMask ) != 0; return ( thisMask & paneMask ) != 0;
@@ -3043,8 +3026,8 @@ void cbDockPane::RecalcLayout()
// then horizontally in each row // then horizontally in each row
for( size_t i = 0; i != mRows.Count(); ++i ) size_t i;
for ( i = 0; i != mRows.Count(); ++i )
RecalcRowLayout( mRows[i] ); RecalcRowLayout( mRows[i] );
} }
@@ -3076,7 +3059,8 @@ int cbDockPane::HitTestPaneItems( const wxPoint& pos,
(*ppRow) = NULL; (*ppRow) = NULL;
(*ppBar) = NULL; (*ppBar) = NULL;
for( size_t i = 0; i != mRows.Count(); ++i ) size_t i;
for ( i = 0; i != mRows.Count(); ++i )
{ {
cbRowInfo& row = *mRows[i]; cbRowInfo& row = *mRows[i];
@@ -3102,7 +3086,8 @@ int cbDockPane::HitTestPaneItems( const wxPoint& pos,
// hit-test bar handles and bar content // hit-test bar handles and bar content
for( size_t k = 0; k != row.mBars.Count(); ++k ) size_t k;
for ( k = 0; k != row.mBars.Count(); ++k )
{ {
cbBarInfo& bar = *row.mBars[k]; cbBarInfo& bar = *row.mBars[k];
wxRect& bounds = bar.mBounds; wxRect& bounds = bar.mBounds;
@@ -3126,7 +3111,6 @@ int cbDockPane::HitTestPaneItems( const wxPoint& pos,
} }
if ( HasPoint( pos, bounds.x, bounds.y, bounds.width, bounds.height ) ) if ( HasPoint( pos, bounds.x, bounds.y, bounds.width, bounds.height ) )
return CB_BAR_CONTENT_HITTED; return CB_BAR_CONTENT_HITTED;
} // hit-test next bar } // hit-test next bar
@@ -3201,18 +3185,17 @@ int cbDockPane::GetMinimalRowHeight( cbRowInfo* pRow )
{ {
int height = mProps.mMinCBarDim.y; int height = mProps.mMinCBarDim.y;
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{
if ( pRow->mBars[i]->IsFixed() ) if ( pRow->mBars[i]->IsFixed() )
height = wxMax( height, pRow->mBars[i]->mBounds.height ); height = wxMax( height, pRow->mBars[i]->mBounds.height );
}
if ( pRow->mHasUpperHandle ) if ( pRow->mHasUpperHandle )
height += mProps.mResizeHandleSize; height += mProps.mResizeHandleSize;
if ( pRow->mHasLowerHandle ) if ( pRow->mHasLowerHandle )
height += mProps.mResizeHandleSize; height += mProps.mResizeHandleSize;
return height; return height;
@@ -3228,11 +3211,12 @@ void cbDockPane::SetRowHeight( cbRowInfo* pRow, int newHeight )
newHeight -= mProps.mResizeHandleSize; newHeight -= mProps.mResizeHandleSize;
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{
if ( !pRow->mBars[i]->IsFixed() ) if ( !pRow->mBars[i]->IsFixed() )
pRow->mBars[i]->mBounds.height = newHeight; pRow->mBars[i]->mBounds.height = newHeight;
}
} }
void cbDockPane::GetRowResizeRange( cbRowInfo* pRow, int* from, int* till, void cbDockPane::GetRowResizeRange( cbRowInfo* pRow, int* from, int* till,
@@ -3379,7 +3363,8 @@ void cbDockPane::DrawVertHandle( wxDC& dc, int x, int y, int height )
dc.DrawLine( x,y, x, lower ); dc.DrawLine( x,y, x, lower );
dc.SetPen( mpLayout->mGrayPen ); dc.SetPen( mpLayout->mGrayPen );
for( int i = 0; i != mProps.mResizeHandleSize-1; ++i ) int i;
for ( i = 0; i != mProps.mResizeHandleSize-1; ++i )
{ {
++x; ++x;
dc.DrawLine( x,y, x, lower ); dc.DrawLine( x,y, x, lower );
@@ -3403,7 +3388,8 @@ void cbDockPane::DrawHorizHandle( wxDC& dc, int x, int y, int width )
dc.SetPen( mpLayout->mGrayPen ); dc.SetPen( mpLayout->mGrayPen );
for( int i = 0; i != mProps.mResizeHandleSize-1; ++i ) int i;
for ( i = 0; i != mProps.mResizeHandleSize-1; ++i )
{ {
++y; ++y;
dc.DrawLine( x,y, right, y ); dc.DrawLine( x,y, right, y );
@@ -3434,7 +3420,8 @@ void cbDockPane::GetRowShapeData( cbRowInfo* pRow, wxList* pLst )
pLst->DeleteContents( TRUE ); pLst->DeleteContents( TRUE );
pLst->Clear(); pLst->Clear();
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{ {
cbBarInfo& bar = *pRow->mBars[i]; cbBarInfo& bar = *pRow->mBars[i];
@@ -3449,11 +3436,13 @@ void cbDockPane::GetRowShapeData( cbRowInfo* pRow, wxList* pLst )
void cbDockPane::SetRowShapeData( cbRowInfo* pRow, wxList* pLst ) void cbDockPane::SetRowShapeData( cbRowInfo* pRow, wxList* pLst )
{ {
if ( pLst->First() == NULL ) return; if ( pLst->First() == NULL )
return;
wxNode* pData = pLst->First(); wxNode* pData = pLst->First();
for( size_t i = 0; i != pRow->mBars.Count(); ++i ) size_t i;
for ( i = 0; i != pRow->mBars.Count(); ++i )
{ {
wxASSERT( pData ); // DBG:: wxASSERT( pData ); // DBG::

View File

@@ -173,7 +173,7 @@ void wxFrameManager::DestroyViews()
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
while( pNode ) while ( pNode )
{ {
delete (wxFrameView*)pNode->Data(); delete (wxFrameView*)pNode->Data();
@@ -190,7 +190,7 @@ int wxFrameManager::GetViewNo( wxFrameView* pView )
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
int n = 0; int n = 0;
while( pNode ) while ( pNode )
{ {
if ( (wxFrameView*)pNode->Data() == pView ) if ( (wxFrameView*)pNode->Data() == pView )
@@ -208,16 +208,17 @@ void wxFrameManager::EnableMenusForView( wxFrameView* pView, bool enable )
wxMenuBar* pMenuBar = GetParentFrame()->GetMenuBar(); wxMenuBar* pMenuBar = GetParentFrame()->GetMenuBar();
int count = pMenuBar->GetMenuCount(); int count = pMenuBar->GetMenuCount();
if ( !pMenuBar ) return; if ( !pMenuBar )
return;
wxStringListNode* pNode = pView->mTopMenus.GetFirst(); wxStringListNode* pNode = pView->mTopMenus.GetFirst();
while( pNode ) int i;
while ( pNode )
{ {
for( int i = 0; i != count; ++i ) for ( i = 0; i != count; ++i )
{ {
if ( pMenuBar->GetMenu(i)->GetTitle() == pNode->GetData() ) if ( pMenuBar->GetMenu(i)->GetTitle() == pNode->GetData() )
pMenuBar->EnableTop( i, enable ); pMenuBar->EnableTop( i, enable );
} }
@@ -230,7 +231,7 @@ void wxFrameManager::SyncAllMenus()
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
int i = 0; int i = 0;
while( pNode ) while ( pNode )
{ {
if ( i != mActiveViewNo ) if ( i != mActiveViewNo )
@@ -265,7 +266,7 @@ void wxFrameManager::Init( wxWindow* pMainFrame, const wxString& settingsFile )
wxNode* pNode = mViews.First(); wxNode* pNode = mViews.First();
while( pNode ) while ( pNode )
{ {
wxFrameView* pView = (wxFrameView*)pNode->Data(); wxFrameView* pView = (wxFrameView*)pNode->Data();
@@ -282,7 +283,7 @@ void wxFrameManager::Init( wxWindow* pMainFrame, const wxString& settingsFile )
pNode = mViews.First(); pNode = mViews.First();
while( pNode ) while ( pNode )
{ {
wxFrameView* pView = (wxFrameView*)pNode->Data(); wxFrameView* pView = (wxFrameView*)pNode->Data();
@@ -293,7 +294,6 @@ void wxFrameManager::Init( wxWindow* pMainFrame, const wxString& settingsFile )
} }
if ( mActiveViewNo >= mViews.Number() ) if ( mActiveViewNo >= mViews.Number() )
mActiveViewNo = -1; mActiveViewNo = -1;
ActivateView( GetView( ( mActiveViewNo == -1 ) ? 0 : mActiveViewNo ) ); ActivateView( GetView( ( mActiveViewNo == -1 ) ? 0 : mActiveViewNo ) );
@@ -311,8 +311,7 @@ void wxFrameManager::AddView( wxFrameView* pFrmView )
void wxFrameManager::RemoveView( wxFrameView* pFrmView ) void wxFrameManager::RemoveView( wxFrameView* pFrmView )
{ {
// TBD:: // TBD::
int avoidCompilerWarning = 0; wxFAIL_MSG("wxFrameManager::RemoveView() has not been implemented yet.");
wxASSERT(avoidCompilerWarning);
} }
int wxFrameManager::GetActiveViewNo() int wxFrameManager::GetActiveViewNo()
@@ -393,7 +392,8 @@ wxWindow* wxFrameManager::GetClientWindow()
void wxFrameManager::DeactivateCurrentView() void wxFrameManager::DeactivateCurrentView()
{ {
if ( mActiveViewNo == -1 ) return; if ( mActiveViewNo == -1 )
return;
wxFrameView* pView = GetActiveView(); wxFrameView* pView = GetActiveView();
@@ -403,7 +403,6 @@ void wxFrameManager::DeactivateCurrentView()
GetParentFrame()->PopEventHandler(); GetParentFrame()->PopEventHandler();
if ( pView->mpLayout ) if ( pView->mpLayout )
pView->mpLayout->Deactivate(); pView->mpLayout->Deactivate();
EnableMenusForView( pView, FALSE ); EnableMenusForView( pView, FALSE );
@@ -429,7 +428,6 @@ bool wxFrameManager::ReloadViews()
// TBD: ???? // TBD: ????
#if 0 #if 0
if ( mSettingsFile == "" || !wxFileExists( mSettingsFile ) ) if ( mSettingsFile == "" || !wxFileExists( mSettingsFile ) )
return FALSE; return FALSE;
DestroyViews(); DestroyViews();

View File

@@ -34,7 +34,9 @@ static int* create_array( int width, int height, int fill = 0 )
int* array = new int[width*height]; int* array = new int[width*height];
int len = width*height; int len = width*height;
for( int i = 0; i != len; ++i ) array[i] = fill; int i;
for ( i = 0; i != len; ++i )
array[i] = fill;
return array; return array;
} }
@@ -110,30 +112,34 @@ static void gray_out_pixmap( int* src, int* dest, int width, int height )
if ( IS_IN_ARRAY(x+1,y-1) ) if ( IS_IN_ARRAY(x+1,y-1) )
{ {
++x;--y; ++x;
--y;
} }
else else
{ {
while( IS_IN_ARRAY(x-1,y+1) ) while ( IS_IN_ARRAY(x-1,y+1) )
{ {
--x;++y; --x;
++y;
} }
if ( IS_IN_ARRAY(x,y+1) ) if ( IS_IN_ARRAY(x,y+1) )
{ {
++y; continue; ++y;
continue;
} }
else else
{ {
if ( IS_IN_ARRAY(x+1,y) ) if ( IS_IN_ARRAY(x+1,y) )
{ {
++x; continue; ++x;
continue;
} }
else break; else break;
} }
} }
} while(1); } while (1);
} }
// alg. for making the image look "grayed" (e.g. disabled button) // alg. for making the image look "grayed" (e.g. disabled button)
@@ -152,23 +158,22 @@ void gray_out_image_on_dc( wxDC& dc, int width, int height )
int* src = create_array( width, height, MASK_BG ); int* src = create_array( width, height, MASK_BG );
int* dest = create_array( width, height, MASK_BG ); int* dest = create_array( width, height, MASK_BG );
int y = 0; int x, y;
for( y = 0; y != height; ++y ) for ( y = 0; y != height; ++y )
{
for( int x = 0; x != width; ++x ) for ( x = 0; x != width; ++x )
{ {
wxColour col; wxColour col;
dc.GetPixel( x,y, &col ); dc.GetPixel( x,y, &col );
GET_ELEM(src,x,y) = MAKE_INT_COLOR( col.Red(), col.Green(), col.Blue() ); GET_ELEM(src,x,y) = MAKE_INT_COLOR( col.Red(), col.Green(), col.Blue() );
} }
}
gray_out_pixmap( src, dest, width, height ); gray_out_pixmap( src, dest, width, height );
for( y = 0; y != height; ++y ) for ( y = 0; y != height; ++y )
{
for( int x = 0; x != width; ++x ) for ( x = 0; x != width; ++x )
{ {
int mask = GET_ELEM(dest,x,y); int mask = GET_ELEM(dest,x,y);
@@ -186,7 +191,7 @@ void gray_out_image_on_dc( wxDC& dc, int width, int height )
default : break; default : break;
} }
} }
}
delete [] src; delete [] src;
delete [] dest; delete [] dest;
} }
@@ -425,8 +430,7 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
} }
else else
{ {
int avoidCompilerWarning = 0; wxFAIL_MSG("Unsupported FL alignment type detected in wxNewBitmapButton::RenderLabelImage()");
wxASSERT(avoidCompilerWarning);// unsupported alignment type
} }
} }
else else
@@ -477,7 +481,7 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
break; break;
pTopWnd = pParent; pTopWnd = pParent;
} while(1); } while (1);
destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) ); destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) );
@@ -527,7 +531,7 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
break; break;
pTopWnd = pParent; pTopWnd = pParent;
} while(1); } while (1);
destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) ); destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) );