Fix refnum handling in reannotation

This commit is contained in:
Jon Evans 2023-11-01 08:26:40 -04:00
parent 248a8caa45
commit 81818cfb1e
2 changed files with 11 additions and 3 deletions

View File

@ -555,6 +555,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
GetRefsInUse( first, idList, minRefId ); GetRefsInUse( first, idList, minRefId );
LastReferenceNumber = createFirstFreeRefId( idList, minRefId ); LastReferenceNumber = createFirstFreeRefId( idList, minRefId );
ref_unit.m_numRef = LastReferenceNumber; ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_numRefStr << LastReferenceNumber;
} }
ref_unit.m_flag = 1; ref_unit.m_flag = 1;
@ -573,6 +574,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
{ {
LastReferenceNumber = FindFirstUnusedReference( ref_unit, minRefId, units ); LastReferenceNumber = FindFirstUnusedReference( ref_unit, minRefId, units );
ref_unit.m_numRef = LastReferenceNumber; ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_numRefStr << LastReferenceNumber;
ref_unit.m_isNew = false; ref_unit.m_isNew = false;
ref_unit.m_flag = 1; ref_unit.m_flag = 1;
} }
@ -610,6 +612,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( inUseRefs.find( ref_candidate ) == inUseRefs.end() ) if( inUseRefs.find( ref_candidate ) == inUseRefs.end() )
{ {
m_flatList[jj].m_numRef = ref_unit.m_numRef; m_flatList[jj].m_numRef = ref_unit.m_numRef;
m_flatList[jj].m_numRefStr = ref_unit.m_numRefStr;
m_flatList[jj].m_isNew = false; m_flatList[jj].m_isNew = false;
m_flatList[jj].m_flag = 1; m_flatList[jj].m_flag = 1;

View File

@ -169,10 +169,15 @@ public:
///< Return reference name with unit altogether ///< Return reference name with unit altogether
wxString GetFullRef() const wxString GetFullRef() const
{ {
wxString refNum = m_numRefStr;
if( refNum.IsEmpty() )
refNum << m_numRef;
if( GetSymbol()->GetUnitCount() > 1 ) if( GetSymbol()->GetUnitCount() > 1 )
return GetRef() + GetRefNumber() + LIB_SYMBOL::SubReference( GetUnit() ); return GetRef() + refNum + LIB_SYMBOL::SubReference( GetUnit() );
else else
return GetRef() + GetRefNumber(); return GetRef() + refNum;
} }
wxString GetRefNumber() const wxString GetRefNumber() const
@ -187,7 +192,7 @@ public:
if( GetLibPart() && GetLibPart()->IsPower() ) if( GetLibPart() && GetLibPart()->IsPower() )
ref = wxT( "0" ); ref = wxT( "0" );
return m_numRefStr.IsEmpty() ? ( ref << m_numRef ) : ( ref << m_numRefStr ); return ref << m_numRef;
} }
int CompareValue( const SCH_REFERENCE& item ) const int CompareValue( const SCH_REFERENCE& item ) const