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

#include <panel_symbol_chooser.h>

Inheritance diagram for PANEL_SYMBOL_CHOOSER:

Public Member Functions

 PANEL_SYMBOL_CHOOSER (SCH_BASE_FRAME *aFrame, wxWindow *aParent, const SYMBOL_LIBRARY_FILTER *aFilter, std::vector< PICKED_SYMBOL > &aHistoryList, std::vector< PICKED_SYMBOL > &aAlreadyPlaced, bool aAllowFieldEdits, bool aShowFootprints, std::function< void()> aAcceptHandler, std::function< void()> aEscapeHandler)
 Create dialog to choose symbol. More...
 
 ~PANEL_SYMBOL_CHOOSER ()
 
void OnChar (wxKeyEvent &aEvent)
 
void FinishSetup ()
 
void SetPreselect (const LIB_ID &aPreselect)
 
LIB_ID GetSelectedLibId (int *aUnit=nullptr) const
 To be called after this dialog returns from ShowModal(). More...
 
int GetItemCount () const
 
wxWindow * GetFocusTarget () const
 
std::vector< std::pair< int, wxString > > GetFields () const
 Get a list of fields edited by the user. More...
 

Static Public Attributes

static std::mutex g_Mutex
 

Protected Member Functions

wxPanel * constructRightPanel (wxWindow *aParent)
 
void OnDetailsCharHook (wxKeyEvent &aEvt)
 
void onCloseTimer (wxTimerEvent &aEvent)
 
void onOpenLibsTimer (wxTimerEvent &aEvent)
 
void onFootprintSelected (wxCommandEvent &aEvent)
 
void onSymbolSelected (wxCommandEvent &aEvent)
 
void onSymbolChosen (wxCommandEvent &aEvent)
 Handle the selection of an item. More...
 
void showFootprintFor (const LIB_ID &aLibId)
 Look up the footprint for a given symbol specified in the LIB_ID and display it. More...
 
void showFootprint (const wxString &aFootprint)
 Display the given footprint by name. More...
 
void populateFootprintSelector (const LIB_ID &aLibId)
 Populate the footprint selector for a given alias. More...
 

Protected Attributes

wxTimer * m_dbl_click_timer
 
wxTimer * m_open_libs_timer
 
SYMBOL_PREVIEW_WIDGETm_symbol_preview
 
wxSplitterWindow * m_hsplitter
 
wxSplitterWindow * m_vsplitter
 
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTERm_adapter
 
FOOTPRINT_SELECT_WIDGETm_fp_sel_ctrl
 
FOOTPRINT_PREVIEW_WIDGETm_fp_preview
 
LIB_TREEm_tree
 
HTML_WINDOWm_details
 
SCH_BASE_FRAMEm_frame
 
std::function< void()> m_acceptHandler
 
std::function< void()> m_escapeHandler
 
bool m_showPower
 
bool m_allow_field_edits
 
bool m_show_footprints
 
wxString m_fp_override
 
std::vector< std::pair< int, wxString > > m_field_edits
 

Static Protected Attributes

static constexpr int DBLCLICK_DELAY = 100
 
static wxString g_symbolSearchString
 
static wxString g_powerSearchString
 

Detailed Description

Definition at line 43 of file panel_symbol_chooser.h.

Constructor & Destructor Documentation

◆ PANEL_SYMBOL_CHOOSER()

PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER ( SCH_BASE_FRAME aFrame,
wxWindow *  aParent,
const SYMBOL_LIBRARY_FILTER aFilter,
std::vector< PICKED_SYMBOL > &  aHistoryList,
std::vector< PICKED_SYMBOL > &  aAlreadyPlaced,
bool  aAllowFieldEdits,
bool  aShowFootprints,
std::function< void()>  aAcceptHandler,
std::function< void()>  aEscapeHandler 
)

Create dialog to choose symbol.

Parameters
aFramethe parent frame (usually a SCH_EDIT_FRAME or SYMBOL_CHOOSER_FRAME)
aParentthe parent window (usually a DIALOG_SHIM or SYMBOL_CHOOSER_FRAME)
aAllowFieldEditsif false, all functions that allow the user to edit fields (currently just footprint selection) will not be available.
aShowFootprintsif false, all footprint preview and selection features are disabled. This forces aAllowFieldEdits false too.
aAcceptHandlera handler to be called on double-click of a footprint
aEscapeHandlera handler to be called on <ESC>

Definition at line 52 of file panel_symbol_chooser.cpp.

