Cache InNetlist status for components

This commit is contained in:
Jon Evans 2019-04-08 21:54:41 -04:00
parent 94ba1bcb87
commit bf051b5c41
2 changed files with 7 additions and 2 deletions

View File

@ -217,6 +217,7 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
} }
m_prefix = wxString( wxT( "U" ) ); m_prefix = wxString( wxT( "U" ) );
m_isInNetlist = true;
} }
@ -690,6 +691,9 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
if( m_prefix != prefix ) if( m_prefix != prefix )
m_prefix = prefix; m_prefix = prefix;
// Power components have references starting with # and are not included in netlists
m_isInNetlist = ! ref.StartsWith( wxT( "#" ) );
} }
@ -1817,8 +1821,7 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
bool SCH_COMPONENT::IsInNetlist() const bool SCH_COMPONENT::IsInNetlist() const
{ {
SCH_FIELD* rf = GetField( REFERENCE ); return m_isInNetlist;
return ! rf->GetText().StartsWith( wxT( "#" ) );
} }

View File

@ -100,6 +100,8 @@ private:
AUTOPLACED m_fieldsAutoplaced; ///< indicates status of field autoplacement AUTOPLACED m_fieldsAutoplaced; ///< indicates status of field autoplacement
bool m_isInNetlist; ///< True if the component should appear in the netlist
/** /**
* Defines the hierarchical path and reference of the component. This allows support * Defines the hierarchical path and reference of the component. This allows support
* for hierarchical sheets that reference the same schematic. The format for the path * for hierarchical sheets that reference the same schematic. The format for the path