KiCad PCB EDA Suite
|
#include <panel_design_block_chooser.h>
Public Member Functions | |
PANEL_DESIGN_BLOCK_CHOOSER (EDA_DRAW_FRAME *aFrame, DESIGN_BLOCK_PANE *aParent, std::vector< LIB_ID > &aHistoryList, std::function< void()> aSelectHandler, TOOL_INTERACTIVE *aContextMenuTool) | |
Panel for using design blocks. | |
~PANEL_DESIGN_BLOCK_CHOOSER () | |
void | SaveSettings () |
void | OnChar (wxKeyEvent &aEvent) |
wxPanel * | GetDetailsPanel () |
void | SetPreviewWidget (DESIGN_BLOCK_PREVIEW_WIDGET *aPreview) |
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 () |
void | ShowChangedLanguage () |
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 |
wxPanel * | m_detailsPanel |
wxBoxSizer * | m_detailsSizer |
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > | m_adapter |
LIB_TREE * | m_tree |
DESIGN_BLOCK_PREVIEW_WIDGET * | m_preview |
DESIGN_BLOCK_PANE * | m_parent |
EDA_DRAW_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 39 of file panel_design_block_chooser.h.
PANEL_DESIGN_BLOCK_CHOOSER::PANEL_DESIGN_BLOCK_CHOOSER | ( | EDA_DRAW_FRAME * | aFrame, |
DESIGN_BLOCK_PANE * | aParent, | ||
std::vector< LIB_ID > & | aHistoryList, | ||
std::function< void()> | aSelectHandler, | ||
TOOL_INTERACTIVE * | aContextMenuTool | ||
) |
Panel for using design blocks.
aFrame | the parent frame (usually a SCH_EDIT_FRAME or PCB_EDIT_FRAME) |
aParent | the parent design block pane |
aAcceptHandler | a handler to be called on double-click of a footprint |
aContextMenuTool | the tool that will be used to provide an appropriate context menu for the design block actions available in that frame |
Definition at line 52 of file panel_design_block_chooser.cpp.
References _, LIB_TREE::ALL_WIDGETS, EDA_BASE_FRAME::config(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::Create(), PROJECT::DesignBlockLibs(), displayErrors(), g_designBlockSearchString, DESIGN_BLOCK_LIB_TABLE::GetGlobalList(), m_adapter, m_dbl_click_timer, APP_SETTINGS_BASE::m_DesignBlockChooserPanel, m_detailsPanel, m_detailsSizer, m_frame, m_open_libs_timer, m_tree, m_vsplitter, OnChar(), onCloseTimer(), onDesignBlockChosen(), onOpenLibsTimer(), KIWAY_HOLDER::Prj(), DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles(), RefreshLibs(), LIB_TREE::SetSearchString(), and APP_SETTINGS_BASE::PANEL_DESIGN_BLOCK_CHOOSER::tree.
PANEL_DESIGN_BLOCK_CHOOSER::~PANEL_DESIGN_BLOCK_CHOOSER | ( | ) |
Definition at line 149 of file panel_design_block_chooser.cpp.
References m_dbl_click_timer, m_open_libs_timer, OnChar(), onCloseTimer(), onDesignBlockChosen(), and onDesignBlockSelected().
|
protected |
Definition at line 369 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 419 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 219 of file panel_design_block_chooser.cpp.
References EDA_BASE_FRAME::config(), APP_SETTINGS_BASE::PANEL_DESIGN_BLOCK_CHOOSER::height, m_adapter, m_frame, m_vsplitter, APP_SETTINGS_BASE::PANEL_DESIGN_BLOCK_CHOOSER::sash_pos_h, APP_SETTINGS_BASE::PANEL_DESIGN_BLOCK_CHOOSER::sash_pos_v, APP_SETTINGS_BASE::PANEL_DESIGN_BLOCK_CHOOSER::sort_mode, and APP_SETTINGS_BASE::PANEL_DESIGN_BLOCK_CHOOSER::width.
Referenced by PCB_DESIGN_BLOCK_PANE::PCB_DESIGN_BLOCK_PANE(), and SCH_DESIGN_BLOCK_PANE::SCH_DESIGN_BLOCK_PANE().
|
inline |
Definition at line 62 of file panel_design_block_chooser.h.
References m_detailsPanel.
Referenced by PCB_DESIGN_BLOCK_PANE::PCB_DESIGN_BLOCK_PANE(), and SCH_DESIGN_BLOCK_PANE::SCH_DESIGN_BLOCK_PANE().
|
inline |
Definition at line 84 of file panel_design_block_chooser.h.
References m_tree.
Referenced by 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 299 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 196 of file panel_design_block_chooser.cpp.
References LIB_TREE::GetSearchString(), m_tree, and LIB_TREE::SetSearchString().
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), PCB_DESIGN_BLOCK_PANE::PCB_DESIGN_BLOCK_PANE(), SCH_DESIGN_BLOCK_PANE::SCH_DESIGN_BLOCK_PANE(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 312 of file panel_design_block_chooser.cpp.
References addDesignBlockToHistory(), DBLCLICK_DELAY, EDA_DRAW_FRAME::GetCanvas(), LIB_TREE::GetSelectedLibId(), m_dbl_click_timer, m_frame, m_selectHandler, m_tree, and EDA_DRAW_PANEL_GAL::SetFocus().
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 352 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 345 of file panel_design_block_chooser.cpp.
References DESIGN_BLOCK_PREVIEW_WIDGET::DisplayDesignBlock(), DESIGN_BLOCK_PANE::GetDesignBlock(), GetSelectedLibId(), m_parent, and m_preview.
Referenced by onOpenLibsTimer(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
|
protected |
Definition at line 334 of file panel_design_block_chooser.cpp.
References EDA_BASE_FRAME::config(), m_adapter, m_frame, and onDesignBlockSelected().
Referenced by PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 396 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 255 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(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::SetLibTable(), 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::SaveSettings | ( | ) |
Definition at line 164 of file panel_design_block_chooser.cpp.
References EDA_BASE_FRAME::config(), g_designBlockSearchString, LIB_TREE::GetSearchString(), LIB_TREE::GetSortMode(), m_adapter, m_frame, m_tree, and m_vsplitter.
Referenced by DESIGN_BLOCK_PANE::SaveSettings().
void PANEL_DESIGN_BLOCK_CHOOSER::SelectLibId | ( | const LIB_ID & | aLibId | ) |
Definition at line 305 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 293 of file panel_design_block_chooser.cpp.
References m_adapter.
Referenced by PCB_DESIGN_BLOCK_PANE::PCB_DESIGN_BLOCK_PANE(), and SCH_DESIGN_BLOCK_PANE::SCH_DESIGN_BLOCK_PANE().
void PANEL_DESIGN_BLOCK_CHOOSER::SetPreviewWidget | ( | DESIGN_BLOCK_PREVIEW_WIDGET * | aPreview | ) |
Definition at line 188 of file panel_design_block_chooser.cpp.
References m_detailsSizer, and m_preview.
Referenced by PCB_DESIGN_BLOCK_PANE::PCB_DESIGN_BLOCK_PANE(), and SCH_DESIGN_BLOCK_PANE::SCH_DESIGN_BLOCK_PANE().
void PANEL_DESIGN_BLOCK_CHOOSER::ShowChangedLanguage | ( | ) |
Definition at line 181 of file panel_design_block_chooser.cpp.
References m_tree, and LIB_TREE::ShowChangedLanguage().
Referenced by DESIGN_BLOCK_PANE::OnLanguageChanged().
|
staticconstexprprotected |
Definition at line 89 of file panel_design_block_chooser.h.
Referenced by onCloseTimer(), and onDesignBlockChosen().
|
staticprotected |
Definition at line 111 of file panel_design_block_chooser.h.
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and SaveSettings().
|
protected |
Definition at line 119 of file panel_design_block_chooser.h.
Referenced by FinishSetup(), onOpenLibsTimer(), PANEL_DESIGN_BLOCK_CHOOSER(), rebuildHistoryNode(), RefreshLibs(), SaveSettings(), and SetPreselect().
|
protected |
Definition at line 113 of file panel_design_block_chooser.h.
Referenced by onCloseTimer(), onDesignBlockChosen(), PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 116 of file panel_design_block_chooser.h.
Referenced by GetDetailsPanel(), and PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 117 of file panel_design_block_chooser.h.
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and SetPreviewWidget().
|
protected |
Definition at line 125 of file panel_design_block_chooser.h.
Referenced by FinishSetup(), onCloseTimer(), onOpenLibsTimer(), PANEL_DESIGN_BLOCK_CHOOSER(), RefreshLibs(), and SaveSettings().
|
protected |
Definition at line 128 of file panel_design_block_chooser.h.
Referenced by addDesignBlockToHistory(), rebuildHistoryNode(), and RefreshLibs().
|
protected |
Definition at line 114 of file panel_design_block_chooser.h.
Referenced by PANEL_DESIGN_BLOCK_CHOOSER(), and ~PANEL_DESIGN_BLOCK_CHOOSER().
|
protected |
Definition at line 124 of file panel_design_block_chooser.h.
Referenced by onDesignBlockSelected().
|
protected |
Definition at line 122 of file panel_design_block_chooser.h.
Referenced by onDesignBlockSelected(), and SetPreviewWidget().
|
protected |
Definition at line 126 of file panel_design_block_chooser.h.
Referenced by onCloseTimer().
|
protected |
Definition at line 121 of file panel_design_block_chooser.h.
Referenced by addDesignBlockToHistory(), GetLibTree(), GetSelectedLibId(), OnChar(), onCloseTimer(), onDesignBlockChosen(), PANEL_DESIGN_BLOCK_CHOOSER(), RefreshLibs(), SaveSettings(), SelectLibId(), and ShowChangedLanguage().
|
protected |
Definition at line 115 of file panel_design_block_chooser.h.
Referenced by FinishSetup(), PANEL_DESIGN_BLOCK_CHOOSER(), and SaveSettings().