Removed non-reachable code (consulted Aleks first, and he said the code was no longer needed)

Commented out unused variables to stop BCC warnings - left the code for debugging purposes
Removed hardcoded tabs and replaced with spaces per the wxWindows code style specs
Spelling typos fixed in comments
Miscellaneous source formatting issues fixed to meet standard wxwindows coding styles


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2001-11-22 23:15:12 +00:00
parent df43c1d682
commit 11a68fa3af
7 changed files with 1101 additions and 1108 deletions

View File

@@ -371,7 +371,7 @@ void cbBarDragPlugin::UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos )
if ( pPane->IsHorizontal() && fromLowerEdge ) if ( pPane->IsHorizontal() && fromLowerEdge )
{ {
bool fromLowerEdge = mousePos.y > bounds.y; // bool fromLowerEdge = mousePos.y > bounds.y;
mHintRect.y = wxMax( bounds.y + bounds.height + 1, mousePos.y - newHeight ); mHintRect.y = wxMax( bounds.y + bounds.height + 1, mousePos.y - newHeight );

View File

@@ -6,7 +6,7 @@
// Created: 30/11/98 (my 22th birthday :-) // Created: 30/11/98 (my 22th birthday :-)
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas // Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -49,42 +49,42 @@ IMPLEMENT_DYNAMIC_CLASS( cbBarHintsPlugin, cbPluginBase )
BEGIN_EVENT_TABLE( cbBarHintsPlugin, cbPluginBase ) BEGIN_EVENT_TABLE( cbBarHintsPlugin, cbPluginBase )
EVT_PL_SIZE_BAR_WND ( cbBarHintsPlugin::OnSizeBarWindow ) EVT_PL_SIZE_BAR_WND ( cbBarHintsPlugin::OnSizeBarWindow )
EVT_PL_DRAW_BAR_DECOR( cbBarHintsPlugin::OnDrawBarDecorations ) EVT_PL_DRAW_BAR_DECOR( cbBarHintsPlugin::OnDrawBarDecorations )
EVT_PL_LEFT_DOWN( cbBarHintsPlugin::OnLeftDown ) EVT_PL_LEFT_DOWN( cbBarHintsPlugin::OnLeftDown )
EVT_PL_LEFT_UP ( cbBarHintsPlugin::OnLeftUp ) EVT_PL_LEFT_UP ( cbBarHintsPlugin::OnLeftUp )
EVT_PL_MOTION ( cbBarHintsPlugin::OnMotion ) EVT_PL_MOTION ( cbBarHintsPlugin::OnMotion )
END_EVENT_TABLE() END_EVENT_TABLE()
cbBarHintsPlugin::cbBarHintsPlugin(void) cbBarHintsPlugin::cbBarHintsPlugin(void)
: mpPane( 0 ), : mpPane( 0 ),
mBtnPressed ( FALSE ), mBtnPressed ( FALSE ),
mCloseBoxOn ( TRUE ), mCloseBoxOn ( TRUE ),
mCollapseBoxOn( TRUE ), mCollapseBoxOn( TRUE ),
mGrooveCount ( 2 ), mGrooveCount ( 2 ),
mHintGap ( 4 ), mHintGap ( 4 ),
mXWeight ( 2 ) mXWeight ( 2 )
{ {
mBoxes[CLOSE_BOX_IDX] = NULL; mBoxes[CLOSE_BOX_IDX] = NULL;
mBoxes[COLLAPSE_BOX_IDX] = NULL; mBoxes[COLLAPSE_BOX_IDX] = NULL;
} }
cbBarHintsPlugin::cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask ) cbBarHintsPlugin::cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask )
: cbPluginBase( pLayout, paneMask ), : cbPluginBase( pLayout, paneMask ),
mpPane( 0 ), mpPane( 0 ),
mBtnPressed ( FALSE ), mBtnPressed ( FALSE ),
mCloseBoxOn ( TRUE ), mCloseBoxOn ( TRUE ),
mCollapseBoxOn( TRUE ), mCollapseBoxOn( TRUE ),
mGrooveCount ( 2 ), mGrooveCount ( 2 ),
mHintGap ( 5 ), mHintGap ( 5 ),
mXWeight ( 2 ) mXWeight ( 2 )
{ {
mBoxes[CLOSE_BOX_IDX] = NULL; mBoxes[CLOSE_BOX_IDX] = NULL;
mBoxes[COLLAPSE_BOX_IDX] = NULL; mBoxes[COLLAPSE_BOX_IDX] = NULL;
} }
@@ -93,31 +93,31 @@ cbBarHintsPlugin::~cbBarHintsPlugin()
if (mBoxes[CLOSE_BOX_IDX]) if (mBoxes[CLOSE_BOX_IDX])
delete mBoxes[CLOSE_BOX_IDX]; delete mBoxes[CLOSE_BOX_IDX];
if (mBoxes[COLLAPSE_BOX_IDX]) if (mBoxes[COLLAPSE_BOX_IDX])
delete mBoxes[COLLAPSE_BOX_IDX]; delete mBoxes[COLLAPSE_BOX_IDX];
} // cbBarHintsPlugin destructor } // cbBarHintsPlugin destructor
void cbBarHintsPlugin::SetGrooveCount( int nGrooves ) void cbBarHintsPlugin::SetGrooveCount( int nGrooves )
{ {
mGrooveCount = nGrooves; mGrooveCount = nGrooves;
} }
void cbBarHintsPlugin::CreateBoxes() void cbBarHintsPlugin::CreateBoxes()
{ {
cbCloseBox* box1 = new cbCloseBox(); cbCloseBox* box1 = new cbCloseBox();
cbCollapseBox* box2 = new cbCollapseBox(); cbCollapseBox* box2 = new cbCollapseBox();
mBoxes[CLOSE_BOX_IDX] = box1; mBoxes[CLOSE_BOX_IDX] = box1;
mBoxes[COLLAPSE_BOX_IDX] = box2; mBoxes[COLLAPSE_BOX_IDX] = box2;
int i; int i;
for( i = 0; i != BOXES_IN_HINT; ++i ) for ( i = 0; i != BOXES_IN_HINT; ++i )
{ {
mBoxes[i]->mpLayout = mpLayout; mBoxes[i]->mpLayout = mpLayout;
mBoxes[i]->mpPlugin = this; mBoxes[i]->mpPlugin = this;
mBoxes[i]->mpWnd = NULL; mBoxes[i]->mpWnd = NULL;
} }
} }
@@ -130,431 +130,434 @@ void cbBarHintsPlugin::DrawCloseBox( wxDC& dc, const wxPoint& pos, bool pressed
} }
void cbBarHintsPlugin::DrawCollapseBox( wxDC& dc, const wxPoint& pos, void cbBarHintsPlugin::DrawCollapseBox( wxDC& dc, const wxPoint& pos,
bool atLeft, bool disabled, bool pressed ) bool atLeft, bool disabled, bool pressed )
{ {
} }
void cbBarHintsPlugin::DrawGrooves( wxDC& dc, const wxPoint& pos, int length ) void cbBarHintsPlugin::DrawGrooves( wxDC& dc, const wxPoint& pos, int length )
{ {
int ofs = 0; int ofs = 0;
int i; int i;
for( i = 0; i != mGrooveCount; ++i, ofs += ( GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP ) ) for ( i = 0; i != mGrooveCount; ++i, ofs += ( GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP ) )
{
if ( mpPane->IsHorizontal() ) if ( mpPane->IsHorizontal() )
{ {
dc.SetPen( mpLayout->mLightPen ); dc.SetPen( mpLayout->mLightPen );
dc.DrawLine( pos.x + ofs, pos.y, pos.x + ofs, pos.y + length - 1 ); dc.DrawLine( pos.x + ofs, pos.y, pos.x + ofs, pos.y + length - 1 );
dc.DrawPoint( pos.x + ofs + 1, pos.y ); dc.DrawPoint( pos.x + ofs + 1, pos.y );
dc.SetPen( mpLayout->mDarkPen ); dc.SetPen( mpLayout->mDarkPen );
dc.DrawLine( pos.x + ofs + 2, pos.y, pos.x + ofs + 2, pos.y + length ); dc.DrawLine( pos.x + ofs + 2, pos.y, pos.x + ofs + 2, pos.y + length );
dc.DrawPoint( pos.x + ofs + 1, pos.y + length - 1 ); dc.DrawPoint( pos.x + ofs + 1, pos.y + length - 1 );
dc.DrawPoint( pos.x + ofs, pos.y + length - 1 ); dc.DrawPoint( pos.x + ofs, pos.y + length - 1 );
} }
else else
{ {
dc.SetPen( mpLayout->mLightPen ); dc.SetPen( mpLayout->mLightPen );
dc.DrawLine( pos.x, pos.y + ofs, pos.x + length - 1, pos.y + ofs ); dc.DrawLine( pos.x, pos.y + ofs, pos.x + length - 1, pos.y + ofs );
dc.DrawPoint( pos.x, pos.y + ofs + 1 ); dc.DrawPoint( pos.x, pos.y + ofs + 1 );
dc.SetPen( mpLayout->mDarkPen ); dc.SetPen( mpLayout->mDarkPen );
dc.DrawLine( pos.x, pos.y + ofs + 2, pos.x + length, pos.y + ofs + 2 ); dc.DrawLine( pos.x, pos.y + ofs + 2, pos.x + length, pos.y + ofs + 2 );
dc.DrawPoint( pos.x + length - 1, pos.y + ofs + 1 ); dc.DrawPoint( pos.x + length - 1, pos.y + ofs + 1 );
dc.DrawPoint( pos.x + length - 1, pos.y + ofs ); dc.DrawPoint( pos.x + length - 1, pos.y + ofs );
} }
}
} }
void cbBarHintsPlugin::ExcludeHints( wxRect& rect, cbBarInfo& info ) void cbBarHintsPlugin::ExcludeHints( wxRect& rect, cbBarInfo& info )
{ {
int boxHeight = BTN_BOX_HEIGHT; int boxHeight = BTN_BOX_HEIGHT;
// collapse and close box are not placed on fixed bars // collapse and close box are not placed on fixed bars
if ( info.IsFixed() || ( !mCloseBoxOn && !mCollapseBoxOn ) ) if ( info.IsFixed() || ( !mCloseBoxOn && !mCollapseBoxOn ) )
boxHeight = 0; boxHeight = 0;
int height = wxMax( mGrooveCount*(GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP) int height = wxMax( mGrooveCount*(GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP)
- GROOVE_TO_GROOVE_GAP, - GROOVE_TO_GROOVE_GAP,
boxHeight boxHeight
); );
if ( mpPane->IsHorizontal() ) if ( mpPane->IsHorizontal() )
{ {
rect.x += ( mHintGap*2 + height ); rect.x += ( mHintGap*2 + height );
rect.width -= (height + 2*mHintGap); rect.width -= (height + 2*mHintGap);
rect.x -= info.mDimInfo.mHorizGap + 2; rect.x -= info.mDimInfo.mHorizGap + 2;
rect.width += info.mDimInfo.mHorizGap + 2; rect.width += info.mDimInfo.mHorizGap + 2;
} }
else else
{ {
rect.y += (mHintGap*2 + height); rect.y += (mHintGap*2 + height);
rect.height -= (height + 2*mHintGap); rect.height -= (height + 2*mHintGap);
rect.y -= info.mDimInfo.mVertGap + 2; rect.y -= info.mDimInfo.mVertGap + 2;
rect.height += info.mDimInfo.mVertGap + 2; rect.height += info.mDimInfo.mVertGap + 2;
} }
} }
void cbBarHintsPlugin::DoDrawHint( wxDC& dc, wxRect& rect, void cbBarHintsPlugin::DoDrawHint( wxDC& dc, wxRect& rect,
int pos, int boxOfs, int grooveOfs, int pos, int boxOfs, int grooveOfs,
bool isFixed ) bool isFixed )
{ {
if ( !isFixed ) if ( !isFixed )
{ {
if ( mpPane->IsHorizontal() ) if ( mpPane->IsHorizontal() )
{ {
if ( mCloseBoxOn ) if ( mCloseBoxOn )
mBoxes[CLOSE_BOX_IDX]->Draw( dc );
if ( mCollapseBoxOn ) mBoxes[CLOSE_BOX_IDX]->Draw( dc );
mBoxes[COLLAPSE_BOX_IDX]->Draw( dc );
}
else
{
if ( mCloseBoxOn )
mBoxes[CLOSE_BOX_IDX]->Draw( dc );
if ( mCollapseBoxOn ) if ( mCollapseBoxOn )
mBoxes[COLLAPSE_BOX_IDX]->Draw( dc ); mBoxes[COLLAPSE_BOX_IDX]->Draw( dc );
} }
} else
{
if ( mCloseBoxOn )
mBoxes[CLOSE_BOX_IDX]->Draw( dc );
if ( mpPane->IsHorizontal() ) if ( mCollapseBoxOn )
DrawGrooves( dc, wxPoint( rect.x + mHintGap + grooveOfs, pos ), mBoxes[COLLAPSE_BOX_IDX]->Draw( dc );
rect.height - (pos - rect.y) - mHintGap ); }
else }
DrawGrooves( dc, wxPoint( rect.x + mHintGap, rect.y + mHintGap + grooveOfs ),
(pos - rect.x) - mHintGap ); if ( mpPane->IsHorizontal() )
DrawGrooves( dc, wxPoint( rect.x + mHintGap + grooveOfs, pos ),
rect.height - (pos - rect.y) - mHintGap );
else
DrawGrooves( dc, wxPoint( rect.x + mHintGap, rect.y + mHintGap + grooveOfs ),
(pos - rect.x) - mHintGap );
} }
void cbBarHintsPlugin::GetHintsLayout( wxRect& rect, cbBarInfo& info, void cbBarHintsPlugin::GetHintsLayout( wxRect& rect, cbBarInfo& info,
int& boxOfs, int& grooveOfs, int& pos ) int& boxOfs, int& grooveOfs, int& pos )
{ {
int boxHeight = BTN_BOX_HEIGHT; int boxHeight = BTN_BOX_HEIGHT;
int boxWidth = BTN_BOX_WIDTH + BOX_TO_GROOVE_GAP + BTN_BOX_WIDTH; // int boxWidth = BTN_BOX_WIDTH + BOX_TO_GROOVE_GAP + BTN_BOX_WIDTH;
// collapse and close box are not placed on fixed bars // collapse and close box are not placed on fixed bars
if ( info.IsFixed() || ( !mCloseBoxOn && !mCollapseBoxOn ) ) if ( info.IsFixed() || ( !mCloseBoxOn && !mCollapseBoxOn ) )
{ {
boxHeight = 0; boxHeight = 0;
boxWidth = 0; // boxWidth = 0;
} }
else /*
if ( !mCloseBoxOn || !mCollapseBoxOn ) else
if ( !mCloseBoxOn || !mCollapseBoxOn )
boxWidth = BTN_BOX_WIDTH; boxWidth = BTN_BOX_WIDTH;
*/
int grooveHeight = mGrooveCount*(GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP)
- GROOVE_TO_GROOVE_GAP;
int grooveHeight = mGrooveCount*(GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP) int height = wxMax( grooveHeight, boxHeight );
- GROOVE_TO_GROOVE_GAP;
int height = wxMax( grooveHeight, boxHeight ); // center boxs and groves with respect to each other
// center boxs and groves with respect to each other boxOfs = ( height - boxHeight ) / 2;
grooveOfs = ( height - grooveHeight ) / 2;
boxOfs = ( height - boxHeight ) / 2; pos = ( mpPane->IsHorizontal() ) ? rect.y + mHintGap
grooveOfs = ( height - grooveHeight ) / 2; : rect.x + rect.width - mHintGap;
pos = ( mpPane->IsHorizontal() ) ? rect.y + mHintGap // setup positions for boxes
: rect.x + rect.width - mHintGap;
// setup positions for boxes if ( !info.IsFixed() )
{
// what direction "collapse-triangle" should look at?
if ( !info.IsFixed() ) bool& isAtLeft = ((cbCollapseBox*)(mBoxes[COLLAPSE_BOX_IDX]))->mIsAtLeft;
{
// what direction "collapse-triangle" should look at? isAtLeft= info.mBounds.x <= mpPane->mPaneWidth - ( info.mBounds.x + info.mBounds.width );
bool& isAtLeft = ((cbCollapseBox*)(mBoxes[COLLAPSE_BOX_IDX]))->mIsAtLeft; if ( info.IsExpanded() )
{
isAtLeft= info.mBounds.x <= mpPane->mPaneWidth - ( info.mBounds.x + info.mBounds.width ); isAtLeft = FALSE;
if ( info.IsExpanded() ) cbBarInfo* pCur = info.mpPrev;
{
isAtLeft = FALSE;
cbBarInfo* pCur = info.mpPrev; while( pCur )
{
if ( !pCur->IsFixed() )
{
isAtLeft = TRUE; break;
}
while( pCur ) pCur = pCur->mpPrev;
{ }
if ( !pCur->IsFixed() ) }
{
isAtLeft = TRUE; break;
}
pCur = pCur->mpPrev; // collapse/expand works only when more not-fixed bars are present in the same row
}
}
// collapse/expand works only when more not-fixed bars are present in the same row mBoxes[COLLAPSE_BOX_IDX]->Enable( info.mpRow->mNotFixedBarsCnt > 1 );
mBoxes[COLLAPSE_BOX_IDX]->Enable( info.mpRow->mNotFixedBarsCnt > 1 ); int i;
for ( i = 0; i != BOXES_IN_HINT; ++i )
{
mBoxes[i]->mpPane = mpPane;
}
int i; if ( mpPane->IsHorizontal() )
for( i = 0; i != BOXES_IN_HINT; ++i ) {
if ( mCloseBoxOn )
{
mBoxes[CLOSE_BOX_IDX]->mPos = wxPoint( rect.x + mHintGap + boxOfs, pos );
mBoxes[i]->mpPane = mpPane; pos += BTN_BOX_HEIGHT;
}
if ( mCollapseBoxOn )
{
if ( mCloseBoxOn ) pos += BOX_T_BOX_GAP;
if ( mpPane->IsHorizontal() ) mBoxes[COLLAPSE_BOX_IDX]->mPos = wxPoint( rect.x + mHintGap + boxOfs, pos );
{
if ( mCloseBoxOn )
{
mBoxes[CLOSE_BOX_IDX]->mPos = wxPoint( rect.x + mHintGap + boxOfs, pos );
pos += BTN_BOX_HEIGHT; pos += BTN_BOX_HEIGHT;
}
if ( mCollapseBoxOn ) pos += BOX_TO_GROOVE_GAP;
{ }
if ( mCloseBoxOn ) pos += BOX_T_BOX_GAP; }
else
{
if ( mCloseBoxOn )
{
pos -= BTN_BOX_WIDTH;
mBoxes[COLLAPSE_BOX_IDX]->mPos = wxPoint( rect.x + mHintGap + boxOfs, pos ); mBoxes[CLOSE_BOX_IDX]->mPos = wxPoint( pos , rect.y + mHintGap + boxOfs );
}
pos += BTN_BOX_HEIGHT; if ( mCollapseBoxOn )
{
if ( mCloseBoxOn ) pos -= BOX_T_BOX_GAP;
pos += BOX_TO_GROOVE_GAP; pos -= BTN_BOX_WIDTH;
}
}
else
{
if ( mCloseBoxOn )
{
pos -= BTN_BOX_WIDTH;
mBoxes[CLOSE_BOX_IDX]->mPos = wxPoint( pos , rect.y + mHintGap + boxOfs ); mBoxes[COLLAPSE_BOX_IDX]->mPos = wxPoint( pos, rect.y + mHintGap + boxOfs );
}
if ( mCollapseBoxOn ) pos -= BOX_TO_GROOVE_GAP;
{ }
if ( mCloseBoxOn ) pos -= BOX_T_BOX_GAP; }
}
pos -= BTN_BOX_WIDTH;
mBoxes[COLLAPSE_BOX_IDX]->mPos = wxPoint( pos, rect.y + mHintGap + boxOfs );
pos -= BOX_TO_GROOVE_GAP;
}
}
}
} }
static inline bool is_in_box( const wxPoint& rectPos, const wxPoint& mousePos ) static inline bool is_in_box( const wxPoint& rectPos, const wxPoint& mousePos )
{ {
return ( mousePos.x >= rectPos.x && return ( mousePos.x >= rectPos.x &&
mousePos.y >= rectPos.y && mousePos.y >= rectPos.y &&
mousePos.x < rectPos.x + BTN_BOX_WIDTH && mousePos.x < rectPos.x + BTN_BOX_WIDTH &&
mousePos.y < rectPos.y + BTN_BOX_HEIGHT ); mousePos.y < rectPos.y + BTN_BOX_HEIGHT );
} }
int cbBarHintsPlugin::HitTestHints( cbBarInfo& info, const wxPoint& pos ) int cbBarHintsPlugin::HitTestHints( cbBarInfo& info, const wxPoint& pos )
{ {
wxPoint inPane = pos; wxPoint inPane = pos;
mpPane->PaneToFrame( &inPane.x, &inPane.y ); mpPane->PaneToFrame( &inPane.x, &inPane.y );
wxRect& rect = info.mBoundsInParent; wxRect& rect = info.mBoundsInParent;
if ( info.IsFixed() ) return FALSE; if ( info.IsFixed() ) return FALSE;
int boxOfs, grooveOfs, coord; int boxOfs, grooveOfs, coord;
GetHintsLayout( rect, info, boxOfs, grooveOfs, coord ); GetHintsLayout( rect, info, boxOfs, grooveOfs, coord );
if ( mpPane->IsHorizontal() ) if ( mpPane->IsHorizontal() )
{ {
if ( mCloseBoxOn ) if ( mCloseBoxOn )
{ {
if ( is_in_box( wxPoint( rect.x + mHintGap + boxOfs, coord ), inPane ) ) if ( is_in_box( wxPoint( rect.x + mHintGap + boxOfs, coord ), inPane ) )
return CLOSE_BOX_HITTED; return CLOSE_BOX_HITTED;
coord += BTN_BOX_HEIGHT; coord += BTN_BOX_HEIGHT;
} }
if ( mCollapseBoxOn ) if ( mCollapseBoxOn )
{ {
if ( mCloseBoxOn ) coord += BOX_T_BOX_GAP; if ( mCloseBoxOn ) coord += BOX_T_BOX_GAP;
if ( is_in_box( wxPoint( rect.x + mHintGap + boxOfs, coord ), inPane ) ) if ( is_in_box( wxPoint( rect.x + mHintGap + boxOfs, coord ), inPane ) )
return COLLAPSE_BOX_HITTED; return COLLAPSE_BOX_HITTED;
coord += BTN_BOX_HEIGHT; coord += BTN_BOX_HEIGHT;
} }
} }
else else
{ {
if ( mCloseBoxOn ) if ( mCloseBoxOn )
{ {
coord -= BTN_BOX_WIDTH; coord -= BTN_BOX_WIDTH;
if ( is_in_box( wxPoint( coord , rect.y + mHintGap + boxOfs ), inPane ) ) if ( is_in_box( wxPoint( coord , rect.y + mHintGap + boxOfs ), inPane ) )
return CLOSE_BOX_HITTED; return CLOSE_BOX_HITTED;
} }
if ( mCollapseBoxOn ) if ( mCollapseBoxOn )
{ {
if ( mCloseBoxOn ) coord -= BOX_T_BOX_GAP; if ( mCloseBoxOn ) coord -= BOX_T_BOX_GAP;
coord -= BTN_BOX_WIDTH; coord -= BTN_BOX_WIDTH;
if ( is_in_box( wxPoint( coord, rect.y + mHintGap + boxOfs ), inPane ) ) if ( is_in_box( wxPoint( coord, rect.y + mHintGap + boxOfs ), inPane ) )
return COLLAPSE_BOX_HITTED; return COLLAPSE_BOX_HITTED;
} }
} }
return FALSE; return FALSE;
} }
// handlers for plugin-events // handlers for plugin-events
void cbBarHintsPlugin::OnSizeBarWindow( cbSizeBarWndEvent& event ) void cbBarHintsPlugin::OnSizeBarWindow( cbSizeBarWndEvent& event )
{ {
wxRect& rect = event.mBoundsInParent; wxRect& rect = event.mBoundsInParent;
mpPane = event.mpPane; mpPane = event.mpPane;
ExcludeHints( rect, *event.mpBar ); ExcludeHints( rect, *event.mpBar );
event.Skip(); // pass event to the next plugin in the chain event.Skip(); // pass event to the next plugin in the chain
} }
void cbBarHintsPlugin::OnDrawBarDecorations( cbDrawBarDecorEvent& event ) void cbBarHintsPlugin::OnDrawBarDecorations( cbDrawBarDecorEvent& event )
{ {
wxRect& rect = event.mBoundsInParent; wxRect& rect = event.mBoundsInParent;
mpPane = event.mpPane; mpPane = event.mpPane;
int boxOfs, grooveOfs, pos; int boxOfs, grooveOfs, pos;
GetHintsLayout( rect, *event.mpBar, boxOfs, grooveOfs, pos ); GetHintsLayout( rect, *event.mpBar, boxOfs, grooveOfs, pos );
DoDrawHint( *event.mpDc, rect, pos, boxOfs, grooveOfs, event.mpBar->IsFixed() ); DoDrawHint( *event.mpDc, rect, pos, boxOfs, grooveOfs, event.mpBar->IsFixed() );
// let other plugins add on their decorations // let other plugins add on their decorations
event.Skip(); event.Skip();
} }
void cbBarHintsPlugin::OnLeftDown( cbLeftDownEvent& event ) void cbBarHintsPlugin::OnLeftDown( cbLeftDownEvent& event )
{ {
mpPane = event.mpPane; mpPane = event.mpPane;
wxPoint inFrame = event.mPos;
wxPoint inFrame = event.mPos; mpPane->PaneToFrame( &inFrame.x, &inFrame.y );
mpPane->PaneToFrame( &inFrame.x, &inFrame.y );
wxBarIterator iter( mpPane->GetRowList() ); wxBarIterator iter( mpPane->GetRowList() );
mpClickedBar = NULL; mpClickedBar = NULL;
while ( iter.Next() ) while ( iter.Next() )
{ {
cbBarInfo& bar = iter.BarInfo(); cbBarInfo& bar = iter.BarInfo();
int boxOfs, grooveOfs, pos; int boxOfs, grooveOfs, pos;
GetHintsLayout( bar.mBoundsInParent, bar, boxOfs, grooveOfs, pos ); GetHintsLayout( bar.mBoundsInParent, bar, boxOfs, grooveOfs, pos );
if ( !bar.IsFixed() ) if ( !bar.IsFixed() )
{ {
int i; int i;
for( i = 0; i != BOXES_IN_HINT; ++i ) for ( i = 0; i != BOXES_IN_HINT; ++i )
{ {
mBoxes[i]->OnLeftDown( inFrame ); mBoxes[i]->OnLeftDown( inFrame );
if ( mBoxes[i]->mPressed ) if ( mBoxes[i]->mPressed )
{ {
mBtnPressed = TRUE; mBtnPressed = TRUE;
mpClickedBar = &bar; mpClickedBar = &bar;
return; // event handled return; // event handled
} }
} }
} }
} }
event.Skip(); event.Skip();
} }
void cbBarHintsPlugin::OnLeftUp( cbLeftUpEvent& event ) void cbBarHintsPlugin::OnLeftUp( cbLeftUpEvent& event )
{ {
if ( mBtnPressed ) if ( mBtnPressed )
{ {
wxPoint inFrame = event.mPos; wxPoint inFrame = event.mPos;
mpPane->PaneToFrame( &inFrame.x, &inFrame.y ); mpPane->PaneToFrame( &inFrame.x, &inFrame.y );
int boxOfs, grooveOfs, pos; int boxOfs, grooveOfs, pos;
GetHintsLayout( mpClickedBar->mBoundsInParent, *mpClickedBar, boxOfs, grooveOfs, pos ); GetHintsLayout( mpClickedBar->mBoundsInParent, *mpClickedBar, boxOfs, grooveOfs, pos );
int result = HitTestHints( *mpClickedBar, event.mPos ); int result = HitTestHints( *mpClickedBar, event.mPos );
int i; int i;
for( i = 0; i != BOXES_IN_HINT; ++i ) for ( i = 0; i != BOXES_IN_HINT; ++i )
{ {
mBoxes[i]->OnLeftUp( inFrame ); mBoxes[i]->OnLeftUp( inFrame );
if ( mBoxes[i]->WasClicked() ) if ( mBoxes[i]->WasClicked() )
{ {
if ( i == 0 ) if ( i == 0 )
{
mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, TRUE );
}
else
{
if ( mpClickedBar->IsExpanded() )
mpPane->ContractBar( mpClickedBar );
else
mpPane->ExpandBar( mpClickedBar );
}
}
}
mpLayout->SetBarState( mpClickedBar, wxCBAR_HIDDEN, TRUE ); mBtnPressed = FALSE;
else return;
{ }
if ( mpClickedBar->IsExpanded() ) else
event.Skip();
mpPane->ContractBar( mpClickedBar );
else
mpPane->ExpandBar( mpClickedBar );
}
}
}
mBtnPressed = FALSE;
return;
}
else
event.Skip();
} }
void cbBarHintsPlugin::OnMotion( cbMotionEvent& event ) void cbBarHintsPlugin::OnMotion( cbMotionEvent& event )
{ {
if ( mBtnPressed ) if ( mBtnPressed )
{ {
wxPoint inFrame = event.mPos; wxPoint inFrame = event.mPos;
mpPane->PaneToFrame( &inFrame.x, &inFrame.y ); mpPane->PaneToFrame( &inFrame.x, &inFrame.y );
mpPane = event.mpPane; mpPane = event.mpPane;
int i; int i;
for( i = 0; i != BOXES_IN_HINT; ++i ) for ( i = 0; i != BOXES_IN_HINT; ++i )
{
mBoxes[i]->OnMotion( inFrame ); mBoxes[i]->OnMotion( inFrame );
} }
else }
event.Skip(); else
event.Skip();
} }
void cbBarHintsPlugin::OnInitPlugin() void cbBarHintsPlugin::OnInitPlugin()
{ {
cbPluginBase::OnInitPlugin(); cbPluginBase::OnInitPlugin();
cbDockPane** panes = mpLayout->GetPanesArray(); cbDockPane** panes = mpLayout->GetPanesArray();
int i; int i;
for( i = 0; i != MAX_PANES; ++i ) for ( i = 0; i != MAX_PANES; ++i )
{ {
if ( panes[i]->MatchesMask( mPaneMask ) ) if ( panes[i]->MatchesMask( mPaneMask ) )
{ {
panes[i]->mProps.mMinCBarDim.x = 25; panes[i]->mProps.mMinCBarDim.x = 25;
panes[i]->mProps.mMinCBarDim.y = 16; panes[i]->mProps.mMinCBarDim.y = 16;
} }
} }
CreateBoxes(); CreateBoxes();
} }

