From 74339e9a9f69c32f9316fde8c847ff85b75ffcd5 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 25 Feb 2024 13:10:54 +0000 Subject: [PATCH] Support pin count and footprint filters in symbol editor. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17105 --- eeschema/fields_grid_table.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index 826af72877..e9736e41dc 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -84,6 +84,28 @@ static wxString netList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH& aSheetPath ) } +static wxString netList( LIB_SYMBOL* aSymbol ) +{ + /* + * Symbol netlist format: + * pinCount + * fpFilters + */ + wxString netlist; + + netlist << wxString::Format( wxS( "%d\r" ), aSymbol->GetPinCount() ); + + wxArrayString fpFilters = aSymbol->GetFPFilters(); + + if( !fpFilters.IsEmpty() ) + netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE ); + + netlist << wxS( "\r" ); + + return netlist; +} + + template FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame, WX_GRID* aGrid, LIB_SYMBOL* aSymbol ) : @@ -93,6 +115,7 @@ FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a m_parentType( SCH_SYMBOL_T ), m_mandatoryFieldCount( MANDATORY_FIELDS ), m_part( aSymbol ), + m_symbolNetlist( netList( aSymbol ) ), m_fieldNameValidator( FIELD_NAME ), m_referenceValidator( REFERENCE_FIELD ), m_valueValidator( VALUE_FIELD ),