Commit 2fc643de authored by jean-pierre charras's avatar jean-pierre charras

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

parent 9c62d2df
...@@ -543,7 +543,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -543,7 +543,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
cmd.SetEventObject( this ); 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 /* Convert lower to upper case (the usual toupper function has problem
* with non ascii codes like function keys */ * with non ascii codes like function keys */
...@@ -598,10 +598,13 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -598,10 +598,13 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
if( m_lastDrawItem && (m_lastDrawItem->GetFlags() == 0) if( ! itemInEdit )
&& ( m_lastDrawItem->Type() == LIB_PIN_T ) ) {
RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem ); if( m_lastDrawItem && !m_lastDrawItem->InEditMode() &&
break; ( m_lastDrawItem->Type() == LIB_PIN_T ) )
RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem );
}
break;
case HK_EDIT: case HK_EDIT:
if( ! itemInEdit ) if( ! itemInEdit )
...@@ -648,8 +651,11 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -648,8 +651,11 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_LIBEDIT_CREATE_PIN: case HK_LIBEDIT_CREATE_PIN:
SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) ); if( ! itemInEdit )
OnLeftClick( aDC, aPosition ); {
SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
OnLeftClick( aDC, aPosition );
}
break; break;
case HK_DELETE: case HK_DELETE:
...@@ -677,12 +683,15 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -677,12 +683,15 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_DRAG: case HK_DRAG:
m_drawItem = LocateItemUsingCursor( aPosition ); if( !itemInEdit )
if( m_drawItem && !m_drawItem->InEditMode() )
{ {
cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM ); m_drawItem = LocateItemUsingCursor( aPosition );
Process_Special_Functions( cmd );
if( m_drawItem && !m_drawItem->InEditMode() )
{
cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
Process_Special_Functions( cmd );
}
} }
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment