Fix mirror X/Y hotkeys in the Symbol Editor
Fixes: lp:1762136 * https://bugs.launchpad.net/kicad/+bug/1762136
This commit is contained in:
parent
900bf0c7a6
commit
9bd6d5e97c
|
@ -830,10 +830,10 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_MIRROR_Y: // Mirror Y
|
case HK_MIRROR_Y: // Mirror Y
|
||||||
if( !itemInEdit )
|
if( !itemInEdit && !blocInProgress )
|
||||||
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
||||||
|
|
||||||
if( GetDrawItem() )
|
if( blocInProgress || GetDrawItem() )
|
||||||
{
|
{
|
||||||
cmd.SetId( ID_LIBEDIT_MIRROR_Y );
|
cmd.SetId( ID_LIBEDIT_MIRROR_Y );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
|
@ -841,10 +841,10 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_MIRROR_X: // Mirror X
|
case HK_MIRROR_X: // Mirror X
|
||||||
if( !itemInEdit )
|
if( !itemInEdit && !blocInProgress )
|
||||||
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
||||||
|
|
||||||
if( GetDrawItem() )
|
if( blocInProgress || GetDrawItem() )
|
||||||
{
|
{
|
||||||
cmd.SetId( ID_LIBEDIT_MIRROR_X );
|
cmd.SetId( ID_LIBEDIT_MIRROR_X );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
|
|
|
@ -1266,21 +1266,36 @@ void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
||||||
SCH_SCREEN* screen = GetScreen();
|
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.
|
// 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 )
|
if( aEvent.GetId() == ID_LIBEDIT_MIRROR_X )
|
||||||
{
|
{
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
screen->m_BlockLocate.SetMessageBlock( this );
|
block.SetMessageBlock( this );
|
||||||
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
|
block.SetCommand( BLOCK_MIRROR_X );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
}
|
}
|
||||||
else if( aEvent.GetId() == ID_LIBEDIT_MIRROR_Y )
|
else if( aEvent.GetId() == ID_LIBEDIT_MIRROR_Y )
|
||||||
{
|
{
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
screen->m_BlockLocate.SetMessageBlock( this );
|
block.SetMessageBlock( this );
|
||||||
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_Y );
|
block.SetCommand( BLOCK_MIRROR_Y );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue