Update all instances in CvPcb when one is changed.

This commit is contained in:
Jeff Young 2020-09-06 17:14:47 +01:00
parent 8648a074da
commit 06ccef3dd4
1 changed files with 22 additions and 11 deletions

View File

@ -479,22 +479,33 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
// Test for validity of the requested footprint // Test for validity of the requested footprint
if( !fpid.empty() && !fpid.IsValid() ) if( !fpid.empty() && !fpid.IsValid() )
{ {
wxString msg = wxString msg = wxString::Format( _( "\"%s\" is not a valid footprint." ),
wxString::Format( _( "\"%s\" is not a valid footprint." ), fpid.Format().wx_str() ); fpid.Format().wx_str() );
DisplayErrorMessage( this, msg ); DisplayErrorMessage( this, msg );
return; return;
} }
// Set the new footprint const KIID& id = component->GetPath().back();
component->SetFPID( fpid );
// create the new component description and set it // Set new footprint to all instances of the selected component
wxString description = wxString::Format( CMP_FORMAT, for( unsigned int idx : GetComponentIndices() )
aAssociation.GetComponentIndex() + 1, {
component->GetReference(), COMPONENT* candidate = m_netlist.GetComponent( idx );
component->GetValue(),
component->GetFPID().Format().wx_str() ); if( candidate->GetPath().back() == id )
m_compListBox->SetString( aAssociation.GetComponentIndex(), description ); {
// Set the new footprint
candidate->SetFPID( fpid );
// create the new component description and set it
wxString description = wxString::Format( CMP_FORMAT,
idx + 1,
candidate->GetReference(),
candidate->GetValue(),
candidate->GetFPID().Format().wx_str() );
m_compListBox->SetString( idx, description );
}
}
// Mark the data as being modified // Mark the data as being modified
m_modified = true; m_modified = true;