| 
    KiCad PCB EDA Suite
    
   | 
 
Model class in the component selector Model-View-Adapter (mediated MVC) architecture. More...
#include <lib_tree_model.h>
  
Public Types | |
| enum class | TYPE {  ROOT , LIBRARY , ITEM , UNIT , INVALID }  | 
| typedef std::vector< std::unique_ptr< LIB_TREE_NODE > > | PTR_VECTOR | 
Public Member Functions | |
| virtual void | UpdateScore (const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > &aMatchers, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter)=0 | 
| Update the score for this part.   | |
| void | RebuildSearchTerms (const std::vector< wxString > &aShownColumns) | 
| Rebuild search terms from source search terms and shown fields.   | |
| void | AssignIntrinsicRanks (const std::vector< wxString > &aShownColumns, bool presorted=false) | 
| Store intrinsic ranks on all children of this node.   | |
| void | SortNodes (bool aUseScores) | 
| Sort child nodes quickly and recursively (IntrinsicRanks must have been set).   | |
| LIB_TREE_NODE () | |
| virtual | ~LIB_TREE_NODE () | 
Static Public Member Functions | |
| static bool | Compare (LIB_TREE_NODE const &aNode1, LIB_TREE_NODE const &aNode2, bool aUseScores) | 
| Compare two nodes.   | |
Public Attributes | |
| LIB_TREE_NODE * | m_Parent | 
| PTR_VECTOR | m_Children | 
| enum TYPE | m_Type | 
| int | m_IntrinsicRank | 
| The rank of the item before any search terms are applied.   | |
| int | m_Score | 
| bool | m_Pinned | 
| wxString | m_Name | 
| wxString | m_Desc | 
| wxString | m_Footprint | 
| int | m_PinCount | 
| std::vector< SEARCH_TERM > | m_SearchTerms | 
| std::map< wxString, wxString > | m_Fields | 
| List of weighted search terms.   | |
| LIB_ID | m_LibId | 
| int | m_Unit | 
| bool | m_IsRoot | 
| bool | m_IsRecentlyUsedGroup | 
| bool | m_IsAlreadyPlacedGroup | 
Protected Attributes | |
| std::vector< SEARCH_TERM > | m_sourceSearchTerms | 
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
The other pieces are in:
This model is populated from LIB_ALIASes; helper methods in the adapter can accept entire libraries.
Quick summary of methods used to populate this class:
CMP_TREE_NODE_ROOT::AddLib() - add a new, empty library to the rootCMP_TREE_NODE_LIB::AddAlias() - add an alias and its units from a given LIB_ALIAS*Quick summary of methods used to drive this class:
UpdateScore() - accumulate scores recursively given a new search tokenAssignIntrinsicRanks() - calculate and cache the initial sort orderSortNodes() - recursively sort the tree by scoreCompare() - compare two nodes; used by SortNodes()The data in the model is meant to be accessed directly. Quick summary of data members:
Parent - parent node, or nullptr if rootChildren - vector of unique_ptrs to childrenType - ROOT, LIB, ALIAS, or UNITm_IntrinsicRank - cached initial sort orderm_Score - score taking into account search terms. Zero means irrelevant and should be hidden.Name - name of the library/alias/unit, to be displayedDesc - description of the alias, to be displayedm_MatchName - Name, normalized to lowercase for matchingm_SearchText - normalized composite of keywords and descriptionLibId - the LIB_ID this alias or unit is from, or not validUnit - the unit number, or zero for non-units Definition at line 74 of file lib_tree_model.h.
| typedef std::vector<std::unique_ptr<LIB_TREE_NODE> > LIB_TREE_NODE::PTR_VECTOR | 
Definition at line 120 of file lib_tree_model.h.
      
  | 
  strong | 
| Enumerator | |
|---|---|
| ROOT | |
| LIBRARY | |
| ITEM | |
| UNIT | |
| INVALID | |
Definition at line 111 of file lib_tree_model.h.
| LIB_TREE_NODE::LIB_TREE_NODE | ( | ) | 
Definition at line 137 of file lib_tree_model.cpp.
References INVALID, m_IntrinsicRank, m_IsAlreadyPlacedGroup, m_IsRecentlyUsedGroup, m_IsRoot, m_Parent, m_PinCount, m_Pinned, m_Score, m_Type, and m_Unit.
Referenced by AssignIntrinsicRanks(), Compare(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), LIB_TREE_NODE_ITEM::operator=(), LIB_TREE_NODE_LIBRARY::operator=(), LIB_TREE_NODE_ROOT::operator=(), LIB_TREE_NODE_UNIT::operator=(), UpdateScore(), LIB_TREE_NODE_ITEM::UpdateScore(), LIB_TREE_NODE_LIBRARY::UpdateScore(), LIB_TREE_NODE_ROOT::UpdateScore(), and LIB_TREE_NODE_UNIT::UpdateScore().
      
  | 
  inlinevirtual | 
