From aad54ec406d9fe7de74a730b4afe778668e3c9c4 Mon Sep 17 00:00:00 2001 From: Joe Ferner Date: Thu, 15 Mar 2012 14:20:22 -0400 Subject: [PATCH] Added a toolbar button to cvpcb to filter by pin/pad count. --- bitmaps_png/CMakeLists.txt | 1 + .../cpp_26/module_pin_filtered_list.cpp | 97 +++++++++++++++++++ .../sources/module_pin_filtered_list.svg | 31 ++++++ common/footprint_info.cpp | 3 + cvpcb/class_footprints_listbox.cpp | 30 ++++++ cvpcb/cvframe.cpp | 36 ++++++- cvpcb/cvpcb_id.h | 1 + cvpcb/cvstruct.h | 2 + cvpcb/tool_cvpcb.cpp | 12 ++- include/bitmaps.h | 1 + include/footprint_info.h | 2 + pcbnew/netlist_reader.h | 7 +- pcbnew/netlist_reader_firstformat.cpp | 12 ++- 13 files changed, 223 insertions(+), 12 deletions(-) create mode 100644 bitmaps_png/cpp_26/module_pin_filtered_list.cpp create mode 100644 bitmaps_png/sources/module_pin_filtered_list.svg diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 8285dd7f00..0ad6cb0b61 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -332,6 +332,7 @@ set( BMAPS_MID module_filtered_list module_full_list module_options + module_pin_filtered_list module_ratsnest module modview_icon diff --git a/bitmaps_png/cpp_26/module_pin_filtered_list.cpp b/bitmaps_png/cpp_26/module_pin_filtered_list.cpp new file mode 100644 index 0000000000..dcafbab9b2 --- /dev/null +++ b/bitmaps_png/cpp_26/module_pin_filtered_list.cpp @@ -0,0 +1,97 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c, + 0xce, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x07, 0x7f, 0x00, 0x00, 0x07, + 0x7f, 0x01, 0x78, 0x5e, 0xe4, 0x82, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, + 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x00, 0x00, 0x04, 0xb2, 0x49, + 0x44, 0x41, 0x54, 0x48, 0x89, 0xcd, 0x94, 0x7f, 0x4c, 0xd4, 0x65, 0x1c, 0xc7, 0x5f, 0xcf, 0xdd, + 0xf7, 0x7b, 0x77, 0xf1, 0x63, 0xa0, 0x70, 0xa8, 0x0c, 0x54, 0x14, 0x0f, 0x06, 0x83, 0xe2, 0xb4, + 0xdc, 0x95, 0x73, 0x3a, 0xb5, 0xb5, 0x65, 0x1b, 0x6b, 0xcb, 0xa9, 0xad, 0x04, 0x4d, 0x8c, 0xc2, + 0x8d, 0xfe, 0xcb, 0x96, 0xeb, 0x8f, 0x36, 0x37, 0xff, 0x68, 0x68, 0xad, 0x52, 0x37, 0x37, 0x56, + 0xce, 0x35, 0xa5, 0x55, 0x5b, 0x5a, 0x6d, 0xb4, 0xc0, 0x10, 0x31, 0xbb, 0x8b, 0x38, 0x9d, 0x1e, + 0x72, 0x62, 0x8a, 0xc0, 0x09, 0x8a, 0x28, 0xdc, 0x71, 0xf0, 0xc5, 0x4f, 0x7f, 0x70, 0x87, 0x87, + 0x82, 0xc2, 0xd6, 0x1f, 0xbd, 0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0xe6, 0x50, 0x6d, 0x6d, 0x6d, 0x00, 0xe0, + 0x5f, 0x6d, 0xdb, 0xe2, 0x7f, 0x13, 0xa4, 0x85, 0xd4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE module_pin_filtered_list_xpm[1] = {{ png, sizeof( png ), "module_pin_filtered_list_xpm" }}; + +//EOF diff --git a/bitmaps_png/sources/module_pin_filtered_list.svg b/bitmaps_png/sources/module_pin_filtered_list.svg new file mode 100644 index 0000000000..6363f781fa --- /dev/null +++ b/bitmaps_png/sources/module_pin_filtered_list.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 0907ca81a1..7e4797fa73 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -117,6 +117,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames ) if( strnicmp( line, "$EndMODULE", 10 ) == 0 ) break; + if( strnicmp( line, "$PAD", 4 ) == 0 ) + ItemLib->m_padCount++; + int id = ((line[0] & 0xFF) << 8) + (line[1] & 0xFF); switch( id ) { diff --git a/cvpcb/class_footprints_listbox.cpp b/cvpcb/class_footprints_listbox.cpp index e0dcab09bb..35b6e60fa8 100644 --- a/cvpcb/class_footprints_listbox.cpp +++ b/cvpcb/class_footprints_listbox.cpp @@ -173,6 +173,36 @@ void FOOTPRINTS_LISTBOX::SetFootprintFilteredList( COMPONENT_INFO* Component, Refresh(); } +void FOOTPRINTS_LISTBOX::SetFootprintFilteredByPinCount( COMPONENT_INFO* Component, + FOOTPRINT_LIST& list ) { + wxString msg; + int OldSelection = GetSelection(); + bool HasItem = false; + + m_FilteredFootprintList.Clear(); + + for( unsigned ii = 0; ii < list.GetCount(); ii++ ) + { + FOOTPRINT_INFO& footprint = list.GetItem(ii); + + if( Component->m_pinCount == footprint.m_padCount ) { + msg.Printf( wxT( "%3d %s" ), m_FilteredFootprintList.GetCount() + 1, + footprint.m_Module.GetData() ); + m_FilteredFootprintList.Add( msg ); + HasItem = true; + } + } + + if( HasItem ) + SetActiveFootprintList( false ); + else + SetActiveFootprintList( true ); + + if( ( GetCount() == 0 ) || ( OldSelection >= GetCount() ) ) + SetSelection( 0, true ); + + Refresh(); +} /** Set the footprint list. We can have 2 footprint list: * The full footprint list diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 84172ef68e..7c79e642bf 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -84,6 +84,8 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME ) EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile ) EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnSelectFilteringFootprint ) + EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, + CVPCB_MAINFRAME::OnSelectFilteringFootprint ) EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, CVPCB_MAINFRAME::OnSelectFilteringFootprint ) @@ -189,7 +191,15 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME() if( config ) { - int state = m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ); + int state = 0; + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) + { + state = 1; + } + else if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) + { + state = 2; + } config->Write( wxT( FILTERFOOTPRINTKEY ), state ); } @@ -506,7 +516,8 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) #define SELECT_FULL_LIST true int selection = -1; - if( !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) + if( !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) + && !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST )) m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST ); else @@ -521,8 +532,18 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) if( &m_components[ selection ] == NULL ) m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST ); else - m_FootprintList->SetFootprintFilteredList( &m_components[ selection ], - m_footprints ); + { + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) + { + m_FootprintList->SetFootprintFilteredByPinCount( &m_components[ selection ], + m_footprints ); + } + else + { + m_FootprintList->SetFootprintFilteredList( &m_components[ selection ], + m_footprints ); + } + } } } @@ -572,12 +593,19 @@ void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event ) { switch( event.GetId() ) { + case ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST: + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false ); + break; + case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST: m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, false ); break; case ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST: m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, false ); break; default: diff --git a/cvpcb/cvpcb_id.h b/cvpcb/cvpcb_id.h index 48b3f8be7b..c37f6eea29 100644 --- a/cvpcb/cvpcb_id.h +++ b/cvpcb/cvpcb_id.h @@ -30,5 +30,6 @@ enum id_cvpcb_frm ID_CVPCB_SHOW3D_FRAME, ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, + ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE }; diff --git a/cvpcb/cvstruct.h b/cvpcb/cvstruct.h index 4aec946433..c95bfde9fe 100644 --- a/cvpcb/cvstruct.h +++ b/cvpcb/cvstruct.h @@ -54,6 +54,8 @@ public: void SetFootprintFullList( FOOTPRINT_LIST& list ); void SetFootprintFilteredList( COMPONENT_INFO* Component, FOOTPRINT_LIST& list ); + void SetFootprintFilteredByPinCount( COMPONENT_INFO* Component, + FOOTPRINT_LIST& list ); void SetActiveFootprintList( bool FullList, bool Redraw = false ); wxString GetSelectedFootprint(); diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp index 3cf0a857b7..78f3ab6178 100644 --- a/cvpcb/tool_cvpcb.cpp +++ b/cvpcb/tool_cvpcb.cpp @@ -103,6 +103,13 @@ used by Eeschema to fill the footprint field of components)" ) ); _( "Display the filtered footprint list for the current component" ), wxEmptyString ); + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, + KiBitmap( module_pin_filtered_list_xpm ), + wxNullBitmap, + true, NULL, + _( "Display the filtered footprint list by pin count for the current component" ), + wxEmptyString ); + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, KiBitmap( module_full_list_xpm ), wxNullBitmap, true, NULL, @@ -113,8 +120,9 @@ used by Eeschema to fill the footprint field of components)" ) ); { wxString key = wxT( FILTERFOOTPRINTKEY ); int opt = config->Read( key, (long) 1 ); - m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt ); - m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, !opt ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt == 2 ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt == 1 ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, opt == 0 ); } // after adding the buttons to the toolbar, must call Realize() to reflect the changes diff --git a/include/bitmaps.h b/include/bitmaps.h index ad07b108a7..ddd10dceed 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -294,6 +294,7 @@ EXTERN_BITMAP( mod_ratsnest_xpm ) EXTERN_BITMAP( module_check_xpm ) EXTERN_BITMAP( module_edit_xpm ) EXTERN_BITMAP( module_filtered_list_xpm ) +EXTERN_BITMAP( module_pin_filtered_list_xpm ) EXTERN_BITMAP( module_full_list_xpm ) EXTERN_BITMAP( module_options_xpm ) EXTERN_BITMAP( module_ratsnest_xpm ) diff --git a/include/footprint_info.h b/include/footprint_info.h index c23aca99e4..1c4cba02a1 100644 --- a/include/footprint_info.h +++ b/include/footprint_info.h @@ -23,10 +23,12 @@ public: int m_Num; /* Order number in the display list. */ wxString m_Doc; /* Footprint description. */ wxString m_KeyWord; /* Footprint key words. */ + int m_padCount; /* Number of pads */ FOOTPRINT_INFO() { m_Num = 0; + m_padCount = 0; } }; diff --git a/pcbnew/netlist_reader.h b/pcbnew/netlist_reader.h index bc958b8128..c75d58f0f4 100644 --- a/pcbnew/netlist_reader.h +++ b/pcbnew/netlist_reader.h @@ -81,6 +81,7 @@ public: wxString m_TimeStamp; // the schematic full time stamp found in netlist wxString m_Libpart; // the schematic libpart found in netlist wxArrayString m_FootprintFilter; // a footprint filters list found in old format netlist + int m_pinCount; // the number of pins found in the netlist public: COMPONENT_INFO( const wxString& libname, const wxString& cmpname, @@ -91,6 +92,7 @@ public: COMPONENT_INFO( const wxString& libname, m_Reference = cmpname; m_Value = value; m_TimeStamp = timestamp; + m_pinCount = 0; } ~COMPONENT_INFO() { }; @@ -409,9 +411,10 @@ private: * If true: component file *.cmp is used * If false: the netlist only is used * This flag is reset to false if the .cmp file is not found - * @return a reference to the corresponding module on board (NULL if not found) + * @return if aBuildList = true, a reference to the COMPONENT_INFO + * if aBuildList = false, a reference to the corresponding MODULE on board (NULL if not found) */ - MODULE* ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildList ); + void* ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildList ); /** * Function loadNewModules diff --git a/pcbnew/netlist_reader_firstformat.cpp b/pcbnew/netlist_reader_firstformat.cpp index 40a8fb0624..bb481a2bbc 100644 --- a/pcbnew/netlist_reader_firstformat.cpp +++ b/pcbnew/netlist_reader_firstformat.cpp @@ -83,6 +83,7 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) // netlineReader dtor will close aFile FILE_LINE_READER netlineReader( aFile, m_netlistFullName ); + COMPONENT_INFO *curComponent = NULL; while( netlineReader.ReadLine() ) { char* line = StrPurge( netlineReader.Line() ); @@ -116,12 +117,15 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) if( state == 2 ) { - ReadOldFmtNetlistModuleDescr( line, BUILDLIST ); + curComponent = (COMPONENT_INFO*)ReadOldFmtNetlistModuleDescr( line, BUILDLIST ); continue; } if( state >= 3 ) // First pass: pad descriptions are not read here. { + if( curComponent ) { + curComponent->m_pinCount++; + } state--; } } @@ -191,7 +195,7 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) if( state == 2 ) { - m_currModule = ReadOldFmtNetlistModuleDescr( line, READMODULE ); + m_currModule = (MODULE*)ReadOldFmtNetlistModuleDescr( line, READMODULE ); continue; } @@ -216,7 +220,7 @@ bool NETLIST_READER::ReadOldFmtdNetList( FILE* aFile ) * (2 MODB_1) * ) */ -MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildList ) +void* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildList ) { char* text; wxString timeStampPath; // the full time stamp read from netlist @@ -264,7 +268,7 @@ MODULE* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildLi COMPONENT_INFO* cmp_info = new COMPONENT_INFO( footprintName, cmpReference, cmpValue, timeStampPath ); AddModuleInfo( cmp_info ); - return NULL; + return cmp_info; } // search the module loaded on board