KiCad PCB EDA Suite
FOOTPRINT_TREE_PANE Class Reference

Footprint Editor pane with footprint library tree. More...

#include <footprint_tree_pane.h>

Inheritance diagram for FOOTPRINT_TREE_PANE:

Public Member Functions

 FOOTPRINT_TREE_PANE (FOOTPRINT_EDIT_FRAME *aParent)
 
 ~FOOTPRINT_TREE_PANE ()
 
LIB_TREEGetLibTree () const
 
void Regenerate ()
 

Updates the footprint tree

More...
 

Protected Member Functions

void onComponentSelected (wxCommandEvent &aEvent)
 
void onUpdateUI (wxUpdateUIEvent &aEvent)
 

Protected Attributes

FOOTPRINT_EDIT_FRAMEm_frame
 
LIB_TREEm_tree
 component search tree widget More...
 

Detailed Description

Footprint Editor pane with footprint library tree.

Definition at line 39 of file footprint_tree_pane.h.

Constructor & Destructor Documentation

◆ FOOTPRINT_TREE_PANE()

FOOTPRINT_TREE_PANE::FOOTPRINT_TREE_PANE ( FOOTPRINT_EDIT_FRAME aParent)

Definition at line 31 of file footprint_tree_pane.cpp.

32  : wxPanel( aParent ),
33  m_frame( aParent ),
34  m_tree( nullptr )
35 {
36  // Create widgets
37  wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
39  boxSizer->Add( m_tree, 1, wxEXPAND, 5 );
40 
41  SetSizer( boxSizer ); // should remove the previous sizer according to wxWidgets docs
42  Layout();
43  boxSizer->Fit( this );
44 
45  // Event handlers
46  Bind( COMPONENT_SELECTED, &FOOTPRINT_TREE_PANE::onComponentSelected, this );
47  m_tree->Bind( wxEVT_UPDATE_UI, &FOOTPRINT_TREE_PANE::onUpdateUI, this );
48 }
LIB_TREE_MODEL_ADAPTER::PTR & GetLibTreeAdapter()
Returns the adapter object that provides the stored data.
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:303
FOOTPRINT_EDIT_FRAME * m_frame
void onComponentSelected(wxCommandEvent &aEvent)
LIB_TREE * m_tree
component search tree widget
void onUpdateUI(wxUpdateUIEvent &aEvent)
Widget displaying a tree of components with optional search text control and description panel.
Definition: lib_tree.h:42

References FOOTPRINT_EDIT_FRAME::GetLibTreeAdapter(), GFootprintTable, m_frame, m_tree, onComponentSelected(), onUpdateUI(), and LIB_TREE::SEARCH.

◆ ~FOOTPRINT_TREE_PANE()

FOOTPRINT_TREE_PANE::~FOOTPRINT_TREE_PANE ( )

Definition at line 51 of file footprint_tree_pane.cpp.

52 {
53  m_tree->Destroy();
54 }
LIB_TREE * m_tree
component search tree widget

References m_tree.

Member Function Documentation

◆ GetLibTree()

LIB_TREE* FOOTPRINT_TREE_PANE::GetLibTree ( ) const
inline

◆ onComponentSelected()

void FOOTPRINT_TREE_PANE::onComponentSelected ( wxCommandEvent &  aEvent)
protected

Definition at line 64 of file footprint_tree_pane.cpp.

65 {
66  m_frame->LoadModuleFromLibrary( GetLibTree()->GetSelectedLibId() );
67  // Make sure current-part highlighting doesn't get lost in seleciton highlighting
68  m_tree->Unselect();
69 }
void LoadModuleFromLibrary(LIB_ID aFPID)
FOOTPRINT_EDIT_FRAME * m_frame
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:171
LIB_TREE * GetLibTree() const
LIB_TREE * m_tree
component search tree widget

References GetLibTree(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), m_frame, m_tree, and LIB_TREE::Unselect().

Referenced by FOOTPRINT_TREE_PANE().

◆ onUpdateUI()

void FOOTPRINT_TREE_PANE::onUpdateUI ( wxUpdateUIEvent &  aEvent)
protected

Definition at line 72 of file footprint_tree_pane.cpp.

73 {
74  if( m_frame->GetCanvas()->HasFocus() )
75  {
76  // Don't allow a selected item in the tree when the canvas has focus: it's too easy
77  // to confuse the selected-highlighting with the being-edited-on-canvas-highlighting.
78  m_tree->Unselect();
79  }
80 }
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
FOOTPRINT_EDIT_FRAME * m_frame
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:171
LIB_TREE * m_tree
component search tree widget

References PCB_BASE_FRAME::GetCanvas(), m_frame, m_tree, and LIB_TREE::Unselect().

Referenced by FOOTPRINT_TREE_PANE().

◆ Regenerate()

void FOOTPRINT_TREE_PANE::Regenerate ( )

Updates the footprint tree

Definition at line 57 of file footprint_tree_pane.cpp.

58 {
59  if( m_tree )
60  m_tree->Regenerate( true );
61 }
void Regenerate(bool aKeepState)
Regenerates the tree.
Definition: lib_tree.cpp:182
LIB_TREE * m_tree
component search tree widget

References m_tree, and LIB_TREE::Regenerate().

Referenced by FOOTPRINT_EDIT_FRAME::SyncLibraryTree().

Member Data Documentation

◆ m_frame

FOOTPRINT_EDIT_FRAME* FOOTPRINT_TREE_PANE::m_frame
protected

Definition at line 57 of file footprint_tree_pane.h.

Referenced by FOOTPRINT_TREE_PANE(), onComponentSelected(), and onUpdateUI().

◆ m_tree

LIB_TREE* FOOTPRINT_TREE_PANE::m_tree
protected

component search tree widget

Definition at line 58 of file footprint_tree_pane.h.

Referenced by FOOTPRINT_TREE_PANE(), GetLibTree(), onComponentSelected(), onUpdateUI(), Regenerate(), and ~FOOTPRINT_TREE_PANE().


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