48 for( std::unique_ptr<LIB_TREE_NODE>& child:
m_Children )
49 child->RebuildSearchTerms( aShownColumns );
51 std::vector<LIB_TREE_NODE*> sort_buf;
57 for(
int i = 0; i <= max; ++i )
62 for( std::unique_ptr<LIB_TREE_NODE>& child:
m_Children )
63 sort_buf.push_back( child.get() );
65 std::sort( sort_buf.begin(), sort_buf.end(),
68 return StrNumCmp( a->m_Name, b->m_Name, true ) > 0;
71 for(
int i = 0; i < (int) sort_buf.size(); ++i )
80 [&]( std::unique_ptr<LIB_TREE_NODE>& a, std::unique_ptr<LIB_TREE_NODE>& b )
82 return Compare( *a, *b, aUseScores );
85 for( std::unique_ptr<LIB_TREE_NODE>& node:
m_Children )
86 node->SortNodes( aUseScores );
116 else if( aNode2.
m_Name.StartsWith( wxT(
"-- " ) ) )
133 return reinterpret_cast<const void*
>( &aNode1 ) <
reinterpret_cast<const void*
>( &aNode2 );
171 if( !aMatchers.empty() )
174 if( aFilter && !(*aFilter)(*
this) )
210 m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( unit ) );
241 for(
const std::unique_ptr<EDA_COMBINED_MATCHER>& matcher : aMatchers )
254 if( aFilter && !(*aFilter)(*
this) )
257 for( std::unique_ptr<LIB_TREE_NODE>& child:
m_Children )
258 child->UpdateScore( aMatchers, aFilter );
263 wxString
const& aDesc )
269 m_LibId.SetLibNickname( aName );
278 m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( item ) );
290 for(
const std::unique_ptr<EDA_COMBINED_MATCHER>& matcher : aMatchers )
307 for( std::unique_ptr<LIB_TREE_NODE>& child:
m_Children )
309 child->UpdateScore( aMatchers, aFilter );
325 m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( lib ) );
333 [&]( std::unique_ptr<LIB_TREE_NODE>& aNode )
335 if( aRecentlyUsedGroup && aNode->m_IsRecentlyUsedGroup )
338 if( aAlreadyPlacedGroup && aNode->m_IsAlreadyPlacedGroup )
356 for( std::unique_ptr<LIB_TREE_NODE>& child:
m_Children )
357 child->UpdateScore( aMatchers, aFilter );
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
virtual wxString GetLibNickname() const =0
virtual int GetSubUnitCount() const
For items with units, return the number of units.
virtual wxString GetUnitName(int aUnit) const
For items with units, return an identifier for unit x.
virtual wxString GetFootprint()
For items with footprint fields.
virtual bool IsPowerSymbol() const
For symbols that could be a power symbol.
virtual LIB_ID GetLIB_ID() const =0
virtual wxString GetDesc()=0
virtual bool IsRoot() const
For items having aliases, IsRoot() indicates the principal item.
virtual wxString GetName() const =0
virtual std::vector< SEARCH_TERM > & GetSearchTerms()=0
virtual int GetPinCount()
The pin count for symbols or the unique pad count for footprints.
virtual void GetChooserFields(std::map< wxString, wxString > &aColumnMap)
Retrieves a key/value map of the fields on this item that should be exposed to the library browser/ch...
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.
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 ...
LIB_TREE_NODE_UNIT & AddUnit(LIB_TREE_ITEM *aItem, int aUnit)
Add a new unit to the component and return it.
void Update(LIB_TREE_ITEM *aItem)
Update the node using data from a LIB_ALIAS object.
LIB_TREE_NODE_LIBRARY(LIB_TREE_NODE_LIBRARY const &_)=delete
The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be ...
void UpdateScore(const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > &aMatchers, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override
Update the score for this part.
LIB_TREE_NODE_ITEM & AddItem(LIB_TREE_ITEM *aItem)
Construct a new alias node, add it to this library, and return it.
void RemoveGroup(bool aRecentlyUsedGroup, bool aAlreadyPlacedGroup)
Remove a library node from the root.
LIB_TREE_NODE_LIBRARY & AddLib(wxString const &aName, wxString const &aDesc)
Construct an empty library node, add it to the root, and return it.
LIB_TREE_NODE_ROOT()
Construct the root node.
void UpdateScore(const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > &aMatchers, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override
Update the score for this part.
void Clear()
Clear the tree.
Node type: unit of component.
LIB_TREE_NODE_UNIT(LIB_TREE_NODE_UNIT const &_)=delete
The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be ...
void UpdateScore(const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > &aMatchers, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override
Update the score for this part.
void SortNodes(bool aUseScores)
Sort child nodes quickly and recursively (IntrinsicRanks must have been set).
void RebuildSearchTerms(const std::vector< wxString > &aShownColumns)
Rebuild search terms from source search terms and shown fields.
static bool Compare(LIB_TREE_NODE const &aNode1, LIB_TREE_NODE const &aNode2, bool aUseScores)
Compare two nodes.
bool m_IsAlreadyPlacedGroup
bool m_IsRecentlyUsedGroup
std::span< SEARCH_TERM > m_sourceSearchTerms
std::vector< SEARCH_TERM > m_SearchTerms
std::map< wxString, wxString > m_Fields
List of weighted search terms.
int m_IntrinsicRank
The rank of the item before any search terms are applied.
void AssignIntrinsicRanks(const std::vector< wxString > &aShownColumns, bool presorted=false)
Store intrinsic ranks on all children of this node.
Abstract pattern-matching tool and implementations.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
A structure for storing weighted search terms.