2017-03-06 14:50:48 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
|
|
|
|
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
|
2019-08-07 04:26:33 +00:00
|
|
|
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-03-06 14:50:48 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
#include <lib_tree_model.h>
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2020-05-11 16:23:04 +00:00
|
|
|
#include <algorithm>
|
2017-03-06 14:50:48 +00:00
|
|
|
#include <eda_pattern_match.h>
|
2018-07-27 20:47:51 +00:00
|
|
|
#include <lib_tree_item.h>
|
2017-03-06 14:50:48 +00:00
|
|
|
#include <utility>
|
2018-01-25 23:49:04 +00:00
|
|
|
#include <pgm_base.h>
|
2021-07-29 09:56:22 +00:00
|
|
|
#include <string_utils.h>
|
2017-03-06 14:50:48 +00:00
|
|
|
|
|
|
|
// Each node gets this lowest score initially, without any matches applied.
|
|
|
|
// Matches will then increase this score depending on match quality. This way,
|
|
|
|
// an empty search string will result in all components being displayed as they
|
|
|
|
// have the minimum score. However, in that case, we avoid expanding all the
|
|
|
|
// nodes asd the result is very unspecific.
|
|
|
|
static const unsigned kLowestDefaultScore = 1;
|
|
|
|
|
|
|
|
|
|
|
|
// Creates a score depending on the position of a string match. If the position
|
|
|
|
// is 0 (= prefix match), this returns the maximum score. This degrades until
|
|
|
|
// pos == max, which returns a score of 0; Evertyhing else beyond that is just
|
|
|
|
// 0. Only values >= 0 allowed for position and max.
|
|
|
|
//
|
|
|
|
// @param aPosition is the position a string has been found in a substring.
|
|
|
|
// @param aMaximum is the maximum score this function returns.
|
|
|
|
// @return position dependent score.
|
|
|
|
static int matchPosScore(int aPosition, int aMaximum)
|
|
|
|
{
|
|
|
|
return ( aPosition < aMaximum ) ? aMaximum - aPosition : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
void LIB_TREE_NODE::ResetScore()
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-12-24 19:42:41 +00:00
|
|
|
for( std::unique_ptr<LIB_TREE_NODE>& child: m_Children )
|
2017-03-06 14:50:48 +00:00
|
|
|
child->ResetScore();
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score = kLowestDefaultScore;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-05 11:56:02 +00:00
|
|
|
void LIB_TREE_NODE::AssignIntrinsicRanks( bool presorted )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2018-07-27 20:47:51 +00:00
|
|
|
std::vector<LIB_TREE_NODE*> sort_buf;
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2018-08-05 11:56:02 +00:00
|
|
|
if( presorted )
|
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
int max = m_Children.size() - 1;
|
2018-08-05 11:56:02 +00:00
|
|
|
|
|
|
|
for( int i = 0; i <= max; ++i )
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Children[i]->m_IntrinsicRank = max - i;
|
2018-08-05 11:56:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-12-24 19:42:41 +00:00
|
|
|
for( std::unique_ptr<LIB_TREE_NODE>& child: m_Children )
|
|
|
|
sort_buf.push_back( child.get() );
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2018-08-05 11:56:02 +00:00
|
|
|
std::sort( sort_buf.begin(), sort_buf.end(),
|
|
|
|
[]( LIB_TREE_NODE* a, LIB_TREE_NODE* b ) -> bool
|
2020-02-07 17:06:24 +00:00
|
|
|
{
|
|
|
|
return StrNumCmp( a->m_Name, b->m_Name, true ) > 0;
|
|
|
|
} );
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2018-08-05 11:56:02 +00:00
|
|
|
for( int i = 0; i < (int) sort_buf.size(); ++i )
|
2020-02-07 17:06:24 +00:00
|
|
|
sort_buf[i]->m_IntrinsicRank = i;
|
2018-08-05 11:56:02 +00:00
|
|
|
}
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
void LIB_TREE_NODE::SortNodes()
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
std::sort( m_Children.begin(), m_Children.end(),
|
2019-08-26 10:02:13 +00:00
|
|
|
[]( std::unique_ptr<LIB_TREE_NODE>& a, std::unique_ptr<LIB_TREE_NODE>& b )
|
|
|
|
{
|
|
|
|
return Compare( *a, *b ) > 0;
|
|
|
|
} );
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
for( std::unique_ptr<LIB_TREE_NODE>& node: m_Children )
|
2017-03-06 14:50:48 +00:00
|
|
|
node->SortNodes();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
int LIB_TREE_NODE::Compare( LIB_TREE_NODE const& aNode1, LIB_TREE_NODE const& aNode2 )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
if( aNode1.m_Type != aNode2.m_Type )
|
2017-03-06 14:50:48 +00:00
|
|
|
return 0;
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
if( aNode1.m_Score != aNode2.m_Score )
|
|
|
|
return aNode1.m_Score - aNode2.m_Score;
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
if( aNode1.m_Parent != aNode2.m_Parent )
|
2017-03-06 14:50:48 +00:00
|
|
|
return 0;
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
return aNode1.m_IntrinsicRank - aNode2.m_IntrinsicRank;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE::LIB_TREE_NODE()
|
2020-02-07 17:06:24 +00:00
|
|
|
: m_Parent( nullptr ),
|
|
|
|
m_Type( INVALID ),
|
|
|
|
m_IntrinsicRank( 0 ),
|
|
|
|
m_Score( kLowestDefaultScore ),
|
|
|
|
m_Pinned( false ),
|
|
|
|
m_Normalized( false ),
|
|
|
|
m_Unit( 0 ),
|
|
|
|
m_IsRoot( false )
|
2017-03-06 14:50:48 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem, int aUnit )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2018-01-25 23:49:04 +00:00
|
|
|
static void* locale = nullptr;
|
|
|
|
static wxString namePrefix;
|
|
|
|
|
|
|
|
// Fetching translations can take a surprising amount of time when loading libraries,
|
|
|
|
// so only do it when necessary.
|
|
|
|
if( Pgm().GetLocale() != locale )
|
|
|
|
{
|
|
|
|
namePrefix = _( "Unit" );
|
|
|
|
locale = Pgm().GetLocale();
|
|
|
|
}
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Parent = aParent;
|
|
|
|
m_Type = UNIT;
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Unit = aUnit;
|
|
|
|
m_LibId = aParent->m_LibId;
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
m_Name = namePrefix + wxT( " " ) + aItem->GetUnitReference( aUnit );
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Desc = wxEmptyString;
|
|
|
|
m_MatchName = wxEmptyString;
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_IntrinsicRank = -aUnit;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-30 13:18:37 +00:00
|
|
|
LIB_TREE_NODE_LIB_ID::LIB_TREE_NODE_LIB_ID( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Type = LIBID;
|
|
|
|
m_Parent = aParent;
|
2018-07-30 13:18:37 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_LibId.SetLibNickname( aItem->GetLibNickname() );
|
2021-06-30 11:00:06 +00:00
|
|
|
m_LibId.SetLibItemName( aItem->GetName() );
|
2018-07-30 13:18:37 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Name = aItem->GetName();
|
|
|
|
m_Desc = aItem->GetDescription();
|
2018-07-30 13:18:37 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_MatchName = aItem->GetName();
|
|
|
|
m_SearchText = aItem->GetSearchText();
|
|
|
|
m_Normalized = false;
|
2018-07-30 13:18:37 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_IsRoot = aItem->IsRoot();
|
2018-07-30 13:18:37 +00:00
|
|
|
|
2018-08-05 13:03:23 +00:00
|
|
|
if( aItem->GetUnitCount() > 1 )
|
|
|
|
{
|
|
|
|
for( int u = 1; u <= aItem->GetUnitCount(); ++u )
|
|
|
|
AddUnit( aItem, u );
|
|
|
|
}
|
2018-01-10 11:04:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE_UNIT& LIB_TREE_NODE_LIB_ID::AddUnit( LIB_TREE_ITEM* aItem, int aUnit )
|
2018-01-10 11:04:34 +00:00
|
|
|
{
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE_UNIT* unit = new LIB_TREE_NODE_UNIT( this, aItem, aUnit );
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( unit ) );
|
2018-01-10 11:04:34 +00:00
|
|
|
return *unit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
void LIB_TREE_NODE_LIB_ID::Update( LIB_TREE_ITEM* aItem )
|
2018-01-10 11:04:34 +00:00
|
|
|
{
|
2018-07-30 13:18:37 +00:00
|
|
|
// Update is called when the names match, so just update the other fields.
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_LibId.SetLibNickname( aItem->GetLibId().GetLibNickname() );
|
2017-09-15 14:17:44 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Desc = aItem->GetDescription();
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_SearchText = aItem->GetSearchText();
|
|
|
|
m_Normalized = false;
|
2017-07-09 13:08:33 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
m_IsRoot = aItem->IsRoot();
|
|
|
|
m_Children.clear();
|
2018-01-10 11:04:34 +00:00
|
|
|
|
2018-07-30 13:18:37 +00:00
|
|
|
for( int u = 1; u <= aItem->GetUnitCount(); ++u )
|
2018-07-27 20:47:51 +00:00
|
|
|
AddUnit( aItem, u );
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-14 15:18:11 +00:00
|
|
|
void LIB_TREE_NODE_LIB_ID::UpdateScore( EDA_COMBINED_MATCHER& aMatcher, const wxString& aLib )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
if( m_Score <= 0 )
|
2017-03-06 14:50:48 +00:00
|
|
|
return; // Leaf nodes without scores are out of the game.
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
if( !m_Normalized )
|
2018-01-25 23:49:04 +00:00
|
|
|
{
|
2021-06-30 10:53:04 +00:00
|
|
|
m_MatchName = UnescapeString( m_MatchName ).Lower();
|
2020-02-07 17:06:24 +00:00
|
|
|
m_SearchText = m_SearchText.Lower();
|
|
|
|
m_Normalized = true;
|
2018-01-25 23:49:04 +00:00
|
|
|
}
|
|
|
|
|
2021-12-14 15:18:11 +00:00
|
|
|
if( !aLib.IsEmpty() && m_Parent->m_MatchName != aLib )
|
|
|
|
{
|
|
|
|
m_Score = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-06 14:50:48 +00:00
|
|
|
// Keywords and description we only count if the match string is at
|
|
|
|
// least two characters long. That avoids spurious, low quality
|
|
|
|
// matches. Most abbreviations are at three characters long.
|
|
|
|
int found_pos = EDA_PATTERN_NOT_FOUND;
|
|
|
|
int matchers_fired = 0;
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
if( aMatcher.GetPattern() == m_MatchName )
|
2017-03-10 13:28:09 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += 1000; // exact match. High score :)
|
2017-03-10 13:28:09 +00:00
|
|
|
}
|
2020-02-07 17:06:24 +00:00
|
|
|
else if( aMatcher.Find( m_MatchName, matchers_fired, found_pos ) )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
|
|
|
// Substring match. The earlier in the string the better.
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += matchPosScore( found_pos, 20 ) + 20;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
2020-02-07 17:06:24 +00:00
|
|
|
else if( aMatcher.Find( m_Parent->m_MatchName, matchers_fired, found_pos ) )
|
2017-03-10 13:28:09 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += 19; // parent name matches. score += 19
|
2017-03-10 13:28:09 +00:00
|
|
|
}
|
2020-02-07 17:06:24 +00:00
|
|
|
else if( aMatcher.Find( m_SearchText, matchers_fired, found_pos ) )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
|
|
|
// If we have a very short search term (like one or two letters),
|
|
|
|
// we don't want to accumulate scores if they just happen to be in
|
|
|
|
// keywords or description as almost any one or two-letter
|
|
|
|
// combination shows up in there.
|
|
|
|
if( aMatcher.GetPattern().length() >= 2 )
|
|
|
|
{
|
|
|
|
// For longer terms, we add scores 1..18 for positional match
|
|
|
|
// (higher in the front, where the keywords are).
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += matchPosScore( found_pos, 17 ) + 1;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// No match. That's it for this item.
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score = 0;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// More matchers = better match
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += 2 * matchers_fired;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB( LIB_TREE_NODE* aParent, wxString const& aName,
|
|
|
|
wxString const& aDesc )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Type = LIB;
|
|
|
|
m_Name = aName;
|
|
|
|
m_MatchName = aName.Lower();
|
|
|
|
m_Desc = aDesc;
|
|
|
|
m_Parent = aParent;
|
|
|
|
m_LibId.SetLibNickname( aName );
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-30 13:18:37 +00:00
|
|
|
LIB_TREE_NODE_LIB_ID& LIB_TREE_NODE_LIB::AddItem( LIB_TREE_ITEM* aItem )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2018-07-30 13:18:37 +00:00
|
|
|
LIB_TREE_NODE_LIB_ID* item = new LIB_TREE_NODE_LIB_ID( this, aItem );
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( item ) );
|
2018-07-30 13:18:37 +00:00
|
|
|
return *item;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-14 15:18:11 +00:00
|
|
|
void LIB_TREE_NODE_LIB::UpdateScore( EDA_COMBINED_MATCHER& aMatcher, const wxString& aLib )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score = 0;
|
2017-03-06 14:50:48 +00:00
|
|
|
|
2018-08-01 00:21:50 +00:00
|
|
|
// We need to score leaf nodes, which are usually (but not always) children.
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
if( m_Children.size() )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-12-24 19:42:41 +00:00
|
|
|
for( std::unique_ptr<LIB_TREE_NODE>& child: m_Children )
|
2018-08-01 00:21:50 +00:00
|
|
|
{
|
2021-12-14 15:18:11 +00:00
|
|
|
child->UpdateScore( aMatcher, aLib );
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score = std::max( m_Score, child->m_Score );
|
2018-08-01 00:21:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// No children; we are a leaf.
|
2021-12-14 15:18:11 +00:00
|
|
|
|
|
|
|
if( !aLib.IsEmpty() )
|
|
|
|
{
|
|
|
|
m_Score = m_MatchName == aLib ? 1000 : 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-08-01 00:21:50 +00:00
|
|
|
int found_pos = EDA_PATTERN_NOT_FOUND;
|
|
|
|
int matchers_fired = 0;
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
if( aMatcher.GetPattern() == m_MatchName )
|
2018-08-01 00:21:50 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += 1000; // exact match. High score :)
|
2018-08-01 00:21:50 +00:00
|
|
|
}
|
2020-02-07 17:06:24 +00:00
|
|
|
else if( aMatcher.Find( m_MatchName, matchers_fired, found_pos ) )
|
2018-08-01 00:21:50 +00:00
|
|
|
{
|
|
|
|
// Substring match. The earlier in the string the better.
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += matchPosScore( found_pos, 20 ) + 20;
|
2018-08-01 00:21:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// More matchers = better match
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Score += 2 * matchers_fired;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT()
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Type = ROOT;
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE_LIB& LIB_TREE_NODE_ROOT::AddLib( wxString const& aName, wxString const& aDesc )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2018-07-27 20:47:51 +00:00
|
|
|
LIB_TREE_NODE_LIB* lib = new LIB_TREE_NODE_LIB( this, aName, aDesc );
|
2020-02-07 17:06:24 +00:00
|
|
|
m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( lib ) );
|
2017-03-06 14:50:48 +00:00
|
|
|
return *lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-14 15:18:11 +00:00
|
|
|
void LIB_TREE_NODE_ROOT::UpdateScore( EDA_COMBINED_MATCHER& aMatcher, const wxString& aLib )
|
2017-03-06 14:50:48 +00:00
|
|
|
{
|
2020-12-24 19:42:41 +00:00
|
|
|
for( std::unique_ptr<LIB_TREE_NODE>& child: m_Children )
|
2021-12-14 15:18:11 +00:00
|
|
|
child->UpdateScore( aMatcher, aLib );
|
2017-03-06 14:50:48 +00:00
|
|
|
}
|
|
|
|
|