Count pins instead of using netcount as a proxy.

Fixes: lp:1703155
* https://bugs.launchpad.net/kicad/+bug/1703155
This commit is contained in:
Jeff Young 2018-03-26 19:55:59 +01:00
parent ca4e4aead4
commit 778a3a4777
4 changed files with 36 additions and 5 deletions

View File

@ -676,7 +676,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
msg.Empty();
if( component )
msg = wxString::Format( wxT( "%i" ), component->GetNetCount() );
msg = wxString::Format( wxT( "%i" ), component->GetPinCount() );
if( !filters.IsEmpty() )
filters += wxT( ", " );

View File

@ -140,7 +140,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
filter.FilterByFootprintFilters( aComponent->GetFootprintFilters() );
if( aFilterType & FILTERING_BY_PIN_COUNT && aComponent )
filter.FilterByPinCount( aComponent->GetNetCount() );
filter.FilterByPinCount( aComponent->GetPinCount() );
if( aFilterType & FILTERING_BY_LIBRARY )
filter.FilterByLibrary( aLibName );

View File

@ -407,6 +407,7 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
wxString libPartName;
wxArrayString footprintFilters;
wxArrayString aliases;
int pinCount = 0;
// The last token read was libpart, so read the next token
while( (token = NextTok()) != T_RIGHT )
@ -442,7 +443,6 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
footprintFilters.Add( FROM_UTF8( CurText() ) );
NeedRIGHT();
}
break;
case T_aliases:
@ -459,6 +459,22 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
NeedRIGHT();
}
break;
case T_pins:
while( (token = NextTok()) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();
if( token != T_pin )
Expecting( T_pin );
pinCount++;
skipCurrent();
}
break;
default:
// Skip not used data (i.e all other tokens)
skipCurrent();
@ -472,12 +488,18 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
component = m_netlist->GetComponent( i );
if( component->IsLibSource( libName, libPartName ) )
{
component->SetFootprintFilters( footprintFilters );
component->SetPinCount( pinCount );
}
for( unsigned jj = 0; jj < aliases.GetCount(); jj++ )
{
if( component->IsLibSource( libName, aliases[jj] ) )
{
component->SetFootprintFilters( footprintFilters );
component->SetPinCount( pinCount );
}
}
}

View File

@ -84,6 +84,7 @@ class COMPONENT
{
COMPONENT_NETS m_nets;
wxArrayString m_footprintFilters; ///< Footprint filters found in netlist.
int m_pinCount; ///< Number of pins found in netlist.
wxString m_reference; ///< The component reference designator found in netlist.
wxString m_value; ///< The component value found in netlist.
@ -121,6 +122,7 @@ public:
m_fpid = aFPID;
m_reference = aReference;
m_value = aValue;
m_pinCount = 0;
m_timeStamp = aTimeStamp;
m_footprintChanged = false;
}
@ -161,11 +163,11 @@ public:
m_altFpid = aFPID;
}
const LIB_ID& GetFPID() const { return m_fpid; }
const LIB_ID& GetFPID() const { return m_fpid; }
const LIB_ID& GetAltFPID() const { return m_altFpid; }
const wxString& GetTimeStamp() const { return m_timeStamp; }
const wxString& GetTimeStamp() const { return m_timeStamp; }
void SetFootprintFilters( const wxArrayString& aFilterList )
{
@ -174,6 +176,13 @@ public:
const wxArrayString& GetFootprintFilters() const { return m_footprintFilters; }
void SetPinCount( int aPinCount )
{
m_pinCount = aPinCount;
}
int GetPinCount() const { return m_pinCount; }
MODULE* GetModule( bool aRelease = false )
{
return ( aRelease ) ? m_footprint.release() : m_footprint.get();