KiCad PCB EDA Suite
|
#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 | |
LIB_TREE_NODE_ITEM (LIB_TREE_NODE_ITEM const &_)=delete | |
The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be copied around. | |
void | operator= (LIB_TREE_NODE_ITEM const &_)=delete |
LIB_TREE_NODE_ITEM (LIB_TREE_NODE *aParent, LIB_TREE_ITEM *aItem) | |
Construct a LIB_ID node. | |
void | Update (LIB_TREE_ITEM *aItem) |
Update the node using data from a LIB_ALIAS object. | |
void | UpdateScore (EDA_COMBINED_MATCHER *aMatcher, const wxString &aLib, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override |
Perform the actual search. | |
virtual void | ResetScore () |
Initialize scores recursively. | |
virtual void | ForceScore (int aScore) |
void | AssignIntrinsicRanks (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). | |
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 |
Protected Member Functions | |
LIB_TREE_NODE_UNIT & | AddUnit (LIB_TREE_ITEM *aItem, int aUnit) |
Add a new unit to the component and return it. | |
Node type: LIB_ID.
Definition at line 186 of file lib_tree_model.h.
|
inherited |
Definition at line 123 of file lib_tree_model.h.
|
stronginherited |
Enumerator | |
---|---|
ROOT | |
LIBRARY | |
ITEM | |
UNIT | |
INVALID |
Definition at line 114 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_ITEM::LIB_TREE_NODE_ITEM | ( | 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 190 of file lib_tree_model.cpp.
References AddUnit(), LIB_TREE_ITEM::GetChooserFields(), LIB_TREE_ITEM::GetDesc(), LIB_TREE_ITEM::GetFootprint(), LIB_TREE_ITEM::GetLibNickname(), LIB_TREE_ITEM::GetName(), LIB_TREE_ITEM::GetPinCount(), LIB_TREE_ITEM::GetSearchTerms(), LIB_TREE_ITEM::GetSubUnitCount(), LIB_TREE_ITEM::IsRoot(), LIB_TREE_NODE::m_Desc, LIB_TREE_NODE::m_Fields, LIB_TREE_NODE::m_Footprint, LIB_TREE_NODE::m_IsRoot, LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_Name, LIB_TREE_NODE::m_Parent, LIB_TREE_NODE::m_PinCount, LIB_TREE_NODE::m_SearchTerms, 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 217 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_Children.
Referenced by LIB_TREE_NODE_ITEM(), and Update().
|
inherited |
Store intrinsic ranks on all children of this node.
See m_IntrinsicRank member doc for more information.
Definition at line 42 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_Children, and LIB_TREE_NODE::m_IntrinsicRank.
Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::AddLibraries(), FP_TREE_MODEL_ADAPTER::AddLibraries(), LIB_TREE_MODEL_ADAPTER::AssignIntrinsicRanks(), LIB_TREE_MODEL_ADAPTER::DoAddLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), and FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().
|
staticinherited |
Compare two nodes.
Returns true if aNode1 < aNode2.
Definition at line 83 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_IntrinsicRank, LIB_TREE_NODE::m_Name, LIB_TREE_NODE::m_Pinned, LIB_TREE_NODE::m_Score, and LIB_TREE_NODE::m_Type.
|
inlinevirtualinherited |
Definition at line 92 of file lib_tree_model.h.
References LIB_TREE_NODE::m_Score.
|
delete |
|
virtualinherited |
Initialize scores recursively.
Definition at line 33 of file lib_tree_model.cpp.
References 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 70 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_Children.
Referenced by LIB_TREE_MODEL_ADAPTER::resortTree(), and LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
void LIB_TREE_NODE_ITEM::Update | ( | LIB_TREE_ITEM * | aItem | ) |
Update the node using data from a LIB_ALIAS object.
Definition at line 225 of file lib_tree_model.cpp.
References AddUnit(), LIB_TREE_ITEM::GetChooserFields(), LIB_TREE_ITEM::GetDesc(), LIB_TREE_ITEM::GetLIB_ID(), LIB_ID::GetLibNickname(), LIB_TREE_ITEM::GetName(), LIB_TREE_ITEM::GetSearchTerms(), LIB_TREE_ITEM::GetSubUnitCount(), LIB_TREE_ITEM::IsRoot(), LIB_TREE_NODE::m_Children, LIB_TREE_NODE::m_Desc, LIB_TREE_NODE::m_Fields, LIB_TREE_NODE::m_IsRoot, LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_Name, LIB_TREE_NODE::m_SearchTerms, LIB_ID::SetLibItemName(), and LIB_ID::SetLibNickname().
|
overridevirtual |
Perform the actual search.
Implements LIB_TREE_NODE.
Definition at line 245 of file lib_tree_model.cpp.
References LIB_TREE_NODE::m_Children, LIB_TREE_NODE::m_Score, LIB_TREE_NODE::m_SearchTerms, and EDA_COMBINED_MATCHER::ScoreTerms().
|
inherited |
Definition at line 126 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_LIBRARY::AddItem(), LIB_TREE_NODE_ROOT::AddLib(), AddUnit(), LIB_TREE_NODE::AssignIntrinsicRanks(), LIB_TREE_NODE_ROOT::Clear(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), LIB_TREE_MODEL_ADAPTER::FindItem(), LIB_TREE_MODEL_ADAPTER::GetChildren(), LIB_TREE_MODEL_ADAPTER::GetItemCount(), LIB_TREE_MODEL_ADAPTER::GetLibrariesCount(), LIB_TREE_MODEL_ADAPTER::IsContainer(), recursiveDescent(), LIB_TREE_NODE_ROOT::RemoveLib(), LIB_TREE_NODE::ResetScore(), LIB_TREE_MODEL_ADAPTER::ShowResults(), LIB_TREE_NODE::SortNodes(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), Update(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), UpdateScore(), LIB_TREE_NODE_LIBRARY::UpdateScore(), LIB_TREE_NODE_ROOT::UpdateScore(), and LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
|
inherited |
Definition at line 140 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), and Update().
|
inherited |
List of weighted search terms.
Definition at line 145 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_NODE_ITEM(), and Update().
|
inherited |
Definition at line 141 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_ITEM(), and PANEL_SYMBOL_CHOOSER::onSymbolSelected().
|
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 134 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 149 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_NODE_ITEM(), and Update().
|
inherited |
Definition at line 147 of file lib_tree_model.h.
Referenced by SCH_DESIGN_BLOCK_CONTROL::DeleteDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::EditDesignBlockProperties(), FOOTPRINT_CHOOSER_FRAME::filterFootprint(), LIB_TREE_MODEL_ADAPTER::GetAliasFor(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), PANEL_SYMBOL_CHOOSER::onSymbolSelected(), LIBRARY_EDITOR_CONTROL::PinLibrary(), SCH_DESIGN_BLOCK_CONTROL::PinLibrary(), LIB_TREE_MODEL_ADAPTER::PinLibrary(), SCH_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::SaveSheetAsDesignBlock(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview(), FP_TREE_SYNCHRONIZING_ADAPTER::ShowPreview(), LIB_TREE_MODEL_ADAPTER::ShowResults(), LIBRARY_EDITOR_CONTROL::UnpinLibrary(), SCH_DESIGN_BLOCK_CONTROL::UnpinLibrary(), LIB_TREE_MODEL_ADAPTER::UnpinLibrary(), and Update().
|
inherited |
Definition at line 139 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE::Compare(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), 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(), Update(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), and LIB_TREE_NODE_LIBRARY::UpdateScore().
|
inherited |
Definition at line 125 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_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().
|
inherited |
Definition at line 142 of file lib_tree_model.h.
Referenced by FOOTPRINT_CHOOSER_FRAME::filterFootprint(), and LIB_TREE_NODE_ITEM().
|
inherited |
Definition at line 137 of file lib_tree_model.h.
Referenced by LIBRARY_EDITOR_CONTROL::AddContextMenuItems(), LIB_TREE_NODE::Compare(), LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode(), LIB_TREE_MODEL_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SCH_DESIGN_BLOCK_CONTROL::Init(), LIB_TREE::onItemContextMenu(), LIBRARY_EDITOR_CONTROL::PinLibrary(), SCH_DESIGN_BLOCK_CONTROL::PinLibrary(), LIB_TREE_MODEL_ADAPTER::PinLibrary(), LIBRARY_EDITOR_CONTROL::UnpinLibrary(), SCH_DESIGN_BLOCK_CONTROL::UnpinLibrary(), and LIB_TREE_MODEL_ADAPTER::UnpinLibrary().
|
inherited |
Definition at line 136 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE::Compare(), LIB_TREE_NODE::ForceScore(), LIB_TREE_NODE::ResetScore(), LIB_TREE_MODEL_ADAPTER::ShowResults(), LIB_TREE_NODE_UNIT::UpdateScore(), UpdateScore(), and LIB_TREE_NODE_LIBRARY::UpdateScore().
|
inherited |
Definition at line 144 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE_ITEM(), LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY(), Update(), UpdateScore(), and LIB_TREE_NODE_LIBRARY::UpdateScore().
|
inherited |
Definition at line 127 of file lib_tree_model.h.
Referenced by LIBRARY_EDITOR_CONTROL::AddContextMenuItems(), LIB_TREE_NODE::Compare(), FOOTPRINT_CHOOSER_FRAME::filterFootprint(), LIB_TREE_MODEL_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetChildren(), LIB_TREE_MODEL_ADAPTER::GetParent(), LIB_TREE_MODEL_ADAPTER::GetTypeFor(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview(), SCH_DESIGN_BLOCK_CONTROL::Init(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), 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(), and LIB_TREE_MODEL_ADAPTER::ShowResults().
|
inherited |
Definition at line 148 of file lib_tree_model.h.
Referenced by LIB_TREE_MODEL_ADAPTER::GetUnitFor(), LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT(), PANEL_SYMBOL_CHOOSER::onSymbolSelected(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview(), and LIB_TREE_MODEL_ADAPTER::ShowResults().