SCH_REFERENCE: drop separate pointer to LIB_SYMBOL
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18115
This commit is contained in:
parent
d34df3e951
commit
2215e8906f
|
@ -84,8 +84,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
||||||
if( symbol->GetLibSymbolRef()
|
if( symbol->GetLibSymbolRef()
|
||||||
&& symbol->GetLibSymbolRef()->GetFPFilters().GetCount() != 0 )
|
&& symbol->GetLibSymbolRef()->GetFPFilters().GetCount() != 0 )
|
||||||
{
|
{
|
||||||
cmpList.push_back( SCH_REFERENCE( symbol, symbol->GetLibSymbolRef().get(),
|
cmpList.push_back( SCH_REFERENCE( symbol, sheet ) );
|
||||||
sheet ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footprint = symbol->GetFootprintFieldText( true, &sheet, false );
|
footprint = symbol->GetFootprintFieldText( true, &sheet, false );
|
||||||
|
|
|
@ -795,14 +795,11 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
|
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH& aSheetPath )
|
||||||
const SCH_SHEET_PATH& aSheetPath )
|
|
||||||
{
|
{
|
||||||
wxASSERT( aSymbol != nullptr );
|
wxASSERT( aSymbol != nullptr );
|
||||||
|
|
||||||
m_rootSymbol = aSymbol;
|
m_rootSymbol = aSymbol;
|
||||||
m_libPart = aLibSymbol; // Warning: can be nullptr for orphan symbols
|
|
||||||
// (i.e. with a symbol library not found)
|
|
||||||
m_unit = aSymbol->GetUnitSelection( &aSheetPath );
|
m_unit = aSymbol->GetUnitSelection( &aSheetPath );
|
||||||
m_footprint = aSymbol->GetFootprintFieldText( true, &aSheetPath, false );
|
m_footprint = aSymbol->GetFootprintFieldText( true, &aSheetPath, false );
|
||||||
m_sheetPath = aSheetPath;
|
m_sheetPath = aSheetPath;
|
||||||
|
|
|
@ -80,7 +80,6 @@ public:
|
||||||
m_sheetPath()
|
m_sheetPath()
|
||||||
{
|
{
|
||||||
m_rootSymbol = nullptr;
|
m_rootSymbol = nullptr;
|
||||||
m_libPart = nullptr;
|
|
||||||
m_unit = 0;
|
m_unit = 0;
|
||||||
m_isNew = false;
|
m_isNew = false;
|
||||||
m_numRef = 0;
|
m_numRef = 0;
|
||||||
|
@ -88,11 +87,11 @@ public:
|
||||||
m_sheetNum = 0;
|
m_sheetNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol, const SCH_SHEET_PATH& aSheetPath );
|
SCH_REFERENCE( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH& aSheetPath );
|
||||||
|
|
||||||
SCH_SYMBOL* GetSymbol() const { return m_rootSymbol; }
|
SCH_SYMBOL* GetSymbol() const { return m_rootSymbol; }
|
||||||
|
|
||||||
LIB_SYMBOL* GetLibPart() const { return m_libPart; }
|
LIB_SYMBOL* GetLibPart() const { return m_rootSymbol->GetLibSymbolRef().get(); }
|
||||||
|
|
||||||
const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
|
const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
|
||||||
|
|
||||||
|
@ -226,8 +225,8 @@ public:
|
||||||
|
|
||||||
bool IsUnitsLocked()
|
bool IsUnitsLocked()
|
||||||
{
|
{
|
||||||
if( m_libPart )
|
if( GetLibPart() )
|
||||||
return m_libPart->UnitsLocked();
|
return GetLibPart()->UnitsLocked();
|
||||||
else
|
else
|
||||||
return true; // Assume units locked when we don't have a library
|
return true; // Assume units locked when we don't have a library
|
||||||
}
|
}
|
||||||
|
@ -238,7 +237,6 @@ private:
|
||||||
/// Symbol reference prefix, without number (for IC1, this is IC) )
|
/// Symbol reference prefix, without number (for IC1, this is IC) )
|
||||||
wxString m_ref; // it's private, use the accessors please
|
wxString m_ref; // it's private, use the accessors please
|
||||||
SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object.
|
SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object.
|
||||||
LIB_SYMBOL* m_libPart; ///< The source symbol from a library.
|
|
||||||
VECTOR2I m_symbolPos; ///< The physical position of the symbol in schematic
|
VECTOR2I 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 symbol with multiple parts
|
int m_unit; ///< The unit number for symbol with multiple parts
|
||||||
|
|
|
@ -397,11 +397,9 @@ void SCH_SHEET_PATH::AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_SYMBOL*
|
||||||
// affects power symbols.
|
// affects power symbols.
|
||||||
if( aIncludePowerSymbols || aSymbol->GetRef( this )[0] != wxT( '#' ) )
|
if( aIncludePowerSymbols || aSymbol->GetRef( this )[0] != wxT( '#' ) )
|
||||||
{
|
{
|
||||||
LIB_SYMBOL* symbol = aSymbol->GetLibSymbolRef().get();
|
if( aSymbol->GetLibSymbolRef() || aForceIncludeOrphanSymbols )
|
||||||
|
|
||||||
if( symbol || aForceIncludeOrphanSymbols )
|
|
||||||
{
|
{
|
||||||
SCH_REFERENCE schReference( aSymbol, symbol, *this );
|
SCH_REFERENCE schReference( aSymbol, *this );
|
||||||
|
|
||||||
schReference.SetSheetNumber( m_virtualPageNumber );
|
schReference.SetSheetNumber( m_virtualPageNumber );
|
||||||
aReferences.AddItem( schReference );
|
aReferences.AddItem( schReference );
|
||||||
|
@ -434,7 +432,7 @@ void SCH_SHEET_PATH::AppendMultiUnitSymbol( SCH_MULTI_UNIT_REFERENCE_MAP& aRefLi
|
||||||
|
|
||||||
if( symbol && symbol->GetUnitCount() > 1 )
|
if( symbol && symbol->GetUnitCount() > 1 )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE schReference = SCH_REFERENCE( aSymbol, symbol, *this );
|
SCH_REFERENCE schReference = SCH_REFERENCE( aSymbol, *this );
|
||||||
schReference.SetSheetNumber( m_virtualPageNumber );
|
schReference.SetSheetNumber( m_virtualPageNumber );
|
||||||
wxString reference_str = schReference.GetRef();
|
wxString reference_str = schReference.GetRef();
|
||||||
|
|
||||||
|
@ -909,7 +907,7 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
||||||
|
|
||||||
if( libSymbol && libSymbol->IsPower() )
|
if( libSymbol && libSymbol->IsPower() )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE schReference( symbol, libSymbol, sheet );
|
SCH_REFERENCE schReference( symbol, sheet );
|
||||||
references.AddItem( schReference );
|
references.AddItem( schReference );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||||
// Then we need to annotate all instances by sheet
|
// Then we need to annotate all instances by sheet
|
||||||
for( SCH_SHEET_PATH& instance : newInstances )
|
for( SCH_SHEET_PATH& instance : newInstances )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE newReference( symbol, symbol->GetLibSymbolRef().get(), instance );
|
SCH_REFERENCE newReference( symbol, instance );
|
||||||
SCH_REFERENCE_LIST refs;
|
SCH_REFERENCE_LIST refs;
|
||||||
refs.AddItem( newReference );
|
refs.AddItem( newReference );
|
||||||
|
|
||||||
|
@ -373,8 +373,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||||
annotate();
|
annotate();
|
||||||
|
|
||||||
// Update the list of references for the next symbol placement.
|
// Update the list of references for the next symbol placement.
|
||||||
SCH_REFERENCE placedSymbolReference( symbol, symbol->GetLibSymbolRef().get(),
|
SCH_REFERENCE placedSymbolReference( symbol, m_frame->GetCurrentSheet() );
|
||||||
m_frame->GetCurrentSheet() );
|
|
||||||
existingRefs.AddItem( placedSymbolReference );
|
existingRefs.AddItem( placedSymbolReference );
|
||||||
existingRefs.SortByReferenceOnly();
|
existingRefs.SortByReferenceOnly();
|
||||||
|
|
||||||
|
@ -436,9 +435,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||||
annotate();
|
annotate();
|
||||||
|
|
||||||
// Update the list of references for the next symbol placement.
|
// Update the list of references for the next symbol placement.
|
||||||
SCH_REFERENCE placedSymbolReference( symbol,
|
SCH_REFERENCE placedSymbolReference( symbol, m_frame->GetCurrentSheet() );
|
||||||
symbol->GetLibSymbolRef().get(),
|
|
||||||
m_frame->GetCurrentSheet() );
|
|
||||||
existingRefs.AddItem( placedSymbolReference );
|
existingRefs.AddItem( placedSymbolReference );
|
||||||
existingRefs.SortByReferenceOnly();
|
existingRefs.SortByReferenceOnly();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1809,7 +1809,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
||||||
// Ignore symbols from a non-existant library.
|
// Ignore symbols from a non-existant library.
|
||||||
if( libSymbol )
|
if( libSymbol )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE schReference( symbol, libSymbol, sheetPath );
|
SCH_REFERENCE schReference( symbol, sheetPath );
|
||||||
schReference.SetSheetNumber( sheetPath.GetVirtualPageNumber() );
|
schReference.SetSheetNumber( sheetPath.GetVirtualPageNumber() );
|
||||||
pastedSymbols[sheetPath].AddItem( schReference );
|
pastedSymbols[sheetPath].AddItem( schReference );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue