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, 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...
 
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,
SYMBOL_LIBRARY_MANAGER aLibMgr 
)

Definition at line 34 of file symbol_tree_pane.cpp.

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

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

◆ ~SYMBOL_TREE_PANE()

SYMBOL_TREE_PANE::~SYMBOL_TREE_PANE ( )

Definition at line 58 of file symbol_tree_pane.cpp.

59 {
60  m_tree->Destroy();
61 }
LIB_TREE * m_tree
symbol search tree widget

References m_tree.

Member Function Documentation

◆ GetLibTree()

◆ onSymbolSelected()

void SYMBOL_TREE_PANE::onSymbolSelected ( wxCommandEvent &  aEvent)
protected

Definition at line 64 of file symbol_tree_pane.cpp.

65 {
67 
68  // Make sure current-part highlighting doesn't get lost in selection highlighting
69  m_tree->Unselect();
70 
71  // Turn off any previous current-part highlighting
73 }
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION editSymbol
Definition: ee_actions.h:172
LIB_TREE * m_tree
symbol search tree widget
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:202
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:231
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
SYMBOL_EDIT_FRAME * m_symbolEditFrame

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 76 of file symbol_tree_pane.cpp.

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

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

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: