KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew/widgets/search_handlers.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef SEARCH_HANDLERS_H
21#define SEARCH_HANDLERS_H
22
23#include <widgets/search_pane.h>
24#include <board_statistics.h>
25#include <unordered_map>
26
27class PCB_EDIT_FRAME;
28
29
31{
32public:
33 PCB_SEARCH_HANDLER( const wxString& aName, PCB_EDIT_FRAME* aFrame ) :
34 SEARCH_HANDLER( aName ),
35 m_frame( aFrame )
36 {}
37
38 wxString GetResultCell( int aRow, int aCol ) override;
39
40 void Sort( int aCol, bool aAscending, std::vector<long>* aSelection ) override;
41
42 void SelectItems( std::vector<long>& aItemRows ) override;
43 void ActivateItem( long aItemRow ) override;
44
45protected:
46 virtual wxString getResultCell( BOARD_ITEM* aItem, int aCol ) = 0;
47
48protected:
50 std::vector<BOARD_ITEM*> m_hitlist;
51};
52
53
55{
56public:
58
59 int Search( const wxString& aQuery ) override;
60
61private:
62 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
63};
64
65
67{
68public:
70
71 int Search( const wxString& aQuery ) override;
72
73private:
74 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
75};
76
77
79{
80public:
82
83 int Search( const wxString& aQuery ) override;
84
85private:
86 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
87};
88
89
91{
92public:
94
95 int Search( const wxString& aQuery ) override;
96
97private:
98 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
99};
100
101
103{
104public:
106
107 int Search( const wxString& aQuery ) override;
108 void SelectItems( std::vector<long>& aItemRows ) override;
109 void ActivateItem( long aItemRow ) override;
110
111private:
112 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
113};
114
115
117{
118public:
120
121 int Search( const wxString& aQuery ) override;
122 void SelectItems( std::vector<long>& aItemRows ) override;
123 void ActivateItem( long aItemRow ) override;
124
125private:
126 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
127};
128
129
131{
132public:
134
135 int Search( const wxString& aQuery ) override;
136 void Sort( int aCol, bool aAscending, std::vector<long>* aSelection ) override;
137 void SelectItems( std::vector<long>& aItemRows ) override;
138
139private:
140 wxString getResultCell( BOARD_ITEM* aItem, int aCol ) override;
141
142 wxString cellText( const DRILL_LINE_ITEM& e, int col ) const;
143 bool rowMatchesQuery( const DRILL_LINE_ITEM& e, const wxString& aQuery ) const;
144
145private:
147 {
149 // While a DRILL_ROW will usually represent multiple identical drills/BOARD_ITEMs,
150 // keeping a pointer to one BOARD_ITEM allows use to provide
151 // compatibility with the rest of PCB_SEARCH_HANDLER, and also to allow
152 // some convenience actions to work when there is just a single entry, e.g.
153 // activating the item to show its properties.
155 };
156
157 std::vector<DRILL_ROW> m_drills;
158
159 // This maps the DRILL_ROW.item to the index in m_drills to allow fast lookup
160 std::unordered_map<BOARD_ITEM*, int> m_ptrToDrill;
161
163};
164
165#endif
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:81
wxString cellText(const DRILL_LINE_ITEM &e, int col) const
std::unordered_map< BOARD_ITEM *, int > m_ptrToDrill
void SelectItems(std::vector< long > &aItemRows) override
int Search(const wxString &aQuery) override
bool rowMatchesQuery(const DRILL_LINE_ITEM &e, const wxString &aQuery) const
DRILL_SEARCH_HANDLER(PCB_EDIT_FRAME *aFrame)
void Sort(int aCol, bool aAscending, std::vector< long > *aSelection) override
std::vector< DRILL_ROW > m_drills
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
FOOTPRINT_SEARCH_HANDLER(PCB_EDIT_FRAME *aFrame)
int Search(const wxString &aQuery) override
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
int Search(const wxString &aQuery) override
GROUP_SEARCH_HANDLER(SCH_EDIT_FRAME *aFrame)
void ActivateItem(long aItemRow) override
int Search(const wxString &aQuery) override
NETS_SEARCH_HANDLER(PCB_EDIT_FRAME *aFrame)
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
void SelectItems(std::vector< long > &aItemRows) override
The main frame for Pcbnew.
void ActivateItem(long aItemRow) override
PCB_SEARCH_HANDLER(const wxString &aName, PCB_EDIT_FRAME *aFrame)
wxString GetResultCell(int aRow, int aCol) override
void Sort(int aCol, bool aAscending, std::vector< long > *aSelection) override
void SelectItems(std::vector< long > &aItemRows) override
std::vector< BOARD_ITEM * > m_hitlist
virtual wxString getResultCell(BOARD_ITEM *aItem, int aCol)=0
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
RATSNEST_SEARCH_HANDLER(PCB_EDIT_FRAME *aFrame)
int Search(const wxString &aQuery) override
void SelectItems(std::vector< long > &aItemRows) override
void ActivateItem(long aItemRow) override
SEARCH_HANDLER(const wxString &aName)
Definition search_pane.h:38
TEXT_SEARCH_HANDLER(SCH_EDIT_FRAME *aFrame)
int Search(const wxString &aQuery) override
wxString getResultCell(const SCH_SEARCH_HIT &hit, int aCol) override
ZONE_SEARCH_HANDLER(PCB_EDIT_FRAME *aFrame)
wxString getResultCell(BOARD_ITEM *aItem, int aCol) override
int Search(const wxString &aQuery) override