KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PANEL_FOOTPRINT_FILTERS Class Reference

The footprint filters/matches panel of the symbol properties dialog. More...

#include <panel_footprint_filters.h>

Inheritance diagram for PANEL_FOOTPRINT_FILTERS:
PANEL_FOOTPRINT_FILTERS_BASE

Public Types

using FOOTPRINT_ASSIGN_QUERY = std::function<bool()>
 
using FOOTPRINT_ASSIGNER = std::function<void( const wxString& )>
 

Public Member Functions

 PANEL_FOOTPRINT_FILTERS (wxWindow *aParent, KIWAY &aKiway)
 
 ~PANEL_FOOTPRINT_FILTERS () override
 
void SetFilters (const wxArrayString &aFilters)
 Replace the filters in the list with aFilters.
 
wxArrayString GetFilters () const
 
void SetFootprintFieldAccessors (FOOTPRINT_ASSIGN_QUERY aCanAssign, FOOTPRINT_ASSIGNER aAssign)
 Injection for interfaces that reach outside the panel to interact with host dialog.
 

Protected Member Functions

void OnFpFilterDClick (wxMouseEvent &aEvent) override
 
void OnEditFootprintFilter (wxCommandEvent &aEvent) override
 
void OnAddFootprintFilter (wxCommandEvent &aEvent) override
 

Protected Attributes

wxStaticText * m_staticTextFootprints
 
wxListBox * m_FootprintFilterListBox
 
STD_BITMAP_BUTTON * m_addFilterButton
 
STD_BITMAP_BUTTON * m_editFilterButton
 
STD_BITMAP_BUTTON * m_deleteFilterButton
 
wxStaticText * m_staticTextFootprints1
 
wxListCtrl * m_matchingFootprints
 

Private Member Functions

void onModify ()
 Mark the host dialog (the top level window) as modified.
 
void updateMatchingFootprints ()
 Refresh the matches list for the current filters, or for the filter being typed in the Add/Edit dialog.
 
void showFootprintMatches (const std::vector< wxString > &aPatterns)
 
wxString matchingFootprintName (long aItem) const
 Return the "library:footprint" name of the given item in the matches list, or an empty string when the item is not a footprint name.
 
void openFootprintInEditor (const wxString &aFootprintName)
 
void copyFootprintName (const wxString &aFootprintName)
 
bool matchLibrariesReady ()
 Return true once the footprint libraries can be queried.
 
void showFpFilterMatchLoadIndication (bool aShow, float aProgress=0.0f)
 Show or hide the footprint filter match list's library load indicator.
 
void onFpFilterMatchLoadTimer (wxTimerEvent &aEvent)
 
void onFilterPreviewText (wxCommandEvent &aEvent)
 Preview the filter text typed in the Add/Edit dialog, once typing pauses.
 
void onMatchingFootprintDoubleClick (wxListEvent &aEvent)
 
void onMatchingFootprintContextMenu (wxListEvent &aEvent)
 
void onMatchingFootprintKeyDown (wxKeyEvent &aEvent)
 
void onNotebookPageChanged (wxBookCtrlEvent &aEvent)
 Query the matches when the page is selected; the libraries are not loaded before that, and native notebooks do not reliably report page visibility with show events.
 

Private Attributes

KIWAY & m_kiway
 
std::unique_ptr< LISTBOX_TRICKS > m_fpFilterTricks
 
std::unique_ptr< FP_FILTER_MATCHER > m_fpMatcher
 Supplies the matches for the footprint filter patterns.
 
wxString m_fpFilterPreview
 The sanitised filter text being typed in the Add/Edit filter dialog.
 
FOOTPRINT_ASSIGN_QUERY m_canAssignFootprint
 Access to panel-external interfaces.
 
FOOTPRINT_ASSIGNER m_assignFootprint
 
bool m_matchLibrariesReady = false
 
