KiCad PCB EDA Suite
|
#include <panel_design_block_chooser.h>
Public Member Functions | |
PANEL_DESIGN_BLOCK_CHOOSER (SCH_EDIT_FRAME *aFrame, wxWindow *aParent, std::vector< LIB_ID > &aHistoryList, std::function< void()> aSelectHandler) | |
Create dialog to choose design_block. | |
~PANEL_DESIGN_BLOCK_CHOOSER () | |
void | OnChar (wxKeyEvent &aEvent) |
void | FinishSetup () |
void | SetPreselect (const LIB_ID &aPreselect) |
void | RefreshLibs (bool aProgress=false) |
LIB_ID | GetSelectedLibId (int *aUnit=nullptr) const |
To be called after this dialog returns from ShowModal(). | |
void | SelectLibId (const LIB_ID &aLibId) |
LIB_TREE * | GetLibTree () |
Protected Member Functions | |
void | OnDetailsCharHook (wxKeyEvent &aEvt) |
void | onCloseTimer (wxTimerEvent &aEvent) |
void | onOpenLibsTimer (wxTimerEvent &aEvent) |
void | onDesignBlockSelected (wxCommandEvent &aEvent) |
void | onDesignBlockChosen (wxCommandEvent &aEvent) |
Handle the selection of an item. | |
void | addDesignBlockToHistory (const LIB_ID &aLibId) |
void | rebuildHistoryNode () |
void | displayErrors (wxTopLevelWindow *aWindow) |
Protected Attributes | |
wxTimer * | m_dbl_click_timer |
wxTimer * | m_open_libs_timer |
wxSplitterWindow * | m_vsplitter |
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > | m_adapter |
LIB_TREE * | m_tree |
DESIGN_BLOCK_PREVIEW_WIDGET * | m_preview |
SCH_EDIT_FRAME * | m_frame |
std::function< void()> | m_selectHandler |
std::vector< LIB_ID > | m_historyList |
Static Protected Attributes | |
static constexpr int | DBLCLICK_DELAY = 100 |
static wxString | g_designBlockSearchString |
Definition at line 38 of file panel_design_block_chooser.h.
PANEL_DESIGN_BLOCK_CHOOSER::PANEL_DESIGN_BLOCK_CHOOSER | ( | SCH_EDIT_FRAME * | aFrame, |
wxWindow * | aParent, | ||
std::vector< LIB_ID > & | aHistoryList, | ||
std::function< void()> | aSelectHandler | ||
) |
Create dialog to choose design_block.
aFrame | the parent frame (usually a SCH_EDIT_FRAME or DESIGN_BLOCK_CHOOSER_FRAME) |
aParent | the parent window (usually a DIALOG_SHIM or DESIGN_BLOCK_CHOOSER_FRAME) |
aAcceptHandler | a handler to be called on double-click of a footprint |
aEscapeHandler | a handler to be called on <ESC> |
Definition at line 53 of file panel_design_block_chooser.cpp.
References _, LIB_TREE::ALL_WIDGETS, DESIGN_BLOCK_TREE_MODEL_ADAPTER::Create(), PROJECT::DesignBlockLibs(), displayErrors(), g_designBlockSearchString, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, SETTINGS_MANAGER::GetAppSettings(), DESIGN_BLOCK_LIB_TABLE::GetGlobalList(), PGM_BASE::GetSettingsManager(), m_adapter, m_dbl_click_timer, m_frame, m_open_libs_timer, m_preview, m_tree, m_vsplitter, OnChar(), onCloseTimer(), onDesignBlockChosen(), onOpenLibsTimer(), Pgm(), KIWAY_HOLDER::Prj(), DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles(), RefreshLibs(), and LIB_TREE::SetSearchString().
PANEL_DESIGN_BLOCK_CHOOSER::~PANEL_DESIGN_BLOCK_CHOOSER | ( | ) |
Definition at line 153 of file panel_design_block_chooser.cpp.
References g_designBlockSearchString, LIB_TREE::GetSearchString(), LIB_TREE::GetSortMode(), Kiface(), m_adapter, m_dbl_click_timer, m_open_libs_timer, m_tree, m_vsplitter, OnChar(), onCloseTimer(), onDesignBlockChosen(), and onDesignBlockSelected().
|
protected |
Definition at line 358 of file panel_design_block_chooser.cpp.
References GetSelectedLibId(), m_historyList, m_tree, rebuildHistoryNode(), LIB_TREE::Regenerate(), SelectLibId(), and LIB_TREE::Unselect().
Referenced by onCloseTimer().
|
protected |
Definition at line 408 of file panel_design_block_chooser.cpp.
References _, HTML_MESSAGE_BOX::AddHTML_Text(), EscapeHTML(), DESIGN_BLOCK_LIB_TABLE::GetGlobalList(), HTML_MESSAGE_BOX::MessageSet(), and DIALOG_SHIM::ShowModal().
Referenced by PANEL_DESIGN_BLOCK_CHOOSER().
void PANEL_DESIGN_BLOCK_CHOOSER::FinishSetup | ( | ) |
Definition at line 208 of file panel_design_block_chooser.cpp.
References EESCHEMA_SETTINGS::PANEL_DESIGN_BLOCK_CHOOSER::height, Kiface(), m_adapter, m_vsplitter, EESCHEMA_SETTINGS::PANEL_DESIGN_BLOCK_CHOOSER::sash_pos_h, EESCHEMA_SETTINGS::PANEL_DESIGN_BLOCK_CHOOSER::sash_pos_v, EESCHEMA_SETTINGS::PANEL_DESIGN_BLOCK_CHOOSER::sort_mode, and EESCHEMA_SETTINGS::PANEL_DESIGN_BLOCK_CHOOSER::width.
Referenced by DESIGN_BLOCK_PANE::DESIGN_BLOCK_PANE().
|
inline |
Definition at line 77 of file panel_design_block_chooser.h.
References m_tree.
Referenced by SCH_DESIGN_BLOCK_CONTROL::getCurrentTreeNode().
LIB_ID PANEL_DESIGN_BLOCK_CHOOSER::GetSelectedLibId | ( | int * | aUnit = nullptr | ) | const |
To be called after this dialog returns from ShowModal().
For multi-unit design_blocks, if the user selects the design_block 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 289 of file panel_design_block_chooser.cpp.
References LIB_TREE::GetSelectedLibId(), and m_tree.
Referenced by addDesignBlockToHistory(), DESIGN_BLOCK_PANE::GetSelectedLibId(), and onDesignBlockSelected().
void PANEL_DESIGN_BLOCK_CHOOSER::OnChar | ( | wxKeyEvent & | aEvent | ) |
Definition at line 184 of file panel_design_block_chooser.cpp.
References LIB_TREE::GetSearchString(), m_tree, and LIB_TREE::SetSearchString().
Referenced by DESIGN_BLOCK_PANE::DESIGN_BLOCK_PANE(), PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 302 of file panel_design_block_chooser.cpp.
References addDesignBlockToHistory(), DBLCLICK_DELAY, LIB_TREE::GetSelectedLibId(), m_dbl_click_timer, m_selectHandler, and m_tree.
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_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 design_block, the design_block is picked.
Definition at line 341 of file panel_design_block_chooser.cpp.
References DBLCLICK_DELAY, LIB_TREE::GetSelectedLibId(), LIB_ID::IsValid(), m_dbl_click_timer, and m_tree.
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 334 of file panel_design_block_chooser.cpp.
References DESIGN_BLOCK_PREVIEW_WIDGET::DisplayDesignBlock(), SCH_EDIT_FRAME::GetDesignBlock(), GetSelectedLibId(), m_frame, and m_preview.
Referenced by onOpenLibsTimer(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
|
protected |
Definition at line 323 of file panel_design_block_chooser.cpp.
References Kiface(), m_adapter, and onDesignBlockSelected().
Referenced by PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 385 of file panel_design_block_chooser.cpp.
References _, DESIGN_BLOCK_LIST::GetDesignBlockInfo(), DESIGN_BLOCK_LIB_TABLE::GetGlobalList(), m_adapter, and m_historyList.
Referenced by addDesignBlockToHistory(), and RefreshLibs().
void PANEL_DESIGN_BLOCK_CHOOSER::RefreshLibs | ( | bool | aProgress = false | ) |
Definition at line 244 of file panel_design_block_chooser.cpp.
References _, DESIGN_BLOCK_TREE_MODEL_ADAPTER::AddLibraries(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::ClearLibraries(), PROJECT::DesignBlockLibs(), DESIGN_BLOCK_LIB_TABLE::GetGlobalList(), m_adapter, m_frame, m_historyList, m_tree, KIWAY_HOLDER::Prj(), DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles(), rebuildHistoryNode(), LIB_TREE::Regenerate(), LIB_TREE_MODEL_ADAPTER::SetPreselectNode(), and LIB_TREE::Unselect().
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and DESIGN_BLOCK_PANE::RefreshLibs().
void PANEL_DESIGN_BLOCK_CHOOSER::SelectLibId | ( | const LIB_ID & | aLibId | ) |
Definition at line 295 of file panel_design_block_chooser.cpp.
References LIB_TREE::CenterLibId(), m_tree, and LIB_TREE::SelectLibId().
Referenced by addDesignBlockToHistory(), and DESIGN_BLOCK_PANE::SelectLibId().
void PANEL_DESIGN_BLOCK_CHOOSER::SetPreselect | ( | const LIB_ID & | aPreselect | ) |
Definition at line 283 of file panel_design_block_chooser.cpp.
References m_adapter.
Referenced by DESIGN_BLOCK_PANE::DESIGN_BLOCK_PANE().
|
staticconstexprprotected |
Definition at line 80 of file panel_design_block_chooser.h.
Referenced by onCloseTimer(), and onDesignBlockChosen().
|
staticprotected |
Definition at line 101 of file panel_design_block_chooser.h.
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 107 of file panel_design_block_chooser.h.
Referenced by FinishSetup(), onOpenLibsTimer(), PANEL_DESIGN_BLOCK_CHOOSER(), rebuildHistoryNode(), RefreshLibs(), SetPreselect(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 103 of file panel_design_block_chooser.h.
Referenced by onCloseTimer(), onDesignBlockChosen(), PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 112 of file panel_design_block_chooser.h.
Referenced by onDesignBlockSelected(), PANEL_DESIGN_BLOCK_CHOOSER(), and RefreshLibs().
|
protected |
Definition at line 115 of file panel_design_block_chooser.h.
Referenced by addDesignBlockToHistory(), rebuildHistoryNode(), and RefreshLibs().
|
protected |
Definition at line 104 of file panel_design_block_chooser.h.
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 110 of file panel_design_block_chooser.h.
Referenced by onDesignBlockSelected(), and PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 113 of file panel_design_block_chooser.h.
Referenced by onCloseTimer().
|
protected |
Definition at line 109 of file panel_design_block_chooser.h.
Referenced by addDesignBlockToHistory(), GetLibTree(), GetSelectedLibId(), OnChar(), onCloseTimer(), onDesignBlockChosen(), PANEL_DESIGN_BLOCK_CHOOSER(), RefreshLibs(), SelectLibId(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 105 of file panel_design_block_chooser.h.
Referenced by FinishSetup(), PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().