Fix mirror X/Y hotkeys in the Symbol Editor

Fixes: lp:1762136
* https://bugs.launchpad.net/kicad/+bug/1762136
This commit is contained in:
Maciej Suminski 2018-04-09 13:40:15 +02:00
parent 900bf0c7a6
commit 9bd6d5e97c
2 changed files with 24 additions and 9 deletions

View File

@ -830,10 +830,10 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_MIRROR_Y: // Mirror Y
if( !itemInEdit )
if( !itemInEdit && !blocInProgress )
SetDrawItem( LocateItemUsingCursor( aPosition ) );
if( GetDrawItem() )
if( blocInProgress || GetDrawItem() )
{
cmd.SetId( ID_LIBEDIT_MIRROR_Y );
GetEventHandler()->ProcessEvent( cmd );
@ -841,10 +841,10 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_MIRROR_X: // Mirror X
if( !itemInEdit )
if( !itemInEdit && !blocInProgress )
SetDrawItem( LocateItemUsingCursor( aPosition ) );
if( GetDrawItem() )
if( blocInProgress || GetDrawItem() )
{
cmd.SetId( ID_LIBEDIT_MIRROR_X );
GetEventHandler()->ProcessEvent( cmd );

View File

@ -1266,21 +1266,36 @@ void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
SCH_SCREEN* screen = GetScreen();
BLOCK_SELECTOR& block = screen->m_BlockLocate;
// Change the current item to a block selection, if there were no items in the block selector
if( screen->GetCurItem() && block.GetState() == STATE_NO_BLOCK )
{
ITEM_PICKER picker( screen->GetCurItem() );
block.PushItem( picker );
block.SetState( STATE_BLOCK_INIT );
const wxPoint& cursorPos = GetCrossHairPosition();
block.SetLastCursorPosition( cursorPos );
block.SetOrigin( cursorPos );
block.SetEnd( cursorPos );
}
// Allows block rotate operation on hot key.
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
if( block.GetState() != STATE_NO_BLOCK )
{
if( aEvent.GetId() == ID_LIBEDIT_MIRROR_X )
{
m_canvas->MoveCursorToCrossHair();
screen->m_BlockLocate.SetMessageBlock( this );
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
block.SetMessageBlock( this );
block.SetCommand( BLOCK_MIRROR_X );
HandleBlockEnd( &dc );
}
else if( aEvent.GetId() == ID_LIBEDIT_MIRROR_Y )
{
m_canvas->MoveCursorToCrossHair();
screen->m_BlockLocate.SetMessageBlock( this );
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_Y );
block.SetMessageBlock( this );
block.SetCommand( BLOCK_MIRROR_Y );
HandleBlockEnd( &dc );
}
}