diff --git a/common/widgets/search_pane_tab.cpp b/common/widgets/search_pane_tab.cpp index dd6dffeb88..5dccf5b621 100644 --- a/common/widgets/search_pane_tab.cpp +++ b/common/widgets/search_pane_tab.cpp @@ -21,12 +21,15 @@ #include #include #include +#include SEARCH_PANE_LISTVIEW::SEARCH_PANE_LISTVIEW( SEARCH_HANDLER* handler, wxWindow* parent, wxWindowID winid, const wxPoint& pos, const wxSize& size ) : wxListView( parent, winid, pos, size, wxLC_REPORT | wxLC_VIRTUAL ), - m_handler( handler ) + m_handler( handler ), + m_sortCol( -1 ), + m_sortAscending( true ) { SetItemCount( 0 ); @@ -36,6 +39,7 @@ SEARCH_PANE_LISTVIEW::SEARCH_PANE_LISTVIEW( SEARCH_HANDLER* handler, wxWindow* p Bind( wxEVT_LIST_ITEM_ACTIVATED, &SEARCH_PANE_LISTVIEW::OnItemActivated, this ); Bind( wxEVT_LIST_ITEM_FOCUSED, &SEARCH_PANE_LISTVIEW::OnItemSelected, this ); Bind( wxEVT_LIST_ITEM_DESELECTED, &SEARCH_PANE_LISTVIEW::OnItemDeselected, this ); + Bind( wxEVT_LIST_COL_CLICK, &SEARCH_PANE_LISTVIEW::OnColClicked, this ); } @@ -112,6 +116,29 @@ void SEARCH_PANE_LISTVIEW::OnItemDeselected( wxListEvent& aEvent ) } +void SEARCH_PANE_LISTVIEW::OnColClicked( wxListEvent& aEvent ) +{ + if( aEvent.GetColumn() == m_sortCol ) + { + m_sortAscending = !m_sortAscending; + } + else + { + m_sortAscending = true; + m_sortCol = aEvent.GetColumn(); + } + + Sort(); + Refresh(); +} + + +void SEARCH_PANE_LISTVIEW::Sort() +{ + m_handler->Sort( m_sortCol, m_sortAscending ); +} + + void SEARCH_PANE_LISTVIEW::RefreshColumnNames() { Freeze(); @@ -158,6 +185,7 @@ void SEARCH_PANE_TAB::Search( wxString& query ) { int results = m_handler->Search( query ); m_listView->SetItemCount( results ); + m_listView->Sort(); m_listView->Refresh(); } diff --git a/eeschema/widgets/search_handlers.cpp b/eeschema/widgets/search_handlers.cpp index 0a540637ad..7f1adf569b 100644 --- a/eeschema/widgets/search_handlers.cpp +++ b/eeschema/widgets/search_handlers.cpp @@ -30,12 +30,6 @@ #include "search_handlers.h" -SCH_SEARCH_HANDLER::SCH_SEARCH_HANDLER( wxString aName, SCH_EDIT_FRAME* aFrame ) : - SEARCH_HANDLER( aName ), m_frame( aFrame ) -{ -} - - void SCH_SEARCH_HANDLER::ActivateItem( long aItemRow ) { std::vector item = { aItemRow }; @@ -63,14 +57,27 @@ void SCH_SEARCH_HANDLER::FindAll( const std::functionLastScreen()->Items() ) { if( aCollector( item, sheet ) ) - { m_hitlist.push_back( { item, sheet } ); - } } } } +void SCH_SEARCH_HANDLER::Sort( int aCol, bool aAscending ) +{ + std::sort( m_hitlist.begin(), m_hitlist.end(), + [&]( const SCH_SEARCH_HIT& a, const SCH_SEARCH_HIT& b ) -> bool + { + // N.B. To meet the iterator sort conditions, we cannot simply invert the truth + // to get the opposite sort. i.e. ~(ab) + if( aAscending ) + return StrNumCmp( getResultCell( a, aCol ), getResultCell( b, aCol ), true ) < 0; + else + return StrNumCmp( getResultCell( b, aCol ), getResultCell( a, aCol ), true ) < 0; + } ); +} + + void SCH_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) { EDA_ITEMS selectedItems; @@ -161,22 +168,21 @@ int SYMBOL_SEARCH_HANDLER::Search( const wxString& aQuery ) } -wxString SYMBOL_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) +wxString SYMBOL_SEARCH_HANDLER::getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) { - SCH_SEARCH_HIT hit = m_hitlist[aRow]; - SCH_SYMBOL* sym = dynamic_cast( hit.item ); + SCH_SYMBOL*sym = dynamic_cast( aHit.item ); if( !sym ) return wxEmptyString; if( aCol == 0 ) - return sym->GetRef( hit.sheetPath, true ); + return sym->GetRef( aHit.sheetPath, true ); else if( aCol == 1 ) - return sym->GetField( VALUE_FIELD )->GetShownText( hit.sheetPath, false ); + return sym->GetField( VALUE_FIELD )->GetShownText( aHit.sheetPath, false ); else if( aCol == 2 ) - return sym->GetField( FOOTPRINT_FIELD )->GetShownText( hit.sheetPath, false ); + return sym->GetField( FOOTPRINT_FIELD )->GetShownText( aHit.sheetPath, false ); else if( aCol == 3 ) - return hit.sheetPath->GetPageNumber(); + return aHit.sheetPath->GetPageNumber(); else if( aCol == 4 ) return m_frame->MessageTextFromValue( sym->GetPosition().x ); else if( aCol == 5 ) @@ -227,13 +233,11 @@ int TEXT_SEARCH_HANDLER::Search( const wxString& aQuery ) } -wxString TEXT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) +wxString TEXT_SEARCH_HANDLER::getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) { - SCH_SEARCH_HIT hit = m_hitlist[aRow]; - - if( hit.item->Type() == SCH_TEXT_T ) + if( aHit.item->Type() == SCH_TEXT_T ) { - SCH_TEXT* txt = dynamic_cast( hit.item ); + SCH_TEXT* txt = dynamic_cast( aHit.item ); if( !txt ) return wxEmptyString; @@ -243,15 +247,15 @@ wxString TEXT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) else if( aCol == 1 ) return txt->GetShownText( false ); else if( aCol == 2 ) - return hit.sheetPath->GetPageNumber(); + return aHit.sheetPath->GetPageNumber(); else if( aCol == 3 ) return m_frame->MessageTextFromValue( txt->GetPosition().x ); else if( aCol == 4 ) return m_frame->MessageTextFromValue( txt->GetPosition().y ); } - else if( hit.item->Type() == SCH_TEXTBOX_T ) + else if( aHit.item->Type() == SCH_TEXTBOX_T ) { - SCH_TEXTBOX* txt = dynamic_cast( hit.item ); + SCH_TEXTBOX* txt = dynamic_cast( aHit.item ); if( !txt ) return wxEmptyString; @@ -261,7 +265,7 @@ wxString TEXT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) else if( aCol == 1 ) return txt->GetShownText( false ); else if( aCol == 2 ) - return hit.sheetPath->GetPageNumber(); + return aHit.sheetPath->GetPageNumber(); else if( aCol == 3 ) return m_frame->MessageTextFromValue( txt->GetPosition().x ); else if( aCol == 4 ) @@ -317,11 +321,9 @@ int LABEL_SEARCH_HANDLER::Search( const wxString& aQuery ) } -wxString LABEL_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) +wxString LABEL_SEARCH_HANDLER::getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) { - SCH_SEARCH_HIT hit = m_hitlist[aRow]; - - SCH_LABEL_BASE* lbl = dynamic_cast( hit.item ); + SCH_LABEL_BASE* lbl = dynamic_cast( aHit.item ); if( !lbl ) return wxEmptyString; @@ -338,7 +340,7 @@ wxString LABEL_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) else if( aCol == 1 ) return lbl->GetShownText( false ); else if( aCol == 2 ) - return hit.sheetPath->GetPageNumber(); + return aHit.sheetPath->GetPageNumber(); else if( aCol == 3 ) return m_frame->MessageTextFromValue( lbl->GetPosition().x ); else if( aCol == 4 ) diff --git a/eeschema/widgets/search_handlers.h b/eeschema/widgets/search_handlers.h index fc9c7dfb57..725aed8a98 100644 --- a/eeschema/widgets/search_handlers.h +++ b/eeschema/widgets/search_handlers.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,7 +28,6 @@ #include class SCH_ITEM; -class SCH_TEXT; class SCH_EDIT_FRAME; struct SCH_SEARCH_HIT @@ -40,12 +39,25 @@ struct SCH_SEARCH_HIT class SCH_SEARCH_HANDLER : public SEARCH_HANDLER { public: - SCH_SEARCH_HANDLER( wxString aName, SCH_EDIT_FRAME* aFrame ); + SCH_SEARCH_HANDLER( const wxString& aName, SCH_EDIT_FRAME* aFrame ) : + SEARCH_HANDLER( aName ), + m_frame( aFrame ) + {} + void ActivateItem( long aItemRow ) override; + wxString GetResultCell( int aRow, int aCol ) override + { + return getResultCell( m_hitlist[aRow], aCol ); + } + void FindAll( const std::function& aCollector ); + void Sort( int aCol, bool aAscending ) override; void SelectItems( std::vector& aItemRows ) override; +protected: + virtual wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) = 0; + protected: SCH_EDIT_FRAME* m_frame; std::vector m_hitlist; @@ -57,8 +69,9 @@ public: SYMBOL_SEARCH_HANDLER( SCH_EDIT_FRAME* aFrame ); int Search( const wxString& aQuery ) override; - wxString GetResultCell( int aRow, int aCol ) override; +protected: + wxString getResultCell( const SCH_SEARCH_HIT& aHit, int aCol ) override; }; class TEXT_SEARCH_HANDLER : public SCH_SEARCH_HANDLER @@ -66,9 +79,10 @@ class TEXT_SEARCH_HANDLER : public SCH_SEARCH_HANDLER public: TEXT_SEARCH_HANDLER( SCH_EDIT_FRAME* aFrame ); - int Search( const wxString& aQuery ) override; - wxString GetResultCell( int aRow, int aCol ) override; + int Search( const wxString& aQuery ) override; +protected: + wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override; }; class LABEL_SEARCH_HANDLER : public SCH_SEARCH_HANDLER @@ -76,9 +90,10 @@ class LABEL_SEARCH_HANDLER : public SCH_SEARCH_HANDLER public: LABEL_SEARCH_HANDLER( SCH_EDIT_FRAME* aFrame ); - int Search( const wxString& aQuery ) override; - wxString GetResultCell( int aRow, int aCol ) override; + int Search( const wxString& aQuery ) override; +protected: + wxString getResultCell( const SCH_SEARCH_HIT& hit, int aCol ) override; }; #endif diff --git a/include/widgets/search_pane.h b/include/widgets/search_pane.h index 9abf8a4f3f..fde79cd565 100644 --- a/include/widgets/search_pane.h +++ b/include/widgets/search_pane.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -29,8 +29,9 @@ class SEARCH_PANE_TAB; class SEARCH_HANDLER { public: - SEARCH_HANDLER( wxString aName ) : - m_name( aName ) {} + SEARCH_HANDLER( const wxString& aName ) : + m_name( aName ) + {} wxString GetName() const { return m_name; } @@ -38,6 +39,7 @@ public: virtual int Search( const wxString& string ) = 0; virtual wxString GetResultCell( int row, int col ) = 0; + virtual void Sort( int aCol, bool aAscending ) = 0; virtual void SelectItems( std::vector& aItemRows ) {} virtual void ActivateItem( long aItemRow ) {} diff --git a/include/widgets/search_pane_tab.h b/include/widgets/search_pane_tab.h index 713296deb6..275a140511 100644 --- a/include/widgets/search_pane_tab.h +++ b/include/widgets/search_pane_tab.h @@ -40,16 +40,21 @@ public: void RefreshColumnNames(); + void Sort(); + protected: wxString OnGetItemText( long item, long column ) const override; void OnItemSelected( wxListEvent& aEvent ); void OnItemActivated( wxListEvent& aEvent ); void OnItemDeselected( wxListEvent& aEvent ); + void OnColClicked( wxListEvent& aEvent ); void GetSelectRowsList( std::vector& aSelectedList ); private: SEARCH_HANDLER* m_handler; + int m_sortCol; + bool m_sortAscending; }; diff --git a/pcbnew/widgets/search_handlers.cpp b/pcbnew/widgets/search_handlers.cpp index b915f48877..2613055bed 100644 --- a/pcbnew/widgets/search_handlers.cpp +++ b/pcbnew/widgets/search_handlers.cpp @@ -30,12 +30,6 @@ #include "search_handlers.h" -PCB_SEARCH_HANDLER::PCB_SEARCH_HANDLER( wxString aName, PCB_EDIT_FRAME* aFrame ) : - SEARCH_HANDLER( aName ), m_frame( aFrame ) -{ -} - - void PCB_SEARCH_HANDLER::ActivateItem( long aItemRow ) { std::vector item = { aItemRow }; @@ -45,6 +39,40 @@ void PCB_SEARCH_HANDLER::ActivateItem( long aItemRow ) } +void PCB_SEARCH_HANDLER::Sort( int aCol, bool aAscending ) +{ + std::sort( m_hitlist.begin(), m_hitlist.end(), + [&]( BOARD_ITEM* a, BOARD_ITEM* b ) -> bool + { + // N.B. To meet the iterator sort conditions, we cannot simply invert the truth + // to get the opposite sort. i.e. ~(ab) + if( aAscending ) + return StrNumCmp( getResultCell( a, aCol ), getResultCell( b, aCol ), true ) < 0; + else + return StrNumCmp( getResultCell( b, aCol ), getResultCell( a, aCol ), true ) < 0; + } ); +} + + +void PCB_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) +{ + std::vector selectedItems; + + for( long row : aItemRows ) + { + if( row >= 0 && row < (long) m_hitlist.size() ) + selectedItems.push_back( m_hitlist[row] ); + } + + m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + + if( selectedItems.size() ) + m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &selectedItems ); + + m_frame->GetCanvas()->Refresh( false ); +} + + FOOTPRINT_SEARCH_HANDLER::FOOTPRINT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) : PCB_SEARCH_HANDLER( wxT( "Footprints" ), aFrame ) { @@ -81,9 +109,9 @@ int FOOTPRINT_SEARCH_HANDLER::Search( const wxString& aQuery ) } -wxString FOOTPRINT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) +wxString FOOTPRINT_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol ) { - FOOTPRINT* fp = m_hitlist[aRow]; + FOOTPRINT* fp = static_cast( aItem ); if( aCol == 0 ) return fp->GetReference(); @@ -100,31 +128,6 @@ wxString FOOTPRINT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) } -void FOOTPRINT_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) -{ - std::vector selectedItems; - - for( long row : aItemRows ) - { - if( row >= 0 && row < (long) m_hitlist.size() ) - { - FOOTPRINT* fp = m_hitlist[row]; - selectedItems.push_back( fp ); - } - } - - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); - - if( selectedItems.size() ) - { - EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() ); - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &selItems ); - } - - m_frame->GetCanvas()->Refresh( false ); -} - - ZONE_SEARCH_HANDLER::ZONE_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) : PCB_SEARCH_HANDLER( wxT( "Zones" ), aFrame ) { @@ -160,9 +163,9 @@ int ZONE_SEARCH_HANDLER::Search( const wxString& aQuery ) } -wxString ZONE_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) +wxString ZONE_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol ) { - ZONE* zone = m_hitlist[aRow]; + ZONE* zone = static_cast( aItem ); if( aCol == 0 ) return zone->GetZoneName(); @@ -189,31 +192,6 @@ wxString ZONE_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) } -void ZONE_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) -{ - std::vector selectedItems; - - for( long row : aItemRows ) - { - if( row >= 0 && row < (long) m_hitlist.size() ) - { - ZONE* zone = m_hitlist[row]; - selectedItems.push_back( zone ); - } - } - - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); - - if( selectedItems.size() ) - { - EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() ); - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &selItems ); - } - - m_frame->GetCanvas()->Refresh( false ); -} - - TEXT_SEARCH_HANDLER::TEXT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) : PCB_SEARCH_HANDLER( wxT( "Text" ), aFrame ) { @@ -251,60 +229,33 @@ int TEXT_SEARCH_HANDLER::Search( const wxString& aQuery ) } -wxString TEXT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) +wxString TEXT_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol ) { - BOARD_ITEM* text = m_hitlist[aRow]; - if( aCol == 0 ) { - if( PCB_TEXT::ClassOf( text ) ) + if( PCB_TEXT::ClassOf( aItem ) ) return _( "Text" ); - else if( PCB_TEXTBOX::ClassOf( text ) ) + else if( PCB_TEXTBOX::ClassOf( aItem ) ) return _( "Textbox" ); } else if( aCol == 1 ) { - if( PCB_TEXT::ClassOf( text ) ) - return UnescapeString( static_cast( text )->GetText() ); - else if( PCB_TEXTBOX::ClassOf( text ) ) - return UnescapeString( static_cast( text )->GetText() ); + if( PCB_TEXT::ClassOf( aItem ) ) + return UnescapeString( static_cast( aItem )->GetText() ); + else if( PCB_TEXTBOX::ClassOf( aItem ) ) + return UnescapeString( static_cast( aItem )->GetText() ); } if( aCol == 2 ) - return text->GetLayerName(); + return aItem->GetLayerName(); else if( aCol == 3 ) - return m_frame->MessageTextFromValue( text->GetX() ); + return m_frame->MessageTextFromValue( aItem->GetX() ); else if( aCol == 4 ) - return m_frame->MessageTextFromValue( text->GetY() ); + return m_frame->MessageTextFromValue( aItem->GetY() ); return wxEmptyString; } -void TEXT_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) -{ - std::vector selectedItems; - - for( long row : aItemRows ) - { - if( row >= 0 && row < (long) m_hitlist.size() ) - { - BOARD_ITEM* text = m_hitlist[row]; - selectedItems.push_back( text ); - } - } - - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); - - if( selectedItems.size() ) - { - EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() ); - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &selItems ); - } - - m_frame->GetCanvas()->Refresh( false ); -} - - NETS_SEARCH_HANDLER::NETS_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ) : PCB_SEARCH_HANDLER( wxT( "Nets" ), aFrame ) { @@ -335,9 +286,9 @@ int NETS_SEARCH_HANDLER::Search( const wxString& aQuery ) } -wxString NETS_SEARCH_HANDLER::GetResultCell( int aRow, int aCol ) +wxString NETS_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol ) { - NETINFO_ITEM* net = m_hitlist[aRow]; + NETINFO_ITEM* net = static_cast( aItem ); if( net->GetNetCode() == 0 ) { @@ -367,7 +318,7 @@ void NETS_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) { if( row >= 0 && row < (long) m_hitlist.size() ) { - NETINFO_ITEM* net = m_hitlist[row]; + NETINFO_ITEM* net = static_cast( m_hitlist[row] ); ps->SetHighlight( true, net->GetNetCode(), true ); } diff --git a/pcbnew/widgets/search_handlers.h b/pcbnew/widgets/search_handlers.h index afa61cb7db..e559a29ad0 100644 --- a/pcbnew/widgets/search_handlers.h +++ b/pcbnew/widgets/search_handlers.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,20 +26,33 @@ #include -class ZONE; -class FOOTPRINT; -class PCB_TEXT; class PCB_EDIT_FRAME; class PCB_SEARCH_HANDLER : public SEARCH_HANDLER { public: - PCB_SEARCH_HANDLER( wxString aName, PCB_EDIT_FRAME* aFrame ); + PCB_SEARCH_HANDLER( const wxString& aName, PCB_EDIT_FRAME* aFrame ) : + SEARCH_HANDLER( aName ), + m_frame( aFrame ) + {} + + wxString GetResultCell( int aRow, int aCol ) override + { + return getResultCell( m_hitlist[aRow], aCol ); + } + + void Sort( int aCol, bool aAscending ) override; + + void SelectItems( std::vector& aItemRows ) override; void ActivateItem( long aItemRow ) override; protected: - PCB_EDIT_FRAME* m_frame; + virtual wxString getResultCell( BOARD_ITEM* aItem, int aCol ) = 0; + +protected: + PCB_EDIT_FRAME* m_frame; + std::vector m_hitlist; }; @@ -49,11 +62,9 @@ public: FOOTPRINT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ); int Search( const wxString& aQuery ) override; - wxString GetResultCell( int aRow, int aCol ) override; - void SelectItems( std::vector& aItemRows ) override; private: - std::vector m_hitlist; + wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override; }; @@ -62,12 +73,10 @@ class ZONE_SEARCH_HANDLER : public PCB_SEARCH_HANDLER public: ZONE_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ); - int Search( const wxString& aQuery ) override; - wxString GetResultCell( int aRow, int aCol ) override; - void SelectItems( std::vector& aItemRows ) override; + int Search( const wxString& aQuery ) override; private: - std::vector m_hitlist; + wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override; }; @@ -76,12 +85,10 @@ class TEXT_SEARCH_HANDLER : public PCB_SEARCH_HANDLER public: TEXT_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ); - int Search( const wxString& aQuery ) override; - wxString GetResultCell( int aRow, int aCol ) override; - void SelectItems( std::vector& aItemRows ) override; + int Search( const wxString& aQuery ) override; private: - std::vector m_hitlist; + wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override; }; @@ -91,12 +98,11 @@ public: NETS_SEARCH_HANDLER( PCB_EDIT_FRAME* aFrame ); int Search( const wxString& aQuery ) override; - wxString GetResultCell( int aRow, int aCol ) override; - void SelectItems( std::vector& aItemRows ) override; - void ActivateItem( long aItemRow ) override; + void SelectItems( std::vector& aItemRows ) override; + void ActivateItem( long aItemRow ) override; private: - std::vector m_hitlist; + wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override; }; #endif