From a5dcc192dccd68da1c2826c61073d8281b258afa Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 6 Feb 2017 18:17:34 +1100 Subject: [PATCH] Fix for bug where rotating / editing a selected item would remove it from screen - Added test to see if there was a currently-editing item Fixes: lp:1661866 https://bugs.launchpad.net/kicad/+bug/1661866 --- eeschema/hotkeys.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index c41537451d..c25f68f6e4 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -660,7 +660,7 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, if( hotKey == NULL ) return false; - bool itemInEdit = GetScreen()->GetCurItem() && GetScreen()->GetCurItem()->GetFlags(); + bool itemInEdit = m_drawItem && m_drawItem->InEditMode(); bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK; @@ -715,7 +715,7 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, break; case HK_EDIT: - if( ! itemInEdit ) + if( !itemInEdit ) m_drawItem = LocateItemUsingCursor( aPosition ); if( m_drawItem ) @@ -755,7 +755,8 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, } else { - m_drawItem = LocateItemUsingCursor( aPosition ); + if ( !itemInEdit ) + m_drawItem = LocateItemUsingCursor( aPosition ); if( m_drawItem ) { @@ -815,13 +816,17 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, break; case HK_MIRROR_Y: // Mirror Y - m_drawItem = LocateItemUsingCursor( aPosition ); + if( !itemInEdit ) + m_drawItem = LocateItemUsingCursor( aPosition ); + cmd.SetId( ID_LIBEDIT_MIRROR_Y ); GetEventHandler()->ProcessEvent( cmd ); break; case HK_MIRROR_X: // Mirror X - m_drawItem = LocateItemUsingCursor( aPosition ); + if( !itemInEdit ) + m_drawItem = LocateItemUsingCursor( aPosition ); + cmd.SetId( ID_LIBEDIT_MIRROR_X ); GetEventHandler()->ProcessEvent( cmd ); break;