Definition at line 109 of file lib_tree_model.h.
| void LIB_TREE_NODE::AssignIntrinsicRanks | ( | const std::vector< wxString > & | aShownColumns, | 
| bool | presorted = false ) | 
Store intrinsic ranks on all children of this node.
See m_IntrinsicRank member doc for more information.
Definition at line 46 of file lib_tree_model.cpp.
References LIB_TREE_NODE(), m_Children, and m_IntrinsicRank.
Referenced by LIB_TREE_MODEL_ADAPTER::DoAddLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().
      
  | 
  static | 
Compare two nodes.
Returns true if aNode1 < aNode2.
Definition at line 90 of file lib_tree_model.cpp.
References LIB_TREE_NODE(), m_IntrinsicRank, m_IsRecentlyUsedGroup, m_Name, m_Pinned, m_Score, and m_Type.
| void LIB_TREE_NODE::RebuildSearchTerms | ( | const std::vector< wxString > & | aShownColumns | ) | 
Rebuild search terms from source search terms and shown fields.
Definition at line 34 of file lib_tree_model.cpp.
References alg::contains(), m_Fields, m_SearchTerms, m_sourceSearchTerms, and name.
| void LIB_TREE_NODE::SortNodes | ( | bool | aUseScores | ) | 
Sort child nodes quickly and recursively (IntrinsicRanks must have been set).
Definition at line 77 of file lib_tree_model.cpp.
References m_Children.
      
  | 
  pure virtual | 
Update the score for this part.
This is accumulative - it will be called once per search term.
| aMatcher | an EDA_COMBINED_MATCHER initialized with the search term | 
Implemented in LIB_TREE_NODE_ITEM, LIB_TREE_NODE_LIBRARY, LIB_TREE_NODE_ROOT, and LIB_TREE_NODE_UNIT.
References LIB_TREE_NODE().
| PTR_VECTOR LIB_TREE_NODE::m_Children | 
Definition at line 123 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_LIBRARY::AddItem(), LIB_TREE_NODE_ROOT::AddLib(), LIB_TREE_NODE_ITEM::AddUnit(), AssignIntrinsicRanks(), LIB_TREE_NODE_ROOT::Clear(), LIB_TREE_MODEL_ADAPTER::GetChildren(), LIB_TREE_MODEL_ADAPTER::IsContainer(), recursiveDescent(), LIB_TREE_NODE_ROOT::RemoveGroup(), LIB_TREE_MODEL_ADAPTER::ShowResults(), SortNodes(), LIB_TREE_NODE_ITEM::Update(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), LIB_TREE_NODE_ITEM::UpdateScore(), LIB_TREE_NODE_LIBRARY::UpdateScore(), and LIB_TREE_NODE_ROOT::UpdateScore().
| wxString LIB_TREE_NODE::m_Desc | 
Definition at line 137 of file lib_tree_model.h.
Referenced by FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), and LIB_TREE_NODE_ITEM::Update().
| std::map<wxString, wxString> LIB_TREE_NODE::m_Fields | 
List of weighted search terms.
Definition at line 142 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), RebuildSearchTerms(), and LIB_TREE_NODE_ITEM::Update().
| wxString LIB_TREE_NODE::m_Footprint | 
Definition at line 138 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), and PANEL_SYMBOL_CHOOSER::onSymbolSelected().
| int LIB_TREE_NODE::m_IntrinsicRank | 
The rank of the item before any search terms are applied.
This is a fairly expensive sort (involving string compares) so it helps to store the result of that sort.
Definition at line 131 of file lib_tree_model.h.
Referenced by AssignIntrinsicRanks(), Compare(), LIB_TREE_NODE(), and LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().
| bool LIB_TREE_NODE::m_IsAlreadyPlacedGroup | 
Definition at line 149 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE(), and PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER().
| bool LIB_TREE_NODE::m_IsRecentlyUsedGroup | 
Definition at line 148 of file lib_tree_model.h.
Referenced by Compare(), LIB_TREE_NODE(), PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER(), and PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER().
| bool LIB_TREE_NODE::m_IsRoot | 
Definition at line 146 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_NODE(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), and LIB_TREE_NODE_ITEM::Update().
| LIB_ID LIB_TREE_NODE::m_LibId | 
Definition at line 144 of file lib_tree_model.h.
Referenced by DESIGN_BLOCK_CONTROL::DeleteDesignBlock(), DESIGN_BLOCK_CONTROL::EditDesignBlockProperties(), FOOTPRINT_CHOOSER_FRAME::filterFootprint(), LIB_TREE_MODEL_ADAPTER::GetAliasFor(), FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), PANEL_SYMBOL_CHOOSER::onSymbolSelected(), DESIGN_BLOCK_CONTROL::PinLibrary(), LIB_TREE_MODEL_ADAPTER::PinLibrary(), PCB_DESIGN_BLOCK_CONTROL::SaveBoardAsDesignBlock(), PCB_DESIGN_BLOCK_CONTROL::SaveBoardToDesignBlock(), PCB_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock(), PCB_DESIGN_BLOCK_CONTROL::SaveSelectionToDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::SaveSelectionToDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::SaveSheetAsDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::SaveSheetToDesignBlock(), FP_TREE_SYNCHRONIZING_ADAPTER::ShowPreview(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview(), LIB_TREE_MODEL_ADAPTER::ShowResults(), DESIGN_BLOCK_CONTROL::UnpinLibrary(), LIB_TREE_MODEL_ADAPTER::UnpinLibrary(), and LIB_TREE_NODE_ITEM::Update().
| wxString LIB_TREE_NODE::m_Name | 
Definition at line 136 of file lib_tree_model.h.
Referenced by Compare(), FP_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), LIB_TREE_MODEL_ADAPTER::ShowResults(), LIB_TREE_NODE_ITEM::Update(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().
| LIB_TREE_NODE* LIB_TREE_NODE::m_Parent | 
Definition at line 122 of file lib_tree_model.h.
Referenced by LIB_TREE::centerIfValid(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetParent(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), LIB_TREE_MODEL_ADAPTER::ShowResults(), and LIB_TREE_NODE_UNIT::UpdateScore().
| int LIB_TREE_NODE::m_PinCount | 
Definition at line 139 of file lib_tree_model.h.
Referenced by FOOTPRINT_CHOOSER_FRAME::filterFootprint(), LIB_TREE_NODE(), and LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM().
| bool LIB_TREE_NODE::m_Pinned | 
Definition at line 134 of file lib_tree_model.h.
Referenced by DESIGN_BLOCK_CONTROL::AddContextMenuItems(), Compare(), LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE(), LIB_TREE::onItemContextMenu(), DESIGN_BLOCK_CONTROL::PinLibrary(), LIB_TREE_MODEL_ADAPTER::PinLibrary(), DESIGN_BLOCK_CONTROL::UnpinLibrary(), and LIB_TREE_MODEL_ADAPTER::UnpinLibrary().
| int LIB_TREE_NODE::m_Score | 
Definition at line 133 of file lib_tree_model.h.
Referenced by Compare(), LIB_TREE_NODE(), LIB_TREE_MODEL_ADAPTER::ShowResults(), LIB_TREE_NODE_ITEM::UpdateScore(), LIB_TREE_NODE_LIBRARY::UpdateScore(), and LIB_TREE_NODE_UNIT::UpdateScore().
| std::vector<SEARCH_TERM> LIB_TREE_NODE::m_SearchTerms | 
Definition at line 141 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), RebuildSearchTerms(), LIB_TREE_NODE_ITEM::UpdateScore(), and LIB_TREE_NODE_LIBRARY::UpdateScore().
      
  | 
  protected | 
Definition at line 152 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), RebuildSearchTerms(), and LIB_TREE_NODE_ITEM::Update().
| enum TYPE LIB_TREE_NODE::m_Type | 
Definition at line 124 of file lib_tree_model.h.
Referenced by DESIGN_BLOCK_CONTROL::AddContextMenuItems(), Compare(), FOOTPRINT_CHOOSER_FRAME::filterFootprint(), FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetChildren(), LIB_TREE_MODEL_ADAPTER::GetParent(), LIB_TREE_MODEL_ADAPTER::GetTypeFor(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), LIB_TREE_NODE(), LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), LIB_TREE::onItemContextMenu(), DESIGN_BLOCK_CONTROL::selIsDesignBlock(), DESIGN_BLOCK_CONTROL::selIsInLibrary(), and LIB_TREE_MODEL_ADAPTER::ShowResults().
| int LIB_TREE_NODE::m_Unit | 
Definition at line 145 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetUnitFor(), LIB_TREE_NODE(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), PANEL_SYMBOL_CHOOSER::onSymbolSelected(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview(), and LIB_TREE_MODEL_ADAPTER::ShowResults().