wxTimer m_matchLoadTimer
 
WX_DEBOUNCED_ACTION m_filterPreviewDebounce
 Debounces the preview of the filter being type to avoid spamming queries.
 

Detailed Description

The footprint filters/matches panel of the symbol properties dialog.

Definition at line 40 of file panel_footprint_filters.h.

Member Typedef Documentation

◆ FOOTPRINT_ASSIGN_QUERY

using PANEL_FOOTPRINT_FILTERS::FOOTPRINT_ASSIGN_QUERY = std::function<bool()>

Definition at line 54 of file panel_footprint_filters.h.

◆ FOOTPRINT_ASSIGNER

using PANEL_FOOTPRINT_FILTERS::FOOTPRINT_ASSIGNER = std::function<void( const wxString& )>

Definition at line 55 of file panel_footprint_filters.h.

Constructor & Destructor Documentation

◆ PANEL_FOOTPRINT_FILTERS()

◆ ~PANEL_FOOTPRINT_FILTERS()

PANEL_FOOTPRINT_FILTERS::~PANEL_FOOTPRINT_FILTERS ( )
override

Member Function Documentation

◆ copyFootprintName()

void PANEL_FOOTPRINT_FILTERS::copyFootprintName ( const wxString & aFootprintName)
private

◆ GetFilters()

wxArrayString PANEL_FOOTPRINT_FILTERS::GetFilters ( ) const
Returns
the filters in the list.

Definition at line 261 of file panel_footprint_filters.cpp.

References PANEL_FOOTPRINT_FILTERS_BASE::m_FootprintFilterListBox.

◆ matchingFootprintName()

wxString PANEL_FOOTPRINT_FILTERS::matchingFootprintName ( long aItem) const
private

Return the "library:footprint" name of the given item in the matches list, or an empty string when the item is not a footprint name.

Definition at line 445 of file panel_footprint_filters.cpp.

References LIB_ID::Format(), LIB_ID::IsValid(), PANEL_FOOTPRINT_FILTERS_BASE::m_matchingFootprints, and LIB_ID::Parse().

Referenced by onMatchingFootprintContextMenu(), onMatchingFootprintDoubleClick(), and onMatchingFootprintKeyDown().

◆ matchLibrariesReady()

bool PANEL_FOOTPRINT_FILTERS::matchLibrariesReady ( )
private

Return true once the footprint libraries can be queried.

While they load, show the loading indication, keep polling and return false.

Definition at line 382 of file panel_footprint_filters.cpp.

References GetFootprintLibrariesLoadProgress(), m_kiway, m_matchLibrariesReady, m_matchLoadTimer, and showFpFilterMatchLoadIndication().

Referenced by onFpFilterMatchLoadTimer(), and showFootprintMatches().

◆ OnAddFootprintFilter()

void PANEL_FOOTPRINT_FILTERS::OnAddFootprintFilter ( wxCommandEvent & aEvent)
overrideprotectedvirtual

◆ OnEditFootprintFilter()

void PANEL_FOOTPRINT_FILTERS::OnEditFootprintFilter ( wxCommandEvent & aEvent)
overrideprotectedvirtual

◆ onFilterPreviewText()

void PANEL_FOOTPRINT_FILTERS::onFilterPreviewText ( wxCommandEvent & aEvent)
private

Preview the filter text typed in the Add/Edit dialog, once typing pauses.

Definition at line 438 of file panel_footprint_filters.cpp.

References m_filterPreviewDebounce, m_fpFilterPreview, and SanitizeFpFilter().

Referenced by OnAddFootprintFilter(), and OnEditFootprintFilter().

◆ OnFpFilterDClick()

void PANEL_FOOTPRINT_FILTERS::OnFpFilterDClick ( wxMouseEvent & aEvent)
overrideprotectedvirtual

◆ onFpFilterMatchLoadTimer()

