KiCad PCB EDA Suite
|
#include <footprint_select_widget.h>
Public Member Functions | |
FOOTPRINT_SELECT_WIDGET (EDA_DRAW_FRAME *aFrame, wxWindow *aParent, FOOTPRINT_LIST *aFpList, bool aUpdate=true, int aMaxItems=400) | |
Construct a footprint selector widget. | |
virtual | ~FOOTPRINT_SELECT_WIDGET () |
void | Load (KIWAY &aKiway, PROJECT &aProject) |
Start loading. | |
void | ClearFilters () |
Clear all filters. | |
void | FilterByPinCount (int aPinCount) |
Filter by pin count. | |
void | FilterByFootprintFilters (const wxArrayString &aFilters, bool aZeroFilters) |
Filter by footprint filter list. | |
void | SetDefaultFootprint (const wxString &aFp) |
Set the default footprint for a part. | |
bool | UpdateList () |
Update the contents of the list to match the filters. | |
void | SelectDefault () |
Set current selection to the default footprint. | |
virtual bool | Enable (bool aEnable=true) override |
Enable or disable the control for input. | |
Private Member Functions | |
void | OnComboBox (wxCommandEvent &aEvent) |
Private Attributes | |
FOOTPRINT_CHOICE * | m_fp_sel_ctrl |
wxSizer * | m_sizer |
bool | m_update |
int | m_max_items |
wxString | m_default_footprint |
FOOTPRINT_LIST * | m_fp_list |
FOOTPRINT_FILTER | m_fp_filter |
bool | m_zero_filter |
EDA_DRAW_FRAME * | m_frame |
Definition at line 39 of file footprint_select_widget.h.
FOOTPRINT_SELECT_WIDGET::FOOTPRINT_SELECT_WIDGET | ( | EDA_DRAW_FRAME * | aFrame, |
wxWindow * | aParent, | ||
FOOTPRINT_LIST * | aFpList, | ||
bool | aUpdate = true , |
||
int | aMaxItems = 400 |
||
) |
Construct a footprint selector widget.
This requires references to an external footprint loader, and an external unique_ptr-to-FOOTPRINT_LIST. The latter will be populated with a FOOTPRINT_LIST instance the first time Load() is called.
The reason for this is that footprint loading tends to be very expensive, especially when using online libraries. The caller is expected to keep these objects around (e.g. they may be statics on the dialog this FOOTPRINT_SELECT_WIDGET is created in) so footprints do not have to be loaded more than once.
aParent | - parent window |
aFpList | - FOOTPRINT_LIST container |
aUpdate | - whether to call UpdateList() automatically when finished loading |
aMaxItems | - maximum number of filter items to display, in addition to Default and Other |
Definition at line 36 of file footprint_select_widget.cpp.
References m_fp_sel_ctrl, m_sizer, m_zero_filter, and OnComboBox().
|
inlinevirtual |
Definition at line 64 of file footprint_select_widget.h.
void FOOTPRINT_SELECT_WIDGET::ClearFilters | ( | ) |
Clear all filters.
Does not update the list.
Definition at line 98 of file footprint_select_widget.cpp.
References FOOTPRINT_FILTER::ClearFilters(), m_default_footprint, m_fp_filter, and m_zero_filter.
Referenced by PANEL_SYMBOL_CHOOSER::populateFootprintSelector().
|
overridevirtual |
Enable or disable the control for input.
Definition at line 169 of file footprint_select_widget.cpp.
References m_fp_sel_ctrl.
Referenced by PANEL_SYMBOL_CHOOSER::populateFootprintSelector().
void FOOTPRINT_SELECT_WIDGET::FilterByFootprintFilters | ( | const wxArrayString & | aFilters, |
bool | aZeroFilters | ||
) |
Filter by footprint filter list.
Does not update the list.
aFilters | is a wxArrayString of strings used to filter the list of available footprints (can be empty). The final fp list is the list of footprint names matching at least one filtering string. A filtering string is something like sm0402 or DIP* |
aZeroFilters | - if true, zero filters = zero footprints. If false, zero filters = not filtering. |
Definition at line 112 of file footprint_select_widget.cpp.
References FOOTPRINT_FILTER::FilterByFootprintFilters(), m_fp_filter, and m_zero_filter.
Referenced by PANEL_SYMBOL_CHOOSER::populateFootprintSelector().
void FOOTPRINT_SELECT_WIDGET::FilterByPinCount | ( | int | aPinCount | ) |
Filter by pin count.
Does not update the list.
Definition at line 106 of file footprint_select_widget.cpp.
References FOOTPRINT_FILTER::FilterByPinCount(), and m_fp_filter.
Referenced by PANEL_SYMBOL_CHOOSER::populateFootprintSelector().
Start loading.
This function returns immediately; footprints will continue to load in the background.
aKiway | - active kiway instance. This is cached for use when "Other" is selected. |
aProject | - current project |
Definition at line 58 of file footprint_select_widget.cpp.
References _, FOOTPRINT_LIST::GetCount(), FOOTPRINT_LIST::GetInstance(), m_fp_filter, m_fp_list, m_frame, m_update, PROJECT::PcbFootprintLibs(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), FOOTPRINT_FILTER::SetList(), and UpdateList().
Referenced by PANEL_SYMBOL_CHOOSER::FinishSetup().
|
private |
Definition at line 81 of file footprint_select_widget.cpp.
References m_fp_sel_ctrl.
Referenced by FOOTPRINT_SELECT_WIDGET().
void FOOTPRINT_SELECT_WIDGET::SelectDefault | ( | ) |
Set current selection to the default footprint.
Definition at line 163 of file footprint_select_widget.cpp.
References m_fp_sel_ctrl.
Referenced by UpdateList().
void FOOTPRINT_SELECT_WIDGET::SetDefaultFootprint | ( | const wxString & | aFp | ) |
Set the default footprint for a part.
This will be listed at the top. May be an empty string.
Definition at line 120 of file footprint_select_widget.cpp.
References m_default_footprint.
Referenced by PANEL_SYMBOL_CHOOSER::populateFootprintSelector().
bool FOOTPRINT_SELECT_WIDGET::UpdateList | ( | ) |
Update the contents of the list to match the filters.
Has no effect if the footprint list has not been loaded yet. The "default" footprint will be selected.
Definition at line 126 of file footprint_select_widget.cpp.
References _, m_default_footprint, m_fp_filter, m_fp_list, m_fp_sel_ctrl, m_max_items, m_zero_filter, and SelectDefault().
Referenced by Load(), and PANEL_SYMBOL_CHOOSER::populateFootprintSelector().
|
private |
Definition at line 131 of file footprint_select_widget.h.
Referenced by ClearFilters(), SetDefaultFootprint(), and UpdateList().
|
private |
Definition at line 134 of file footprint_select_widget.h.
Referenced by ClearFilters(), FilterByFootprintFilters(), FilterByPinCount(), Load(), and UpdateList().
|
private |
Definition at line 133 of file footprint_select_widget.h.
Referenced by Load(), and UpdateList().
|
private |
Definition at line 126 of file footprint_select_widget.h.
Referenced by Enable(), FOOTPRINT_SELECT_WIDGET(), OnComboBox(), SelectDefault(), and UpdateList().
|
private |
Definition at line 136 of file footprint_select_widget.h.
Referenced by Load().
|
private |
Definition at line 130 of file footprint_select_widget.h.
Referenced by UpdateList().
|
private |
Definition at line 127 of file footprint_select_widget.h.
Referenced by FOOTPRINT_SELECT_WIDGET().
|
private |
Definition at line 129 of file footprint_select_widget.h.
Referenced by Load().
|
private |
Definition at line 135 of file footprint_select_widget.h.
Referenced by ClearFilters(), FilterByFootprintFilters(), FOOTPRINT_SELECT_WIDGET(), and UpdateList().