1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-30 07:08:39 +02:00

Fixed docking of large toolbars.

Previously there were three problems:
1) Docking marker calculation was relative to the mouse rather than relative to the top left of the dragged toolbar.  On a big toolbar dragged from the bottom of the dragger that could be a long way off.
2) Docking markers appeared too low down.  Their position was relative to the middle of the dragged toolbar.  However as the toolbar may be resized on placement that does not make sense.
3) Large (Height()>120) toolbars could be thought to be too tall to dock in some places.  The positioning code used their current size rather than their minimum size.
This commit is contained in:
james.k.crook@gmail.com 2014-10-24 18:18:51 +00:00
parent 7508f10f64
commit 8567775efb
2 changed files with 5 additions and 5 deletions

View File

@ -331,7 +331,7 @@ int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
{
// Add the new bars' dimensions to the mix
tinfo[ct].rect = t->GetRect();
tinfo[ct].min = t->GetSize();
tinfo[ct].min = t->GetMinSize();
tindx = ct;
ndx--;
}

View File

@ -949,7 +949,7 @@ void ToolManager::OnMouse( wxMouseEvent & event )
// Retrieve the event position
wxPoint pos =
( (wxWindow *)event.GetEventObject() )->ClientToScreen( event.GetPosition() );
( (wxWindow *)event.GetEventObject() )->ClientToScreen( event.GetPosition() ) - mDragOffset;
// Button was released...finish the drag
if( !event.LeftIsDown() )
@ -990,7 +990,7 @@ void ToolManager::OnMouse( wxMouseEvent & event )
else if( event.Dragging() && pos != mLastPos )
{
// Make toolbar follow the mouse
mDragWindow->Move( pos - mDragOffset );
mDragWindow->Move( pos );
// Remember to prevent excessive movement
mLastPos = pos;
@ -1044,8 +1044,8 @@ void ToolManager::OnMouse( wxMouseEvent & event )
else
{
p.x = dr.GetLeft() + r.GetLeft();
p.y = dr.GetTop() + r.GetTop() +
( ( r.GetHeight() - mLeft->GetBox().GetHeight() ) / 2 );
p.y = dr.GetTop() + r.GetTop() + mLeft->GetBox().GetHeight() / 2;
//JKC ( ( r.GetHeight() - mLeft->GetBox().GetHeight() ) / 2 );
mCurrent = mLeft;
}