KiCad PCB EDA Suite
|
#include <panel_symbol_chooser.h>
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. | |
~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(). | |
int | GetItemCount () const |
wxWindow * | GetFocusTarget () const |
std::vector< std::pair< int, wxString > > | GetFields () const |
Get a list of fields edited by the user. | |
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. | |
void | showFootprintFor (const LIB_ID &aLibId) |
Look up the footprint for a given symbol specified in the LIB_ID and display it. | |
void | showFootprint (const wxString &aFootprint) |
Display the given footprint by name. | |
void | populateFootprintSelector (const LIB_ID &aLibId) |
Populate the footprint selector for a given alias. | |
Protected Attributes | |
wxTimer * | m_dbl_click_timer |
wxTimer * | m_open_libs_timer |
SYMBOL_PREVIEW_WIDGET * | m_symbol_preview |
wxSplitterWindow * | m_hsplitter |
wxSplitterWindow * | m_vsplitter |
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > | m_adapter |
FOOTPRINT_SELECT_WIDGET * | m_fp_sel_ctrl |
FOOTPRINT_PREVIEW_WIDGET * | m_fp_preview |
LIB_TREE * | m_tree |
HTML_WINDOW * | m_details |
SCH_BASE_FRAME * | m_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 |
Definition at line 44 of file panel_symbol_chooser.h.
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.
aFrame | the parent frame (usually a SCH_EDIT_FRAME or SYMBOL_CHOOSER_FRAME) |
aParent | the parent window (usually a DIALOG_SHIM or SYMBOL_CHOOSER_FRAME) |
aAllowFieldEdits | if false, all functions that allow the user to edit fields (currently just footprint selection) will not be available. |
aShowFootprints | if false, all footprint preview and selection features are disabled. This forces aAllowFieldEdits false too. |
aAcceptHandler | a handler to be called on double-click of a footprint |
aEscapeHandler | a handler to be called on <ESC> |
Definition at line 55 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(), SETTINGS_MANAGER::GetAppSettings(), PGM_BASE::GetCommonSettings(), SYMBOL_LIBRARY_FILTER::GetFilterPowerSymbols(), LIB_TABLE_ROW::GetIsVisible(), SCH_BASE_FRAME::GetLibSymbol(), LIB_TABLE::GetLogicalLibs(), PROJECT::GetProjectFile(), PGM_BASE::GetSettingsManager(), 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, COMMON_SETTINGS::m_Session, 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 SCH_FIELD::SetText().
PANEL_SYMBOL_CHOOSER::~PANEL_SYMBOL_CHOOSER | ( | ) |
Definition at line 292 of file panel_symbol_chooser.cpp.
References g_powerSearchString, g_symbolSearchString, LIB_TREE::GetSearchString(), LIB_TREE::GetSortMode(), Kiface(), m_adapter, m_dbl_click_timer, m_details, m_fp_sel_ctrl, m_hsplitter, m_open_libs_timer, m_showPower, m_tree, m_vsplitter, OnChar(), onCloseTimer(), OnDetailsCharHook(), onFootprintSelected(), onSymbolChosen(), and onSymbolSelected().
|
protected |
Definition at line 367 of file panel_symbol_chooser.cpp.
References APP_SETTINGS_BASE::GRAPHICS::canvas_type, SETTINGS_MANAGER::GetAppSettings(), EDA_DRAW_PANEL_GAL::GetBackend(), SCH_BASE_FRAME::GetCanvas(), FOOTPRINT_LIST::GetInstance(), PGM_BASE::GetSettingsManager(), UNITS_PROVIDER::GetUserUnits(), KIWAY_HOLDER::Kiway(), m_allow_field_edits, m_fp_preview, m_fp_sel_ctrl, m_frame, APP_SETTINGS_BASE::m_Graphics, m_show_footprints, m_symbol_preview, Pgm(), and FOOTPRINT_PREVIEW_WIDGET::SetUserUnits().
Referenced by PANEL_SYMBOL_CHOOSER().
void PANEL_SYMBOL_CHOOSER::FinishSetup | ( | ) |
Definition at line 421 of file panel_symbol_chooser.cpp.
References EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::height, FOOTPRINT_PREVIEW_WIDGET::IsInitialized(), Kiface(), KIWAY_HOLDER::Kiway(), FOOTPRINT_SELECT_WIDGET::Load(), m_adapter, m_fp_preview, m_fp_sel_ctrl, m_frame, m_hsplitter, m_vsplitter, KIWAY_HOLDER::Prj(), EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::sash_pos_h, EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::sash_pos_v, FOOTPRINT_PREVIEW_WIDGET::SetStatusText(), EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::sort_mode, and EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::width.
Referenced by DIALOG_SYMBOL_CHOOSER::DIALOG_SYMBOL_CHOOSER(), and SYMBOL_CHOOSER_FRAME::SYMBOL_CHOOSER_FRAME().
|
inline |
Get a list of fields edited by the user.
Definition at line 97 of file panel_symbol_chooser.h.
References m_field_edits.
Referenced by DIALOG_SYMBOL_CHOOSER::GetFields().
|
inline |
Definition at line 90 of file panel_symbol_chooser.h.
References LIB_TREE::GetFocusTarget(), and m_tree.
Referenced by DIALOG_SYMBOL_CHOOSER::DIALOG_SYMBOL_CHOOSER(), and SYMBOL_CHOOSER_FRAME::OnPaint().
|
inline |
Definition at line 88 of file panel_symbol_chooser.h.
References m_adapter.
Referenced by DIALOG_SYMBOL_CHOOSER::DIALOG_SYMBOL_CHOOSER(), and SYMBOL_CHOOSER_FRAME::SYMBOL_CHOOSER_FRAME().
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).
aUnit | if not NULL, the selected unit is filled in here. |
Definition at line 496 of file panel_symbol_chooser.cpp.
References LIB_TREE::GetSelectedLibId(), and m_tree.
Referenced by DIALOG_SYMBOL_CHOOSER::GetSelectedLibId(), and SYMBOL_CHOOSER_FRAME::OnOK().
void PANEL_SYMBOL_CHOOSER::OnChar | ( | wxKeyEvent & | aEvent | ) |
Definition at line 341 of file panel_symbol_chooser.cpp.
References LIB_TREE::GetSearchString(), m_escapeHandler, m_tree, and LIB_TREE::SetSearchString().
Referenced by DIALOG_SYMBOL_CHOOSER::DIALOG_SYMBOL_CHOOSER(), PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 502 of file panel_symbol_chooser.cpp.
References DBLCLICK_DELAY, m_acceptHandler, and m_dbl_click_timer.
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 468 of file panel_symbol_chooser.cpp.
References m_details.
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 628 of file panel_symbol_chooser.cpp.
References alg::delete_if(), FOOTPRINT_FIELD, m_field_edits, m_fp_override, and showFootprint().
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 522 of file panel_symbol_chooser.cpp.
References Kiface(), and m_adapter.
Referenced by PANEL_SYMBOL_CHOOSER().
|
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 670 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().
|
protected |
Definition at line 643 of file panel_symbol_chooser.cpp.
References _, SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), LIB_TREE::GetCurrentTreeNode(), FOOTPRINT_PREVIEW_WIDGET::IsInitialized(), LIB_ID::IsValid(), LIB_TREE_NODE::m_Footprint, m_fp_preview, LIB_TREE_NODE::m_LibId, m_symbol_preview, m_tree, LIB_TREE_NODE::m_Unit, populateFootprintSelector(), SYMBOL_PREVIEW_WIDGET::SetStatusText(), FOOTPRINT_PREVIEW_WIDGET::SetStatusText(), showFootprint(), and showFootprintFor().
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Populate the footprint selector for a given alias.
aLibId | the LIB_ID of the selection or invalid to clear. |
Definition at line 584 of file panel_symbol_chooser.cpp.
References _, FOOTPRINT_SELECT_WIDGET::ClearFilters(), FOOTPRINT_SELECT_WIDGET::Enable(), FOOTPRINT_SELECT_WIDGET::FilterByFootprintFilters(), FOOTPRINT_SELECT_WIDGET::FilterByPinCount(), FOOTPRINT_FIELD, LIB_SYMBOL::GetFieldById(), LIB_SYMBOL::GetFPFilters(), SCH_FIELD::GetFullText(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), LIB_SYMBOL::GetPins(), LIB_ID::IsValid(), SYMBOL_LIB_TABLE::LoadSymbol(), m_fp_sel_ctrl, m_frame, KIWAY_HOLDER::Prj(), PROJECT_SCH::SchSymbolLibTable(), FOOTPRINT_SELECT_WIDGET::SetDefaultFootprint(), FOOTPRINT_SELECT_WIDGET::UpdateList(), IO_ERROR::What(), and UTF8::wx_str().
Referenced by onSymbolSelected().
void PANEL_SYMBOL_CHOOSER::SetPreselect | ( | const LIB_ID & | aPreselect | ) |
Definition at line 490 of file panel_symbol_chooser.cpp.
References m_adapter.
Referenced by DIALOG_SYMBOL_CHOOSER::DIALOG_SYMBOL_CHOOSER(), and SYMBOL_CHOOSER_FRAME::ShowModal().
|
protected |
Display the given footprint by name.
Definition at line 558 of file panel_symbol_chooser.cpp.
References _, FOOTPRINT_PREVIEW_WIDGET::ClearStatus(), FOOTPRINT_PREVIEW_WIDGET::DisplayFootprint(), FOOTPRINT_PREVIEW_WIDGET::IsInitialized(), LIB_ID::IsValid(), m_fp_preview, LIB_ID::Parse(), and FOOTPRINT_PREVIEW_WIDGET::SetStatusText().
Referenced by onFootprintSelected(), onSymbolSelected(), and showFootprintFor().
|
protected |
Look up the footprint for a given symbol specified in the LIB_ID and display it.
Definition at line 529 of file panel_symbol_chooser.cpp.
References _, FOOTPRINT_FIELD, LIB_SYMBOL::GetFieldById(), SCH_FIELD::GetFullText(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), FOOTPRINT_PREVIEW_WIDGET::IsInitialized(), SYMBOL_LIB_TABLE::LoadSymbol(), m_fp_preview, m_frame, KIWAY_HOLDER::Prj(), PROJECT_SCH::SchSymbolLibTable(), showFootprint(), IO_ERROR::What(), and UTF8::wx_str().
Referenced by onSymbolSelected().
|
staticconstexprprotected |
Definition at line 103 of file panel_symbol_chooser.h.
Referenced by onCloseTimer(), and onSymbolChosen().
|
static |
Definition at line 140 of file panel_symbol_chooser.h.
|
staticprotected |
Definition at line 144 of file panel_symbol_chooser.h.
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
staticprotected |
Definition at line 143 of file panel_symbol_chooser.h.
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 160 of file panel_symbol_chooser.h.
Referenced by onCloseTimer(), and PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 152 of file panel_symbol_chooser.h.
Referenced by FinishSetup(), GetItemCount(), onOpenLibsTimer(), PANEL_SYMBOL_CHOOSER(), SetPreselect(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 164 of file panel_symbol_chooser.h.
Referenced by constructRightPanel().
|
protected |
Definition at line 146 of file panel_symbol_chooser.h.
Referenced by onCloseTimer(), onSymbolChosen(), PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 157 of file panel_symbol_chooser.h.
Referenced by OnDetailsCharHook(), PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 161 of file panel_symbol_chooser.h.
Referenced by OnChar().
|
protected |
Definition at line 168 of file panel_symbol_chooser.h.
Referenced by GetFields(), and onFootprintSelected().
|
protected |
Definition at line 166 of file panel_symbol_chooser.h.
Referenced by onFootprintSelected().
|
protected |
Definition at line 155 of file panel_symbol_chooser.h.
Referenced by constructRightPanel(), FinishSetup(), onSymbolSelected(), showFootprint(), and showFootprintFor().
|
protected |
Definition at line 154 of file panel_symbol_chooser.h.
Referenced by constructRightPanel(), FinishSetup(), PANEL_SYMBOL_CHOOSER(), populateFootprintSelector(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 159 of file panel_symbol_chooser.h.
Referenced by constructRightPanel(), FinishSetup(), PANEL_SYMBOL_CHOOSER(), populateFootprintSelector(), and showFootprintFor().
|
protected |
Definition at line 149 of file panel_symbol_chooser.h.
Referenced by FinishSetup(), PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 147 of file panel_symbol_chooser.h.
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 165 of file panel_symbol_chooser.h.
Referenced by constructRightPanel(), and PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 163 of file panel_symbol_chooser.h.
Referenced by PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 148 of file panel_symbol_chooser.h.
Referenced by constructRightPanel(), and onSymbolSelected().
|
protected |
Definition at line 156 of file panel_symbol_chooser.h.
Referenced by GetFocusTarget(), GetSelectedLibId(), OnChar(), onSymbolChosen(), onSymbolSelected(), PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().
|
protected |
Definition at line 150 of file panel_symbol_chooser.h.
Referenced by FinishSetup(), PANEL_SYMBOL_CHOOSER(), and ~PANEL_SYMBOL_CHOOSER().