View File

@@ -141,7 +141,8 @@ void cbGCUpdatesMgr::UpdateNow()
wxList mBarsToResize; wxList mBarsToResize;
for( int n = 0; n != MAX_PANES; ++n ) int n;
for ( n = 0; n != MAX_PANES; ++n )
{ {
cbDockPane& pane = *(panes[n]); cbDockPane& pane = *(panes[n]);
@@ -164,7 +165,7 @@ void cbGCUpdatesMgr::UpdateNow()
cbBarInfo* pBar = pRow->GetFirstBar(); cbBarInfo* pBar = pRow->GetFirstBar();
bool rowChanged = FALSE; bool rowChanged = FALSE;
bool rowBkPainted = FALSE; // bool rowBkPainted = FALSE;
// FIXME:: the below should not be fixed // FIXME:: the below should not be fixed
cbBarInfo* barsToRepaint[128]; cbBarInfo* barsToRepaint[128];
@@ -207,7 +208,7 @@ void cbGCUpdatesMgr::UpdateNow()
cbBarInfo* pCurBar = pRow->GetFirstBar(); cbBarInfo* pCurBar = pRow->GetFirstBar();
while( pCurBar ) while ( pCurBar )
{ {
if ( WasChanged( pCurBar->mUMgrData, if ( WasChanged( pCurBar->mUMgrData,
pCurBar->mBoundsInParent ) ) pCurBar->mBoundsInParent ) )
@@ -226,7 +227,7 @@ void cbGCUpdatesMgr::UpdateNow()
else else
if ( nBars != 0 ) if ( nBars != 0 )
{ {
for( int i = 0; i != nBars; ++i ) for ( int i = 0; i != nBars; ++i )
// postphone the resizement and refreshing the changed // postphone the resizement and refreshing the changed
// bar windows // bar windows

View File

@@ -381,14 +381,7 @@ void cbPaneDrawPlugin::OnLDblClick( cbLeftDClickEvent& event )
&pBarToFloat ) == CB_BAR_CONTENT_HITTED &pBarToFloat ) == CB_BAR_CONTENT_HITTED
) )
{ {
// TBD: ???? return;
return;
mpLayout->SetBarState( pBarToFloat, wxCBAR_FLOATING, TRUE );
mpLayout->RepositionFloatedBar( pBarToFloat );
return; // event is "eaten" by this plugin
} }
event.Skip(); event.Skip();
@@ -439,7 +432,7 @@ void cbPaneDrawPlugin::OnLButtonDown( cbLeftDownEvent& event )
{ {
// otehrwise if bar handle dragged // otehrwise if bar handle dragged
cbRowInfo& rowInfo = *mpDraggedBar->mpRow; // cbRowInfo& rowInfo = *mpDraggedBar->mpRow;
wxRect& bounds = mpDraggedBar->mBounds; wxRect& bounds = mpDraggedBar->mBounds;
mHandleIsVertical = ( event.mpPane->IsHorizontal() ) ? TRUE : FALSE; mHandleIsVertical = ( event.mpPane->IsHorizontal() ) ? TRUE : FALSE;
@@ -735,27 +728,27 @@ void cbPaneDrawPlugin::OnDrawRowBackground ( cbDrawRowBkGroundEvent& event )
wxRect rowBounds = pRow->mBoundsInParent; wxRect rowBounds = pRow->mBoundsInParent;
bool isHorizontal = event.mpPane->IsHorizontal(); bool isHorizontal = event.mpPane->IsHorizontal();
int prevPos; // int prevPos;
if ( isHorizontal ) if ( isHorizontal )
{ {
prevPos = rowBounds.x; // prevPos = rowBounds.x;
// include one line obove and below the row // include one line above and below the row
--rowBounds.y; --rowBounds.y;
rowBounds.height +=2; rowBounds.height += 2;
--rowBounds.x; --rowBounds.x;
rowBounds.width += 2; rowBounds.width += 2;
} }
else else
{ {
prevPos = rowBounds.y; // prevPos = rowBounds.y;
// include one line obove and below the row // include one line above and below the row
--rowBounds.x; --rowBounds.x;
rowBounds.width += 2; rowBounds.width += 2;
--rowBounds.y; --rowBounds.y;
rowBounds.height +=2; rowBounds.height += 2;
} }
//#define TEST_BK_ERASING //#define TEST_BK_ERASING
@@ -1170,7 +1163,7 @@ void cbPaneDrawPlugin::OnDrawPaneDecorations( cbDrawPaneDecorEvent& event )
void cbPaneDrawPlugin::OnDrawBarDecorations( cbDrawBarDecorEvent& event ) void cbPaneDrawPlugin::OnDrawBarDecorations( cbDrawBarDecorEvent& event )
{ {
cbBarInfo* pBar = event.mpBar; // cbBarInfo* pBar = event.mpBar;
wxDC& dc = *event.mpDc; wxDC& dc = *event.mpDc;
// draw brick borders // draw brick borders

View File

@@ -229,7 +229,7 @@ void cbRowDragPlugin::OnMouseMove( cbMotionEvent& event )
// DBG:: // DBG::
wxPoint p = event.mPos; wxPoint p = event.mPos;
wxPoint d = mDragOrigin; wxPoint d = mDragOrigin;
int dif = event.mPos.x - mDragOrigin.x; // int dif = event.mPos.x - mDragOrigin.x;
// row is dragged up or down; // row is dragged up or down;
ShowDraggedRow( pos.y - mDragOrigin.y ); ShowDraggedRow( pos.y - mDragOrigin.y );
@@ -239,7 +239,7 @@ void cbRowDragPlugin::OnMouseMove( cbMotionEvent& event )
// DBG:: // DBG::
wxPoint p = event.mPos; wxPoint p = event.mPos;
wxPoint d = mDragOrigin; wxPoint d = mDragOrigin;
int dif = event.mPos.x - mDragOrigin.x; // int dif = event.mPos.x - mDragOrigin.x;
// row is dragged left or right // row is dragged left or right
ShowDraggedRow( pos.x - mDragOrigin.x ); ShowDraggedRow( pos.x - mDragOrigin.x );

File diff suppressed because it is too large Load Diff

View File

@@ -289,3 +289,4 @@ void cbSimpleUpdatesMgr::UpdateNow()
} }
} }