Eeschema, renumbering components: Fix multiparts IC supply renumber problem.

With "reset but keep order of multi-units parts" option on, these units were incorrectly grouped.

Fixes: lp:1780876
https://bugs.launchpad.net/kicad/+bug/1780876
This commit is contained in:
jean-pierre charras 2018-07-10 17:51:14 +02:00
parent 5e1605af19
commit 840a8b1d36
1 changed files with 10 additions and 4 deletions

View File

@ -273,11 +273,15 @@ int SCH_REFERENCE_LIST::CreateFirstFreeRefId( std::vector<int>& aIdList, int aFi
// A helper function to build a full reference string of a SCH_REFERENCE item
wxString buildFullReference( const SCH_REFERENCE& aItem )
wxString buildFullReference( const SCH_REFERENCE& aItem, int aUnitNumber = -1 )
{
wxString fullref;
fullref = aItem.GetRef() + aItem.GetRefNumber();
fullref << ".." << aItem.GetUnit();
if( aUnitNumber < 0 )
fullref << ".." << aItem.GetUnit();
else
fullref << ".." << aUnitNumber;
return fullref;
}
@ -344,6 +348,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : aLockedUnitMap )
{
unsigned n_refs = pair.second.GetCount();
for( unsigned thisRefI = 0; thisRefI < n_refs; ++thisRefI )
{
SCH_REFERENCE &thisRef = pair.second[thisRefI];
@ -433,6 +438,8 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
{
// This is the component we're currently annotating. Hold the unit!
componentFlatList[ii].m_Unit = thisRef.m_Unit;
// lock this new full reference
inUseRefs.insert( buildFullReference( componentFlatList[ii] ) );
}
if( thisRef.CompareValue( componentFlatList[ii] ) != 0 )
@ -447,7 +454,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( ! thisRef.IsSameInstance( componentFlatList[jj] ) )
continue;
wxString ref_candidate = buildFullReference( componentFlatList[ii] );
wxString ref_candidate = buildFullReference( componentFlatList[ii], thisRef.m_Unit );
// propagate the new reference and unit selection to the "old" component,
// if this new full reference is not already used (can happens when initial
@ -465,7 +472,6 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
}
}
}
else
{
/* search for others units of this component.