1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-05 14:49:25 +02:00

Much easier to dock with an empty dock now.

Overlapping a dock is now enough to trigger docking.  Previously the top left corner had to be in the dock.
This commit is contained in:
james.k.crook@gmail.com 2014-11-02 17:39:50 +00:00
parent a0ff55faa9
commit 799230b882
3 changed files with 12 additions and 14 deletions

View File

@ -115,6 +115,11 @@ void ToolDock::Undock( ToolBar *bar )
}
}
int ToolDock::GetBarCount()
{
return mDockedBars.GetCount();
}
//
// Handle ToolDock events
//

View File

@ -54,17 +54,12 @@ class ToolDock:public wxPanel
~ToolDock();
void LayoutToolBars();
void ShowHide( int type );
void Expose( int type, bool show );
int GetOrder( ToolBar *bar );
int GetBarCount();
void Dock( ToolBar *bar, int ndx = -1 );
void Undock( ToolBar *bar );
int PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect );
protected:

View File

@ -1033,16 +1033,15 @@ void ToolManager::OnMouse( wxMouseEvent & event )
// lands back where we started.
pos += wxPoint( 5, 20 );
// Is mouse pointer within either dock?
// To find which dock, rather than test against pos, test against the whole dragger rect.
// This means it is enough to overlap the dock to dock with it.
wxRect barRect = mDragWindow->GetRect();
ToolDock *dock = NULL;
if( tr.Contains( pos ) )
{
if( tr.Intersects( barRect ) )
dock = mTopDock;
}
else if( br.Contains( pos ) )
{
else if( br.Intersects( barRect ) )
dock = mBotDock;
}
// Looks like we have a winner...
if( dock )
@ -1050,7 +1049,6 @@ void ToolManager::OnMouse( wxMouseEvent & event )
wxPoint p;
wxRect r;
// Calculate where the bar would be placed
mDragBefore = dock->PositionBar( mDragBar, pos, r );