![]() |
KiCad PCB EDA Suite
|
#include <lib_tree_model.h>
Public Types | |
enum | TYPE { ROOT, LIB, LIBID, UNIT, INVALID } |
typedef std::vector< std::unique_ptr< LIB_TREE_NODE > > | PTR_VECTOR |
Public Member Functions | |
LIB_TREE_NODE_LIB_ID (LIB_TREE_NODE_LIB_ID const &_)=delete | |
The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be copied around. More... | |
void | operator= (LIB_TREE_NODE_LIB_ID const &_)=delete |
LIB_TREE_NODE_LIB_ID (LIB_TREE_NODE *aParent, LIB_TREE_ITEM *aItem) | |
Construct a LIB_ID node. More... | |
void | Update (LIB_TREE_ITEM *aItem) |
Update the node using data from a LIB_ALIAS object. More... | |
virtual void | UpdateScore (EDA_COMBINED_MATCHER &aMatcher, const wxString &aLib) override |
Perform the actual search. More... | |
void | ResetScore () |
Initialize score to kLowestDefaultScore, recursively. More... | |
void | AssignIntrinsicRanks (bool presorted=false) |
Store intrinsic ranks on all children of this node. More... | |
void | SortNodes () |
Sort child nodes quickly and recursively (IntrinsicRanks must have been set). More... | |
Static Public Member Functions | |
static int | Compare (LIB_TREE_NODE const &aNode1, LIB_TREE_NODE const &aNode2) |
Compare two nodes. More... | |
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. More... | |
int | m_Score |
bool | m_Pinned |
wxString | m_Name |
wxString | m_Desc |
wxString | m_MatchName |
wxString | m_SearchText |
bool | m_Normalized |
LIB_ID | m_LibId |
int | m_Unit |
bool | m_IsRoot |
Protected Member Functions | |
LIB_TREE_NODE_UNIT & | AddUnit (LIB_TREE_ITEM *aItem, int aUnit) |
Add a new unit to the component and return it. More... | |
Node type: LIB_ID.
Definition at line 180 of file lib_tree_model.h.
|
inherited |
Definition at line 115 of file lib_tree_model.h.
|
inherited |
Enumerator | |
---|---|
ROOT | |
LIB | |
LIBID | |
UNIT | |
INVALID |
Definition at line 111 of file lib_tree_model.h.
|
delete |
The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be copied around.
LIB_TREE_NODE_LIB_ID::LIB_TREE_NODE_LIB_ID | ( | LIB_TREE_NODE * | aParent, |
LIB_TREE_ITEM * | aItem | ||
) |
Construct a LIB_ID node.
All fields will be populated from the LIB_ALIAS, including children (unit nodes will be generated automatically). This does not keep the pointer to the #LIB_ALIAS object because at any time, a #LIB_ALIAS can be remove from a library which will result in an invalid pointer. The alias must be resolved at the time of use. Anything else is a bug.
aParent | parent node, should be a CMP_TREE_NODE_LIB |
aItem | LIB_COMPONENT to populate the node. |
Definition at line 157 of file lib_tree_model.cpp.
References AddUnit(), LIB_TREE_ITEM::GetDescription(), LIB_TREE_ITEM::GetLibNickname(), LIB_TREE_ITEM::GetName(), LIB_TREE_ITEM::GetSearchText(), LIB_TREE_ITEM::GetUnitCount(), LIB_TREE_ITEM::IsRoot(), LIB_TREE_NODE::LIBID, LIB_TREE_NODE::m_Desc, LIB_TREE_NODE::m_IsRoot, LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_MatchName, LIB_TREE_NODE::m_Name, LIB_TREE_NODE::m_Normalized, LIB_TREE_NODE::m_Parent, LIB_TREE_NODE::m_SearchText, LIB_TREE_NODE::m_Type, LIB_ID::SetLibItemName(), and LIB_ID::SetLibNickname().
|
protected |
Add a new unit to the component and return it.
This should not be used directly, as the constructor adds all units.
Definition at line 182 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_Children.
Referenced by LIB_TREE_NODE_LIB_ID(), and Update().
|
inherited |
Store intrinsic ranks on all children of this node.
See m_IntrinsicRank member doc for more information.
Definition at line 62 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_Children, LIB_TREE_NODE::m_IntrinsicRank, LIB_TREE_NODE::m_Name, and StrNumCmp().
Referenced by FP_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), LIB_TREE_MODEL_ADAPTER::AssignIntrinsicRanks(), LIB_TREE_MODEL_ADAPTER::DoAddLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().
|
staticinherited |
Compare two nodes.
Returns negative if aNode1 < aNode2, zero if aNode1 == aNode2, or positive if aNode1 > aNode2.
Definition at line 103 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_IntrinsicRank, LIB_TREE_NODE::m_Parent, LIB_TREE_NODE::m_Score, and LIB_TREE_NODE::m_Type.
Referenced by LIB_TREE_NODE::SortNodes().
|
delete |
|
inherited |
Initialize score to kLowestDefaultScore, recursively.
Definition at line 53 of file lib_tree_model.cpp.
References kLowestDefaultScore, LIB_TREE_NODE::m_Children, and LIB_TREE_NODE::m_Score.
Referenced by LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
|
inherited |
Sort child nodes quickly and recursively (IntrinsicRanks must have been set).
Definition at line 90 of file lib_tree_model.cpp.
References LIB_TREE_NODE::Compare(), and LIB_TREE_NODE::m_Children.
Referenced by LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
void LIB_TREE_NODE_LIB_ID::Update | ( | LIB_TREE_ITEM * | aItem | ) |
Update the node using data from a LIB_ALIAS object.
Definition at line 190 of file lib_tree_model.cpp.
References AddUnit(), LIB_TREE_ITEM::GetDescription(), LIB_TREE_ITEM::GetLibId(), LIB_ID::GetLibNickname(), LIB_TREE_ITEM::GetSearchText(), LIB_TREE_ITEM::GetUnitCount(), LIB_TREE_ITEM::IsRoot(), LIB_TREE_NODE::m_Children, LIB_TREE_NODE::m_Desc, LIB_TREE_NODE::m_IsRoot, LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_Normalized, LIB_TREE_NODE::m_SearchText, and LIB_ID::SetLibNickname().
|
overridevirtual |
Perform the actual search.
Implements LIB_TREE_NODE.
Definition at line 209 of file lib_tree_model.cpp.
References EDA_PATTERN_NOT_FOUND, EDA_COMBINED_MATCHER::Find(), EDA_COMBINED_MATCHER::GetPattern(), LIB_TREE_NODE::m_MatchName, LIB_TREE_NODE::m_Normalized, LIB_TREE_NODE::m_Parent, LIB_TREE_NODE::m_Score, LIB_TREE_NODE::m_SearchText, matchPosScore(), and UnescapeString().
|
inherited |
Definition at line 118 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_LIB::AddItem(), LIB_TREE_NODE_ROOT::AddLib(), AddUnit(), LIB_TREE_NODE::AssignIntrinsicRanks(), FP_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), LIB_TREE_MODEL_ADAPTER::FindAndExpand(), LIB_TREE_MODEL_ADAPTER::FindItem(), LIB_TREE_MODEL_ADAPTER::GetItemCount(), LIB_TREE_MODEL_ADAPTER::GetLibrariesCount(), LIB_TREE_MODEL_ADAPTER::IntoArray(), LIB_TREE_MODEL_ADAPTER::IsContainer(), LIB_TREE_NODE::ResetScore(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), LIB_TREE_MODEL_ADAPTER::ShowPreselect(), LIB_TREE_MODEL_ADAPTER::ShowSingleLibrary(), LIB_TREE_NODE::SortNodes(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), Update(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), LIB_TREE_NODE_LIB::UpdateScore(), LIB_TREE_NODE_ROOT::UpdateScore(), and LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
|
inherited |
Definition at line 132 of file lib_tree_model.h.
Referenced by SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_MODEL_ADAPTER::GetValue(), LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB(), LIB_TREE_NODE_LIB_ID(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), and Update().
|
inherited |
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 126 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE::AssignIntrinsicRanks(), LIB_TREE_NODE::Compare(), and LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().
|
inherited |
Definition at line 140 of file lib_tree_model.h.
Referenced by SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetAttr(), LIB_TREE_NODE_LIB_ID(), and Update().
|
inherited |
Definition at line 138 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode(), LIB_TREE_MODEL_ADAPTER::GetAliasFor(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB(), LIB_TREE_NODE_LIB_ID(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), LIB_TREE_MODEL_ADAPTER::ShowPreselect(), and Update().
|
inherited |
Definition at line 133 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB(), LIB_TREE_NODE_LIB_ID(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), UpdateScore(), and LIB_TREE_NODE_LIB::UpdateScore().
|
inherited |
Definition at line 131 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE::AssignIntrinsicRanks(), FP_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_MODEL_ADAPTER::GetValue(), LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB(), LIB_TREE_NODE_LIB_ID(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().
|
inherited |
Definition at line 135 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_LIB_ID(), Update(), and UpdateScore().
|
inherited |
Definition at line 117 of file lib_tree_model.h.
Referenced by LIB_TREE::centerIfValid(), LIB_TREE_NODE::Compare(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetParent(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB(), LIB_TREE_NODE_LIB_ID(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), LIB_TREE_MODEL_ADAPTER::ShowPreselect(), LIB_TREE_MODEL_ADAPTER::ShowSingleLibrary(), and UpdateScore().
|
inherited |
Definition at line 129 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_EDITOR_CONTROL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), FOOTPRINT_EDITOR_CONTROL::PinLibrary(), SYMBOL_EDITOR_CONTROL::PinLibrary(), FOOTPRINT_EDITOR_CONTROL::UnpinLibrary(), and SYMBOL_EDITOR_CONTROL::UnpinLibrary().
|
inherited |
Definition at line 128 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE::Compare(), LIB_TREE_NODE::ResetScore(), LIB_TREE_MODEL_ADAPTER::ShowResults(), UpdateScore(), and LIB_TREE_NODE_LIB::UpdateScore().
|
inherited |
Definition at line 134 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_LIB_ID(), Update(), and UpdateScore().
|
inherited |
Definition at line 119 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE::Compare(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetChildren(), LIB_TREE_MODEL_ADAPTER::GetParent(), LIB_TREE_MODEL_ADAPTER::GetTypeFor(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_EDITOR_CONTROL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB(), LIB_TREE_NODE_LIB_ID(), LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), LIB_TREE_MODEL_ADAPTER::ShowPreselect(), LIB_TREE_MODEL_ADAPTER::ShowResults(), and LIB_TREE_MODEL_ADAPTER::ShowSingleLibrary().
|
inherited |
Definition at line 139 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetUnitFor(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), and LIB_TREE_MODEL_ADAPTER::ShowPreselect().