From 351fc0c34324963f6e39ab576c48cd22eeafc108 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 22 Mar 2018 10:55:32 +0100 Subject: [PATCH] eeschema: preserve unit number after pasting a component Fixes: lp:1757373 * https://bugs.launchpad.net/kicad/+bug/1757373 --- eeschema/block.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 3a0ec5f8b8..ac84676903 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -528,8 +528,13 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) // Clear annotation and init new time stamp for the new components and sheets: if( item->Type() == SCH_COMPONENT_T ) { - ( (SCH_COMPONENT*) item )->SetTimeStamp( GetNewTimeStamp() ); - ( (SCH_COMPONENT*) item )->ClearAnnotation( NULL ); + SCH_COMPONENT* cmp = static_cast( item ); + cmp->SetTimeStamp( GetNewTimeStamp() ); + + // clear the annotation, but preserve the selected unit + int unit = cmp->GetUnit(); + cmp->ClearAnnotation( NULL ); + cmp->SetUnit( unit ); } else if( item->Type() == SCH_SHEET_T ) {