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

#include <panel_design_block_chooser.h>

Inheritance diagram for PANEL_DESIGN_BLOCK_CHOOSER:

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_TREEGetLibTree ()
 

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_ADAPTERm_adapter
 
LIB_TREEm_tree
 
DESIGN_BLOCK_PREVIEW_WIDGETm_preview
 
SCH_EDIT_FRAMEm_frame
 
std::function< void()> m_selectHandler
 
std::vector< LIB_IDm_historyList
 

Static Protected Attributes

static constexpr int DBLCLICK_DELAY = 100
 
static wxString g_designBlockSearchString
 

Detailed Description

Definition at line 38 of file panel_design_block_chooser.h.

Constructor & Destructor Documentation

◆ PANEL_DESIGN_BLOCK_CHOOSER()

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.

Parameters
aFramethe parent frame (usually a SCH_EDIT_FRAME or DESIGN_BLOCK_CHOOSER_FRAME)
aParentthe parent window (usually a DIALOG_SHIM or DESIGN_BLOCK_CHOOSER_FRAME)
aAcceptHandlera handler to be called on double-click of a footprint
aEscapeHandlera 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()

Member Function Documentation

◆ addDesignBlockToHistory()

void PANEL_DESIGN_BLOCK_CHOOSER::addDesignBlockToHistory ( const LIB_ID aLibId)
protected

◆ displayErrors()

void PANEL_DESIGN_BLOCK_CHOOSER::displayErrors ( wxTopLevelWindow *  aWindow)
protected

◆ FinishSetup()

◆ GetLibTree()

LIB_TREE * PANEL_DESIGN_BLOCK_CHOOSER::GetLibTree ( )
inline

Definition at line 77 of file panel_design_block_chooser.h.

References m_tree.

Referenced by SCH_DESIGN_BLOCK_CONTROL::getCurrentTreeNode().

◆ GetSelectedLibId()

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).

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

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().

◆ OnChar()

void PANEL_DESIGN_BLOCK_CHOOSER::OnChar ( wxKeyEvent &  aEvent)

◆ onCloseTimer()

void PANEL_DESIGN_BLOCK_CHOOSER::onCloseTimer ( wxTimerEvent &  aEvent)
protected

◆ onDesignBlockChosen()

void PANEL_DESIGN_BLOCK_CHOOSER::onDesignBlockChosen ( 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 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().

◆ onDesignBlockSelected()

void PANEL_DESIGN_BLOCK_CHOOSER::onDesignBlockSelected ( wxCommandEvent &  aEvent)
protected

◆ OnDetailsCharHook()

void PANEL_DESIGN_BLOCK_CHOOSER::OnDetailsCharHook ( wxKeyEvent &  aEvt)
protected

◆ onOpenLibsTimer()

void PANEL_DESIGN_BLOCK_CHOOSER::onOpenLibsTimer ( wxTimerEvent &  aEvent)
protected

Definition at line 323 of file panel_design_block_chooser.cpp.

References Kiface(), m_adapter, and onDesignBlockSelected().

Referenced by PANEL_DESIGN_BLOCK_CHOOSER().

◆ rebuildHistoryNode()

void PANEL_DESIGN_BLOCK_CHOOSER::rebuildHistoryNode ( )
protected

◆ RefreshLibs()

◆ SelectLibId()

void PANEL_DESIGN_BLOCK_CHOOSER::SelectLibId ( const LIB_ID aLibId)

◆ SetPreselect()

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().

Member Data Documentation

◆ DBLCLICK_DELAY

constexpr int PANEL_DESIGN_BLOCK_CHOOSER::DBLCLICK_DELAY = 100
staticconstexprprotected

Definition at line 80 of file panel_design_block_chooser.h.

Referenced by onCloseTimer(), and onDesignBlockChosen().

◆ g_designBlockSearchString

wxString PANEL_DESIGN_BLOCK_CHOOSER::g_designBlockSearchString
staticprotected

◆ m_adapter

wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> PANEL_DESIGN_BLOCK_CHOOSER::m_adapter
protected

◆ m_dbl_click_timer

wxTimer* PANEL_DESIGN_BLOCK_CHOOSER::m_dbl_click_timer
protected

◆ m_frame

SCH_EDIT_FRAME* PANEL_DESIGN_BLOCK_CHOOSER::m_frame
protected

◆ m_historyList

std::vector<LIB_ID> PANEL_DESIGN_BLOCK_CHOOSER::m_historyList
protected

◆ m_open_libs_timer

wxTimer* PANEL_DESIGN_BLOCK_CHOOSER::m_open_libs_timer
protected

◆ m_preview

DESIGN_BLOCK_PREVIEW_WIDGET* PANEL_DESIGN_BLOCK_CHOOSER::m_preview
protected

◆ m_selectHandler

std::function<void()> PANEL_DESIGN_BLOCK_CHOOSER::m_selectHandler
protected

Definition at line 113 of file panel_design_block_chooser.h.

Referenced by onCloseTimer().

◆ m_tree

◆ m_vsplitter

wxSplitterWindow* PANEL_DESIGN_BLOCK_CHOOSER::m_vsplitter
protected

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