Naming conventions (including some component -> symbol).

This commit is contained in:
Jeff Young 2020-11-15 16:08:31 +00:00
parent 4e8072b8c2
commit 6e6e0aa644
30 changed files with 440 additions and 486 deletions

View File

@ -37,11 +37,11 @@ void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
{ {
SCH_REFERENCE_LIST references; SCH_REFERENCE_LIST references;
Schematic().GetSheets().GetComponents( references ); Schematic().GetSheets().GetSymbols( references );
for( size_t i = 0; i < references.GetCount(); i++ ) for( size_t i = 0; i < references.GetCount(); i++ )
{ {
SCH_COMPONENT* comp = references[ i ].GetComp(); SCH_COMPONENT* comp = references[ i ].GetSymbol();
SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath(); SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
KIID_PATH curr_full_uuid = curr_sheetpath->Path(); KIID_PATH curr_full_uuid = curr_sheetpath->Path();
curr_full_uuid.push_back( comp->m_Uuid ); curr_full_uuid.push_back( comp->m_Uuid );
@ -133,7 +133,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
if( aLockUnits ) if( aLockUnits )
{ {
if( aAnnotateSchematic ) if( aAnnotateSchematic )
sheets.GetMultiUnitComponents( lockedComponents ); sheets.GetMultiUnitSymbols( lockedComponents );
else else
GetCurrentSheet().GetMultiUnitComponents( lockedComponents ); GetCurrentSheet().GetMultiUnitComponents( lockedComponents );
} }
@ -150,9 +150,9 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
// Build component list // Build component list
if( aAnnotateSchematic ) if( aAnnotateSchematic )
sheets.GetComponents( references ); sheets.GetSymbols( references );
else else
GetCurrentSheet().GetComponents( references ); GetCurrentSheet().GetSymbols( references );
// Break full components reference in name (prefix) and number: // Break full components reference in name (prefix) and number:
// example: IC1 become IC, and 1 // example: IC1 become IC, and 1
@ -190,21 +190,21 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
for( size_t i = 0; i < references.GetCount(); i++ ) for( size_t i = 0; i < references.GetCount(); i++ )
{ {
SCH_REFERENCE& ref = references[i]; SCH_REFERENCE& ref = references[i];
SCH_COMPONENT* comp = ref.GetComp(); SCH_COMPONENT* symbol = ref.GetSymbol();
SCH_SHEET_PATH* sheet = &ref.GetSheetPath(); SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
SaveCopyInUndoList( sheet->LastScreen(), comp, UNDO_REDO::CHANGED, appendUndo ); SaveCopyInUndoList( sheet->LastScreen(), symbol, UNDO_REDO::CHANGED, appendUndo );
appendUndo = true; appendUndo = true;
ref.Annotate(); ref.Annotate();
KIID_PATH full_uuid = sheet->Path(); KIID_PATH full_uuid = sheet->Path();
full_uuid.push_back( comp->m_Uuid ); full_uuid.push_back( symbol->m_Uuid );
wxString prevRef = previousAnnotation[ full_uuid.AsString() ]; wxString prevRef = previousAnnotation[ full_uuid.AsString() ];
wxString newRef = comp->GetRef( sheet ); wxString newRef = symbol->GetRef( sheet );
if( comp->GetUnitCount() > 1 ) if( symbol->GetUnitCount() > 1 )
newRef << LIB_PART::SubReference( comp->GetUnitSelection( sheet ) ); newRef << LIB_PART::SubReference( symbol->GetUnitSelection( sheet ) );
wxString msg; wxString msg;
@ -213,28 +213,28 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
if( newRef == prevRef ) if( newRef == prevRef )
continue; continue;
if( comp->GetUnitCount() > 1 ) if( symbol->GetUnitCount() > 1 )
msg.Printf( _( "Updated %s (unit %s) from %s to %s" ), msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
comp->GetValue( sheet ), symbol->GetValue( sheet ),
LIB_PART::SubReference( comp->GetUnit(), false ), LIB_PART::SubReference( symbol->GetUnit(), false ),
prevRef, prevRef,
newRef ); newRef );
else else
msg.Printf( _( "Updated %s from %s to %s" ), msg.Printf( _( "Updated %s from %s to %s" ),
comp->GetValue( sheet ), symbol->GetValue( sheet ),
prevRef, prevRef,
newRef ); newRef );
} }
else else
{ {
if( comp->GetUnitCount() > 1 ) if( symbol->GetUnitCount() > 1 )
msg.Printf( _( "Annotated %s (unit %s) as %s" ), msg.Printf( _( "Annotated %s (unit %s) as %s" ),
comp->GetValue( sheet ), symbol->GetValue( sheet ),
LIB_PART::SubReference( comp->GetUnit(), false ), LIB_PART::SubReference( symbol->GetUnit(), false ),
newRef ); newRef );
else else
msg.Printf( _( "Annotated %s as %s" ), msg.Printf( _( "Annotated %s as %s" ),
comp->GetValue( sheet ), symbol->GetValue( sheet ),
newRef ); newRef );
} }
@ -260,18 +260,18 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
int SCH_EDIT_FRAME::CheckAnnotate( REPORTER& aReporter, bool aOneSheetOnly ) int SCH_EDIT_FRAME::CheckAnnotate( REPORTER& aReporter, bool aOneSheetOnly )
{ {
SCH_REFERENCE_LIST componentsList; SCH_REFERENCE_LIST referenceList;
constexpr bool includePowerSymbols = false; constexpr bool includePowerSymbols = false;
// Build the list of components // Build the list of symbols
if( !aOneSheetOnly ) if( !aOneSheetOnly )
Schematic().GetSheets().GetComponents( componentsList, includePowerSymbols ); Schematic().GetSheets().GetSymbols( referenceList, includePowerSymbols );
else else
GetCurrentSheet().GetComponents( componentsList ); GetCurrentSheet().GetSymbols( referenceList );
// Empty schematic does not need annotation // Empty schematic does not need annotation
if( componentsList.GetCount() == 0 ) if( referenceList.GetCount() == 0 )
return 0; return 0;
return componentsList.CheckAnnotation( aReporter ); return referenceList.CheckAnnotation( aReporter );
} }

View File

@ -54,16 +54,16 @@ bool SCH_REFERENCE_LIST::sortByXPosition( const SCH_REFERENCE& item1, const SCH_
int ii = item1.CompareRef( item2 ); int ii = item1.CompareRef( item2 );
if( ii == 0 ) if( ii == 0 )
ii = item1.m_SheetNum - item2.m_SheetNum; ii = item1.m_sheetNum - item2.m_sheetNum;
if( ii == 0 ) if( ii == 0 )
ii = item1.m_CmpPos.x - item2.m_CmpPos.x; ii = item1.m_symbolPos.x - item2.m_symbolPos.x;
if( ii == 0 ) if( ii == 0 )
ii = item1.m_CmpPos.y - item2.m_CmpPos.y; ii = item1.m_symbolPos.y - item2.m_symbolPos.y;
if( ii == 0 ) if( ii == 0 )
return item1.m_Uuid < item2.m_Uuid; // ensure a deterministic sort return item1.m_symbolUuid < item2.m_symbolUuid; // ensure a deterministic sort
else else
return ii < 0; return ii < 0;
} }
@ -74,16 +74,16 @@ bool SCH_REFERENCE_LIST::sortByYPosition( const SCH_REFERENCE& item1, const SCH_
int ii = item1.CompareRef( item2 ); int ii = item1.CompareRef( item2 );
if( ii == 0 ) if( ii == 0 )
ii = item1.m_SheetNum - item2.m_SheetNum; ii = item1.m_sheetNum - item2.m_sheetNum;
if( ii == 0 ) if( ii == 0 )
ii = item1.m_CmpPos.y - item2.m_CmpPos.y; ii = item1.m_symbolPos.y - item2.m_symbolPos.y;
if( ii == 0 ) if( ii == 0 )
ii = item1.m_CmpPos.x - item2.m_CmpPos.x; ii = item1.m_symbolPos.x - item2.m_symbolPos.x;
if( ii == 0 ) if( ii == 0 )
return item1.m_Uuid < item2.m_Uuid; // ensure a deterministic sort return item1.m_symbolUuid < item2.m_symbolUuid; // ensure a deterministic sort
else else
return ii < 0; return ii < 0;
} }
@ -98,19 +98,19 @@ bool SCH_REFERENCE_LIST::sortByRefAndValue( const SCH_REFERENCE& item1,
ii = item1.CompareValue( item2 ); ii = item1.CompareValue( item2 );
if( ii == 0 ) if( ii == 0 )
ii = item1.m_Unit - item2.m_Unit; ii = item1.m_unit - item2.m_unit;
if( ii == 0 ) if( ii == 0 )
ii = item1.m_SheetNum - item2.m_SheetNum; ii = item1.m_sheetNum - item2.m_sheetNum;
if( ii == 0 ) if( ii == 0 )
ii = item1.m_CmpPos.x - item2.m_CmpPos.x; ii = item1.m_symbolPos.x - item2.m_symbolPos.x;
if( ii == 0 ) if( ii == 0 )
ii = item1.m_CmpPos.y - item2.m_CmpPos.y; ii = item1.m_symbolPos.y - item2.m_symbolPos.y;
if( ii == 0 ) if( ii == 0 )
return item1.m_Uuid < item2.m_Uuid; // ensure a deterministic sort return item1.m_symbolUuid < item2.m_symbolUuid; // ensure a deterministic sort
else else
return ii < 0; return ii < 0;
} }
@ -122,10 +122,10 @@ bool SCH_REFERENCE_LIST::sortByReferenceOnly( const SCH_REFERENCE& item1,
int ii = UTIL::RefDesStringCompare( item1.GetRef(), item2.GetRef() ); int ii = UTIL::RefDesStringCompare( item1.GetRef(), item2.GetRef() );
if( ii == 0 ) if( ii == 0 )
ii = item1.m_Unit - item2.m_Unit; ii = item1.m_unit - item2.m_unit;
if( ii == 0 ) if( ii == 0 )
return item1.m_Uuid < item2.m_Uuid; // ensure a deterministic sort return item1.m_symbolUuid < item2.m_symbolUuid; // ensure a deterministic sort
else else
return ii < 0; return ii < 0;
} }
@ -134,10 +134,10 @@ bool SCH_REFERENCE_LIST::sortByReferenceOnly( const SCH_REFERENCE& item1,
bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1, bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1,
const SCH_REFERENCE& item2 ) const SCH_REFERENCE& item2 )
{ {
int ii = item1.m_SheetPath.Cmp( item2.m_SheetPath ); int ii = item1.m_sheetPath.Cmp( item2.m_sheetPath );
if( ii == 0 ) if( ii == 0 )
return item1.m_Uuid < item2.m_Uuid; // ensure a deterministic sort return item1.m_symbolUuid < item2.m_symbolUuid; // ensure a deterministic sort
else else
return ii < 0; return ii < 0;
} }
@ -147,17 +147,17 @@ int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit )
{ {
int NumRef; int NumRef;
NumRef = flatList[aIndex].m_NumRef; NumRef = flatList[aIndex].m_numRef;
for( size_t ii = 0; ii < flatList.size(); ii++ ) for( size_t ii = 0; ii < flatList.size(); ii++ )
{ {
if( ( aIndex == ii ) if( ( aIndex == ii )
|| ( flatList[ii].m_IsNew ) || ( flatList[ii].m_isNew )
|| ( flatList[ii].m_NumRef != NumRef ) || ( flatList[ii].m_numRef != NumRef )
|| ( flatList[aIndex].CompareRef( flatList[ii] ) != 0 ) ) || ( flatList[aIndex].CompareRef( flatList[ii] ) != 0 ) )
continue; continue;
if( flatList[ii].m_Unit == aUnit ) if( flatList[ii].m_unit == aUnit )
return (int) ii; return (int) ii;
} }
@ -195,8 +195,8 @@ void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList,
for( SCH_REFERENCE& ref : flatList ) for( SCH_REFERENCE& ref : flatList )
{ {
if( flatList[aIndex].CompareRef( ref ) == 0 && ref.m_NumRef >= aMinRefId ) if( flatList[aIndex].CompareRef( ref ) == 0 && ref.m_numRef >= aMinRefId )
aIdList.push_back( ref.m_NumRef ); aIdList.push_back( ref.m_numRef );
} }
sort( aIdList.begin(), aIdList.end() ); sort( aIdList.begin(), aIdList.end() );
@ -222,8 +222,8 @@ int SCH_REFERENCE_LIST::GetLastReference( int aIndex, int aMinValue )
continue; continue;
// update max value for the current reference prefix // update max value for the current reference prefix
if( lastNumber < ref.m_NumRef ) if( lastNumber < ref.m_numRef )
lastNumber = ref.m_NumRef; lastNumber = ref.m_numRef;
} }
return lastNumber; return lastNumber;
@ -301,7 +301,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
// when using sheet number, ensure ref number >= sheet number* aSheetIntervalId // when using sheet number, ensure ref number >= sheet number* aSheetIntervalId
if( aUseSheetNum ) if( aUseSheetNum )
minRefId = flatList[first].m_SheetNum * aSheetIntervalId + 1; minRefId = flatList[first].m_sheetNum * aSheetIntervalId + 1;
else else
minRefId = aStartNumber + 1; minRefId = aStartNumber + 1;
@ -326,7 +326,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
{ {
auto& ref_unit = flatList[ii]; auto& ref_unit = flatList[ii];
if( ref_unit.m_Flag ) if( ref_unit.m_flag )
continue; continue;
// Check whether this component is in aLockedUnitMap. // Check whether this component is in aLockedUnitMap.
@ -349,14 +349,14 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
} }
if( ( flatList[first].CompareRef( ref_unit ) != 0 ) if( ( flatList[first].CompareRef( ref_unit ) != 0 )
|| ( aUseSheetNum && ( flatList[first].m_SheetNum != ref_unit.m_SheetNum ) ) ) || ( aUseSheetNum && ( flatList[first].m_sheetNum != ref_unit.m_sheetNum ) ) )
{ {
// New reference found: we need a new ref number for this reference // New reference found: we need a new ref number for this reference
first = ii; first = ii;
// when using sheet number, ensure ref number >= sheet number* aSheetIntervalId // when using sheet number, ensure ref number >= sheet number* aSheetIntervalId
if( aUseSheetNum ) if( aUseSheetNum )
minRefId = ref_unit.m_SheetNum * aSheetIntervalId + 1; minRefId = ref_unit.m_sheetNum * aSheetIntervalId + 1;
else else
minRefId = aStartNumber + 1; minRefId = aStartNumber + 1;
@ -366,30 +366,30 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
// Annotation of one part per package components (trivial case). // Annotation of one part per package components (trivial case).
if( ref_unit.GetLibPart()->GetUnitCount() <= 1 ) if( ref_unit.GetLibPart()->GetUnitCount() <= 1 )
{ {
if( ref_unit.m_IsNew ) if( ref_unit.m_isNew )
{ {
LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId ); LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId );
ref_unit.m_NumRef = LastReferenceNumber; ref_unit.m_numRef = LastReferenceNumber;
} }
ref_unit.m_Unit = 1; ref_unit.m_unit = 1;
ref_unit.m_Flag = 1; ref_unit.m_flag = 1;
ref_unit.m_IsNew = false; ref_unit.m_isNew = false;
continue; continue;
} }
// Annotation of multi-unit parts ( n units per part ) (complex case) // Annotation of multi-unit parts ( n units per part ) (complex case)
NumberOfUnits = ref_unit.GetLibPart()->GetUnitCount(); NumberOfUnits = ref_unit.GetLibPart()->GetUnitCount();
if( ref_unit.m_IsNew ) if( ref_unit.m_isNew )
{ {
LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId ); LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId );
ref_unit.m_NumRef = LastReferenceNumber; ref_unit.m_numRef = LastReferenceNumber;
if( !ref_unit.IsUnitsLocked() ) if( !ref_unit.IsUnitsLocked() )
ref_unit.m_Unit = 1; ref_unit.m_unit = 1;
ref_unit.m_Flag = 1; ref_unit.m_flag = 1;
} }
// If this component is in aLockedUnitMap, copy the annotation to all // If this component is in aLockedUnitMap, copy the annotation to all
@ -405,7 +405,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( thisRef.IsSameInstance( ref_unit ) ) if( thisRef.IsSameInstance( ref_unit ) )
{ {
// This is the component we're currently annotating. Hold the unit! // This is the component we're currently annotating. Hold the unit!
ref_unit.m_Unit = thisRef.m_Unit; ref_unit.m_unit = thisRef.m_unit;
// lock this new full reference // lock this new full reference
inUseRefs.insert( buildFullReference( ref_unit ) ); inUseRefs.insert( buildFullReference( ref_unit ) );
} }
@ -422,17 +422,17 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( ! thisRef.IsSameInstance( flatList[jj] ) ) if( ! thisRef.IsSameInstance( flatList[jj] ) )
continue; continue;
wxString ref_candidate = buildFullReference( ref_unit, thisRef.m_Unit ); wxString ref_candidate = buildFullReference( ref_unit, thisRef.m_unit );
// propagate the new reference and unit selection to the "old" component, // propagate the new reference and unit selection to the "old" component,
// if this new full reference is not already used (can happens when initial // if this new full reference is not already used (can happens when initial
// multiunits components have duplicate references) // multiunits components have duplicate references)
if( inUseRefs.find( ref_candidate ) == inUseRefs.end() ) if( inUseRefs.find( ref_candidate ) == inUseRefs.end() )
{ {
flatList[jj].m_NumRef = ref_unit.m_NumRef; flatList[jj].m_numRef = ref_unit.m_numRef;
flatList[jj].m_Unit = thisRef.m_Unit; flatList[jj].m_unit = thisRef.m_unit;
flatList[jj].m_IsNew = false; flatList[jj].m_isNew = false;
flatList[jj].m_Flag = 1; flatList[jj].m_flag = 1;
// lock this new full reference // lock this new full reference
inUseRefs.insert( ref_candidate ); inUseRefs.insert( ref_candidate );
break; break;
@ -448,7 +448,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
*/ */
for( Unit = 1; Unit <= NumberOfUnits; Unit++ ) for( Unit = 1; Unit <= NumberOfUnits; Unit++ )
{ {
if( ref_unit.m_Unit == Unit ) if( ref_unit.m_unit == Unit )
continue; continue;
int found = FindUnit( ii, Unit ); int found = FindUnit( ii, Unit );
@ -461,7 +461,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
{ {
auto& cmp_unit = flatList[jj]; auto& cmp_unit = flatList[jj];
if( cmp_unit.m_Flag ) // already tested if( cmp_unit.m_flag ) // already tested
continue; continue;
if( cmp_unit.CompareRef( ref_unit ) != 0 ) if( cmp_unit.CompareRef( ref_unit ) != 0 )
@ -477,17 +477,17 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
cmp_unit.GetSheetPath().Cmp( ref_unit.GetSheetPath() ) != 0 ) cmp_unit.GetSheetPath().Cmp( ref_unit.GetSheetPath() ) != 0 )
continue; continue;
if( !cmp_unit.m_IsNew ) if( !cmp_unit.m_isNew )
continue; continue;
// Component without reference number found, annotate it if possible // Component without reference number found, annotate it if possible
if( !cmp_unit.IsUnitsLocked() if( !cmp_unit.IsUnitsLocked()
|| ( cmp_unit.m_Unit == Unit ) ) || ( cmp_unit.m_unit == Unit ) )
{ {
cmp_unit.m_NumRef = ref_unit.m_NumRef; cmp_unit.m_numRef = ref_unit.m_numRef;
cmp_unit.m_Unit = Unit; cmp_unit.m_unit = Unit;
cmp_unit.m_Flag = 1; cmp_unit.m_flag = 1;
cmp_unit.m_IsNew = false; cmp_unit.m_isNew = false;
break; break;
} }
} }
@ -513,21 +513,21 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
msg.Empty(); msg.Empty();
tmp.Empty(); tmp.Empty();
if( flatList[ii].m_IsNew ) // Not yet annotated if( flatList[ii].m_isNew ) // Not yet annotated
{ {
if( flatList[ii].m_NumRef >= 0 ) if( flatList[ii].m_numRef >= 0 )
tmp << flatList[ii].m_NumRef; tmp << flatList[ii].m_numRef;
else else
tmp = wxT( "?" ); tmp = wxT( "?" );
if( ( flatList[ii].m_Unit > 0 ) if( ( flatList[ii].m_unit > 0 )
&& ( flatList[ii].m_Unit < 0x7FFFFFFF ) ) && ( flatList[ii].m_unit < 0x7FFFFFFF ) )
{ {
msg.Printf( _( "Item not annotated: %s%s (unit %d)\n" ), msg.Printf( _( "Item not annotated: %s%s (unit %d)\n" ),
flatList[ii].GetRef(), flatList[ii].GetRef(),
tmp, tmp,
flatList[ii].m_Unit ); flatList[ii].m_unit );
} }
else else
{ {
@ -545,17 +545,17 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
// parts in the component ). This can happen if a component has changed in a // parts in the component ). This can happen if a component has changed in a
// library after a previous annotation. // library after a previous annotation.
if( std::max( flatList[ii].GetLibPart()->GetUnitCount(), 1 ) if( std::max( flatList[ii].GetLibPart()->GetUnitCount(), 1 )
< flatList[ii].m_Unit ) < flatList[ii].m_unit )
{ {
if( flatList[ii].m_NumRef >= 0 ) if( flatList[ii].m_numRef >= 0 )
tmp << flatList[ii].m_NumRef; tmp << flatList[ii].m_numRef;
else else
tmp = wxT( "?" ); tmp = wxT( "?" );
msg.Printf( _( "Error: symbol %s%s unit %d and symbol has only %d units defined\n" ), msg.Printf( _( "Error: symbol %s%s unit %d and symbol has only %d units defined\n" ),
flatList[ii].GetRef(), flatList[ii].GetRef(),
tmp, tmp,
flatList[ii].m_Unit, flatList[ii].m_unit,
flatList[ii].GetLibPart()->GetUnitCount() ); flatList[ii].GetLibPart()->GetUnitCount() );
aReporter.Report( msg, RPT_SEVERITY_ERROR ); aReporter.Report( msg, RPT_SEVERITY_ERROR );
@ -576,24 +576,24 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
tmp.Empty(); tmp.Empty();
if( ( flatList[ii].CompareRef( flatList[ii + 1] ) != 0 ) if( ( flatList[ii].CompareRef( flatList[ii + 1] ) != 0 )
|| ( flatList[ii].m_NumRef != flatList[ii + 1].m_NumRef ) ) || ( flatList[ii].m_numRef != flatList[ ii + 1].m_numRef ) )
continue; continue;
// Same reference found. If same unit, error! // Same reference found. If same unit, error!
if( flatList[ii].m_Unit == flatList[ii + 1].m_Unit ) if( flatList[ii].m_unit == flatList[ ii + 1].m_unit )
{ {
if( flatList[ii].m_NumRef >= 0 ) if( flatList[ii].m_numRef >= 0 )
tmp << flatList[ii].m_NumRef; tmp << flatList[ii].m_numRef;
else else
tmp = wxT( "?" ); tmp = wxT( "?" );
if( ( flatList[ii].m_Unit > 0 ) if( ( flatList[ii].m_unit > 0 )
&& ( flatList[ii].m_Unit < 0x7FFFFFFF ) ) && ( flatList[ii].m_unit < 0x7FFFFFFF ) )
{ {
msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), msg.Printf( _( "Multiple item %s%s (unit %d)\n" ),
flatList[ii].GetRef(), flatList[ii].GetRef(),
tmp, tmp,
flatList[ii].m_Unit ); flatList[ii].m_unit );
} }
else else
{ {
@ -612,18 +612,18 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
if( flatList[ii].GetLibPart()->GetUnitCount() if( flatList[ii].GetLibPart()->GetUnitCount()
!= flatList[ ii + 1].GetLibPart()->GetUnitCount() ) != flatList[ ii + 1].GetLibPart()->GetUnitCount() )
{ {
if( flatList[ii].m_NumRef >= 0 ) if( flatList[ii].m_numRef >= 0 )
tmp << flatList[ii].m_NumRef; tmp << flatList[ii].m_numRef;
else else
tmp = wxT( "?" ); tmp = wxT( "?" );
if( ( flatList[ii].m_Unit > 0 ) if( ( flatList[ii].m_unit > 0 )
&& ( flatList[ii].m_Unit < 0x7FFFFFFF ) ) && ( flatList[ii].m_unit < 0x7FFFFFFF ) )
{ {
msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), msg.Printf( _( "Multiple item %s%s (unit %d)\n" ),
flatList[ii].GetRef(), flatList[ii].GetRef(),
tmp, tmp,
flatList[ii].m_Unit ); flatList[ii].m_unit );
} }
else else
{ {
@ -643,13 +643,13 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
{ {
msg.Printf( _( "Different values for %s%d%s (%s) and %s%d%s (%s)" ), msg.Printf( _( "Different values for %s%d%s (%s) and %s%d%s (%s)" ),
flatList[ii].GetRef(), flatList[ii].GetRef(),
flatList[ii].m_NumRef, flatList[ii].m_numRef,
LIB_PART::SubReference( flatList[ii].m_Unit ), LIB_PART::SubReference( flatList[ii].m_unit ),
flatList[ii].m_Value, flatList[ii].m_value,
flatList[next].GetRef(), flatList[next].GetRef(),
flatList[next].m_NumRef, flatList[next].m_numRef,
LIB_PART::SubReference( flatList[next].m_Unit ), LIB_PART::SubReference( flatList[next].m_unit ),
flatList[next].m_Value ); flatList[next].m_value );
aReporter.Report( msg, RPT_SEVERITY_ERROR ); aReporter.Report( msg, RPT_SEVERITY_ERROR );
error++; error++;
@ -660,48 +660,48 @@ int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter )
} }
SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibPart, SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aSymbol, LIB_PART* aLibPart,
const SCH_SHEET_PATH& aSheetPath ) const SCH_SHEET_PATH& aSheetPath )
{ {
wxASSERT( aComponent != NULL ); wxASSERT( aSymbol != NULL );
m_RootCmp = aComponent; m_rootSymbol = aSymbol;
m_Entry = aLibPart; // Warning: can be nullptr for orphan components m_libPart = aLibPart; // Warning: can be nullptr for orphan components
// (i.e. with a symbol library not found) // (i.e. with a symbol library not found)
m_Unit = aComponent->GetUnitSelection( &aSheetPath ); m_unit = aSymbol->GetUnitSelection( &aSheetPath );
m_Footprint = aComponent->GetFootprint( &aSheetPath ); m_footprint = aSymbol->GetFootprint( &aSheetPath );
m_SheetPath = aSheetPath; m_sheetPath = aSheetPath;
m_IsNew = false; m_isNew = false;
m_Flag = 0; m_flag = 0;
m_Uuid = aComponent->m_Uuid; m_symbolUuid = aSymbol->m_Uuid;
m_CmpPos = aComponent->GetPosition(); m_symbolPos = aSymbol->GetPosition();
m_SheetNum = 0; m_sheetNum = 0;
if( aComponent->GetRef( &aSheetPath ).IsEmpty() ) if( aSymbol->GetRef( &aSheetPath ).IsEmpty() )
aComponent->SetRef( &aSheetPath, wxT( "DefRef?" ) ); aSymbol->SetRef( &aSheetPath, wxT( "DefRef?" ) );
wxString ref = aComponent->GetRef( &aSheetPath ); wxString ref = aSymbol->GetRef( &aSheetPath );
SetRef( ref ); SetRef( ref );
m_NumRef = -1; m_numRef = -1;
if( aComponent->GetValue( &aSheetPath ).IsEmpty() ) if( aSymbol->GetValue( &aSheetPath ).IsEmpty() )
aComponent->SetValue( &aSheetPath, wxT( "~" ) ); aSymbol->SetValue( &aSheetPath, wxT( "~" ) );
m_Value = aComponent->GetValue( &aSheetPath ); m_value = aSymbol->GetValue( &aSheetPath );
} }
void SCH_REFERENCE::Annotate() void SCH_REFERENCE::Annotate()
{ {
if( m_NumRef < 0 ) if( m_numRef < 0 )
m_Ref += '?'; m_ref += '?';
else else
m_Ref = TO_UTF8( GetRef() << GetRefNumber() ); m_ref = TO_UTF8( GetRef() << GetRefNumber() );
m_RootCmp->SetRef( &m_SheetPath, FROM_UTF8( m_Ref.c_str() ) ); m_rootSymbol->SetRef( &m_sheetPath, FROM_UTF8( m_ref.c_str() ) );
m_RootCmp->SetUnit( m_Unit ); m_rootSymbol->SetUnit( m_unit );
m_RootCmp->SetUnitSelection( &m_SheetPath, m_Unit ); m_rootSymbol->SetUnitSelection( &m_sheetPath, m_unit );
} }
@ -709,16 +709,16 @@ void SCH_REFERENCE::Split()
{ {
std::string refText = GetRefStr(); std::string refText = GetRefStr();
m_NumRef = -1; m_numRef = -1;
int ll = refText.length() - 1; int ll = refText.length() - 1;
if( refText[ll] == '?' ) if( refText[ll] == '?' )
{ {
m_IsNew = true; m_isNew = true;
if( !IsUnitsLocked() ) if( !IsUnitsLocked() )
m_Unit = 0x7FFFFFFF; m_unit = 0x7FFFFFFF;
refText.erase( ll ); // delete last char refText.erase( ll ); // delete last char
@ -726,10 +726,10 @@ void SCH_REFERENCE::Split()
} }
else if( isdigit( refText[ll] ) == 0 ) else if( isdigit( refText[ll] ) == 0 )
{ {
m_IsNew = true; m_isNew = true;
if( !IsUnitsLocked() ) if( !IsUnitsLocked() )
m_Unit = 0x7FFFFFFF; m_unit = 0x7FFFFFFF;
} }
else else
{ {
@ -744,7 +744,7 @@ void SCH_REFERENCE::Split()
// null terminated C string into cp // null terminated C string into cp
const char* cp = refText.c_str() + ll + 1; const char* cp = refText.c_str() + ll + 1;
m_NumRef = atoi( cp ); m_numRef = atoi( cp );
} }
refText.erase( ll+1 ); // delete from ll+1 to end refText.erase( ll+1 ); // delete from ll+1 to end
@ -765,13 +765,13 @@ wxString SCH_REFERENCE_LIST::Shorthand( std::vector<SCH_REFERENCE> aList )
while( i < aList.size() ) while( i < aList.size() )
{ {
wxString ref = aList[ i ].GetRef(); wxString ref = aList[ i ].GetRef();
int numRef = aList[ i ].m_NumRef; int numRef = aList[ i ].m_numRef;
size_t range = 1; size_t range = 1;
while( i + range < aList.size() while( i + range < aList.size()
&& aList[ i + range ].GetRef() == ref && aList[ i + range ].GetRef() == ref
&& aList[ i + range ].m_NumRef == int( numRef + range ) ) && aList[ i + range ].m_numRef == int( numRef + range ) )
{ {
range++; range++;
} }

View File

@ -411,13 +411,13 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
SCH_REFERENCE_LIST references; SCH_REFERENCE_LIST references;
// build the full list of components including component having no symbol in loaded libs // build the full list of components including component having no symbol in loaded libs
// (orphan components) // (orphan components)
sheets.GetComponents( references, /* include power symbols */true, sheets.GetSymbols( references, /* include power symbols */true,
/* include orphan components */true ); /* include orphan components */true );
for( unsigned ii = 0; ii < references.GetCount(); ii++ ) for( unsigned ii = 0; ii < references.GetCount(); ii++ )
{ {
SCH_REFERENCE& item = references[ii]; SCH_REFERENCE& item = references[ii];
CMP_CANDIDATE candidate( item.GetComp() ); CMP_CANDIDATE candidate( item.GetSymbol() );
candidate.m_Screen = item.GetSheetPath().LastScreen(); candidate.m_Screen = item.GetSheetPath().LastScreen();
SCH_SHEET_PATH sheetpath = item.GetSheetPath(); SCH_SHEET_PATH sheetpath = item.GetSheetPath();
candidate.m_Reference = candidate.m_Component->GetRef( &sheetpath ); candidate.m_Reference = candidate.m_Component->GetRef( &sheetpath );

View File

@ -246,21 +246,21 @@ void DIALOG_LABEL_EDITOR::onScintillaCharAdded( wxStyledTextEvent &aEvent )
wxString ref = te->GetRange( refStart, start-1 ); wxString ref = te->GetRange( refStart, start-1 );
SCH_SHEET_LIST sheets = m_Parent->Schematic().GetSheets(); SCH_SHEET_LIST sheets = m_Parent->Schematic().GetSheets();
SCH_REFERENCE_LIST refs; SCH_REFERENCE_LIST refs;
SCH_COMPONENT* refComponent = nullptr; SCH_COMPONENT* refSymbol = nullptr;
sheets.GetComponents( refs ); sheets.GetSymbols( refs );
for( size_t jj = 0; jj < refs.GetCount(); jj++ ) for( size_t jj = 0; jj < refs.GetCount(); jj++ )
{ {
if( refs[ jj ].GetComp()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref ) if( refs[ jj ].GetSymbol()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref )
{ {
refComponent = refs[ jj ].GetComp(); refSymbol = refs[ jj ].GetSymbol();
break; break;
} }
} }
if( refComponent ) if( refSymbol )
refComponent->GetContextualTextVars( &autocompleteTokens ); refSymbol->GetContextualTextVars( &autocompleteTokens );
} }
} }
else if( textVarRef( start ) ) else if( textVarRef( start ) )

View File

@ -339,21 +339,21 @@ void DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded( wxStyledTextEvent &aEvent
wxString ref = m_StyledTextCtrl->GetRange( refStart, start - 1 ); wxString ref = m_StyledTextCtrl->GetRange( refStart, start - 1 );
SCH_SHEET_LIST sheets = editFrame->Schematic().GetSheets(); SCH_SHEET_LIST sheets = editFrame->Schematic().GetSheets();
SCH_REFERENCE_LIST refs; SCH_REFERENCE_LIST refs;
SCH_COMPONENT* refComponent = nullptr; SCH_COMPONENT* refSymbol = nullptr;
sheets.GetComponents( refs ); sheets.GetSymbols( refs );
for( size_t jj = 0; jj < refs.GetCount(); jj++ ) for( size_t jj = 0; jj < refs.GetCount(); jj++ )
{ {
if( refs[ jj ].GetComp()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref ) if( refs[ jj ].GetSymbol()->GetRef( &refs[ jj ].GetSheetPath(), true ) == ref )
{ {
refComponent = refs[ jj ].GetComp(); refSymbol = refs[ jj ].GetSymbol();
break; break;
} }
} }
if( refComponent ) if( refSymbol )
refComponent->GetContextualTextVars( &autocompleteTokens ); refSymbol->GetContextualTextVars( &autocompleteTokens );
} }
} }
else if( textVarRef( start ) ) else if( textVarRef( start ) )

View File

@ -167,7 +167,7 @@ protected:
// The data model is fundamentally m_componentRefs X m_fieldNames. // The data model is fundamentally m_componentRefs X m_fieldNames.
SCH_EDIT_FRAME* m_frame; SCH_EDIT_FRAME* m_frame;
SCH_REFERENCE_LIST m_componentRefs; SCH_REFERENCE_LIST m_symbolsList;
bool m_edited; bool m_edited;
std::vector<wxString> m_fieldNames; std::vector<wxString> m_fieldNames;
int m_sortColumn; int m_sortColumn;
@ -189,14 +189,14 @@ protected:
public: public:
FIELDS_EDITOR_GRID_DATA_MODEL( SCH_EDIT_FRAME* aFrame, SCH_REFERENCE_LIST& aComponentList ) : FIELDS_EDITOR_GRID_DATA_MODEL( SCH_EDIT_FRAME* aFrame, SCH_REFERENCE_LIST& aSymbolsList ) :
m_frame( aFrame ), m_frame( aFrame ),
m_componentRefs( aComponentList ), m_symbolsList( aSymbolsList ),
m_edited( false ), m_edited( false ),
m_sortColumn( 0 ), m_sortColumn( 0 ),
m_sortAscending( false ) m_sortAscending( false )
{ {
m_componentRefs.SplitReferences(); m_symbolsList.SplitReferences();
} }
@ -204,10 +204,10 @@ public:
{ {
m_fieldNames.push_back( aFieldName ); m_fieldNames.push_back( aFieldName );
for( unsigned i = 0; i < m_componentRefs.GetCount(); ++i ) for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
{ {
SCH_COMPONENT* comp = m_componentRefs[ i ].GetComp(); SCH_COMPONENT* symbol = m_symbolsList[ i ].GetSymbol();
m_dataStore[ comp->m_Uuid ][ aFieldName ] = comp->GetFieldText( aFieldName, m_frame ); m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName, m_frame );
} }
} }
@ -281,19 +281,19 @@ public:
} }
else // Other columns are either a single value or ROW_MULTI_ITEMS else // Other columns are either a single value or ROW_MULTI_ITEMS
{ {
const KIID& compID = ref.GetComp()->m_Uuid; const KIID& symbolID = ref.GetSymbol()->m_Uuid;
if( !m_dataStore.count( compID ) || if( !m_dataStore.count( symbolID ) ||
!m_dataStore[ compID ].count( m_fieldNames[ aCol ] ) ) !m_dataStore[ symbolID ].count( m_fieldNames[ aCol ] ) )
{ {
return INDETERMINATE_STATE; return INDETERMINATE_STATE;
} }
if( &ref == &group.m_Refs.front() ) if( &ref == &group.m_Refs.front() )
{ {
fieldValue = m_dataStore[ compID ][ m_fieldNames[ aCol ] ]; fieldValue = m_dataStore[ symbolID ][ m_fieldNames[ aCol ] ];
} }
else if ( fieldValue != m_dataStore[ compID ][ m_fieldNames[ aCol ] ] ) else if ( fieldValue != m_dataStore[ symbolID ][ m_fieldNames[ aCol ] ] )
{ {
return INDETERMINATE_STATE; return INDETERMINATE_STATE;
} }
@ -348,7 +348,7 @@ public:
wxString fieldName = m_fieldNames[ aCol ]; wxString fieldName = m_fieldNames[ aCol ];
for( const auto& ref : rowGroup.m_Refs ) for( const auto& ref : rowGroup.m_Refs )
m_dataStore[ ref.GetComp()->m_Uuid ][ fieldName ] = aValue; m_dataStore[ ref.GetSymbol()->m_Uuid ][ fieldName ] = aValue;
m_edited = true; m_edited = true;
} }
@ -411,8 +411,7 @@ public:
bool unitMatch( const SCH_REFERENCE& lhRef, const SCH_REFERENCE& rhRef ) bool unitMatch( const SCH_REFERENCE& lhRef, const SCH_REFERENCE& rhRef )
{ {
// If items are unannotated then we can't tell if they're units of the same // If items are unannotated then we can't tell if they're units of the same symbol or not
// component or not
if( lhRef.GetRefNumber() == wxT( "?" ) ) if( lhRef.GetRefNumber() == wxT( "?" ) )
return false; return false;
@ -436,8 +435,8 @@ public:
matchFound = true; matchFound = true;
} }
const KIID& lhRefID = lhRef.GetComp()->m_Uuid; const KIID& lhRefID = lhRef.GetSymbol()->m_Uuid;
const KIID& rhRefID = rhRef.GetComp()->m_Uuid; const KIID& rhRefID = rhRef.GetSymbol()->m_Uuid;
// Now check all the other columns. This must be done out of the dataStore // Now check all the other columns. This must be done out of the dataStore
// for the refresh button to work after editing. // for the refresh button to work after editing.
@ -458,7 +457,7 @@ public:
} }
void RebuildRows( wxCheckBox* groupComponentsBox, wxDataViewListCtrl* fieldsCtrl ) void RebuildRows( wxCheckBox* aGroupSymbolsBox, wxDataViewListCtrl* aFieldsCtrl )
{ {
if ( GetView() ) if ( GetView() )
{ {
@ -472,12 +471,12 @@ public:
m_rows.clear(); m_rows.clear();
for( unsigned i = 0; i < m_componentRefs.GetCount(); ++i ) for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
{ {
SCH_REFERENCE ref = m_componentRefs[ i ]; SCH_REFERENCE ref = m_symbolsList[ i ];
bool matchFound = false; bool matchFound = false;
// See if we already have a row which this component fits into // See if we already have a row which this symbol fits into
for( auto& row : m_rows ) for( auto& row : m_rows )
{ {
// all group members must have identical refs so just use the first one // all group members must have identical refs so just use the first one
@ -489,7 +488,7 @@ public:
row.m_Refs.push_back( ref ); row.m_Refs.push_back( ref );
break; break;
} }
else if (groupComponentsBox->GetValue() && groupMatch( ref, rowRef, fieldsCtrl ) ) else if ( aGroupSymbolsBox->GetValue() && groupMatch( ref, rowRef, aFieldsCtrl ) )
{ {
matchFound = true; matchFound = true;
row.m_Refs.push_back( ref ); row.m_Refs.push_back( ref );
@ -518,7 +517,7 @@ public:
{ {
bool matchFound = false; bool matchFound = false;
// See if we already have a child group which this component fits into // See if we already have a child group which this symbol fits into
for( auto& child : children ) for( auto& child : children )
{ {
// group members are by definition all matching, so just check // group members are by definition all matching, so just check
@ -608,30 +607,30 @@ public:
void ApplyData() void ApplyData()
{ {
for( unsigned i = 0; i < m_componentRefs.GetCount(); ++i ) for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
{ {
SCH_COMPONENT& comp = *m_componentRefs[i].GetComp(); SCH_COMPONENT& symbol = *m_symbolsList[ i ].GetSymbol();
SCH_SCREEN* screen = m_componentRefs[i].GetSheetPath().LastScreen(); SCH_SCREEN* screen = m_symbolsList[i].GetSheetPath().LastScreen();
m_frame->SaveCopyInUndoList( screen, &comp, UNDO_REDO::CHANGED, true ); m_frame->SaveCopyInUndoList( screen, &symbol, UNDO_REDO::CHANGED, true );
const std::map<wxString, wxString>& fieldStore = m_dataStore[comp.m_Uuid]; const std::map<wxString, wxString>& fieldStore = m_dataStore[symbol.m_Uuid];
for( const std::pair<wxString, wxString> srcData : fieldStore ) for( const std::pair<wxString, wxString> srcData : fieldStore )
{ {
const wxString& srcName = srcData.first; const wxString& srcName = srcData.first;
const wxString& srcValue = srcData.second; const wxString& srcValue = srcData.second;
SCH_FIELD* destField = comp.FindField( srcName ); SCH_FIELD* destField = symbol.FindField( srcName );
if( !destField && !srcValue.IsEmpty() ) if( !destField && !srcValue.IsEmpty() )
{ {
const auto compOrigin = comp.GetPosition(); const wxPoint symbolPos = symbol.GetPosition();
destField = comp.AddField( SCH_FIELD( compOrigin, -1, &comp, srcName ) ); destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) );
} }
if( !destField ) if( !destField )
{ {
comp.RemoveField( srcName ); symbol.RemoveField( srcName );
} }
else if( destField->GetId() == REFERENCE_FIELD ) else if( destField->GetId() == REFERENCE_FIELD )
{ {
@ -641,11 +640,11 @@ public:
{ {
// Value field cannot be empty // Value field cannot be empty
if( !srcValue.IsEmpty() ) if( !srcValue.IsEmpty() )
comp.SetValue( srcValue ); symbol.SetValue( srcValue );
} }
else if( destField->GetId() == FOOTPRINT_FIELD ) else if( destField->GetId() == FOOTPRINT_FIELD )
{ {
comp.SetFootprint( srcValue ); symbol.SetFootprint( srcValue );
} }
else else
{ {
@ -671,12 +670,12 @@ public:
} }
else else
{ {
wxString column_label = GetColLabelValue( aCol ); // component fieldName or Qty string wxString column_label = GetColLabelValue( aCol ); // symbol fieldName or Qty string
for( unsigned compRef = 0; compRef < m_componentRefs.GetCount(); ++ compRef ) for( unsigned symbolRef = 0; symbolRef < m_symbolsList.GetCount(); ++ symbolRef )
{ {
const KIID& compId = m_componentRefs[ compRef ].GetComp()->m_Uuid; const KIID& symbolID = m_symbolsList[ symbolRef ].GetSymbol()->m_Uuid;
wxString text = m_dataStore[ compId ][ column_label ]; wxString text = m_dataStore[ symbolID ][ column_label ];
width = std::max( width, KIUI::GetTextSize( text, GetView() ).x ); width = std::max( width, KIUI::GetTextSize( text, GetView() ).x );
} }
@ -699,8 +698,8 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent
{ {
wxSize defaultDlgSize = ConvertDialogToPixels( wxSize( 600, 300 ) ); wxSize defaultDlgSize = ConvertDialogToPixels( wxSize( 600, 300 ) );
// Get all components from the list of schematic sheets // Get all symbols from the list of schematic sheets
m_parent->Schematic().GetSheets().GetComponents( m_componentRefs, false ); m_parent->Schematic().GetSheets().GetSymbols( m_symbolsList, false );
m_bRefresh->SetBitmap( KiBitmap( refresh_xpm ) ); m_bRefresh->SetBitmap( KiBitmap( refresh_xpm ) );
@ -725,7 +724,7 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent
// expander buttons... but it doesn't. Fix by forcing the indent to 0. // expander buttons... but it doesn't. Fix by forcing the indent to 0.
m_fieldsCtrl->SetIndent( 0 ); m_fieldsCtrl->SetIndent( 0 );
m_dataModel = new FIELDS_EDITOR_GRID_DATA_MODEL( m_parent, m_componentRefs ); m_dataModel = new FIELDS_EDITOR_GRID_DATA_MODEL( m_parent, m_symbolsList );
LoadFieldNames(); // loads rows into m_fieldsCtrl and columns into m_dataModel LoadFieldNames(); // loads rows into m_fieldsCtrl and columns into m_dataModel
@ -754,7 +753,7 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent
m_splitterMainWindow->SetMinimumPaneSize( fieldsMinWidth ); m_splitterMainWindow->SetMinimumPaneSize( fieldsMinWidth );
m_splitterMainWindow->SetSashPosition( fieldsMinWidth + 40 ); m_splitterMainWindow->SetSashPosition( fieldsMinWidth + 40 );
m_dataModel->RebuildRows( m_groupComponentsBox, m_fieldsCtrl ); m_dataModel->RebuildRows( m_groupSymbolsBox, m_fieldsCtrl );
m_dataModel->Sort( 0, true ); m_dataModel->Sort( 0, true );
// wxGrid's column moving is buggy with native headers and this is one dialog where you'd // wxGrid's column moving is buggy with native headers and this is one dialog where you'd
@ -866,19 +865,19 @@ bool DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow()
TOOL_MANAGER* toolMgr = m_parent->GetToolManager(); TOOL_MANAGER* toolMgr = m_parent->GetToolManager();
EE_SELECTION_TOOL* selectionTool = toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selectionTool = toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selectionTool->GetSelection(); EE_SELECTION& selection = selectionTool->GetSelection();
SCH_COMPONENT* component = nullptr; SCH_COMPONENT* symbol = nullptr;
if( selection.GetSize() == 1 ) if( selection.GetSize() == 1 )
{ {
EDA_ITEM* item = selection.Front(); EDA_ITEM* item = selection.Front();
if( item->Type() == SCH_COMPONENT_T ) if( item->Type() == SCH_COMPONENT_T )
component = (SCH_COMPONENT*) item; symbol = (SCH_COMPONENT*) item;
else if( item->GetParent() && item->GetParent()->Type() == SCH_COMPONENT_T ) else if( item->GetParent() && item->GetParent()->Type() == SCH_COMPONENT_T )
component = (SCH_COMPONENT*) item->GetParent(); symbol = (SCH_COMPONENT*) item->GetParent();
} }
if( component ) if( symbol )
{ {
for( int row = 0; row < m_dataModel->GetNumberRows(); ++row ) for( int row = 0; row < m_dataModel->GetNumberRows(); ++row )
{ {
@ -887,7 +886,7 @@ bool DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow()
for( const SCH_REFERENCE& ref : references ) for( const SCH_REFERENCE& ref : references )
{ {
if( ref.GetComp() == component ) if( ref.GetSymbol() == symbol )
{ {
found = true; found = true;
break; break;
@ -967,12 +966,12 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames()
{ {
std::set<wxString> userFieldNames; std::set<wxString> userFieldNames;
for( unsigned i = 0; i < m_componentRefs.GetCount(); ++i ) for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
{ {
SCH_COMPONENT* comp = m_componentRefs[ i ].GetComp(); SCH_COMPONENT* symbol = m_symbolsList[ i ].GetSymbol();
for( int j = MANDATORY_FIELDS; j < comp->GetFieldCount(); ++j ) for( int j = MANDATORY_FIELDS; j < symbol->GetFieldCount(); ++j )
userFieldNames.insert( comp->GetField( j )->GetName() ); userFieldNames.insert( symbol->GetField( j )->GetName() );
} }
// Force References to always be shown // Force References to always be shown
@ -1090,7 +1089,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnColumnItemToggled( wxDataViewEvent& event )
std::string fieldName( m_fieldsCtrl->GetTextValue( row, CANONICAL_NAME_COLUMN ).ToUTF8() ); std::string fieldName( m_fieldsCtrl->GetTextValue( row, CANONICAL_NAME_COLUMN ).ToUTF8() );
cfg->m_FieldEditorPanel.fields_group_by[fieldName] = value; cfg->m_FieldEditorPanel.fields_group_by[fieldName] = value;
m_dataModel->RebuildRows( m_groupComponentsBox, m_fieldsCtrl ); m_dataModel->RebuildRows( m_groupSymbolsBox, m_fieldsCtrl );
m_dataModel->Sort( m_grid->GetSortingColumn(), m_grid->IsSortOrderAscending() ); m_dataModel->Sort( m_grid->GetSortingColumn(), m_grid->IsSortOrderAscending() );
m_grid->ForceRefresh(); m_grid->ForceRefresh();
break; break;
@ -1099,9 +1098,9 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnColumnItemToggled( wxDataViewEvent& event )
} }
void DIALOG_FIELDS_EDITOR_GLOBAL::OnGroupComponentsToggled( wxCommandEvent& event ) void DIALOG_FIELDS_EDITOR_GLOBAL::OnGroupSymbolsToggled( wxCommandEvent& event )
{ {
m_dataModel->RebuildRows( m_groupComponentsBox, m_fieldsCtrl ); m_dataModel->RebuildRows( m_groupSymbolsBox, m_fieldsCtrl );
m_dataModel->Sort( m_grid->GetSortingColumn(), m_grid->IsSortOrderAscending() ); m_dataModel->Sort( m_grid->GetSortingColumn(), m_grid->IsSortOrderAscending() );
m_grid->ForceRefresh(); m_grid->ForceRefresh();
} }
@ -1145,9 +1144,9 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableColSize( wxGridSizeEvent& aEvent )
} }
void DIALOG_FIELDS_EDITOR_GLOBAL::OnRegroupComponents( wxCommandEvent& aEvent ) void DIALOG_FIELDS_EDITOR_GLOBAL::OnRegroupSymbols( wxCommandEvent& aEvent )
{ {
m_dataModel->RebuildRows( m_groupComponentsBox, m_fieldsCtrl ); m_dataModel->RebuildRows( m_groupSymbolsBox, m_fieldsCtrl );
m_dataModel->Sort( m_grid->GetSortingColumn(), m_grid->IsSortOrderAscending() ); m_dataModel->Sort( m_grid->GetSortingColumn(), m_grid->IsSortOrderAscending() );
m_grid->ForceRefresh(); m_grid->ForceRefresh();
} }
@ -1163,7 +1162,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick( wxGridEvent& event )
m_dataModel->ExpandCollapseRow( event.GetRow() ); m_dataModel->ExpandCollapseRow( event.GetRow() );
std::vector<SCH_REFERENCE> refs = m_dataModel->GetRowReferences( event.GetRow() ); std::vector<SCH_REFERENCE> refs = m_dataModel->GetRowReferences( event.GetRow() );
// Focus Eeschema view on the component selected in the dialog // Focus Eeschema view on the symbol selected in the dialog
if( refs.size() == 1 ) if( refs.size() == 1 )
{ {
SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>(); SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>();

View File

@ -49,7 +49,7 @@ private:
int m_groupByColWidth; int m_groupByColWidth;
int m_canonicalNameColWidth; int m_canonicalNameColWidth;
SCH_REFERENCE_LIST m_componentRefs; SCH_REFERENCE_LIST m_symbolsList;
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel; FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
void AddField( const wxString& displayName, const wxString& aCanonicalName, bool defaultShow, void AddField( const wxString& displayName, const wxString& aCanonicalName, bool defaultShow,
@ -59,8 +59,8 @@ private:
void OnColSort( wxGridEvent& aEvent ); void OnColSort( wxGridEvent& aEvent );
void OnColumnItemToggled( wxDataViewEvent& event ) override; void OnColumnItemToggled( wxDataViewEvent& event ) override;
void OnGroupComponentsToggled( wxCommandEvent& event ) override; void OnGroupSymbolsToggled( wxCommandEvent& event ) override;
void OnRegroupComponents( wxCommandEvent& event ) override; void OnRegroupSymbols( wxCommandEvent& aEvent ) override;
void OnTableValueChanged( wxGridEvent& event ) override; void OnTableValueChanged( wxGridEvent& event ) override;
void OnTableCellClick( wxGridEvent& event ) override; void OnTableCellClick( wxGridEvent& event ) override;
void OnTableItemContextMenu( wxGridEvent& event ) override; void OnTableItemContextMenu( wxGridEvent& event ) override;

View File

@ -28,11 +28,11 @@ DIALOG_FIELDS_EDITOR_GLOBAL_BASE::DIALOG_FIELDS_EDITOR_GLOBAL_BASE( wxWindow* pa
wxBoxSizer* bGroupSizer; wxBoxSizer* bGroupSizer;
bGroupSizer = new wxBoxSizer( wxHORIZONTAL ); bGroupSizer = new wxBoxSizer( wxHORIZONTAL );
m_groupComponentsBox = new wxCheckBox( m_leftPanel, OPT_GROUP_COMPONENTS, _("Group symbols"), wxDefaultPosition, wxDefaultSize, 0 ); m_groupSymbolsBox = new wxCheckBox( m_leftPanel, OPT_GROUP_COMPONENTS, _( "Group symbols"), wxDefaultPosition, wxDefaultSize, 0 );
m_groupComponentsBox->SetValue(true); m_groupSymbolsBox->SetValue( true);
m_groupComponentsBox->SetToolTip( _("Group components together based on common properties") ); m_groupSymbolsBox->SetToolTip( _( "Group components together based on common properties") );
bGroupSizer->Add( m_groupComponentsBox, 0, wxALL|wxEXPAND, 5 ); bGroupSizer->Add( m_groupSymbolsBox, 0, wxALL | wxEXPAND, 5 );
bGroupSizer->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); bGroupSizer->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
@ -126,8 +126,8 @@ DIALOG_FIELDS_EDITOR_GLOBAL_BASE::DIALOG_FIELDS_EDITOR_GLOBAL_BASE( wxWindow* pa
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnClose ) );
m_groupComponentsBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnGroupComponentsToggled ), NULL, this ); m_groupSymbolsBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnGroupSymbolsToggled ), NULL, this );
m_bRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnRegroupComponents ), NULL, this ); m_bRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnRegroupSymbols ), NULL, this );
m_fieldsCtrl->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnColumnItemToggled ), NULL, this ); m_fieldsCtrl->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnColumnItemToggled ), NULL, this );
m_fieldsCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnSizeFieldList ), NULL, this ); m_fieldsCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnSizeFieldList ), NULL, this );
m_addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnAddField ), NULL, this ); m_addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnAddField ), NULL, this );
@ -144,8 +144,8 @@ DIALOG_FIELDS_EDITOR_GLOBAL_BASE::~DIALOG_FIELDS_EDITOR_GLOBAL_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnClose ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnClose ) );
m_groupComponentsBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnGroupComponentsToggled ), NULL, this ); m_groupSymbolsBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnGroupSymbolsToggled ), NULL, this );
m_bRefresh->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnRegroupComponents ), NULL, this ); m_bRefresh->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnRegroupSymbols ), NULL, this );
m_fieldsCtrl->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnColumnItemToggled ), NULL, this ); m_fieldsCtrl->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnColumnItemToggled ), NULL, this );
m_fieldsCtrl->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnSizeFieldList ), NULL, this ); m_fieldsCtrl->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnSizeFieldList ), NULL, this );
m_addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnAddField ), NULL, this ); m_addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELDS_EDITOR_GLOBAL_BASE::OnAddField ), NULL, this );

