KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_footprint_filters.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
#pragma once
21
22
#include <functional>
23
#include <memory>
24
#include <vector>
25
26
#include <wx/arrstr.h>
27
#include <wx/timer.h>
28
29
#include <
dialog_lib_symbol_properties_base.h
>
30
#include <
widgets/wx_debounced_action.h
>
31
32
class
KIWAY
;
33
class
FP_FILTER_MATCHER
;
34
class
LISTBOX_TRICKS
;
35
36
40
class
PANEL_FOOTPRINT_FILTERS
:
public
PANEL_FOOTPRINT_FILTERS_BASE
41
{
42
public
:
43
PANEL_FOOTPRINT_FILTERS
( wxWindow* aParent,
KIWAY
& aKiway );
44
45
~PANEL_FOOTPRINT_FILTERS
()
override
;
46
48
void
SetFilters
(
const
wxArrayString& aFilters );
49
51
wxArrayString
GetFilters
()
const
;
52
53
54
using
FOOTPRINT_ASSIGN_QUERY
= std::function<bool()>;
55
using
FOOTPRINT_ASSIGNER
= std::function<void(
const
wxString& )>;
56
64
void
SetFootprintFieldAccessors
(
FOOTPRINT_ASSIGN_QUERY
aCanAssign,
FOOTPRINT_ASSIGNER
aAssign );
65
66
protected
:
67
void
OnFpFilterDClick
( wxMouseEvent& aEvent )
override
;
68
void
OnEditFootprintFilter
( wxCommandEvent& aEvent )
override
;
69
void
OnAddFootprintFilter
( wxCommandEvent& aEvent )
override
;
70
71
private
:
73
void
onModify
();
74
77
void
updateMatchingFootprints
();
78
79
void
showFootprintMatches
(
const
std::vector<wxString>& aPatterns );
80
85
wxString
matchingFootprintName
(
long
aItem )
const
;
86
87
void
openFootprintInEditor
(
const
wxString& aFootprintName );
88
void
copyFootprintName
(
const
wxString& aFootprintName );
89
92
bool
matchLibrariesReady
();
93
100
void
showFpFilterMatchLoadIndication
(
bool
aShow,
float
aProgress = 0.0f );
101
void
onFpFilterMatchLoadTimer
( wxTimerEvent& aEvent );
102
104
void
onFilterPreviewText
( wxCommandEvent& aEvent );
105
106
void
onMatchingFootprintDoubleClick
( wxListEvent& aEvent );
107
void
onMatchingFootprintContextMenu
( wxListEvent& aEvent );
108
void
onMatchingFootprintKeyDown
( wxKeyEvent& aEvent );
109
112
void
onNotebookPageChanged
( wxBookCtrlEvent& aEvent );
113
114
KIWAY
&
m_kiway
;
115
116
std::unique_ptr<LISTBOX_TRICKS>
m_fpFilterTricks
;
117
119
std::unique_ptr<FP_FILTER_MATCHER>
m_fpMatcher
;
120
123
wxString
m_fpFilterPreview
;
124
126
FOOTPRINT_ASSIGN_QUERY
m_canAssignFootprint
;
127
FOOTPRINT_ASSIGNER
m_assignFootprint
;
128
129
bool
m_matchLibrariesReady
=
false
;
130
wxTimer
m_matchLoadTimer
;
131
133
WX_DEBOUNCED_ACTION
m_filterPreviewDebounce
;
134
};
FP_FILTER_MATCHER
Supplies the footprints matching a symbol's footprint filter patterns.
Definition
panel_footprint_filters.cpp:60
KIWAY
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition
kiway.h:348
LISTBOX_TRICKS
Definition
listbox_tricks.h:42
PANEL_FOOTPRINT_FILTERS_BASE::PANEL_FOOTPRINT_FILTERS_BASE
PANEL_FOOTPRINT_FILTERS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
Definition
dialog_lib_symbol_properties_base.cpp:629
PANEL_FOOTPRINT_FILTERS::m_fpFilterTricks
std::unique_ptr< LISTBOX_TRICKS > m_fpFilterTricks
Definition
panel_footprint_filters.h:116
PANEL_FOOTPRINT_FILTERS::matchingFootprintName
wxString matchingFootprintName(long aItem) const
Return the "library:footprint" name of the given item in the matches list, or an empty string when th...
Definition
panel_footprint_filters.cpp:445
PANEL_FOOTPRINT_FILTERS::m_matchLibrariesReady
bool m_matchLibrariesReady
Definition
panel_footprint_filters.h:129
PANEL_FOOTPRINT_FILTERS::FOOTPRINT_ASSIGNER
std::function< void(const wxString &)> FOOTPRINT_ASSIGNER
Definition
panel_footprint_filters.h:55
PANEL_FOOTPRINT_FILTERS::m_canAssignFootprint
FOOTPRINT_ASSIGN_QUERY m_canAssignFootprint
Access to panel-external interfaces.
Definition
panel_footprint_filters.h:126
PANEL_FOOTPRINT_FILTERS::OnAddFootprintFilter
void OnAddFootprintFilter(wxCommandEvent &aEvent) override
Definition
panel_footprint_filters.cpp:551
PANEL_FOOTPRINT_FILTERS::onMatchingFootprintKeyDown
void onMatchingFootprintKeyDown(wxKeyEvent &aEvent)
Definition
panel_footprint_filters.cpp:533
PANEL_FOOTPRINT_FILTERS::PANEL_FOOTPRINT_FILTERS
PANEL_FOOTPRINT_FILTERS(wxWindow *aParent, KIWAY &aKiway)
Definition
panel_footprint_filters.cpp:161
PANEL_FOOTPRINT_FILTERS::openFootprintInEditor
void openFootprintInEditor(const wxString &aFootprintName)
Definition
panel_footprint_filters.cpp:461
PANEL_FOOTPRINT_FILTERS::onModify
void onModify()
Mark the host dialog (the top level window) as modified.
Definition
panel_footprint_filters.cpp:275
PANEL_FOOTPRINT_FILTERS::m_fpFilterPreview
wxString m_fpFilterPreview
The sanitised filter text being typed in the Add/Edit filter dialog.
Definition
panel_footprint_filters.h:123
PANEL_FOOTPRINT_FILTERS::copyFootprintName
void copyFootprintName(const wxString &aFootprintName)
Definition
panel_footprint_filters.cpp:470
PANEL_FOOTPRINT_FILTERS::onFpFilterMatchLoadTimer
void onFpFilterMatchLoadTimer(wxTimerEvent &aEvent)
Definition
panel_footprint_filters.cpp:428
PANEL_FOOTPRINT_FILTERS::showFpFilterMatchLoadIndication
void showFpFilterMatchLoadIndication(bool aShow, float aProgress=0.0f)
Show or hide the footprint filter match list's library load indicator.
Definition
panel_footprint_filters.cpp:403
PANEL_FOOTPRINT_FILTERS::m_matchLoadTimer
wxTimer m_matchLoadTimer
Definition
panel_footprint_filters.h:130
PANEL_FOOTPRINT_FILTERS::m_filterPreviewDebounce
WX_DEBOUNCED_ACTION m_filterPreviewDebounce
Debounces the preview of the filter being type to avoid spamming queries.
Definition
panel_footprint_filters.h:133
PANEL_FOOTPRINT_FILTERS::onNotebookPageChanged
void onNotebookPageChanged(wxBookCtrlEvent &aEvent)
Query the matches when the page is selected; the libraries are not loaded before that,...
Definition
panel_footprint_filters.cpp:282
PANEL_FOOTPRINT_FILTERS::updateMatchingFootprints
void updateMatchingFootprints()
Refresh the matches list for the current filters, or for the filter being typed in the Add/Edit dialo...
Definition
panel_footprint_filters.cpp:308
PANEL_FOOTPRINT_FILTERS::~PANEL_FOOTPRINT_FILTERS
~PANEL_FOOTPRINT_FILTERS() override
Definition
panel_footprint_filters.cpp:246
PANEL_FOOTPRINT_FILTERS::SetFilters
void SetFilters(const wxArrayString &aFilters)
Replace the filters in the list with aFilters.
Definition
panel_footprint_filters.cpp:255
PANEL_FOOTPRINT_FILTERS::SetFootprintFieldAccessors
void SetFootprintFieldAccessors(FOOTPRINT_ASSIGN_QUERY aCanAssign, FOOTPRINT_ASSIGNER aAssign)
Injection for interfaces that reach outside the panel to interact with host dialog.
Definition
panel_footprint_filters.cpp:267
PANEL_FOOTPRINT_FILTERS::OnEditFootprintFilter
void OnEditFootprintFilter(wxCommandEvent &aEvent) override
Definition
panel_footprint_filters.cpp:582
PANEL_FOOTPRINT_FILTERS::m_kiway
KIWAY & m_kiway
Definition
panel_footprint_filters.h:114
PANEL_FOOTPRINT_FILTERS::m_assignFootprint
FOOTPRINT_ASSIGNER m_assignFootprint
Definition
panel_footprint_filters.h:127
PANEL_FOOTPRINT_FILTERS::FOOTPRINT_ASSIGN_QUERY
std::function< bool()> FOOTPRINT_ASSIGN_QUERY
Definition
panel_footprint_filters.h:54
PANEL_FOOTPRINT_FILTERS::onMatchingFootprintContextMenu
void onMatchingFootprintContextMenu(wxListEvent &aEvent)
Definition
panel_footprint_filters.cpp:489
PANEL_FOOTPRINT_FILTERS::showFootprintMatches
void showFootprintMatches(const std::vector< wxString > &aPatterns)
Definition
panel_footprint_filters.cpp:350
PANEL_FOOTPRINT_FILTERS::onMatchingFootprintDoubleClick
void onMatchingFootprintDoubleClick(wxListEvent &aEvent)
Definition
panel_footprint_filters.cpp:480
PANEL_FOOTPRINT_FILTERS::onFilterPreviewText
void onFilterPreviewText(wxCommandEvent &aEvent)
Preview the filter text typed in the Add/Edit dialog, once typing pauses.
Definition
panel_footprint_filters.cpp:438
PANEL_FOOTPRINT_FILTERS::matchLibrariesReady
bool matchLibrariesReady()
Return true once the footprint libraries can be queried.
Definition
panel_footprint_filters.cpp:382
PANEL_FOOTPRINT_FILTERS::OnFpFilterDClick
void OnFpFilterDClick(wxMouseEvent &aEvent) override
Definition
panel_footprint_filters.cpp:296
PANEL_FOOTPRINT_FILTERS::m_fpMatcher
std::unique_ptr< FP_FILTER_MATCHER > m_fpMatcher
Supplies the matches for the footprint filter patterns.
Definition
panel_footprint_filters.h:119
PANEL_FOOTPRINT_FILTERS::GetFilters
wxArrayString GetFilters() const
Definition
panel_footprint_filters.cpp:261
WX_DEBOUNCED_ACTION
Debounces an action: runs it only after a quiet period following the last trigger.
Definition
wx_debounced_action.h:34
dialog_lib_symbol_properties_base.h
wx_debounced_action.h
src
eeschema
dialogs
panel_footprint_filters.h
Generated on Wed Oct 7 2026 00:05:55 for KiCad PCB EDA Suite by
1.13.2