From 60d93d024cc69b058981d0087c1888bbadc6f032 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Fri, 18 Mar 2016 07:15:50 -0400 Subject: [PATCH] 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. --- pcbnew/tools/edit_tool.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 7e47fbdb91..02bbc78a2a 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -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();