eeschema: do not propagate text field change to other units for not annotated symbols

Fixes #4602
https://gitlab.com/kicad/code/kicad/issues/4602
This commit is contained in:
jean-pierre charras 2020-06-03 08:52:48 +02:00
parent b681af4556
commit e099a82d15
1 changed files with 14 additions and 11 deletions

View File

@ -312,21 +312,24 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
&& ( fieldType == VALUE || fieldType == FOOTPRINT || fieldType == DATASHEET ) )
{
const wxString thisRef = component->GetRef( &( editFrame->GetCurrentSheet() ) );
int thisUnit = component->GetUnit();
SCH_REFERENCE_LIST components;
editFrame->GetCurrentSheet().GetComponents( components );
for( unsigned i = 0; i < components.GetCount(); i++ )
if( thisRef.Last() != '?' ) // Obvioulsy, the component must be annotated
{
SCH_REFERENCE componentRef = components[i];
int thisUnit = component->GetUnit();
SCH_REFERENCE_LIST components;
editFrame->GetCurrentSheet().GetComponents( components );
if( componentRef.GetRef() == thisRef && componentRef.GetUnit() != thisUnit )
for( unsigned i = 0; i < components.GetCount(); i++ )
{
SCH_COMPONENT* otherUnit = componentRef.GetComp();
editFrame->SaveCopyInUndoList( otherUnit, UR_CHANGED, true /* append */);
otherUnit->GetField( fieldType )->SetText( m_text );
editFrame->RefreshItem( otherUnit );
SCH_REFERENCE componentRef = components[i];
if( componentRef.GetRef() == thisRef && componentRef.GetUnit() != thisUnit )
{
SCH_COMPONENT* otherUnit = componentRef.GetComp();
editFrame->SaveCopyInUndoList( otherUnit, UR_CHANGED, true /* append */);
otherUnit->GetField( fieldType )->SetText( m_text );
editFrame->RefreshItem( otherUnit );
}
}
}
}