void PANEL_FOOTPRINT_FILTERS::onFpFilterMatchLoadTimer ( wxTimerEvent & aEvent)
private

◆ onMatchingFootprintContextMenu()

void PANEL_FOOTPRINT_FILTERS::onMatchingFootprintContextMenu ( wxListEvent & aEvent)
private

◆ onMatchingFootprintDoubleClick()

void PANEL_FOOTPRINT_FILTERS::onMatchingFootprintDoubleClick ( wxListEvent & aEvent)
private

◆ onMatchingFootprintKeyDown()

void PANEL_FOOTPRINT_FILTERS::onMatchingFootprintKeyDown ( wxKeyEvent & aEvent)
private

◆ onModify()

void PANEL_FOOTPRINT_FILTERS::onModify ( )
private

Mark the host dialog (the top level window) as modified.

Definition at line 275 of file panel_footprint_filters.cpp.

Referenced by OnAddFootprintFilter(), and OnEditFootprintFilter().

◆ onNotebookPageChanged()

void PANEL_FOOTPRINT_FILTERS::onNotebookPageChanged ( wxBookCtrlEvent & aEvent)
private

Query the matches when the page is selected; the libraries are not loaded before that, and native notebooks do not reliably report page visibility with show events.

Definition at line 282 of file panel_footprint_filters.cpp.

References updateMatchingFootprints().

Referenced by ~PANEL_FOOTPRINT_FILTERS().

◆ openFootprintInEditor()

void PANEL_FOOTPRINT_FILTERS::openFootprintInEditor ( const wxString & aFootprintName)
private

◆ SetFilters()

void PANEL_FOOTPRINT_FILTERS::SetFilters ( const wxArrayString & aFilters)

Replace the filters in the list with aFilters.

Definition at line 255 of file panel_footprint_filters.cpp.

References PANEL_FOOTPRINT_FILTERS_BASE::m_FootprintFilterListBox.

◆ SetFootprintFieldAccessors()

void PANEL_FOOTPRINT_FILTERS::SetFootprintFieldAccessors ( FOOTPRINT_ASSIGN_QUERY aCanAssign,
FOOTPRINT_ASSIGNER aAssign )

Injection for interfaces that reach outside the panel to interact with host dialog.

Parameters
aCanAssignreports whether the FP field can be written at all
aAssignpushes a footprint name into the field.

Definition at line 267 of file panel_footprint_filters.cpp.

References m_assignFootprint, and m_canAssignFootprint.

◆ showFootprintMatches()

void PANEL_FOOTPRINT_FILTERS::showFootprintMatches ( const std::vector< wxString > & aPatterns)
private

◆ showFpFilterMatchLoadIndication()

void PANEL_FOOTPRINT_FILTERS::showFpFilterMatchLoadIndication ( bool aShow,
float aProgress = 0.0f )
private

Show or hide the footprint filter match list's library load indicator.

Parameters
aShowWhether to show the load indicator.
aProgressThe progress of the library loading, between 0.0 and 1.0.

Definition at line 403 of file panel_footprint_filters.cpp.

References _, PANEL_FOOTPRINT_FILTERS_BASE::m_matchingFootprints, and PANEL_FOOTPRINT_FILTERS_BASE::m_staticTextFootprints1.

Referenced by matchLibrariesReady().

◆ updateMatchingFootprints()

void PANEL_FOOTPRINT_FILTERS::updateMatchingFootprints ( )
private

Refresh the matches list for the current filters, or for the filter being typed in the Add/Edit dialog.

Definition at line 308 of file panel_footprint_filters.cpp.

References filters, PANEL_FOOTPRINT_FILTERS_BASE::m_FootprintFilterListBox, m_fpFilterPreview, m_fpMatcher, and showFootprintMatches().

Referenced by OnAddFootprintFilter(), OnEditFootprintFilter(), onFpFilterMatchLoadTimer(), onNotebookPageChanged(), and PANEL_FOOTPRINT_FILTERS().

