Keep value, footprint and datasheet in sync in multi-unit parts
Fixes: lp:1731743 * https://bugs.launchpad.net/kicad/+bug/1731743
This commit is contained in:
parent
6436b70176
commit
c6d0075076
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include <general.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <sch_reference_list.h>
|
||||
#include <class_library.h>
|
||||
#include <sch_component.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
@ -509,6 +510,32 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
|
|||
// reference.
|
||||
m_cmp->SetRef( &GetParent()->GetCurrentSheet(), m_FieldsBuf[REFERENCE].GetText() );
|
||||
|
||||
// The value, footprint and datasheet fields should be kept in sync in multi-unit
|
||||
// parts.
|
||||
if( m_cmp->GetUnitCount() > 1 )
|
||||
{
|
||||
const LIB_ID thisLibId = m_cmp->GetLibId();
|
||||
const wxString thisRef = m_cmp->GetRef( &( GetParent()->GetCurrentSheet() ) );
|
||||
int thisUnit = m_cmp->GetUnit();
|
||||
|
||||
SCH_REFERENCE_LIST components;
|
||||
GetParent()->GetCurrentSheet().GetComponents( components );
|
||||
for( int i = 0; i < components.GetCount(); i++ )
|
||||
{
|
||||
SCH_REFERENCE component = components[i];
|
||||
if( component.GetLibPart()->GetLibId() == thisLibId
|
||||
&& component.GetRef() == thisRef
|
||||
&& component.GetUnit() != thisUnit )
|
||||
{
|
||||
SCH_COMPONENT* otherUnit = component.GetComp();
|
||||
GetParent()->SaveCopyInUndoList( otherUnit, UR_CHANGED, true /* append */);
|
||||
otherUnit->GetField( VALUE )->SetText( m_FieldsBuf[VALUE].GetText() );
|
||||
otherUnit->GetField( FOOTPRINT )->SetText( m_FieldsBuf[FOOTPRINT].GetText() );
|
||||
otherUnit->GetField( DATASHEET )->SetText( m_FieldsBuf[DATASHEET].GetText() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetParent()->OnModify();
|
||||
GetParent()->GetScreen()->TestDanglingEnds();
|
||||
|
||||
|
|
Loading…
Reference in New Issue