View File

@ -227,7 +227,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_groupComponentsBox</property> <property name="name">m_groupSymbolsBox</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -240,7 +240,7 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">Group components together based on common properties</property> <property name="tooltip">Group symbols together based on common properties</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
@ -248,7 +248,7 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnCheckBox">OnGroupComponentsToggled</event> <event name="OnCheckBox">OnGroupSymbolsToggled</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
@ -331,7 +331,7 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnButtonClick">OnRegroupComponents</event> <event name="OnButtonClick">OnRegroupSymbols</event>
</object> </object>
</object> </object>
</object> </object>

View File

@ -45,7 +45,7 @@ class DIALOG_FIELDS_EDITOR_GLOBAL_BASE : public DIALOG_SHIM
protected: protected:
wxSplitterWindow* m_splitterMainWindow; wxSplitterWindow* m_splitterMainWindow;
wxPanel* m_leftPanel; wxPanel* m_leftPanel;
wxCheckBox* m_groupComponentsBox; wxCheckBox* m_groupSymbolsBox;
wxBitmapButton* m_bRefresh; wxBitmapButton* m_bRefresh;
wxDataViewListCtrl* m_fieldsCtrl; wxDataViewListCtrl* m_fieldsCtrl;
wxButton* m_addFieldButton; wxButton* m_addFieldButton;
@ -58,8 +58,8 @@ class DIALOG_FIELDS_EDITOR_GLOBAL_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnGroupComponentsToggled( wxCommandEvent& event ) { event.Skip(); } virtual void OnGroupSymbolsToggled( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRegroupComponents( wxCommandEvent& event ) { event.Skip(); } virtual void OnRegroupSymbols( wxCommandEvent& event ) { event.Skip(); }
virtual void OnColumnItemToggled( wxDataViewEvent& event ) { event.Skip(); } virtual void OnColumnItemToggled( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnSizeFieldList( wxSizeEvent& event ) { event.Skip(); } virtual void OnSizeFieldList( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }

View File

@ -197,14 +197,14 @@ void CollectOtherUnits( const wxString& aRef, int aUnit, SCH_SHEET_PATH& aSheet,
std::vector<SCH_COMPONENT*>* otherUnits ) std::vector<SCH_COMPONENT*>* otherUnits )
{ {
SCH_REFERENCE_LIST components; SCH_REFERENCE_LIST components;
aSheet.GetComponents( components ); aSheet.GetSymbols( components );
for( unsigned i = 0; i < components.GetCount(); i++ ) for( unsigned i = 0; i < components.GetCount(); i++ )
{ {
SCH_REFERENCE component = components[i]; SCH_REFERENCE component = components[i];
if( component.GetRef() == aRef && component.GetUnit() != aUnit ) if( component.GetRef() == aRef && component.GetUnit() != aUnit )
otherUnits->push_back( component.GetComp() ); otherUnits->push_back( component.GetSymbol() );
} }
} }

View File

@ -334,7 +334,7 @@ int ERC_TESTER::TestMultiunitFootprints()
int errors = 0; int errors = 0;
std::map<wxString, LIB_ID> footprints; std::map<wxString, LIB_ID> footprints;
SCH_MULTI_UNIT_REFERENCE_MAP refMap; SCH_MULTI_UNIT_REFERENCE_MAP refMap;
sheets.GetMultiUnitComponents( refMap, true ); sheets.GetMultiUnitSymbols( refMap, true );
for( std::pair<const wxString, SCH_REFERENCE_LIST>& component : refMap ) for( std::pair<const wxString, SCH_REFERENCE_LIST>& component : refMap )
{ {
@ -358,7 +358,7 @@ int ERC_TESTER::TestMultiunitFootprints()
if( !unitFP.IsEmpty() ) if( !unitFP.IsEmpty() )
{ {
unit = refList.GetItem( i ).GetComp(); unit = refList.GetItem( i ).GetSymbol();
unitName = unit->GetRef( &sheetPath, true ); unitName = unit->GetRef( &sheetPath, true );
break; break;
} }
@ -367,7 +367,7 @@ int ERC_TESTER::TestMultiunitFootprints()
for( unsigned i = 0; i < refList.GetCount(); ++i ) for( unsigned i = 0; i < refList.GetCount(); ++i )
{ {
SCH_REFERENCE& secondRef = refList.GetItem( i ); SCH_REFERENCE& secondRef = refList.GetItem( i );
SCH_COMPONENT* secondUnit = secondRef.GetComp(); SCH_COMPONENT* secondUnit = secondRef.GetSymbol();
wxString secondName = secondUnit->GetRef( &secondRef.GetSheetPath(), true ); wxString secondName = secondUnit->GetRef( &secondRef.GetSheetPath(), true );
const wxString secondFp = secondRef.GetFootprint(); const wxString secondFp = secondRef.GetFootprint();
wxString msg; wxString msg;

View File

@ -725,7 +725,7 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
{ {
SCH_REFERENCE_LIST instances; SCH_REFERENCE_LIST instances;
sheetPath.GetComponents( instances, true, true ); sheetPath.GetSymbols( instances, true, true );
instances.SortByReferenceOnly(); instances.SortByReferenceOnly();
for( size_t i = 0; i < instances.GetCount(); i++ ) for( size_t i = 0; i < instances.GetCount(); i++ )

View File

@ -38,117 +38,97 @@
/** /**
* SCH_REFERENCE * SCH_REFERENCE
* is used as a helper to define a component's reference designator in a schematic. This * is used as a helper to define a symbol's reference designator in a schematic. This helper
* helper is required in a complex hierarchy because a component can be used more than * is required in a complex hierarchy because a symbol can be used more than once and its
* once and its reference depends on the sheet path. This class is used to flatten the * reference depends on the sheet path. This class is used to flatten the schematic hierarchy
* schematic hierarchy for annotation, net list generation, and bill of material * for annotation, net list generation, and bill of material generation.
* generation.
*/ */
class SCH_REFERENCE class SCH_REFERENCE
{ {
/// Component reference prefix, without number (for IC1, this is IC) ) /// Symbol reference prefix, without number (for IC1, this is IC) )
UTF8 m_Ref; // it's private, use the accessors please UTF8 m_ref; // it's private, use the accessors please
SCH_COMPONENT* m_RootCmp; ///< The component associated the reference object. SCH_COMPONENT* m_rootSymbol; ///< The symbol associated the reference object.
LIB_PART* m_Entry; ///< The source component from a library. LIB_PART* m_libPart; ///< The source symbol from a library.
wxPoint m_CmpPos; ///< The physical position of the component in schematic wxPoint m_symbolPos; ///< The physical position of the symbol in schematic
///< used to annotate by X or Y position ///< used to annotate by X or Y position
int m_Unit; ///< The unit number for components with multiple parts int m_unit; ///< The unit number for symbol with multiple parts
///< per package. ///< per package.
wxString m_Value; ///< The component value. wxString m_value; ///< The symbol value.
wxString m_Footprint; ///< The footprint assigned. wxString m_footprint; ///< The footprint assigned.
SCH_SHEET_PATH m_SheetPath; ///< The sheet path for this reference. SCH_SHEET_PATH m_sheetPath; ///< The sheet path for this reference.
bool m_IsNew; ///< True if not yet annotated. bool m_isNew; ///< True if not yet annotated.
int m_SheetNum; ///< The sheet number for the reference. int m_sheetNum; ///< The sheet number for the reference.
KIID m_Uuid; ///< UUID of the component. KIID m_symbolUuid; ///< UUID of the symbol.
int m_NumRef; ///< The numeric part of the reference designator. int m_numRef; ///< The numeric part of the reference designator.
int m_Flag; int m_flag;
friend class SCH_REFERENCE_LIST; friend class SCH_REFERENCE_LIST;
public: public:
SCH_REFERENCE() : SCH_REFERENCE() :
m_SheetPath() m_sheetPath()
{ {
m_RootCmp = NULL; m_rootSymbol = NULL;
m_Entry = NULL; m_libPart = NULL;
m_Unit = 0; m_unit = 0;
m_IsNew = false; m_isNew = false;
m_NumRef = 0; m_numRef = 0;
m_Flag = 0; m_flag = 0;
m_SheetNum = 0; m_sheetNum = 0;
} }
SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent, SCH_REFERENCE( SCH_COMPONENT* aSymbol, LIB_PART* aLibPart, const SCH_SHEET_PATH& aSheetPath );
const SCH_SHEET_PATH& aSheetPath );
SCH_COMPONENT* GetComp() const { return m_RootCmp; } SCH_COMPONENT* GetSymbol() const { return m_rootSymbol; }
LIB_PART* GetLibPart() const { return m_Entry; } LIB_PART* GetLibPart() const { return m_libPart; }
const SCH_SHEET_PATH& GetSheetPath() const { return m_SheetPath; } const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
SCH_SHEET_PATH& GetSheetPath() { return m_SheetPath; } SCH_SHEET_PATH& GetSheetPath() { return m_sheetPath; }
int GetUnit() const { return m_Unit; } int GetUnit() const { return m_unit; }
void SetUnit( int aUnit ) { m_Unit = aUnit; } void SetUnit( int aUnit ) { m_unit = aUnit; }
const wxString GetValue() const { return m_Value; } const wxString GetValue() const { return m_value; }
void SetValue( const wxString& aValue ) { m_Value = aValue; } void SetValue( const wxString& aValue ) { m_value = aValue; }
const wxString GetFootprint() const { return m_Footprint; } const wxString GetFootprint() const { return m_footprint; }
void SetFootprint( const wxString& aFP ) { m_Footprint = aFP; } void SetFootprint( const wxString& aFP ) { m_footprint = aFP; }
void SetSheetNumber( int aSheetNumber ) { m_SheetNum = aSheetNumber; } void SetSheetNumber( int aSheetNumber ) { m_sheetNum = aSheetNumber; }
const wxString GetPath() const const wxString GetPath() const
{ {
return m_RootCmp ? m_SheetPath.PathAsString() + m_RootCmp->m_Uuid.AsString() : ""; return m_rootSymbol ? m_sheetPath.PathAsString() + m_rootSymbol->m_Uuid.AsString() : "";
} }
/** /**
* Function Annotate * Function Annotate
* updates the annotation of the component according the the current object state. * updates the annotation of the symbol according the the current object state.
*/ */
void Annotate(); void Annotate();
/** /**
* Function Split * Function Split
* attempts to split the reference designator into a name (U) and number (1). If the * attempts to split the reference designator into a name (U) and number (1). If the
* last character is '?' or not a digit, the reference is tagged as not annotated. * last character is '?' or not a digit, the reference is tagged as not annotated. For
* For components with multiple parts per package that are not already annotated, set * sybmols with multiple parts per package that are not already annotated, sets m_unit to
* m_Unit to a max value (0x7FFFFFFF). * a max value (0x7FFFFFFF).
*/ */
void Split(); void Split();
/* Some accessors which hide the strategy of how the reference is stored, void SetRef( const wxString& aReference ) { m_ref = aReference; }
thereby making it easy to change that strategy. wxString GetRef() const { return m_ref; }
*/
void SetRef( const wxString& aReference ) void SetRefStr( const std::string& aReference ) { m_ref = aReference; }
{ const char* GetRefStr() const { return m_ref.c_str(); }
m_Ref = aReference;
}
wxString GetRef() const
{
return m_Ref;
}
void SetRefStr( const std::string& aReference )
{
m_Ref = aReference;
}
const char* GetRefStr() const
{
return m_Ref.c_str();
}
///> Return reference name with unit altogether ///> Return reference name with unit altogether
wxString GetFullRef() wxString GetFullRef()
{ {
if( GetComp()->GetUnitCount() > 1 ) if( GetSymbol()->GetUnitCount() > 1 )
return GetRef() + LIB_PART::SubReference( GetUnit() ); return GetRef() + LIB_PART::SubReference( GetUnit() );
else else
return GetRef(); return GetRef();
@ -158,59 +138,58 @@ public:
{ {
wxString ref; wxString ref;
if( m_NumRef < 0 ) if( m_numRef < 0 )
return wxT( "?" ); return wxT( "?" );
// To avoid a risk of duplicate, for power components // To avoid a risk of duplicate, for power symbols the ref number is 0nnn instead of nnn.
// the ref number is 0nnn instead of nnn. // Just because sometimes only power symbols are annotated
// Just because sometimes only power components are annotated
if( GetLibPart() && GetLibPart()->IsPower() ) if( GetLibPart() && GetLibPart()->IsPower() )
ref = wxT( "0" ); ref = wxT( "0" );
return ref << m_NumRef; return ref << m_numRef;
} }
int CompareValue( const SCH_REFERENCE& item ) const int CompareValue( const SCH_REFERENCE& item ) const
{ {
return m_Value.Cmp( item.m_Value ); return m_value.Cmp( item.m_value );
} }
int CompareRef( const SCH_REFERENCE& item ) const int CompareRef( const SCH_REFERENCE& item ) const
{ {
return m_Ref.compare( item.m_Ref ); return m_ref.compare( item.m_ref );
} }
int CompareLibName( const SCH_REFERENCE& item ) const int CompareLibName( const SCH_REFERENCE& item ) const
{ {
return m_RootCmp->GetLibId().GetLibItemName().compare( return m_rootSymbol->GetLibId().GetLibItemName().compare(
item.m_RootCmp->GetLibId().GetLibItemName() ); item.m_rootSymbol->GetLibId().GetLibItemName() );
} }
/** /**
* Function IsSameInstance * Function IsSameInstance
* returns whether this reference refers to the same component instance * returns whether this reference refers to the same symbol instance (symbol and sheet) as
* (component and sheet) as another. * another.
*/ */
bool IsSameInstance( const SCH_REFERENCE& other ) const bool IsSameInstance( const SCH_REFERENCE& other ) const
{ {
// JEY TODO: should this be checking unit as well? // JEY TODO: should this be checking unit as well?
return GetComp() == other.GetComp() return GetSymbol() == other.GetSymbol()
&& GetSheetPath().Path() == other.GetSheetPath().Path(); && GetSheetPath().Path() == other.GetSheetPath().Path();
} }
bool IsUnitsLocked() bool IsUnitsLocked()
{ {
return m_Entry->UnitsLocked(); return m_libPart->UnitsLocked();
} }
}; };
/** /**
* SCH_REFERENCE_LIST * SCH_REFERENCE_LIST
* is used to create a flattened list of components because in a complex hierarchy, a component * is used to create a flattened list of symbols because in a complex hierarchy, a symbol
* can be used more than once and its reference designator is dependent on the sheet path for * can be used more than once and its reference designator is dependent on the sheet path for
* the same component. This flattened list is used for netlist generation, BOM generation, * the same symbol. This flattened list is used for netlist generation, BOM generation, and
* and schematic annotation. * schematic annotation.
*/ */
class SCH_REFERENCE_LIST class SCH_REFERENCE_LIST
{ {
@ -234,33 +213,11 @@ public:
flatList.clear(); flatList.clear();
} }
/** unsigned GetCount() const { return flatList.size(); }
* Function GetCount
* @return the number of items in the list
*/
unsigned GetCount() const
{
return flatList.size();
}
/** SCH_REFERENCE& GetItem( int aIdx ) { return flatList[aIdx]; }
* Function GetItem
* @return the aIdx item
*/
SCH_REFERENCE& GetItem( int aIdx )
{
return flatList[aIdx];
}
/** void AddItem( SCH_REFERENCE& aItem ) { flatList.push_back( aItem ); }
* Function AddItem
* adds a SCH_REFERENCE object to the list of references.
* @param aItem - a SCH_REFERENCE item to add
*/
void AddItem( SCH_REFERENCE& aItem )
{
flatList.push_back( aItem );
}
/** /**
* Function RemoveItem * Function RemoveItem
@ -271,21 +228,20 @@ public:
void RemoveItem( unsigned int aIndex ); void RemoveItem( unsigned int aIndex );
/* Sort functions: /* Sort functions:
* Sort functions are used to sort components for annotation or BOM generation. * Sort functions are used to sort symbols for annotation or BOM generation. Because
* Because sorting depends on what we want to do, there are many sort functions. * sorting depends on what we want to do, there are many sort functions.
* Note: * Note:
* When creating BOM, components are fully annotated. * When creating BOM, symbols are fully annotated. References are something like U3,
* references are something like U3, U5 or R4, R8 * U5 or R4, R8. When annotating, some or all suymbols are not annotated, i.e. ref is
* When annotating, some or all components are not annotated, * only U or R, with no number.
* i.e. ref is only U or R, with no number.
*/ */
/** /**
* Function SplitReferences * Function SplitReferences
* attempts to split all reference designators into a name (U) and number (1). If the * attempts to split all reference designators into a name (U) and number (1). If the
* last character is '?' or not a digit, the reference is tagged as not annotated. * last character is '?' or not a digit, the reference is tagged as not annotated. For
* For components with multiple parts per package that are not already annotated, set * symbols with multiple parts per package that are not already annotated, set m_unit to
* m_Unit to a max value (0x7FFFFFFF). * a max value (0x7FFFFFFF).
* @see SCH_REFERENCE::Split() * @see SCH_REFERENCE::Split()
*/ */
void SplitReferences() void SplitReferences()
@ -296,18 +252,16 @@ public:
/** /**
* function UpdateAnnotation * function UpdateAnnotation
* Updates the reference components for the schematic project (or the current sheet) * Updates the symbol references for the schematic project (or the current sheet).
* Note: this function does not calculate the reference numbers stored in m_NumRef * Note: this function does not calculate the reference numbers stored in m_numRef so it
* So, it must be called after calculation of new reference numbers * must be called after calculation of new reference numbers
* @see SCH_REFERENCE::Annotate() * @see SCH_REFERENCE::Annotate()
*/ */
void UpdateAnnotation() void UpdateAnnotation()
{ {
/* update the reference numbers */ /* update the reference numbers */
for( unsigned ii = 0; ii < GetCount(); ii++ ) for( unsigned ii = 0; ii < GetCount(); ii++ )
{
flatList[ii].Annotate(); flatList[ii].Annotate();
}
} }
/** /**
@ -336,10 +290,10 @@ public:
* <p> * <p>
* The following annotation error conditions are tested: * The following annotation error conditions are tested:
* <ul> * <ul>
* <li>Components not annotated.</li> * <li>Symbols not annotated.</li>
* <li>Components having the same reference designator (duplicates).</li> * <li>Symbols having the same reference designator (duplicates).</li>
* <li>Components with multiple parts per package having different reference designators.</li> * <li>Symbols with multiple parts per package having different reference designators.</li>
* <li>Components with multiple parts per package with invalid part count.</li> * <li>Symbols with multiple parts per package with invalid part count.</li>
* </ul> * </ul>
* </p> * </p>
* @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors. * @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors.
@ -348,10 +302,10 @@ public:
int CheckAnnotation( REPORTER& aReporter ); int CheckAnnotation( REPORTER& aReporter );
/** /**
* Function sortByXCoordinate * Function SortByXCoordinate
* sorts the list of references by X position. * sorts the list of references by X position.
* <p> * <p>
* Components are sorted as follows: * Symbols are sorted as follows:
* <ul> * <ul>
* <li>Numeric value of reference designator.</li> * <li>Numeric value of reference designator.</li>
* <li>Sheet number.</li> * <li>Sheet number.</li>
@ -367,10 +321,10 @@ public:
} }
/** /**
* Function sortByYCoordinate * Function SortByYCoordinate
* sorts the list of references by Y position. * sorts the list of references by Y position.
* <p> * <p>
* Components are sorted as follows: * Symbols are sorted as follows:
* <ul> * <ul>
* <li>Numeric value of reference designator.</li> * <li>Numeric value of reference designator.</li>
* <li>Sheet number.</li> * <li>Sheet number.</li>
@ -386,7 +340,7 @@ public:
} }
/** /**
* Function SortComponentsByTimeStamp * Function SortByTimeStamp
* sort the flat list by Time Stamp (sheet path + timestamp). * sort the flat list by Time Stamp (sheet path + timestamp).
* Useful to detect duplicate Time Stamps * Useful to detect duplicate Time Stamps
*/ */
@ -399,11 +353,11 @@ public:
* Function SortByRefAndValue * Function SortByRefAndValue
* sorts the list of references by value. * sorts the list of references by value.
* <p> * <p>
* Components are sorted in the following order: * Symbols are sorted in the following order:
* <ul> * <ul>
* <li>Numeric value of reference designator.</li> * <li>Numeric value of reference designator.</li>
* <li>Value of component.</li> * <li>Value of symbol.</li>
* <li>Unit number when component has multiple parts.</li> * <li>Unit number when symbol has multiple parts.</li>
* <li>Sheet number.</li> * <li>Sheet number.</li>
* <li>X coordinate position.</li> * <li>X coordinate position.</li>
* <li>Y coordinate position.</li> * <li>Y coordinate position.</li>
@ -419,10 +373,10 @@ public:
* Function SortByReferenceOnly * Function SortByReferenceOnly
* sorts the list of references by reference. * sorts the list of references by reference.
* <p> * <p>
* Components are sorted in the following order: * Symbols are sorted in the following order:
* <ul> * <ul>
* <li>Numeric value of reference designator.</li> * <li>Numeric value of reference designator.</li>
* <li>Unit number when component has multiple parts.</li> * <li>Unit number when symbol has multiple parts.</li>
* </ul> * </ul>
* </p> * </p>
*/ */
@ -432,26 +386,25 @@ public:
} }
/** /**
* searches the list for a component with a given reference. * searches the list for a symbol with a given reference.
* @param aPath * @param aPath
* @return * @return
*/ */
int FindRef( const wxString& aPath ) const; int FindRef( const wxString& aPath ) const;
/** /**
* searches the sorted list of components for a another component with the same * searches the sorted list of symbols for a another symbol with the same reference and a
* reference and a given part unit. Use this method to manage components with * given part unit. Use this method to manage symbols with multiple parts per package.
* multiple parts per package. * @param aIndex = index in aSymbolsList for of given SCH_REFERENCE item to test.
* @param aIndex = index in aComponentsList for of given SCH_REFERENCE item to test.
* @param aUnit = the given unit number to search * @param aUnit = the given unit number to search
* @return index in aComponentsList if found or -1 if not found * @return index in aSymbolsList if found or -1 if not found
*/ */
int FindUnit( size_t aIndex, int aUnit ); int FindUnit( size_t aIndex, int aUnit );
/** /**
* searches the list for a component with the given KIID path * searches the list for a symbol with the given KIID path
* @param aPath path to search * @param aPath path to search
* @return index in aComponentsList if found or -1 if not found * @return index in aSymbolsList if found or -1 if not found
*/ */
int FindRefByPath( const wxString& aPath ) const; int FindRefByPath( const wxString& aPath ) const;
@ -459,7 +412,7 @@ public:
* Function GetRefsInUse * Function GetRefsInUse
* adds all the reference designator numbers greater than \a aMinRefId to \a aIdList * adds all the reference designator numbers greater than \a aMinRefId to \a aIdList
* skipping the reference at \a aIndex. * skipping the reference at \a aIndex.
* @param aIndex = the current component index to use for reference prefix filtering. * @param aIndex = the current symbol's index to use for reference prefix filtering.
* @param aIdList = the buffer to fill * @param aIdList = the buffer to fill
* @param aMinRefId = the min id value to store. all values < aMinRefId are ignored * @param aMinRefId = the min id value to store. all values < aMinRefId are ignored
*/ */
@ -467,9 +420,8 @@ public:
/** /**
* Function GetLastReference * Function GetLastReference
* returns the last used (greatest) reference number in the reference list * returns the last used (greatest) reference number in the reference list for the prefix
* for the prefix reference given by \a aIndex. The component list must be * used by the symbol pointed to by \a aIndex. The symbol list must be sorted.
* sorted.
* *
* @param aIndex The index of the reference item used for the search pattern. * @param aIndex The index of the reference item used for the search pattern.
* @param aMinValue The minimum value for the current search. * @param aMinValue The minimum value for the current search.
@ -486,11 +438,10 @@ public:
SCH_REFERENCE& schref = flatList[i]; SCH_REFERENCE& schref = flatList[i];
printf( " [%-2d] ref:%-8s num:%-3d lib_part:%s\n", printf( " [%-2d] ref:%-8s num:%-3d lib_part:%s\n",
i, i,
schref.m_Ref.c_str(), schref.m_ref.c_str(),
schref.m_NumRef, schref.m_numRef,
TO_UTF8( schref.GetLibPart()->GetName() ) TO_UTF8( schref.GetLibPart()->GetName() ) );
);
} }
} }
#endif #endif

View File

@ -261,8 +261,8 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
void SCH_SHEET_PATH::GetComponents( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols, void SCH_SHEET_PATH::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols,
bool aForceIncludeOrphanComponents ) const bool aForceIncludeOrphanComponents ) const
{ {
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
{ {
@ -693,16 +693,16 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols()
} }
void SCH_SHEET_LIST::GetComponents( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols, void SCH_SHEET_LIST::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols,
bool aForceIncludeOrphanComponents ) const bool aForceIncludeOrphanComponents ) const
{ {
for( const SCH_SHEET_PATH& sheet : *this ) for( const SCH_SHEET_PATH& sheet : *this )
sheet.GetComponents( aReferences, aIncludePowerSymbols, aForceIncludeOrphanComponents ); sheet.GetSymbols( aReferences, aIncludePowerSymbols, aForceIncludeOrphanComponents );
} }
void SCH_SHEET_LIST::GetMultiUnitComponents( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, void SCH_SHEET_LIST::GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList,
bool aIncludePowerSymbols ) const bool aIncludePowerSymbols ) const
{ {
for( SCH_SHEET_PATHS::const_iterator it = begin(); it != end(); ++it ) for( SCH_SHEET_PATHS::const_iterator it = begin(); it != end(); ++it )
{ {
@ -778,7 +778,7 @@ void SCH_SHEET_LIST::UpdateSymbolInstances(
{ {
SCH_REFERENCE_LIST symbolInstances; SCH_REFERENCE_LIST symbolInstances;
GetComponents( symbolInstances, true, true ); GetSymbols( symbolInstances, true, true );
std::map<KIID_PATH, wxString> pathNameCache; std::map<KIID_PATH, wxString> pathNameCache;
@ -811,7 +811,7 @@ void SCH_SHEET_LIST::UpdateSymbolInstances(
continue; continue;
} }
SCH_COMPONENT* symbol = symbolInstances[i].GetComp(); SCH_COMPONENT* symbol = symbolInstances[ i ].GetSymbol();
wxCHECK2( symbol, continue ); wxCHECK2( symbol, continue );

View File

@ -293,8 +293,8 @@ public:
* ( orphan components) * ( orphan components)
* The normal option is false, and set to true only to build the full list of components. * The normal option is false, and set to true only to build the full list of components.
*/ */
void GetComponents( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true, void GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true,
bool aForceIncludeOrphanComponents = false ) const; bool aForceIncludeOrphanComponents = false ) const;
/** /**
* Add a #SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of * Add a #SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of
@ -408,8 +408,8 @@ public:
* ( orphan components) * ( orphan components)
* The normal option is false, and set to true only to build the full list of components. * The normal option is false, and set to true only to build the full list of components.
*/ */
void GetComponents( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true, void GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true,
bool aForceIncludeOrphanComponents = false ) const; bool aForceIncludeOrphanComponents = false ) const;
/** /**
* Add a #SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of * Add a #SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of
@ -419,8 +419,8 @@ public:
* @param aRefList Map of reference designators to reference lists * @param aRefList Map of reference designators to reference lists
* @param aIncludePowerSymbols Set to false to only get normal components. * @param aIncludePowerSymbols Set to false to only get normal components.
*/ */
void GetMultiUnitComponents( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, void GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList,
bool aIncludePowerSymbols = true ) const; bool aIncludePowerSymbols = true ) const;
/** /**
* Test every #SCH_SHEET_PATH in this #SCH_SHEET_LIST to verify if adding the sheets stored * Test every #SCH_SHEET_PATH in this #SCH_SHEET_LIST to verify if adding the sheets stored

View File

@ -230,18 +230,18 @@ wxString SCHEMATIC::ConvertRefsToKIIDs( const wxString& aSource ) const
wxString ref = token.BeforeFirst( ':', &remainder ); wxString ref = token.BeforeFirst( ':', &remainder );
SCH_REFERENCE_LIST references; SCH_REFERENCE_LIST references;
sheetList.GetComponents( references ); sheetList.GetSymbols( references );
for( size_t jj = 0; jj < references.GetCount(); jj++ ) for( size_t jj = 0; jj < references.GetCount(); jj++ )
{ {
SCH_COMPONENT* refComponent = references[ jj ].GetComp(); SCH_COMPONENT* refSymbol = references[ jj ].GetSymbol();
if( ref == refComponent->GetRef( &references[ jj ].GetSheetPath(), true ) ) if( ref == refSymbol->GetRef( &references[ jj ].GetSheetPath(), true ) )
{ {
wxString test( remainder ); wxString test( remainder );
if( refComponent->ResolveTextVar( &test ) ) if( refSymbol->ResolveTextVar( &test ) )
token = refComponent->m_Uuid.AsString() + ":" + remainder; token = refSymbol->m_Uuid.AsString() + ":" + remainder;
break; break;
} }

View File

@ -141,7 +141,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
InitExitKey(); InitExitKey();
updateTitle(); updateTitle();
DisplayCmpDoc(); DisplaySymbolDatasheet();
RebuildSymbolUnitsList(); RebuildSymbolUnitsList();
// Create the infobar // Create the infobar
@ -1252,6 +1252,6 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( const std::unique_ptr<LIB_PART>
updateTitle(); updateTitle();
RebuildSymbolUnitsList(); RebuildSymbolUnitsList();
SetShowDeMorgan( GetCurPart()->HasConversion() ); SetShowDeMorgan( GetCurPart()->HasConversion() );
DisplayCmpDoc(); DisplaySymbolDatasheet();
Refresh(); Refresh();
} }

View File

@ -76,8 +76,8 @@ class SYMBOL_EDIT_FRAME : public SCH_BASE_FRAME
wxString m_reference; wxString m_reference;
// True to force DeMorgan/normal tools selection enabled. // True to force DeMorgan/normal tools selection enabled.
// They are enabled when the loaded component has graphic items for converted shape // They are enabled when the loaded symbol has graphic items for converted shape
// But under some circumstances (New component created) these tools must left enabled // But under some circumstances (New symbol created) these tools must left enabled
static bool m_showDeMorgan; static bool m_showDeMorgan;
public: public:
@ -267,7 +267,10 @@ public:
bool GetShowDeMorgan() const { return m_showDeMorgan; } bool GetShowDeMorgan() const { return m_showDeMorgan; }
void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; } void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
void ClearMsgPanel() override { DisplayCmpDoc(); } void ClearMsgPanel() override
{
DisplaySymbolDatasheet();
}
bool IsSymbolFromSchematic() const { return m_isSymbolFromSchematic; } bool IsSymbolFromSchematic() const { return m_isSymbolFromSchematic; }
@ -324,7 +327,7 @@ private:
* @param aConvert Convert to be selected * @param aConvert Convert to be selected
* @return true if the symbol loaded correctly. * @return true if the symbol loaded correctly.
*/ */
bool LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aConvert = 0 ); bool LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aConvert = 0 );
/** /**
* Create a copy of \a aLibEntry into memory. * Create a copy of \a aLibEntry into memory.
@ -341,24 +344,24 @@ private:
public: public:
/** /**
* Display the documentation of the selected component. * Display the documentation of the selected symbol.
*/ */
void DisplayCmpDoc(); void DisplaySymbolDatasheet();
// General editing // General editing
/** /**
* Create a copy of the current component, and save it in the undo list. * Create a copy of the current symbol, and save it in the undo list.
* *
* Because a component in library editor does not have a lot of primitives, * Because a symbol in library editor does not have a lot of primitives, the full data is
* the full data is duplicated. It is not worth to try to optimize this save function. * duplicated. It is not worth to try to optimize this save function.
*/ */
void SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT, void SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT,
bool aAppend = false ); bool aAppend = false );
void GetComponentFromUndoList(); void GetSymbolFromUndoList();
void GetComponentFromRedoList(); void GetSymbolFromRedoList();
void RollbackPartFromUndo(); void RollbackSymbolFromUndo();
/** /**
* Free the undo or redo list from \a aList element. * Free the undo or redo list from \a aList element.
@ -376,7 +379,7 @@ public:
private: private:
/** /**
* Read a component symbol file (*.sym ) and add graphic items to the current component. * Read a symbol file (*.sym ) and add graphic items to the current symbol.
* *
* A symbol file *.sym has the same format as a library, and contains only one symbol. * A symbol file *.sym has the same format as a library, and contains only one symbol.
*/ */
@ -385,7 +388,7 @@ private:
/** /**
* Saves the current symbol to a symbol file. * Saves the current symbol to a symbol file.
* *
* The symbol file format is similar to the standard component library file format, but * The symbol file format is similar to the standard symbol library file format, but
* there is only one symbol. Invisible pins are not saved. * there is only one symbol. Invisible pins are not saved.
*/ */
void SaveOneSymbol(); void SaveOneSymbol();
@ -401,7 +404,7 @@ public:
* @param aConvert the DeMorgan variant to show * @param aConvert the DeMorgan variant to show
* @return true if the symbol defined by \a aLibId was loaded. * @return true if the symbol defined by \a aLibId was loaded.
*/ */
bool LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert ); bool LoadSymbolAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert );
/** /**
* Print a page * Print a page
@ -411,9 +414,9 @@ public:
void PrintPage( RENDER_SETTINGS* aSettings ) override; void PrintPage( RENDER_SETTINGS* aSettings ) override;
/** /**
* Creates the SVG print file for the current edited component. * Creates the SVG print file for the current edited symbol.
*/ */
void SVG_PlotComponent( const wxString& aFullFileName ); void SVGPlotSymbol( const wxString& aFullFileName );
/** /**
* Synchronize the library manager to the symbol library table, and then the symbol tree * Synchronize the library manager to the symbol library table, and then the symbol tree
@ -461,7 +464,7 @@ public:
* @param aConvert the alternate body style of the symbol to edit. * @param aConvert the alternate body style of the symbol to edit.
*/ */
void LoadSymbolFromSchematic( const std::unique_ptr<LIB_PART>& aSymbol, void LoadSymbolFromSchematic( const std::unique_ptr<LIB_PART>& aSymbol,
const wxString& aReference, int aUnit, int aConvert ); const wxString& aReference, int aUnit, int aConvert );
///> Restores the empty editor screen, without any part or library selected. ///> Restores the empty editor screen, without any part or library selected.
void emptyScreen(); void emptyScreen();
@ -483,16 +486,17 @@ private:
///> Returns currently edited part. ///> Returns currently edited part.
LIB_PART* getTargetPart() const; LIB_PART* getTargetPart() const;
///> Returns either the part selected in the component tree, if context menu is active ///> Returns either the part selected in the symbol tree, if context menu is active or the
///> or the currently modified part. ///> currently modified part.
LIB_ID getTargetLibId() const; LIB_ID getTargetLibId() const;
///> Returns either the library selected in the component tree, if context menu is active ///> Returns either the library selected in the symbol tree, if context menu is active or
///> or the library that is currently modified. ///> the library that is currently modified.
wxString getTargetLib() const; wxString getTargetLib() const;
/* Returns true when the operation has succeeded (all requested libraries have been saved or /*
* none was selected and confirmed by OK). * Returns true when the operation has succeeded (all requested libraries have been saved
* or none was selected and confirmed by OK).
* @param aRequireConfirmation when true, the user must be asked to confirm. * @param aRequireConfirmation when true, the user must be asked to confirm.
*/ */
bool saveAllLibraries( bool aRequireConfirmation ); bool saveAllLibraries( bool aRequireConfirmation );
@ -506,7 +510,7 @@ private:
///> Returns true if \a aLibId is an alias for the editor screen part. ///> Returns true if \a aLibId is an alias for the editor screen part.
bool isCurrentPart( const LIB_ID& aLibId ) const; bool isCurrentPart( const LIB_ID& aLibId ) const;
///> Renames LIB_PART aliases to avoid conflicts before adding a component to a library ///> Renames LIB_PART aliases to avoid conflicts before adding a symbol to a library
void ensureUniqueName( LIB_PART* aPart, const wxString& aLibrary ); void ensureUniqueName( LIB_PART* aPart, const wxString& aLibrary );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -148,7 +148,7 @@ bool SYMBOL_EDIT_FRAME::saveCurrentPart()
} }
bool SYMBOL_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert ) bool SYMBOL_EDIT_FRAME::LoadSymbolAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert )
{ {
if( GetCurPart() && GetCurPart()->GetLibId() == aLibId if( GetCurPart() && GetCurPart()->GetLibId() == aLibId
&& GetUnit() == aUnit && GetConvert() == aConvert ) && GetUnit() == aUnit && GetConvert() == aConvert )
@ -167,12 +167,12 @@ bool SYMBOL_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUn
} }
SelectActiveLibrary( aLibId.GetLibNickname() ); SelectActiveLibrary( aLibId.GetLibNickname() );
return LoadComponentFromCurrentLib( aLibId.GetLibItemName(), aUnit, aConvert ); return LoadSymbolFromCurrentLib( aLibId.GetLibItemName(), aUnit, aConvert );
} }
bool SYMBOL_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit, bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit,
int aConvert ) int aConvert )
{ {
LIB_PART* alias = nullptr; LIB_PART* alias = nullptr;
@ -264,7 +264,7 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString&
// Display the document information based on the entry selected just in // Display the document information based on the entry selected just in
// case the entry is an alias. // case the entry is an alias.
DisplayCmpDoc(); DisplaySymbolDatasheet();
Refresh(); Refresh();
return true; return true;
@ -750,7 +750,7 @@ void SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName )
RebuildSymbolUnitsList(); RebuildSymbolUnitsList();
SetShowDeMorgan( GetCurPart()->Flatten()->HasConversion() ); SetShowDeMorgan( GetCurPart()->Flatten()->HasConversion() );
updateTitle(); updateTitle();
DisplayCmpDoc(); DisplaySymbolDatasheet();
RebuildView(); RebuildView();
OnModify(); OnModify();
@ -1136,7 +1136,7 @@ bool SYMBOL_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation )
} }
void SYMBOL_EDIT_FRAME::DisplayCmpDoc() void SYMBOL_EDIT_FRAME::DisplaySymbolDatasheet()
{ {
EDA_DRAW_FRAME::ClearMsgPanel(); EDA_DRAW_FRAME::ClearMsgPanel();

View File

@ -29,7 +29,7 @@
#include <class_library.h> #include <class_library.h>
#include <plotters_specific.h> #include <plotters_specific.h>
void SYMBOL_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName ) void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
{ {
KIGFX::SCH_RENDER_SETTINGS renderSettings; KIGFX::SCH_RENDER_SETTINGS renderSettings;
renderSettings.LoadColors( GetColorSettings() ); renderSettings.LoadColors( GetColorSettings() );

View File

@ -57,7 +57,7 @@ void SYMBOL_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType
} }
void SYMBOL_EDIT_FRAME::GetComponentFromRedoList() void SYMBOL_EDIT_FRAME::GetSymbolFromRedoList()
{ {
if( GetRedoCommandCount() <= 0 ) if( GetRedoCommandCount() <= 0 )
return; return;
@ -105,7 +105,7 @@ void SYMBOL_EDIT_FRAME::GetComponentFromRedoList()
} }
void SYMBOL_EDIT_FRAME::GetComponentFromUndoList() void SYMBOL_EDIT_FRAME::GetSymbolFromUndoList()
{ {
if( GetUndoCommandCount() <= 0 ) if( GetUndoCommandCount() <= 0 )
return; return;
@ -153,7 +153,7 @@ void SYMBOL_EDIT_FRAME::GetComponentFromUndoList()
} }
void SYMBOL_EDIT_FRAME::RollbackPartFromUndo() void SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo()
{ {
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );

View File

@ -46,7 +46,7 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets(); SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
bool isChanged = false; bool isChanged = false;
sheets.GetComponents( refs, false ); sheets.GetSymbols( refs, false );
DSNLEXER lexer( aChangedSetOfReferences, FROM_UTF8( __func__ ) ); DSNLEXER lexer( aChangedSetOfReferences, FROM_UTF8( __func__ ) );
PTREE doc; PTREE doc;
@ -81,7 +81,7 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
// We have found a candidate. // We have found a candidate.
// Note: it can be not unique (multiple parts per package) // Note: it can be not unique (multiple parts per package)
// So we *do not* stop the search here // So we *do not* stop the search here
SCH_COMPONENT* component = refs[ii].GetComp(); SCH_COMPONENT* component = refs[ ii ].GetSymbol();
// For backwards-compatibility CvPcb currently updates all instances of a // For backwards-compatibility CvPcb currently updates all instances of a
// component (even though it lists these instances separately). // component (even though it lists these instances separately).
SCH_SHEET_PATH* sheetPath = nullptr; // &refs[ii].GetSheetPath(); SCH_SHEET_PATH* sheetPath = nullptr; // &refs[ii].GetSheetPath();
@ -122,7 +122,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
SCH_REFERENCE_LIST referencesList; SCH_REFERENCE_LIST referencesList;
SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets(); SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
sheetList.GetComponents( referencesList, false ); sheetList.GetSymbols( referencesList, false );
FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) ); FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
@ -182,13 +182,13 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
// We have found a candidate. // We have found a candidate.
// Note: it can be not unique (multiple units per part) // Note: it can be not unique (multiple units per part)
// So we *do not* stop the search here // So we *do not* stop the search here
SCH_COMPONENT* component = referencesList[ii].GetComp(); SCH_COMPONENT* symbol = referencesList[ ii ].GetSymbol();
SCH_SHEET_PATH* sheetPath = &referencesList[ii].GetSheetPath(); SCH_SHEET_PATH* sheetPath = &referencesList[ii].GetSheetPath();
component->SetFootprint( sheetPath, footprint ); symbol->SetFootprint( sheetPath, footprint );
if( aForceVisibilityState ) if( aForceVisibilityState )
component->GetField( FOOTPRINT_FIELD )->SetVisible( aVisibilityState ); symbol->GetField( FOOTPRINT_FIELD )->SetVisible( aVisibilityState );
} }
} }
} }

View File

@ -74,8 +74,8 @@ bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
getPcbModulesFromString( aNetlist ); getPcbModulesFromString( aNetlist );
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets(); SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
sheets.GetComponents( m_refs, false ); sheets.GetSymbols( m_refs, false );
sheets.GetMultiUnitComponents( m_multiUnitsRefs ); sheets.GetMultiUnitSymbols( m_multiUnitsRefs );
getChangeList(); getChangeList();
checkForUnusedSymbols(); checkForUnusedSymbols();
@ -230,7 +230,7 @@ void BACK_ANNOTATE::getChangeList()
for( size_t i = 0; i < refList.GetCount(); ++i ) for( size_t i = 0; i < refList.GetCount(); ++i )
{ {
refList[i].GetComp()->ClearFlags( SKIP_STRUCT ); refList[ i ].GetSymbol()->ClearFlags(SKIP_STRUCT );
m_changelist.emplace_back( CHANGELIST_ITEM( refList[i], pcbData ) ); m_changelist.emplace_back( CHANGELIST_ITEM( refList[i], pcbData ) );
} }
@ -248,7 +248,7 @@ void BACK_ANNOTATE::getChangeList()
if( refIndex >= 0 ) if( refIndex >= 0 )
{ {
m_refs[refIndex].GetComp()->ClearFlags( SKIP_STRUCT ); m_refs[ refIndex ].GetSymbol()->ClearFlags(SKIP_STRUCT );
m_changelist.emplace_back( CHANGELIST_ITEM( m_refs[refIndex], pcbData ) ); m_changelist.emplace_back( CHANGELIST_ITEM( m_refs[refIndex], pcbData ) );
} }
else else
@ -304,13 +304,13 @@ void BACK_ANNOTATE::applyChangelist()
// Apply changes from change list // Apply changes from change list
for( CHANGELIST_ITEM& item : m_changelist ) for( CHANGELIST_ITEM& item : m_changelist )
{ {
SCH_REFERENCE& ref = item.first; SCH_REFERENCE& ref = item.first;
PCB_FP_DATA& fpData = *item.second; PCB_FP_DATA& fpData = *item.second;
SCH_COMPONENT* comp = ref.GetComp(); SCH_COMPONENT* symbol = ref.GetSymbol();
SCH_SCREEN* screen = ref.GetSheetPath().LastScreen(); SCH_SCREEN* screen = ref.GetSheetPath().LastScreen();
wxString oldFootprint = ref.GetFootprint(); wxString oldFootprint = ref.GetFootprint();
wxString oldValue = ref.GetValue(); wxString oldValue = ref.GetValue();
bool skip = ( ref.GetComp()->GetFlags() & SKIP_STRUCT ) > 0; bool skip = ( ref.GetSymbol()->GetFlags() & SKIP_STRUCT ) > 0;
if( m_processReferences && ref.GetRef() != fpData.m_ref && !skip ) if( m_processReferences && ref.GetRef() != fpData.m_ref && !skip )
{ {
@ -321,9 +321,9 @@ void BACK_ANNOTATE::applyChangelist()
if( !m_dryRun ) if( !m_dryRun )
{ {
m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, symbol, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
comp->SetRef( &ref.GetSheetPath(), fpData.m_ref ); symbol->SetRef( &ref.GetSheetPath(), fpData.m_ref );
} }
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION ); m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
@ -339,9 +339,9 @@ void BACK_ANNOTATE::applyChangelist()
if( !m_dryRun ) if( !m_dryRun )
{ {
m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, symbol, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
comp->SetFootprint( &ref.GetSheetPath(), fpData.m_footprint ); symbol->SetFootprint( &ref.GetSheetPath(), fpData.m_footprint );
} }
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION ); m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
@ -357,9 +357,9 @@ void BACK_ANNOTATE::applyChangelist()
if( !m_dryRun ) if( !m_dryRun )
{ {
m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, symbol, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
comp->SetValue( &ref.GetSheetPath(), fpData.m_value ); symbol->SetValue( &ref.GetSheetPath(), fpData.m_value );
} }
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION ); m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
@ -371,7 +371,7 @@ void BACK_ANNOTATE::applyChangelist()
{ {
const wxString& pinNumber = entry.first; const wxString& pinNumber = entry.first;
const wxString& shortNetName = entry.second; const wxString& shortNetName = entry.second;
SCH_PIN* pin = comp->GetPin( pinNumber ); SCH_PIN* pin = symbol->GetPin( pinNumber );
if( !pin ) if( !pin )
{ {
@ -421,7 +421,7 @@ static LABEL_SPIN_STYLE orientLabel( SCH_PIN* aPin )
case PIN_RIGHT: spin = LABEL_SPIN_STYLE::LEFT; break; case PIN_RIGHT: spin = LABEL_SPIN_STYLE::LEFT; break;
} }
// Reorient based on the actual component orientation now // Reorient based on the actual symbol orientation now
struct ORIENT struct ORIENT
{ {
int flag; int flag;
@ -447,16 +447,16 @@ static LABEL_SPIN_STYLE orientLabel( SCH_PIN* aPin )
ORIENT o = orientations[ 0 ]; ORIENT o = orientations[ 0 ];
SCH_COMPONENT* comp = aPin->GetParentSymbol(); SCH_COMPONENT* parentSymbol = aPin->GetParentSymbol();
if( !comp ) if( !parentSymbol )
return spin; return spin;
int compOrient = comp->GetOrientation(); int symbolOrientation = parentSymbol->GetOrientation();
for( auto& i : orientations ) for( auto& i : orientations )
{ {
if( i.flag == compOrient ) if( i.flag == symbolOrientation )
{ {
o = i; o = i;
break; break;

View File

@ -899,7 +899,7 @@ void EE_POINT_EDITOR::saveItemsToUndo()
void EE_POINT_EDITOR::rollbackFromUndo() void EE_POINT_EDITOR::rollbackFromUndo()
{ {
if( m_isSymbolEditor ) if( m_isSymbolEditor )
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->RollbackPartFromUndo(); static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->RollbackSymbolFromUndo();
else else
static_cast<SCH_EDIT_FRAME*>( m_frame )->RollbackSchematicFromUndo(); static_cast<SCH_EDIT_FRAME*>( m_frame )->RollbackSchematicFromUndo();
} }

View File

@ -379,7 +379,7 @@ int LIB_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) ); pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
editFrame->GetScreen()->SetPageSettings( pageTemp ); editFrame->GetScreen()->SetPageSettings( pageTemp );
editFrame->SVG_PlotComponent( fullFileName ); editFrame->SVGPlotSymbol( fullFileName );
editFrame->GetScreen()->SetPageSettings( pageSave ); editFrame->GetScreen()->SetPageSettings( pageSave );
} }

View File

@ -527,7 +527,7 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
updateItem( aField, true ); updateItem( aField, true );
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
m_frame->OnModify(); m_frame->OnModify();
m_frame->DisplayCmpDoc(); m_frame->DisplaySymbolDatasheet();
} }
} }
@ -594,7 +594,7 @@ int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
int LIB_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent ) int LIB_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
{ {
m_frame->GetComponentFromUndoList(); m_frame->GetSymbolFromUndoList();
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selTool->RebuildSelection(); selTool->RebuildSelection();
@ -605,7 +605,7 @@ int LIB_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
int LIB_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent ) int LIB_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent )
{ {
m_frame->GetComponentFromRedoList(); m_frame->GetSymbolFromRedoList();
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selTool->RebuildSelection(); selTool->RebuildSelection();

View File

@ -286,7 +286,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
if( restore_state ) if( restore_state )
{ {
m_frame->RollbackPartFromUndo(); m_frame->RollbackSymbolFromUndo();
if( unselect ) if( unselect )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );

View File

@ -1422,8 +1422,8 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{ {
auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ); auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true );
editor->LoadComponentAndSelectLib( component->GetLibId(), component->GetUnit(), editor->LoadSymbolAndSelectLib( component->GetLibId(), component->GetUnit(),
component->GetConvert() ); component->GetConvert());
editor->Show( true ); editor->Show( true );
editor->Raise(); editor->Raise();

View File

@ -1246,7 +1246,7 @@ bool SCH_EDITOR_CONTROL::doCopy()
} }
m_supplementaryClipboardInstances.Clear(); m_supplementaryClipboardInstances.Clear();
schematic.GetSheets().GetComponents( m_supplementaryClipboardInstances, true, true ); schematic.GetSheets().GetSymbols( m_supplementaryClipboardInstances, true, true );
m_supplementaryClipboardPath = m_frame->GetCurrentSheet().Path(); m_supplementaryClipboardPath = m_frame->GetCurrentSheet().Path();
STRING_FORMATTER formatter; STRING_FORMATTER formatter;