Member Data Documentation

◆ m_addFilterButton

STD_BITMAP_BUTTON* PANEL_FOOTPRINT_FILTERS_BASE::m_addFilterButton
protectedinherited

◆ m_assignFootprint

FOOTPRINT_ASSIGNER PANEL_FOOTPRINT_FILTERS::m_assignFootprint
private

◆ m_canAssignFootprint

FOOTPRINT_ASSIGN_QUERY PANEL_FOOTPRINT_FILTERS::m_canAssignFootprint
private

Access to panel-external interfaces.

Definition at line 126 of file panel_footprint_filters.h.

Referenced by onMatchingFootprintContextMenu(), and SetFootprintFieldAccessors().

◆ m_deleteFilterButton

STD_BITMAP_BUTTON* PANEL_FOOTPRINT_FILTERS_BASE::m_deleteFilterButton
protectedinherited

Definition at line 156 of file dialog_lib_symbol_properties_base.h.

Referenced by PANEL_FOOTPRINT_FILTERS_BASE().

◆ m_editFilterButton

STD_BITMAP_BUTTON* PANEL_FOOTPRINT_FILTERS_BASE::m_editFilterButton
protectedinherited

◆ m_filterPreviewDebounce

WX_DEBOUNCED_ACTION PANEL_FOOTPRINT_FILTERS::m_filterPreviewDebounce
private

Debounces the preview of the filter being type to avoid spamming queries.

Definition at line 133 of file panel_footprint_filters.h.

Referenced by OnAddFootprintFilter(), OnEditFootprintFilter(), onFilterPreviewText(), and PANEL_FOOTPRINT_FILTERS().

◆ m_FootprintFilterListBox

◆ m_fpFilterPreview

wxString PANEL_FOOTPRINT_FILTERS::m_fpFilterPreview
private

The sanitised filter text being typed in the Add/Edit filter dialog.

If it is set, the match list previews this instead of the filters in the list pane.

Definition at line 123 of file panel_footprint_filters.h.

Referenced by OnAddFootprintFilter(), OnEditFootprintFilter(), onFilterPreviewText(), and updateMatchingFootprints().

◆ m_fpFilterTricks

std::unique_ptr<LISTBOX_TRICKS> PANEL_FOOTPRINT_FILTERS::m_fpFilterTricks
private

Definition at line 116 of file panel_footprint_filters.h.

Referenced by PANEL_FOOTPRINT_FILTERS().

◆ m_fpMatcher

std::unique_ptr<FP_FILTER_MATCHER> PANEL_FOOTPRINT_FILTERS::m_fpMatcher
private

Supplies the matches for the footprint filter patterns.

Definition at line 119 of file panel_footprint_filters.h.

Referenced by PANEL_FOOTPRINT_FILTERS(), showFootprintMatches(), and updateMatchingFootprints().

◆ m_kiway

KIWAY& PANEL_FOOTPRINT_FILTERS::m_kiway
private

◆ m_matchingFootprints

◆ m_matchLibrariesReady

bool PANEL_FOOTPRINT_FILTERS::m_matchLibrariesReady = false
private

Definition at line 129 of file panel_footprint_filters.h.

Referenced by matchLibrariesReady().

◆ m_matchLoadTimer

wxTimer PANEL_FOOTPRINT_FILTERS::m_matchLoadTimer
private

◆ m_staticTextFootprints

wxStaticText* PANEL_FOOTPRINT_FILTERS_BASE::m_staticTextFootprints
protectedinherited

Definition at line 152 of file dialog_lib_symbol_properties_base.h.

Referenced by PANEL_FOOTPRINT_FILTERS_BASE().

◆ m_staticTextFootprints1

wxStaticText* PANEL_FOOTPRINT_FILTERS_BASE::m_staticTextFootprints1
protectedinherited

The documentation for this class was generated from the following files: