KiCad PCB EDA Suite
SYMBOL_TREE_PANE Class Reference

Library Editor pane with symbol tree and symbol library table selector. More...

#include <symbol_tree_pane.h>

Inheritance diagram for SYMBOL_TREE_PANE:

Public Member Functions

 SYMBOL_TREE_PANE (SYMBOL_EDIT_FRAME *aParent, LIB_SYMBOL_LIBRARY_MANAGER *aLibMgr)
 
 ~SYMBOL_TREE_PANE ()
 
LIB_TREEGetLibTree () const
 

Protected Member Functions

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

Protected Attributes

SYMBOL_EDIT_FRAMEm_symbolEditFrame
 
LIB_TREEm_tree
 symbol search tree widget More...
 
LIB_SYMBOL_LIBRARY_MANAGERm_libMgr
 

Detailed Description

Library Editor pane with symbol tree and symbol library table selector.

Definition at line 41 of file symbol_tree_pane.h.

Constructor & Destructor Documentation

◆ SYMBOL_TREE_PANE()

SYMBOL_TREE_PANE::SYMBOL_TREE_PANE ( SYMBOL_EDIT_FRAME aParent,
LIB_SYMBOL_LIBRARY_MANAGER aLibMgr 
)

Definition at line 34 of file symbol_tree_pane.cpp.

36 : wxPanel( aParent ),
37 m_symbolEditFrame( aParent ),
38 m_tree( nullptr ),
39 m_libMgr( aLibMgr )
40{
41 // Create widgets
42 wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
43 m_tree = new LIB_TREE( this, wxT( "symbols" ), &SYMBOL_LIB_TABLE::GetGlobalLibTable(),
45 boxSizer->Add( m_tree, 1, wxEXPAND, 5 );
46
47 SetSizer( boxSizer ); // should remove the previous sizer according to wxWidgets docs
48 Layout();
49 boxSizer->Fit( this );
50
51 m_libMgr->GetAdapter()->FinishTreeInitialization();
52
53 // Event handlers
54 Bind( SYMBOL_SELECTED, &SYMBOL_TREE_PANE::onSymbolSelected, this );
55 m_tree->Bind( wxEVT_UPDATE_UI, &SYMBOL_TREE_PANE::onUpdateUI, this );
56}
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetAdapter()
Return the adapter object that provides the stored data.
Widget displaying a tree of symbols with optional search text control and description panel....
Definition: lib_tree.h:46
@ MULTISELECT
Definition: lib_tree.h:55
@ SEARCH
Definition: lib_tree.h:52
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
void onUpdateUI(wxUpdateUIEvent &aEvent)
LIB_SYMBOL_LIBRARY_MANAGER * m_libMgr
SYMBOL_EDIT_FRAME * m_symbolEditFrame
void onSymbolSelected(wxCommandEvent &aEvent)
LIB_TREE * m_tree
symbol search tree widget

References LIB_SYMBOL_LIBRARY_MANAGER::GetAdapter(), SYMBOL_LIB_TABLE::GetGlobalLibTable(), m_libMgr, m_tree, LIB_TREE::MULTISELECT, onSymbolSelected(), onUpdateUI(), and LIB_TREE::SEARCH.

◆ ~SYMBOL_TREE_PANE()

SYMBOL_TREE_PANE::~SYMBOL_TREE_PANE ( )

Definition at line 59 of file symbol_tree_pane.cpp.

60{
61 m_tree->Destroy();
62}

References m_tree.

Member Function Documentation

◆ GetLibTree()

◆ onSymbolSelected()

void SYMBOL_TREE_PANE::onSymbolSelected ( wxCommandEvent &  aEvent)
protected

Definition at line 65 of file symbol_tree_pane.cpp.

66{
68
69 // Make sure current-part highlighting doesn't get lost in selection highlighting
71
72 // Turn off any previous current-part highlighting
74}
static TOOL_ACTION editSymbol
Definition: ee_actions.h:187
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:313
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:242
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142

References EE_ACTIONS::editSymbol, TOOLS_HOLDER::GetToolManager(), m_symbolEditFrame, m_tree, LIB_TREE::RefreshLibTree(), TOOL_MANAGER::RunAction(), and LIB_TREE::Unselect().

Referenced by SYMBOL_TREE_PANE().

◆ onUpdateUI()

void SYMBOL_TREE_PANE::onUpdateUI ( wxUpdateUIEvent &  aEvent)
protected

Definition at line 77 of file symbol_tree_pane.cpp.

78{
79 if( m_symbolEditFrame->GetCanvas()->HasFocus() )
80 {
81 // Don't allow a selected item in the tree when the canvas has focus: it's too easy
82 // to confuse the selected-highlighting with the being-edited-on-canvas-highlighting.
83 if( m_symbolEditFrame->GetCurSymbol() != nullptr )
84 {
86 }
87 }
88}
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.

References SCH_BASE_FRAME::GetCanvas(), SYMBOL_EDIT_FRAME::GetCurSymbol(), m_symbolEditFrame, m_tree, and LIB_TREE::Unselect().

Referenced by SYMBOL_TREE_PANE().

Member Data Documentation

◆ m_libMgr

LIB_SYMBOL_LIBRARY_MANAGER* SYMBOL_TREE_PANE::m_libMgr
protected

Definition at line 58 of file symbol_tree_pane.h.

Referenced by SYMBOL_TREE_PANE().

◆ m_symbolEditFrame

SYMBOL_EDIT_FRAME* SYMBOL_TREE_PANE::m_symbolEditFrame
protected

Definition at line 56 of file symbol_tree_pane.h.

Referenced by onSymbolSelected(), and onUpdateUI().

◆ m_tree

LIB_TREE* SYMBOL_TREE_PANE::m_tree
protected

symbol search tree widget

Definition at line 57 of file symbol_tree_pane.h.

Referenced by GetLibTree(), onSymbolSelected(), onUpdateUI(), SYMBOL_TREE_PANE(), and ~SYMBOL_TREE_PANE().


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