pcbnew: don't pick up selection after unsuccessful Duplicate

Following rev 6627 (git 2777182), if a non-duplicatable item was the object of
a Duplicate action, the original item would be picked up, potentially
misleading the user into thinking something was actually duplicated.
This commit is contained in:
Chris Pavlina 2016-03-18 07:15:50 -04:00
parent fd1d7ecb6e
commit 60d93d024c
1 changed files with 9 additions and 7 deletions

View File

@ -777,16 +777,18 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
}
// record the new items as added
if( !m_editModules )
if( !m_editModules && !selection.Empty() )
{
editFrame->SaveCopyInUndoList( selection.items, UR_NEW );
editFrame->DisplayToolMsg( wxString::Format( _( "Duplicated %d item(s)" ),
(int) old_items.size() ) );
editFrame->DisplayToolMsg( wxString::Format( _( "Duplicated %d item(s)" ),
(int) old_items.size() ) );
// pick up the selected item(s) and start moving
// this works well for "dropping" copies around
TOOL_EVENT evt = COMMON_ACTIONS::editActivate.MakeEvent();
Main( evt );
// If items were duplicated, pick them up
// this works well for "dropping" copies around
TOOL_EVENT evt = COMMON_ACTIONS::editActivate.MakeEvent();
Main( evt );
}
// and re-enable undos
decUndoInhibit();