Sync all fields between units when symbol is edited.
Fixes https://gitlab.com/kicad/code/kicad/issues/10610
This commit is contained in:
parent
e499793147
commit
d60ed70d54
|
@ -729,8 +729,8 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
}
|
||||
|
||||
// The value, footprint and datasheet fields, alternate pin assignements, and include/exclude
|
||||
// flags should be kept in sync in multi-unit parts.
|
||||
// Keep fields other than the reference, include/exclude flags, and alternate pin assignements
|
||||
// in sync in multi-unit parts.
|
||||
if( m_symbol->GetUnitCount() > 1 && m_symbol->IsAnnotated( &GetParent()->GetCurrentSheet() ) )
|
||||
{
|
||||
wxString ref = m_symbol->GetRef( &GetParent()->GetCurrentSheet() );
|
||||
|
@ -751,7 +751,30 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
appendUndo );
|
||||
otherUnit->SetValue( m_fields->at( VALUE_FIELD ).GetText() );
|
||||
otherUnit->SetFootprint( m_fields->at( FOOTPRINT_FIELD ).GetText() );
|
||||
otherUnit->GetField( DATASHEET_FIELD )->SetText( m_fields->at( DATASHEET_FIELD ).GetText() );
|
||||
|
||||
for( size_t ii = DATASHEET_FIELD; ii < m_fields->size(); ++ii )
|
||||
{
|
||||
SCH_FIELD* otherField = otherUnit->FindField( m_fields->at( ii ).GetName() );
|
||||
|
||||
if( otherField )
|
||||
{
|
||||
otherField->SetText( m_fields->at( ii ).GetText() );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_FIELD* newField = otherUnit->AddField( m_fields->at( ii ) );
|
||||
const_cast<KIID&>( newField->m_Uuid ) = KIID();
|
||||
}
|
||||
}
|
||||
|
||||
for( size_t ii = otherUnit->GetFields().size() - 1; ii > DATASHEET_FIELD; ii-- )
|
||||
{
|
||||
SCH_FIELD& otherField = otherUnit->GetFields().at( ii );
|
||||
|
||||
if( !m_symbol->FindField( otherField.GetName() ) )
|
||||
otherUnit->GetFields().erase( otherUnit->GetFields().begin() + ii );
|
||||
}
|
||||
|
||||
otherUnit->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
|
||||
otherUnit->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
|
||||
|
||||
|
|
|
@ -695,13 +695,13 @@ private:
|
|||
*/
|
||||
wxString m_schLibSymbolName;
|
||||
|
||||
TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
|
||||
SCH_FIELDS m_fields; ///< Variable length list of fields.
|
||||
TRANSFORM m_transform; ///< The rotation/mirror transformation.
|
||||
std::vector<SCH_FIELD> m_fields; ///< Variable length list of fields.
|
||||
|
||||
std::unique_ptr< LIB_SYMBOL > m_part; // a flattened copy of the LIB_SYMBOL from
|
||||
// the PROJECT's libraries.
|
||||
std::vector<std::unique_ptr<SCH_PIN>> m_pins; // a SCH_PIN for every LIB_PIN (all units)
|
||||
std::unordered_map<LIB_PIN*, unsigned> m_pinMap; // library pin pointer to SCH_PIN's index
|
||||
std::unique_ptr< LIB_SYMBOL > m_part; ///< a flattened copy of the LIB_SYMBOL
|
||||
///< from the PROJECT's libraries.
|
||||
std::vector<std::unique_ptr<SCH_PIN>> m_pins; ///< a SCH_PIN for every LIB_PIN (all units)
|
||||
std::unordered_map<LIB_PIN*, unsigned> m_pinMap; ///< library pin pointer : SCH_PIN's index
|
||||
|
||||
bool m_isInNetlist; ///< True if the symbol should appear in the netlist
|
||||
bool m_inBom; ///< True to include in bill of materials export.
|
||||
|
|
Loading…
Reference in New Issue