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

#include <footprint_select_widget.h>

Inheritance diagram for FOOTPRINT_SELECT_WIDGET:

Public Member Functions

 FOOTPRINT_SELECT_WIDGET (EDA_DRAW_FRAME *aFrame, wxWindow *aParent, int aMaxItems=400)
 Construct a footprint selector widget.
 
virtual ~FOOTPRINT_SELECT_WIDGET ()
 
void Load (KIWAY &aKiway, PROJECT &aProject)
 Initialize the widget with a KIWAY for cross-module communication.
 
void ClearFilters ()
 Clear all filters.
 
void AddAlwaysIncludedFootprint (const LIB_ID &aFootprintId)
 Add a footprint that is always listed regardless of the pin-count and glob filters (issue #2282).
 
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 by fetching filtered footprints from pcbnew.
 
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
 
int m_max_items
 
wxString m_default_footprint
 
int m_pin_count
 
wxArrayString m_filters
 
bool m_zero_filter
 
std::vector< LIB_ID > m_always_included
 
KIWAY * m_kiway
 

Detailed Description

Definition at line 42 of file footprint_select_widget.h.

Constructor & Destructor Documentation

◆ FOOTPRINT_SELECT_WIDGET()

FOOTPRINT_SELECT_WIDGET::FOOTPRINT_SELECT_WIDGET ( EDA_DRAW_FRAME * aFrame,
wxWindow * aParent,
int aMaxItems = 400 )

Construct a footprint selector widget.

Parameters
aFrame- parent frame for context
aParent- parent window
aMaxItems- maximum number of filter items to display

Definition at line 31 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl, m_kiway, m_max_items, m_pin_count, m_sizer, m_zero_filter, and OnComboBox().

◆ ~FOOTPRINT_SELECT_WIDGET()

virtual FOOTPRINT_SELECT_WIDGET::~FOOTPRINT_SELECT_WIDGET ( )
inlinevirtual

Definition at line 54 of file footprint_select_widget.h.

Member Function Documentation

◆ AddAlwaysIncludedFootprint()

void FOOTPRINT_SELECT_WIDGET::AddAlwaysIncludedFootprint ( const LIB_ID & aFootprintId)

Add a footprint that is always listed regardless of the pin-count and glob filters (issue #2282).

Explicitly associated footprints are sorted ahead of the glob matches and are never excluded by the graphical pin-count filter, since a mapped EP/NC footprint legally has more pads than the symbol has pins. Does not update the list.

Parameters
aFootprintIdis the concrete footprint LIB_ID to always include.

Definition at line 82 of file footprint_select_widget.cpp.

References LIB_ID::IsValid(), and m_always_included.

◆ ClearFilters()

void FOOTPRINT_SELECT_WIDGET::ClearFilters ( )

Clear all filters.

Does not update the list.

Definition at line 72 of file footprint_select_widget.cpp.

References m_always_included, m_default_footprint, m_filters, m_pin_count, and m_zero_filter.

◆ Enable()

bool FOOTPRINT_SELECT_WIDGET::Enable ( bool aEnable = true)
overridevirtual

Enable or disable the control for input.

Definition at line 184 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl.

◆ FilterByFootprintFilters()

void FOOTPRINT_SELECT_WIDGET::FilterByFootprintFilters ( const wxArrayString & aFilters,
bool aZeroFilters )

Filter by footprint filter list.

Does not update the list.

Parameters
aFiltersis 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 103 of file footprint_select_widget.cpp.

References m_filters, and m_zero_filter.

◆ FilterByPinCount()

void FOOTPRINT_SELECT_WIDGET::FilterByPinCount ( int aPinCount)

Filter by pin count.

Does not update the list.

Definition at line 97 of file footprint_select_widget.cpp.

References m_pin_count.

◆ Load()

void FOOTPRINT_SELECT_WIDGET::Load ( KIWAY & aKiway,
PROJECT & aProject )

Initialize the widget with a KIWAY for cross-module communication.

Parameters
aKiway- active kiway instance used to fetch filtered footprints from pcbnew
aProject- current project (unused, kept for API compatibility)

Definition at line 50 of file footprint_select_widget.cpp.

References m_kiway.

◆ OnComboBox()

void FOOTPRINT_SELECT_WIDGET::OnComboBox ( wxCommandEvent & aEvent)
private

Definition at line 56 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl.

Referenced by FOOTPRINT_SELECT_WIDGET().

◆ SelectDefault()

void FOOTPRINT_SELECT_WIDGET::SelectDefault ( )

Set current selection to the default footprint.

Definition at line 178 of file footprint_select_widget.cpp.

References m_fp_sel_ctrl.

Referenced by UpdateList().

◆ SetDefaultFootprint()

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 110 of file footprint_select_widget.cpp.

References m_default_footprint.

◆ UpdateList()

bool FOOTPRINT_SELECT_WIDGET::UpdateList ( )

Member Data Documentation

◆ m_always_included

std::vector<LIB_ID> FOOTPRINT_SELECT_WIDGET::m_always_included
private

Definition at line 133 of file footprint_select_widget.h.

Referenced by AddAlwaysIncludedFootprint(), ClearFilters(), and UpdateList().

◆ m_default_footprint

wxString FOOTPRINT_SELECT_WIDGET::m_default_footprint
private

Definition at line 127 of file footprint_select_widget.h.

Referenced by ClearFilters(), SetDefaultFootprint(), and UpdateList().

◆ m_filters

wxArrayString FOOTPRINT_SELECT_WIDGET::m_filters
private

Definition at line 131 of file footprint_select_widget.h.

Referenced by ClearFilters(), FilterByFootprintFilters(), and UpdateList().

◆ m_fp_sel_ctrl

FOOTPRINT_CHOICE* FOOTPRINT_SELECT_WIDGET::m_fp_sel_ctrl
private

◆ m_kiway

KIWAY* FOOTPRINT_SELECT_WIDGET::m_kiway
private

Definition at line 135 of file footprint_select_widget.h.

Referenced by FOOTPRINT_SELECT_WIDGET(), Load(), and UpdateList().

◆ m_max_items

int FOOTPRINT_SELECT_WIDGET::m_max_items
private

Definition at line 126 of file footprint_select_widget.h.

Referenced by FOOTPRINT_SELECT_WIDGET(), and UpdateList().

◆ m_pin_count

int FOOTPRINT_SELECT_WIDGET::m_pin_count
private

◆ m_sizer

wxSizer* FOOTPRINT_SELECT_WIDGET::m_sizer
private

Definition at line 124 of file footprint_select_widget.h.

Referenced by FOOTPRINT_SELECT_WIDGET().

◆ m_zero_filter

bool FOOTPRINT_SELECT_WIDGET::m_zero_filter
private

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