Eeschema, Libedit: Fix potential issues when using some hot keys.

This commit is contained in:
jean-pierre charras 2013-01-02 09:34:46 +01:00
parent 9c62d2dfb7
commit 2fc643de36
1 changed files with 21 additions and 12 deletions

View File

@ -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,9 +598,12 @@ 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 ) )
if( ! itemInEdit )
{
if( m_lastDrawItem && !m_lastDrawItem->InEditMode() &&
( m_lastDrawItem->Type() == LIB_PIN_T ) )
RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem );
}
break;
case HK_EDIT:
@ -648,8 +651,11 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_LIBEDIT_CREATE_PIN:
if( ! itemInEdit )
{
SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
OnLeftClick( aDC, aPosition );
}
break;
case HK_DELETE:
@ -677,6 +683,8 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_DRAG:
if( !itemInEdit )
{
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem && !m_drawItem->InEditMode() )
@ -684,6 +692,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
Process_Special_Functions( cmd );
}
}
break;
}
}