← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix for cancellation of duplicate in GAL mode

 

I have noticed a quirk when cancelling a duplicate in modedit under GAL.
The duplicated item would be left in the same place as the original
rather than being deleted.

This was caused by not handling the creation of the undo point correctly
in modedit (the analogous case was already handled in pcbnew).

Please find attached a patch to fix this issue.

Thanks,

John
diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index e676822..52ca089 100644
--- a/pcbnew/tools/edit_tool.cpp
+++ b/pcbnew/tools/edit_tool.cpp
@@ -736,6 +736,9 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
     // the original
     incUndoInhibit();
 
+    if( m_editModules )
+        editFrame->SaveCopyInUndoList( editFrame->GetBoard()->m_Modules, UR_MODEDIT );
+
     std::vector<BOARD_ITEM*> old_items;
 
     for( int i = 0; i < selection.Size(); ++i )
@@ -778,7 +781,8 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
     }
 
     // record the new items as added
-    editFrame->SaveCopyInUndoList( selection.items, UR_NEW );
+    if( !m_editModules )
+        editFrame->SaveCopyInUndoList( selection.items, UR_NEW );
 
     editFrame->DisplayToolMsg( wxString::Format( _( "Duplicated %d item(s)" ),
             (int) old_items.size() ) );

Follow ups