Update alt pin assignments in other units.

Fixes https://gitlab.com/kicad/code/kicad/issues/10849

(cherry picked from commit e499793147)
This commit is contained in:
Jeff Young 2022-02-16 18:26:46 +00:00
parent cfae33e7a8
commit e56355fc17
1 changed files with 25 additions and 13 deletions

View File

@ -700,8 +700,19 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
m_symbol->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() ); m_symbol->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
m_symbol->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() ); m_symbol->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
// The value, footprint and datasheet fields and exclude from bill of materials setting // Update any assignments
// should be kept in sync in multi-unit parts. 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() ) ) if( m_symbol->GetUnitCount() > 1 && m_symbol->IsAnnotated( &GetParent()->GetCurrentSheet() ) )
{ {
wxString ref = m_symbol->GetRef( &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->GetField( DATASHEET_FIELD )->SetText( m_fields->at( DATASHEET_FIELD ).GetText() );
otherUnit->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() ); otherUnit->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
otherUnit->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() ); otherUnit->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
GetParent()->UpdateItem( otherUnit, false, true );
}
}
}
// Update any assignments
if( m_dataModel ) if( m_dataModel )
{ {
for( const SCH_PIN& model_pin : *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 = otherUnit->GetPin( model_pin.GetNumber() );
SCH_PIN* src_pin = m_symbol->GetPin( model_pin.GetLibPin() );
if( src_pin )
src_pin->SetAlt( model_pin.GetAlt() ); src_pin->SetAlt( model_pin.GetAlt() );
} }
} }
GetParent()->UpdateItem( otherUnit, false, true );
}
}
}
currentScreen->Append( m_symbol ); currentScreen->Append( m_symbol );
GetParent()->TestDanglingEnds(); GetParent()->TestDanglingEnds();
GetParent()->UpdateItem( m_symbol, false, true ); GetParent()->UpdateItem( m_symbol, false, true );