From e56355fc17158672402c3cc55f67c8ee22912b1e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 16 Feb 2022 18:26:46 +0000 Subject: [PATCH] Update alt pin assignments in other units. Fixes https://gitlab.com/kicad/code/kicad/issues/10849 (cherry picked from commit e499793147287f1ba9f5d64d1708473c6c290454) --- eeschema/dialogs/dialog_symbol_properties.cpp | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index f18d2de2d1..26cc5c1519 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -700,8 +700,19 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow() m_symbol->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() ); m_symbol->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() ); - // The value, footprint and datasheet fields and exclude from bill of materials setting - // should be kept in sync in multi-unit parts. + // Update any assignments + if( m_dataModel ) + { + for( const SCH_PIN& model_pin : *m_dataModel ) + { + // map from the edited copy back to the "real" pin in the symbol. + SCH_PIN* src_pin = m_symbol->GetPin( model_pin.GetLibPin() ); + src_pin->SetAlt( model_pin.GetAlt() ); + } + } + + // The value, footprint and datasheet fields, alternate pin assignements, and include/exclude + // flags should be kept in sync in multi-unit parts. if( m_symbol->GetUnitCount() > 1 && m_symbol->IsAnnotated( &GetParent()->GetCurrentSheet() ) ) { wxString ref = m_symbol->GetRef( &GetParent()->GetCurrentSheet() ); @@ -725,22 +736,23 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow() otherUnit->GetField( DATASHEET_FIELD )->SetText( m_fields->at( DATASHEET_FIELD ).GetText() ); otherUnit->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() ); otherUnit->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() ); + + if( m_dataModel ) + { + for( const SCH_PIN& model_pin : *m_dataModel ) + { + SCH_PIN* src_pin = otherUnit->GetPin( model_pin.GetNumber() ); + + if( src_pin ) + src_pin->SetAlt( model_pin.GetAlt() ); + } + } + GetParent()->UpdateItem( otherUnit, false, true ); } } } - // Update any assignments - if( m_dataModel ) - { - for( const SCH_PIN& model_pin : *m_dataModel ) - { - // map from the edited copy back to the "real" pin in the symbol. - SCH_PIN* src_pin = m_symbol->GetPin( model_pin.GetLibPin() ); - src_pin->SetAlt( model_pin.GetAlt() ); - } - } - currentScreen->Append( m_symbol ); GetParent()->TestDanglingEnds(); GetParent()->UpdateItem( m_symbol, false, true );