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 (const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > &aMatchers, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override |
Perform the actual search. | |
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). | |
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 Member Functions | |
LIB_TREE_NODE_UNIT & | AddUnit (LIB_TREE_ITEM *aItem, int aUnit) |
Add a new unit to the component and return it. | |
Protected Attributes | |
std::vector< SEARCH_TERM > | m_sourceSearchTerms |
Node type: LIB_ID.
Definition at line 189 of file lib_tree_model.h.
|
inherited |
Definition at line 120 of file lib_tree_model.h.
|
stronginherited |
Enumerator | |
---|---|
ROOT | |
LIBRARY | |
ITEM | |
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.
References _, and LIB_TREE_NODE_ITEM().
Referenced by LIB_TREE_NODE_ITEM(), and operator=().
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 178 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::LIB_TREE_NODE(), 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_sourceSearchTerms, and LIB_TREE_NODE::m_Type.
|
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 205 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 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().
|
staticinherited |
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.
|
delete |
References _, LIB_TREE_NODE::LIB_TREE_NODE(), and LIB_TREE_NODE_ITEM().
|
inherited |
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.
|
inherited |
Sort child nodes quickly and recursively (IntrinsicRanks must have been set).
Definition at line 77 of file lib_tree_model.cpp.
References m_Children.
void LIB_TREE_NODE_ITEM::Update | ( | LIB_TREE_ITEM * | aItem | ) |
Update the node using data from a LIB_ALIAS object.
Definition at line 213 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, and LIB_TREE_NODE::m_sourceSearchTerms.
Referenced by FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), FOOTPRINT_EDIT_FRAME::UpdateLibraryTree(), and SYMBOL_EDIT_FRAME::UpdateLibraryTree().
|
overridevirtual |
Perform the actual search.
Implements LIB_TREE_NODE.
Definition at line 233 of file lib_tree_model.cpp.
References LIB_TREE_NODE::LIB_TREE_NODE(), LIB_TREE_NODE::m_Children, LIB_TREE_NODE::m_Score, and LIB_TREE_NODE::m_SearchTerms.
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
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 131 of file lib_tree_model.h.
Referenced by AssignIntrinsicRanks(), Compare(), LIB_TREE_NODE(), and LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().
|
inherited |
Definition at line 149 of file lib_tree_model.h.
Referenced by LIB_TREE_NODE(), and PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
inherited |
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().
|
protectedinherited |
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().
|
inherited |
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().
|
inherited |
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().