References _, SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_TREE_MODEL_ADAPTER::AddLibrary(), LIB_TREE::ALL_WIDGETS, LIB_TREE_MODEL_ADAPTER::AssignIntrinsicRanks(), constructRightPanel(), alg::contains(), SYMBOL_TREE_MODEL_ADAPTER::Create(), LIB_TREE_MODEL_ADAPTER::DoAddLibrary(), SYMBOL_LIB_TABLE::FindRow(), g_powerSearchString, g_symbolSearchString, SYMBOL_LIBRARY_FILTER::GetAllowedLibList(), SYMBOL_LIBRARY_FILTER::GetFilterPowerSymbols(), LIB_TABLE_ROW::GetIsVisible(), SCH_BASE_FRAME::GetLibSymbol(), LIB_TABLE::GetLogicalLibs(), PROJECT::GetProjectFile(), LIB_TABLE::HasLibrary(), m_acceptHandler, m_adapter, m_dbl_click_timer, m_details, m_fp_sel_ctrl, m_frame, m_hsplitter, m_open_libs_timer, m_show_footprints, m_showPower, m_tree, m_vsplitter, OnChar(), onCloseTimer(), OnDetailsCharHook(), onFootprintSelected(), onOpenLibsTimer(), onSymbolChosen(), onSymbolSelected(), Pgm(), COMMON_SETTINGS::SESSION::pinned_symbol_libs, KIWAY_HOLDER::Prj(), project, PROJECT_SCH::SchSymbolLibTable(), LIB_TREE_MODEL_ADAPTER::SetFilter(), LIB_TREE_MODEL_ADAPTER::SetPreselectNode(), LIB_TREE::SetSearchString(), and EDA_TEXT::SetText().

◆ ~PANEL_SYMBOL_CHOOSER()

Member Function Documentation

◆ constructRightPanel()

◆ FinishSetup()

◆ GetFields()

std::vector< std::pair< int, wxString > > PANEL_SYMBOL_CHOOSER::GetFields ( ) const
inline

Get a list of fields edited by the user.

Returns
vector of pairs; each.first = field ID, each.second = new value.

Definition at line 96 of file panel_symbol_chooser.h.

References m_field_edits.

Referenced by DIALOG_SYMBOL_CHOOSER::GetFields().

◆ GetFocusTarget()

wxWindow * PANEL_SYMBOL_CHOOSER::GetFocusTarget ( ) const
inline

◆ GetItemCount()

int PANEL_SYMBOL_CHOOSER::GetItemCount ( ) const
inline

◆ GetSelectedLibId()

LIB_ID PANEL_SYMBOL_CHOOSER::GetSelectedLibId ( int *  aUnit = nullptr) const

To be called after this dialog returns from ShowModal().

For multi-unit symbols, if the user selects the symbol itself rather than picking an individual unit, 0 will be returned in aUnit. Beware that this is an invalid unit number - this should be replaced with whatever default is desired (usually 1).

Parameters
aUnitif not NULL, the selected unit is filled in here.
Returns
the LIB_ID of the symbol that has been selected.

Definition at line 493 of file panel_symbol_chooser.cpp.

References LIB_TREE::GetSelectedLibId(), and m_tree.

Referenced by DIALOG_SYMBOL_CHOOSER::GetSelectedLibId(), and SYMBOL_CHOOSER_FRAME::OnOK().

◆ OnChar()

void PANEL_SYMBOL_CHOOSER::OnChar ( wxKeyEvent &  aEvent)

◆ onCloseTimer()

void PANEL_SYMBOL_CHOOSER::onCloseTimer ( wxTimerEvent &  aEvent)
protected

◆ OnDetailsCharHook()

void PANEL_SYMBOL_CHOOSER::OnDetailsCharHook ( wxKeyEvent &  aEvt)
protected

Definition at line 465 of file panel_symbol_chooser.cpp.

References m_details.

Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().

◆ onFootprintSelected()

void PANEL_SYMBOL_CHOOSER::onFootprintSelected ( wxCommandEvent &  aEvent)
protected

◆ onOpenLibsTimer()

void PANEL_SYMBOL_CHOOSER::onOpenLibsTimer ( wxTimerEvent &  aEvent)
protected

Definition at line 519 of file panel_symbol_chooser.cpp.

References Kiface(), and m_adapter.

Referenced by PANEL_SYMBOL_CHOOSER().

◆ onSymbolChosen()

void PANEL_SYMBOL_CHOOSER::onSymbolChosen ( wxCommandEvent &  aEvent)
protected

Handle the selection of an item.

This is called when either the search box or the tree receive an Enter, or the tree receives a double click. If the item selected is a category, it is expanded or collapsed; if it is a symbol, the symbol is picked.

Definition at line 673 of file panel_symbol_chooser.cpp.

References DBLCLICK_DELAY, LIB_TREE::GetSelectedLibId(), LIB_ID::IsValid(), m_dbl_click_timer, and m_tree.

Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().

◆ onSymbolSelected()

◆ populateFootprintSelector()

◆ SetPreselect()

void PANEL_SYMBOL_CHOOSER::SetPreselect ( const LIB_ID aPreselect)

◆ showFootprint()

void PANEL_SYMBOL_CHOOSER::showFootprint ( const wxString &  aFootprint)
protected

◆ showFootprintFor()

void PANEL_SYMBOL_CHOOSER::showFootprintFor ( const LIB_ID aLibId)
protected

Member Data Documentation

◆ DBLCLICK_DELAY

constexpr int PANEL_SYMBOL_CHOOSER::DBLCLICK_DELAY = 100
staticconstexprprotected

Definition at line 102 of file panel_symbol_chooser.h.

Referenced by onCloseTimer(), and onSymbolChosen().

◆ g_Mutex

std::mutex PANEL_SYMBOL_CHOOSER::g_Mutex
static

Definition at line 139 of file panel_symbol_chooser.h.

◆ g_powerSearchString

wxString PANEL_SYMBOL_CHOOSER::g_powerSearchString
staticprotected

Definition at line 143 of file panel_symbol_chooser.h.

Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().

◆ g_symbolSearchString

wxString PANEL_SYMBOL_CHOOSER::g_symbolSearchString
staticprotected

Definition at line 142 of file panel_symbol_chooser.h.

Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().

◆ m_acceptHandler

std::function<void()> PANEL_SYMBOL_CHOOSER::m_acceptHandler
protected

Definition at line 159 of file panel_symbol_chooser.h.

Referenced by onCloseTimer(), and PANEL_SYMBOL_CHOOSER().

◆ m_adapter

wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> PANEL_SYMBOL_CHOOSER::m_adapter
protected

◆ m_allow_field_edits

bool PANEL_SYMBOL_CHOOSER::m_allow_field_edits
protected

Definition at line 163 of file panel_symbol_chooser.h.

Referenced by constructRightPanel().

◆ m_dbl_click_timer

wxTimer* PANEL_SYMBOL_CHOOSER::m_dbl_click_timer
protected

◆ m_details

HTML_WINDOW* PANEL_SYMBOL_CHOOSER::m_details
protected

◆ m_escapeHandler

std::function<void()> PANEL_SYMBOL_CHOOSER::m_escapeHandler
protected

Definition at line 160 of file panel_symbol_chooser.h.

Referenced by OnChar().

◆ m_field_edits

std::vector<std::pair<int, wxString> > PANEL_SYMBOL_CHOOSER::m_field_edits
protected

Definition at line 167 of file panel_symbol_chooser.h.

Referenced by GetFields(), and onFootprintSelected().

◆ m_fp_override

wxString PANEL_SYMBOL_CHOOSER::m_fp_override
protected

Definition at line 165 of file panel_symbol_chooser.h.

Referenced by onFootprintSelected().

◆ m_fp_preview

FOOTPRINT_PREVIEW_WIDGET* PANEL_SYMBOL_CHOOSER::m_fp_preview
protected

◆ m_fp_sel_ctrl

FOOTPRINT_SELECT_WIDGET* PANEL_SYMBOL_CHOOSER::m_fp_sel_ctrl
protected

◆ m_frame

SCH_BASE_FRAME* PANEL_SYMBOL_CHOOSER::m_frame
protected

◆ m_hsplitter

wxSplitterWindow* PANEL_SYMBOL_CHOOSER::m_hsplitter
protected

◆ m_open_libs_timer

wxTimer* PANEL_SYMBOL_CHOOSER::m_open_libs_timer
protected

Definition at line 146 of file panel_symbol_chooser.h.

Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().

◆ m_show_footprints

bool PANEL_SYMBOL_CHOOSER::m_show_footprints
protected

Definition at line 164 of file panel_symbol_chooser.h.

Referenced by constructRightPanel(), and PANEL_SYMBOL_CHOOSER().

◆ m_showPower

bool PANEL_SYMBOL_CHOOSER::m_showPower
protected

Definition at line 162 of file panel_symbol_chooser.h.

Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().

◆ m_symbol_preview

SYMBOL_PREVIEW_WIDGET* PANEL_SYMBOL_CHOOSER::m_symbol_preview
protected

Definition at line 147 of file panel_symbol_chooser.h.

Referenced by constructRightPanel(), and onSymbolSelected().

◆ m_tree

LIB_TREE* PANEL_SYMBOL_CHOOSER::m_tree
protected

◆ m_vsplitter

wxSplitterWindow* PANEL_SYMBOL_CHOOSER::m_vsplitter
protected

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