From 6422be116bea0ef86ee89eaa5bbf5fd575b25816 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 2 Jan 2013 09:34:46 +0100 Subject: [PATCH] Eeschema, Libedit: Fix potential issues when using some hot keys. --- eeschema/hotkeys.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 16dfac3585..ac34731e0c 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -543,7 +543,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, cmd.SetEventObject( this ); - bool itemInEdit = m_drawItem && m_drawItem->GetFlags(); + bool itemInEdit = m_drawItem && m_drawItem->InEditMode(); /* Convert lower to upper case (the usual toupper function has problem * with non ascii codes like function keys */ @@ -598,10 +598,13 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, break; case HK_REPEAT_LAST: - if( m_lastDrawItem && (m_lastDrawItem->GetFlags() == 0) - && ( m_lastDrawItem->Type() == LIB_PIN_T ) ) - RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem ); - break; + if( ! itemInEdit ) + { + if( m_lastDrawItem && !m_lastDrawItem->InEditMode() && + ( m_lastDrawItem->Type() == LIB_PIN_T ) ) + RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem ); + } + break; case HK_EDIT: if( ! itemInEdit ) @@ -648,8 +651,11 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, break; case HK_LIBEDIT_CREATE_PIN: - SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) ); - OnLeftClick( aDC, aPosition ); + if( ! itemInEdit ) + { + SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) ); + OnLeftClick( aDC, aPosition ); + } break; case HK_DELETE: @@ -677,12 +683,15 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, break; case HK_DRAG: - m_drawItem = LocateItemUsingCursor( aPosition ); - - if( m_drawItem && !m_drawItem->InEditMode() ) + if( !itemInEdit ) { - cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM ); - Process_Special_Functions( cmd ); + m_drawItem = LocateItemUsingCursor( aPosition ); + + if( m_drawItem && !m_drawItem->InEditMode() ) + { + cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM ); + Process_Special_Functions( cmd ); + } } break; }