From bf051b5c41a5dce56a26afc2bd1e39575bf6bdbb Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Mon, 8 Apr 2019 21:54:41 -0400 Subject: [PATCH] Cache InNetlist status for components --- eeschema/sch_component.cpp | 7 +++++-- eeschema/sch_component.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 134a0d8488..55f05a7928 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -217,6 +217,7 @@ void SCH_COMPONENT::Init( const wxPoint& pos ) } 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 ) 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 { - SCH_FIELD* rf = GetField( REFERENCE ); - return ! rf->GetText().StartsWith( wxT( "#" ) ); + return m_isInNetlist; } diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 34b939fbf4..9a102917fa 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -100,6 +100,8 @@ private: 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 * for hierarchical sheets that reference the same schematic. The format for the path