From 0829446c86d4e33bcf129e2ad95a3fef79310637 Mon Sep 17 00:00:00 2001 From: "lukasz.iwaszkiewicz@gmail.com" Date: Wed, 24 Feb 2016 17:30:35 +0100 Subject: [PATCH] Add CvPcb footprint search and filter by name. --- bitmaps_png/CMakeLists.txt | 1 + .../cpp_26/module_name_filtered_list.cpp | 89 ++++++++ .../sources/module_name_filtered_list.svg | 162 +++++++++++++++ cvpcb/CMakeLists.txt | 1 + cvpcb/class_footprints_listbox.cpp | 11 +- cvpcb/cvpcb_id.h | 1 + cvpcb/cvpcb_mainframe.cpp | 193 ++++++++++++------ cvpcb/cvpcb_mainframe.h | 8 + cvpcb/cvstruct.h | 5 +- cvpcb/menubar.cpp | 11 +- cvpcb/tool_cvpcb.cpp | 7 + include/bitmaps.h | 1 + .../mimetypes/application-x-cvpcb-project.png | Bin 2435 -> 0 bytes .../icons/hicolor/scalable/apps/cvpcb.svg | 41 ---- 14 files changed, 420 insertions(+), 111 deletions(-) create mode 100644 bitmaps_png/cpp_26/module_name_filtered_list.cpp create mode 100644 bitmaps_png/sources/module_name_filtered_list.svg delete mode 100644 resources/linux/mime/icons/hicolor/48x48/mimetypes/application-x-cvpcb-project.png delete mode 100644 resources/linux/mime/icons/hicolor/scalable/apps/cvpcb.svg diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index bb556ab703..6ff0471005 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -362,6 +362,7 @@ set( BMAPS_MID module_options module_pin_filtered_list module_library_list + module_name_filtered_list module_ratsnest module modview_icon diff --git a/bitmaps_png/cpp_26/module_name_filtered_list.cpp b/bitmaps_png/cpp_26/module_name_filtered_list.cpp new file mode 100644 index 0000000000..b0c9edb7b5 --- /dev/null +++ b/bitmaps_png/cpp_26/module_name_filtered_list.cpp @@ -0,0 +1,89 @@ + +/* 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, 0x19, 0x08, 0x06, 0x00, 0x00, 0x00, 0x2f, 0xde, 0x3e, + 0x60, 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, 0x0e, 0x58, 0x00, 0x00, 0x0e, + 0x58, 0x01, 0x22, 0x7b, 0x1d, 0x35, 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, 0x38, 0x49, + 0x44, 0x41, 0x54, 0x48, 0x89, 0xbd, 0x95, 0x5f, 0x4c, 0x53, 0x57, 0x1c, 0xc7, 0x3f, 0xe7, 0xde, + 0xde, 0x0b, 0x6d, 0x57, 0xdb, 0x2e, 0x13, 0x44, 0x4c, 0x24, 0x1d, 0x4b, 0xb6, 0x21, 0x13, 0xa4, + 0x31, 0x46, 0x13, 0x33, 0x5d, 0x56, 0x31, 0xd3, 0xac, 0x14, 0x16, 0x12, 0x35, 0xa9, 0x6f, 0x26, + 0x8b, 0x02, 0x99, 0x1b, 0x0f, 0x92, 0x35, 0x3e, 0x62, 0x5c, 0x96, 0x90, 0xb9, 0x3d, 0x90, 0x91, + 0xb0, 0x34, 0x12, 0x1e, 0x8c, 0xe8, 0x83, 0x66, 0xc9, 0x42, 0x48, 0x36, 0x79, 0xd0, 0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0xc1, 0xed, + 0x76, 0x3f, 0x37, 0x4b, 0xb7, 0xdb, 0xcd, 0x81, 0x03, 0x07, 0x36, 0x54, 0x11, 0x80, 0x69, 0x9a, + 0xdc, 0xbe, 0x7d, 0x1b, 0x45, 0x08, 0x71, 0x2b, 0x10, 0x08, 0x18, 0x6b, 0xed, 0x9a, 0xe7, 0x61, + 0x71, 0x71, 0x91, 0x50, 0x28, 0xc4, 0xa9, 0x53, 0xa7, 0x98, 0x9c, 0x9c, 0x5c, 0x37, 0x56, 0x01, + 0x8c, 0x17, 0x56, 0x28, 0x80, 0x69, 0x9a, 0xc4, 0x62, 0x31, 0x4e, 0x9e, 0x3c, 0x49, 0x4f, 0x4f, + 0x8f, 0xe5, 0x2c, 0x3d, 0x2b, 0x94, 0x87, 0x61, 0x18, 0x4c, 0x4c, 0x4c, 0x58, 0x5a, 0x22, 0x91, + 0xc8, 0x13, 0xce, 0xcc, 0xcc, 0x60, 0x9a, 0x66, 0x3e, 0xde, 0x6e, 0xb7, 0x13, 0x8d, 0x46, 0x09, + 0x06, 0x83, 0xe4, 0x72, 0x39, 0x7a, 0x7a, 0x7a, 0x38, 0x71, 0xe2, 0x04, 0xa3, 0xa3, 0xa3, 0xab, + 0x84, 0x2c, 0x37, 0xc3, 0xe8, 0xe8, 0x28, 0x17, 0xbf, 0xf9, 0x82, 0xec, 0xca, 0x73, 0xb5, 0x24, + 0x29, 0xd7, 0xb6, 0xf0, 0xd5, 0x85, 0x2e, 0xc6, 0xc7, 0xc7, 0xe9, 0xfe, 0xee, 0x5b, 0x76, 0x55, + 0xd7, 0x58, 0x08, 0x5c, 0x2e, 0x17, 0xed, 0xed, 0xed, 0x1c, 0x3c, 0x78, 0x90, 0xce, 0xce, 0x4e, + 0xa6, 0xa7, 0xa7, 0x39, 0x7d, 0xfa, 0x34, 0xb5, 0xb5, 0xb5, 0x5c, 0xba, 0x74, 0xc9, 0x5a, 0x51, + 0x2a, 0x95, 0x22, 0x1e, 0x8f, 0x33, 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 0x90, 0xd7, + 0xeb, 0xe5, 0xdc, 0xb9, 0x73, 0x94, 0x94, 0x94, 0xb0, 0x7b, 0xf7, 0xee, 0x75, 0x63, 0x2d, 0x42, + 0x8a, 0xa2, 0xa4, 0xcb, 0xee, 0xbb, 0xed, 0x47, 0xbf, 0xde, 0x39, 0x0f, 0x20, 0x4c, 0x14, 0x45, + 0x8a, 0xe5, 0xbe, 0x10, 0x29, 0xd7, 0x5c, 0xb1, 0xd3, 0xb6, 0xa4, 0x5a, 0x08, 0x8e, 0x1c, 0x39, + 0xb2, 0xa1, 0xa4, 0x56, 0x2d, 0x6c, 0x30, 0x18, 0xf4, 0x38, 0x1c, 0x8e, 0xbc, 0x5d, 0xd7, 0xf5, + 0xc5, 0xde, 0xde, 0xde, 0x34, 0x40, 0x47, 0x47, 0xc7, 0x5e, 0x5d, 0xd7, 0x6f, 0x15, 0xbe, 0x61, + 0x1b, 0x81, 0xa2, 0x28, 0x0b, 0x7f, 0x01, 0x15, 0x0c, 0xa7, 0xd1, 0x9f, 0xd3, 0xfe, 0xa7, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE module_name_filtered_list_xpm[1] = {{ png, sizeof( png ), "module_name_filtered_list_xpm" }}; + +//EOF diff --git a/bitmaps_png/sources/module_name_filtered_list.svg b/bitmaps_png/sources/module_name_filtered_list.svg new file mode 100644 index 0000000000..ffbd12c03a --- /dev/null +++ b/bitmaps_png/sources/module_name_filtered_list.svg @@ -0,0 +1,162 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 90430b1809..e2a9878c54 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -137,6 +137,7 @@ add_library( cvpcb_kiface MODULE ${CVPCB_SRCS} ${CVPCB_DIALOGS} ) + set_target_properties( cvpcb_kiface PROPERTIES OUTPUT_NAME cvpcb PREFIX ${KIFACE_PREFIX} diff --git a/cvpcb/class_footprints_listbox.cpp b/cvpcb/class_footprints_listbox.cpp index 7d2414f3e9..b2db63422a 100644 --- a/cvpcb/class_footprints_listbox.cpp +++ b/cvpcb/class_footprints_listbox.cpp @@ -127,7 +127,7 @@ void FOOTPRINTS_LISTBOX::SetSelection( int index, bool State ) void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, - COMPONENT* aComponent, int aFilterType ) + COMPONENT* aComponent, const wxString &footPrintName, int aFilterType ) { wxArrayString newList; wxString msg; @@ -159,6 +159,15 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a && aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() ) continue; + wxString itemsName = aList.GetItem( ii ).GetNickname().Lower () + + aList.GetItem (ii).GetFootprintName().Lower (); + + if( (aFilterType & BY_NAME) && !footPrintName.IsEmpty() + && itemsName.Find (footPrintName.Lower ()) == wxNOT_FOUND) + { + continue; + } + msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetFootprintName() ) ); diff --git a/cvpcb/cvpcb_id.h b/cvpcb/cvpcb_id.h index 57a2fee849..9de30e40b9 100644 --- a/cvpcb/cvpcb_id.h +++ b/cvpcb/cvpcb_id.h @@ -53,6 +53,7 @@ enum id_cvpcb_frm ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, + ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, ID_CVPCB_LIBRARY_LIST, ID_CVPCB_EQUFILES_LIST_EDIT, diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 4b3e4d0a00..ba0c8b0f37 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -67,6 +67,7 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER ) EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp ) EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout ) EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile ) + EVT_MENU( ID_FIND_ITEMS, CVPCB_MAINFRAME::OnMenuSearch ) EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths ) EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave ) EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList ) @@ -87,6 +88,8 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER ) CVPCB_MAINFRAME::OnSelectFilteringFootprint ) EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, CVPCB_MAINFRAME::OnSelectFilteringFootprint ) + EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, + CVPCB_MAINFRAME::OnToolbarSearch ) // Frame events EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow ) @@ -223,6 +226,9 @@ void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg ) if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) state |= FOOTPRINTS_LISTBOX::BY_LIBRARY; +// if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) ) +// state |= FOOTPRINTS_LISTBOX::BY_NAME; + aCfg->Write( wxT( FILTERFOOTPRINTKEY ), state ); } @@ -511,75 +517,120 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) return; wxString libraryName; - COMPONENT* component = NULL; - int filter = FOOTPRINTS_LISTBOX::UNFILTERED; - - if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) - filter |= FOOTPRINTS_LISTBOX::BY_COMPONENT; - - if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) - filter |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT; - - if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) - filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY; - - component = GetSelectedComponent(); + COMPONENT* component = GetSelectedComponent(); + int filter = getFilterType (); libraryName = m_libListBox->GetSelectedLibrary(); - m_footprintListBox->SetFootprints( m_footprints, libraryName, component, filter ); - - // Tell AuiMgr that objects are changed ! - if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized - // (could be not the case when starting CvPcb - m_auimgr.Update(); - - if( component == NULL ) - return; - - // Preview of the already assigned footprint. - // Find the footprint that was already chosen for this component and select it, - // but only if the selection is made from the component list or the library list. - // If the selection is made from the footprint list, do not change the current - // selected footprint. - if( FindFocus() == m_compListBox || FindFocus() == m_libListBox ) - { - wxString module = FROM_UTF8( component->GetFPID().Format().c_str() ); - - bool found = false; - - for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ ) - { - wxString footprintName; - wxString msg = m_footprintListBox->OnGetItemText( ii, 0 ); - msg.Trim( true ); - msg.Trim( false ); - footprintName = msg.AfterFirst( wxChar( ' ' ) ); - - if( module.Cmp( footprintName ) == 0 ) - { - m_footprintListBox->SetSelection( ii, true ); - found = true; - break; - } - } - - if( !found ) - { - int ii = m_footprintListBox->GetSelection(); - - if ( ii >= 0 ) - m_footprintListBox->SetSelection( ii, false ); - - if( GetFootprintViewerFrame() ) - { - CreateScreenCmp(); - } - } - } - - SendMessageToEESCHEMA(); - DisplayStatus(); + m_footprintListBox->SetFootprints( m_footprints, libraryName, component, m_currentSearch, filter); + RefreshAfterComponentSearch (component); } +void CVPCB_MAINFRAME::OnToolbarSearch( wxCommandEvent& aEvent ) +{ + if( m_skipComponentSelect ) + return; + + if(m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) ) { + SearchDialogAndStore (); + } + else { + m_currentSearch = ""; + } + + OnSelectFilteringFootprint (aEvent); +} + +void CVPCB_MAINFRAME::OnMenuSearch( wxCommandEvent& aEvent ) +{ + if( m_skipComponentSelect ) + return; + + SearchDialogAndStore (); + OnSelectFilteringFootprint (aEvent); +} + +void CVPCB_MAINFRAME::SearchDialogAndStore () +{ + wxTextEntryDialog myDialog (this, _ ("Find footprint"), _ ("Find"), ""); + if (myDialog.ShowModal () == wxID_OK) { + m_currentSearch = myDialog.GetValue (); + } + + m_mainToolBar->ToggleTool ( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, !m_currentSearch.empty ()); +} + +int CVPCB_MAINFRAME::getFilterType () +{ + int filter = FOOTPRINTS_LISTBOX::UNFILTERED; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) + filter |= FOOTPRINTS_LISTBOX::BY_COMPONENT; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) + filter |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) + filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME) ) + filter |= FOOTPRINTS_LISTBOX::BY_NAME; + + return filter; +} + +void CVPCB_MAINFRAME::RefreshAfterComponentSearch (COMPONENT* component) +{ + // Tell AuiMgr that objects are changed ! + if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized + // (could be not the case when starting CvPcb + m_auimgr.Update(); + + if( component == NULL ) + return; + + // Preview of the already assigned footprint. + // Find the footprint that was already chosen for this component and select it, + // but only if the selection is made from the component list or the library list. + // If the selection is made from the footprint list, do not change the current + // selected footprint. + if( FindFocus() == m_compListBox || FindFocus() == m_libListBox ) + { + wxString module = FROM_UTF8( component->GetFPID().Format().c_str() ); + + bool found = false; + + for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ ) + { + wxString footprintName; + wxString msg = m_footprintListBox->OnGetItemText( ii, 0 ); + msg.Trim( true ); + msg.Trim( false ); + footprintName = msg.AfterFirst( wxChar( ' ' ) ); + + if( module.Cmp( footprintName ) == 0 ) + { + m_footprintListBox->SetSelection( ii, true ); + found = true; + break; + } + } + + if( !found ) + { + int ii = m_footprintListBox->GetSelection(); + + if ( ii >= 0 ) + m_footprintListBox->SetSelection( ii, false ); + + if( GetFootprintViewerFrame() ) + { + CreateScreenCmp(); + } + } + } + + SendMessageToEESCHEMA(); + DisplayStatus(); +} void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event ) { @@ -665,6 +716,14 @@ void CVPCB_MAINFRAME::DisplayStatus() filters += _( "library" ); } + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME ) ) + { + if( !filters.IsEmpty() ) + filters += wxT( "+" ); + + filters += _( "name" ); + } + if( filters.IsEmpty() ) msg = _( "No filtering" ); else @@ -822,7 +881,7 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX() } m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL, - FOOTPRINTS_LISTBOX::UNFILTERED ); + wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED ); DisplayStatus(); } diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index 5261350df9..0c9f90f9b8 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -58,6 +58,7 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER friend struct CV::IFACE; wxArrayString m_footprintListEntries; + wxString m_currentSearch; public: bool m_KeepCvpcbOpen; @@ -102,6 +103,8 @@ public: * * Updates the footprint shown in footprint display window (if opened) */ void OnSelectComponent( wxListEvent& event ); + void OnToolbarSearch (wxCommandEvent& aEvent); + void OnMenuSearch (wxCommandEvent& aEvent); /** * Function OnEditFootrprintLibraryTable @@ -293,6 +296,11 @@ private: */ int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL ); + void RefreshAfterComponentSearch (COMPONENT* component); + int getFilterType (); + void SearchDialogAndStore (); + + DECLARE_EVENT_TABLE() }; diff --git a/cvpcb/cvstruct.h b/cvpcb/cvstruct.h index 90eb4ef4c0..0ebf8d9d2b 100644 --- a/cvpcb/cvstruct.h +++ b/cvpcb/cvstruct.h @@ -96,6 +96,7 @@ public: BY_COMPONENT = 0x0001, BY_PIN_COUNT = 0x0002, BY_LIBRARY = 0x0004, + BY_NAME = 0x0008, }; FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id, @@ -119,7 +120,9 @@ public: * @param aFilterType defines the criteria to filter \a aList. */ void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, - COMPONENT* aComponent, int aFilterType ); + COMPONENT* aComponent, const wxString &footPrintName, int aFilterType ); + +// void searchByName (FOOTPRINT_LIST& aList, const wxString &footPrintName); wxString GetSelectedFootprint(); diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index eae2ce37af..9101ebe418 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -78,7 +78,15 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() _( "&Close" ), _( "Close CvPcb" ), KiBitmap( exit_xpm ) ); - // Menu Preferences: + // Find menu + wxMenu* findMenu = new wxMenu; + + AddMenuItem( findMenu, ID_FIND_ITEMS, + _( "&Find footprint\tCtrl+F" ), + _( "Find footprint by its name\nor filter the footprint list by the partial name" ), + KiBitmap( info_xpm )); + + // Preferences Menu : wxMenu* preferencesMenu = new wxMenu; AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT, @@ -139,6 +147,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // Create the menubar and append all submenus menuBar->Append( filesMenu, _( "&Save" ) ); + menuBar->Append( findMenu, _( "&Find" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp index b53f9c9bd2..28d6c0112a 100644 --- a/cvpcb/tool_cvpcb.cpp +++ b/cvpcb/tool_cvpcb.cpp @@ -105,11 +105,18 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() _( "Filter footprint list by library" ), wxEmptyString ); + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, + KiBitmap( module_name_filtered_list_xpm ), + wxNullBitmap, true, NULL, + _( "Find footprint by its name\nor filter the footprint list by the partial name\n" + "Ctrl+F to call the dialog to enter the filter string" ), + wxEmptyString ); if( config ) { wxString key = wxT( FILTERFOOTPRINTKEY ); int opt = config->Read( key, (long) 1 ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, opt & 8 ); m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, opt & 4 ); m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt & 2 ); m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt & 1 ); diff --git a/include/bitmaps.h b/include/bitmaps.h index b00b533c0e..cce4b0784f 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -328,6 +328,7 @@ EXTERN_BITMAP( module_wizard_xpm ) EXTERN_BITMAP( module_filtered_list_xpm ) EXTERN_BITMAP( module_pin_filtered_list_xpm ) EXTERN_BITMAP( module_library_list_xpm ) +EXTERN_BITMAP( module_name_filtered_list_xpm ) EXTERN_BITMAP( module_full_list_xpm ) EXTERN_BITMAP( module_options_xpm ) EXTERN_BITMAP( module_ratsnest_xpm ) diff --git a/resources/linux/mime/icons/hicolor/48x48/mimetypes/application-x-cvpcb-project.png b/resources/linux/mime/icons/hicolor/48x48/mimetypes/application-x-cvpcb-project.png deleted file mode 100644 index 56bba832ee7d1672d8569116bf3d094e3bafee7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2435 zcmV-}34Hd6P)?k%K~z|U?U{LS)zuZpKj+@xdoK%lP)E)i*#{;akOfQU>5{s^=K8-Xn(5-$KICflvRpMgcH+SIE6s(M8l-~cZGjX*hIFJfB) zd;lB*Zs=8h)d3 zcoZmA)j2)oV|tl<#`mWdPZ&EO=fMIS^GD)71{bzHb%EKnz>dzt3}gY%06RrwRtllE zCjIn?lt(~B#P4VDk8Upc)xf^SZ`w4bYQ7w{a8u>c@5+NoUk11vh>FO(WY>wE+>8L$ z0GoRV_bD)3L_(?>xhw>L!dHJh>7kM_#lxuHA8#~1f|>5~M~@N!z6Zns1xkT7;ErU! zqAq;p^$_b!(pL!h>I6i@4k=6@a8*gsT^WAI7ezHD!r=V&cU83!nAXX50dTvj&PaaG z=G+Q(8dwbM0{(fCkXHkzRrNqmxurS>LQl;Zb60WcpuTN;tK(wCsF((B-_+QJ?MEag zZfCf_a$uyYE(N?E;!OlTP9?EaODH@rKRC@VVqJ|3g1AU?H@2SvRzz-A)eS%uFkV%6 zbY+|zq4Pw*JmAwVbkN&u%0rz?9^jfu!Y;3W|mtE!*% z5aPmppoqjq*Vu&)E@2-C+;CO?sH||v@9z2B6~Txg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