Fix toolbar palette location

This better aligns the first button in the palette with the
group button on the toolbar.
This commit is contained in:
Ian McInerney 2020-09-27 01:58:41 +01:00
parent fc565edb33
commit df3018832b
1 changed files with 8 additions and 4 deletions

View File

@ -575,25 +575,29 @@ void ACTION_TOOLBAR::onTimerDone( wxTimerEvent& aEvent )
case wxAUI_DOCK_TOP: case wxAUI_DOCK_TOP:
// Top toolbars need to shift the palette window down by the toolbar padding // Top toolbars need to shift the palette window down by the toolbar padding
pos = ClientToScreen( toolRect.GetBottomLeft() ); pos = ClientToScreen( toolRect.GetBottomLeft() );
pos += wxPoint( 0, GetToolBorderPadding() ); pos += wxPoint( -( PALETTE_BORDER + BUTTON_BORDER ), // Shift left to align the button
GetToolBorderPadding() ); // Shift down to move away from the toolbar
break; break;
case wxAUI_DOCK_BOTTOM: case wxAUI_DOCK_BOTTOM:
// Bottom toolbars need to shift the palette window up by its height (1 button + border + toolbar padding) // Bottom toolbars need to shift the palette window up by its height (1 button + border + toolbar padding)
pos = ClientToScreen( toolRect.GetTopLeft() ); pos = ClientToScreen( toolRect.GetTopLeft() );
pos -= wxPoint( GetToolBorderPadding(), 2*PALETTE_BORDER + toolRect.GetHeight() + GetToolBorderPadding() ); pos -= wxPoint( ( PALETTE_BORDER + BUTTON_BORDER ), // Shift left to align the button
2*PALETTE_BORDER + toolRect.GetHeight() + GetToolBorderPadding() );
break; break;
case wxAUI_DOCK_LEFT: case wxAUI_DOCK_LEFT:
// Left toolbars need to shift the palette window up by the toolbar padding // Left toolbars need to shift the palette window up by the toolbar padding
pos = ClientToScreen( toolRect.GetTopRight() ); pos = ClientToScreen( toolRect.GetTopRight() );
pos += wxPoint( GetToolBorderPadding(), 0 ); pos += wxPoint( GetToolBorderPadding(), // Shift right to move away from the toolbar
-( PALETTE_BORDER + BUTTON_BORDER ) ); // Shift up to align the button
break; break;
case wxAUI_DOCK_RIGHT: case wxAUI_DOCK_RIGHT:
// Right toolbars need to shift the palette window left by its width (1 button + border + toolbar padding) // Right toolbars need to shift the palette window left by its width (1 button + border + toolbar padding)
pos = ClientToScreen( toolRect.GetTopLeft() ); pos = ClientToScreen( toolRect.GetTopLeft() );
pos -= wxPoint( 2*PALETTE_BORDER + toolRect.GetHeight() + GetToolBorderPadding(), 0 ); pos -= wxPoint( 2*PALETTE_BORDER + toolRect.GetHeight() + GetToolBorderPadding(),
( PALETTE_BORDER + BUTTON_BORDER ) ); // Shift up to align the button
break; break;
} }