Clearer naming.

This commit is contained in:
Jeff Young 2023-11-08 17:34:14 +00:00
parent b2c33ed6b2
commit 78e00ade7a
14 changed files with 76 additions and 74 deletions

View File

@ -160,9 +160,9 @@ LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* a
} }
LIB_TREE_NODE_LIB_ID::LIB_TREE_NODE_LIB_ID( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem ) LIB_TREE_NODE_LIB_ITEM::LIB_TREE_NODE_LIB_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem )
{ {
m_Type = LIBID; m_Type = LIB_ITEM;
m_Parent = aParent; m_Parent = aParent;
m_LibId.SetLibNickname( aItem->GetLibNickname() ); m_LibId.SetLibNickname( aItem->GetLibNickname() );
@ -187,7 +187,7 @@ LIB_TREE_NODE_LIB_ID::LIB_TREE_NODE_LIB_ID( LIB_TREE_NODE* aParent, LIB_TREE_ITE
} }
LIB_TREE_NODE_UNIT& LIB_TREE_NODE_LIB_ID::AddUnit( LIB_TREE_ITEM* aItem, int aUnit ) LIB_TREE_NODE_UNIT& LIB_TREE_NODE_LIB_ITEM::AddUnit( LIB_TREE_ITEM* aItem, int aUnit )
{ {
LIB_TREE_NODE_UNIT* unit = new LIB_TREE_NODE_UNIT( this, aItem, aUnit ); LIB_TREE_NODE_UNIT* unit = new LIB_TREE_NODE_UNIT( this, aItem, aUnit );
m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( unit ) ); m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( unit ) );
@ -195,7 +195,7 @@ LIB_TREE_NODE_UNIT& LIB_TREE_NODE_LIB_ID::AddUnit( LIB_TREE_ITEM* aItem, int aUn
} }
void LIB_TREE_NODE_LIB_ID::Update( LIB_TREE_ITEM* aItem ) void LIB_TREE_NODE_LIB_ITEM::Update( LIB_TREE_ITEM* aItem )
{ {
m_LibId.SetLibNickname( aItem->GetLibId().GetLibNickname() ); m_LibId.SetLibNickname( aItem->GetLibId().GetLibNickname() );
m_LibId.SetLibItemName( aItem->GetName() ); m_LibId.SetLibItemName( aItem->GetName() );
@ -215,8 +215,8 @@ void LIB_TREE_NODE_LIB_ID::Update( LIB_TREE_ITEM* aItem )
} }
void LIB_TREE_NODE_LIB_ID::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, void LIB_TREE_NODE_LIB_ITEM::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib,
std::function<bool( LIB_TREE_NODE& aNode )>* aFilter ) std::function<bool( LIB_TREE_NODE& aNode )>* aFilter )
{ {
// aMatcher test is additive // aMatcher test is additive
if( aMatcher ) if( aMatcher )
@ -236,10 +236,10 @@ void LIB_TREE_NODE_LIB_ID::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wx
} }
LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB( LIB_TREE_NODE* aParent, wxString const& aName, LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE* aParent, wxString const& aName,
wxString const& aDesc ) wxString const& aDesc )
{ {
m_Type = LIB; m_Type = LIBRARY;
m_Name = aName; m_Name = aName;
m_Desc = aDesc; m_Desc = aDesc;
m_Parent = aParent; m_Parent = aParent;
@ -249,16 +249,16 @@ LIB_TREE_NODE_LIB::LIB_TREE_NODE_LIB( LIB_TREE_NODE* aParent, wxString const& aN
} }
LIB_TREE_NODE_LIB_ID& LIB_TREE_NODE_LIB::AddItem( LIB_TREE_ITEM* aItem ) LIB_TREE_NODE_LIB_ITEM& LIB_TREE_NODE_LIBRARY::AddItem( LIB_TREE_ITEM* aItem )
{ {
LIB_TREE_NODE_LIB_ID* item = new LIB_TREE_NODE_LIB_ID( this, aItem ); LIB_TREE_NODE_LIB_ITEM* item = new LIB_TREE_NODE_LIB_ITEM( this, aItem );
m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( item ) ); m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( item ) );
return *item; return *item;
} }
void LIB_TREE_NODE_LIB::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, void LIB_TREE_NODE_LIBRARY::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib,
std::function<bool( LIB_TREE_NODE& aNode )>* aFilter ) std::function<bool( LIB_TREE_NODE& aNode )>* aFilter )
{ {
if( m_Children.size() ) if( m_Children.size() )
{ {
@ -289,9 +289,9 @@ LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT()
} }
LIB_TREE_NODE_LIB& LIB_TREE_NODE_ROOT::AddLib( wxString const& aName, wxString const& aDesc ) LIB_TREE_NODE_LIBRARY& LIB_TREE_NODE_ROOT::AddLib( wxString const& aName, wxString const& aDesc )
{ {
LIB_TREE_NODE_LIB* lib = new LIB_TREE_NODE_LIB( this, aName, aDesc ); LIB_TREE_NODE_LIBRARY* lib = new LIB_TREE_NODE_LIBRARY( this, aName, aDesc );
m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( lib ) ); m_Children.push_back( std::unique_ptr<LIB_TREE_NODE>( lib ) );
return *lib; return *lib;
} }

View File

@ -110,10 +110,11 @@ void LIB_TREE_MODEL_ADAPTER::SetPreselectNode( const LIB_ID& aLibId, int aUnit )
} }
LIB_TREE_NODE_LIB& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( const wxString& aNodeName, LIB_TREE_NODE_LIBRARY& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( const wxString& aNodeName,
const wxString& aDesc, bool pinned ) const wxString& aDesc,
bool pinned )
{ {
LIB_TREE_NODE_LIB& lib_node = m_tree.AddLib( aNodeName, aDesc ); LIB_TREE_NODE_LIBRARY& lib_node = m_tree.AddLib( aNodeName, aDesc );
lib_node.m_Pinned = pinned; lib_node.m_Pinned = pinned;
@ -125,7 +126,7 @@ void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( const wxString& aNodeName, const wxSt
const std::vector<LIB_TREE_ITEM*>& aItemList, const std::vector<LIB_TREE_ITEM*>& aItemList,
bool pinned, bool presorted ) bool pinned, bool presorted )
{ {
LIB_TREE_NODE_LIB& lib_node = DoAddLibraryNode( aNodeName, aDesc, pinned ); LIB_TREE_NODE_LIBRARY& lib_node = DoAddLibraryNode( aNodeName, aDesc, pinned );
for( LIB_TREE_ITEM* item: aItemList ) for( LIB_TREE_ITEM* item: aItemList )
lib_node.AddItem( item ); lib_node.AddItem( item );
@ -416,8 +417,8 @@ unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem,
unsigned int count = 0; unsigned int count = 0;
if( node->m_Type == LIB_TREE_NODE::TYPE::ROOT if( node->m_Type == LIB_TREE_NODE::TYPE::ROOT
|| node->m_Type == LIB_TREE_NODE::LIB || node->m_Type == LIB_TREE_NODE::LIBRARY
|| ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::LIBID ) ) || ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::LIB_ITEM ) )
{ {
for( std::unique_ptr<LIB_TREE_NODE> const& child: node->m_Children ) for( std::unique_ptr<LIB_TREE_NODE> const& child: node->m_Children )
{ {
@ -591,7 +592,7 @@ bool LIB_TREE_MODEL_ADAPTER::GetAttr( const wxDataViewItem& aItem,
LIB_TREE_NODE* node = ToNode( aItem ); LIB_TREE_NODE* node = ToNode( aItem );
wxCHECK( node, false ); wxCHECK( node, false );
if( node->m_Type == LIB_TREE_NODE::LIBID ) if( node->m_Type == LIB_TREE_NODE::LIB_ITEM )
{ {
if( !node->m_IsRoot && aCol == 0 ) if( !node->m_IsRoot && aCol == 0 )
{ {
@ -625,7 +626,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
recursiveDescent( m_tree, recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n ) [&]( const LIB_TREE_NODE* n )
{ {
if( n->m_Type == LIB_TREE_NODE::TYPE::LIBID && n->m_Score > 1 ) if( n->m_Type == LIB_TREE_NODE::TYPE::LIB_ITEM && n->m_Score > 1 )
{ {
if( !firstMatch ) if( !firstMatch )
firstMatch = n; firstMatch = n;
@ -644,7 +645,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
recursiveDescent( m_tree, recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n ) [&]( const LIB_TREE_NODE* n )
{ {
if( n->m_Type == LIB_TREE_NODE::LIBID if( n->m_Type == LIB_TREE_NODE::LIB_ITEM
&& ( n->m_Children.empty() || !m_preselect_unit ) && ( n->m_Children.empty() || !m_preselect_unit )
&& m_preselect_lib_id == n->m_LibId ) && m_preselect_lib_id == n->m_LibId )
{ {
@ -671,7 +672,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
recursiveDescent( m_tree, recursiveDescent( m_tree,
[&]( const LIB_TREE_NODE* n ) [&]( const LIB_TREE_NODE* n )
{ {
if( n->m_Type == LIB_TREE_NODE::TYPE::LIBID if( n->m_Type == LIB_TREE_NODE::TYPE::LIB_ITEM
&& n->m_Parent->m_Parent->m_Children.size() == 1 ) && n->m_Parent->m_Parent->m_Children.size() == 1 )
{ {
firstMatch = n; firstMatch = n;

View File

@ -584,7 +584,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
case WXK_ADD: case WXK_ADD:
updateRecentSearchMenu(); updateRecentSearchMenu();
if( type == LIB_TREE_NODE::LIB ) if( type == LIB_TREE_NODE::LIBRARY )
m_tree_ctrl->Expand( sel ); m_tree_ctrl->Expand( sel );
break; break;
@ -592,7 +592,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
case WXK_SUBTRACT: case WXK_SUBTRACT:
updateRecentSearchMenu(); updateRecentSearchMenu();
if( type == LIB_TREE_NODE::LIB ) if( type == LIB_TREE_NODE::LIBRARY )
m_tree_ctrl->Collapse( sel ); m_tree_ctrl->Collapse( sel );
break; break;
@ -603,7 +603,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
if( GetSelectedLibId().IsValid() ) if( GetSelectedLibId().IsValid() )
postSelectEvent(); postSelectEvent();
else if( type == LIB_TREE_NODE::LIB ) else if( type == LIB_TREE_NODE::LIBRARY )
toggleExpand( sel ); toggleExpand( sel );
break; break;
@ -878,7 +878,7 @@ void LIB_TREE::onItemContextMenu( wxDataViewEvent& aEvent )
{ {
LIB_TREE_NODE* current = GetCurrentTreeNode(); LIB_TREE_NODE* current = GetCurrentTreeNode();
if( current && current->m_Type == LIB_TREE_NODE::LIB ) if( current && current->m_Type == LIB_TREE_NODE::LIBRARY )
{ {
ACTION_MENU menu( true, nullptr ); ACTION_MENU menu( true, nullptr );

View File

@ -1145,7 +1145,7 @@ void SYMBOL_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem, LIB_
if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
// from file therefore not yet in tree. // from file therefore not yet in tree.
{ {
static_cast<LIB_TREE_NODE_LIB_ID*>( aTreeItem.GetID() )->Update( aSymbol ); static_cast<LIB_TREE_NODE_LIB_ITEM*>( aTreeItem.GetID() )->Update( aSymbol );
m_treePane->GetLibTree()->RefreshLibTree(); m_treePane->GetLibTree()->RefreshLibTree();
} }
} }

View File

@ -63,7 +63,7 @@ TOOL_INTERACTIVE* SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool()
bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const
{ {
const LIB_TREE_NODE* node = ToNode( aItem ); const LIB_TREE_NODE* node = ToNode( aItem );
return node ? node->m_Type == LIB_TREE_NODE::LIB : true; return node ? node->m_Type == LIB_TREE_NODE::LIBRARY : true;
} }
@ -102,7 +102,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync( const wxString& aForceRefresh,
} }
else else
{ {
updateLibrary( *(LIB_TREE_NODE_LIB*) it->get() ); updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() );
} }
++it; ++it;
@ -128,7 +128,8 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync( const wxString& aForceRefresh,
bool pinned = alg::contains( cfg->m_Session.pinned_symbol_libs, libName ) bool pinned = alg::contains( cfg->m_Session.pinned_symbol_libs, libName )
|| alg::contains( project.m_PinnedSymbolLibs, libName ); || alg::contains( project.m_PinnedSymbolLibs, libName );
LIB_TREE_NODE_LIB& lib_node = DoAddLibraryNode( libName, library->GetDescr(), pinned ); LIB_TREE_NODE_LIBRARY& lib_node = DoAddLibraryNode( libName, library->GetDescr(),
pinned );
updateLibrary( lib_node ); updateLibrary( lib_node );
} }
@ -152,7 +153,7 @@ int SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetLibrariesCount() const
} }
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIB& aLibNode ) void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode )
{ {
auto hashIt = m_libHashes.find( aLibNode.m_Name ); auto hashIt = m_libHashes.find( aLibNode.m_Name );
@ -180,7 +181,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIB& aLibNo
{ {
// alias exists both in the symbol tree and the library manager, // alias exists both in the symbol tree and the library manager,
// update only the node data. // update only the node data.
static_cast<LIB_TREE_NODE_LIB_ID*>( nodeIt->get() )->Update( *aliasIt ); static_cast<LIB_TREE_NODE_LIB_ITEM*>( nodeIt->get() )->Update( *aliasIt );
aliases.erase( aliasIt ); aliases.erase( aliasIt );
++nodeIt; ++nodeIt;
} }
@ -244,12 +245,12 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie
aVariant = UnescapeString( node->m_Name ); aVariant = UnescapeString( node->m_Name );
// mark modified items with an asterisk // mark modified items with an asterisk
if( node->m_Type == LIB_TREE_NODE::LIB ) if( node->m_Type == LIB_TREE_NODE::LIBRARY )
{ {
if( m_libMgr->IsLibraryModified( node->m_Name ) ) if( m_libMgr->IsLibraryModified( node->m_Name ) )
aVariant = aVariant.GetString() + " *"; aVariant = aVariant.GetString() + " *";
} }
else if( node->m_Type == LIB_TREE_NODE::LIBID ) else if( node->m_Type == LIB_TREE_NODE::LIB_ITEM )
{ {
if( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) ) if( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) )
aVariant = aVariant.GetString() + " *"; aVariant = aVariant.GetString() + " *";
@ -260,7 +261,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie
default: default:
if( m_colIdxMap.count( aCol ) ) if( m_colIdxMap.count( aCol ) )
{ {
if( node->m_Type == LIB_TREE_NODE::LIB ) if( node->m_Type == LIB_TREE_NODE::LIBRARY )
{ {
LIB_SYMBOL_LIBRARY_MANAGER& libMgr = m_frame->GetLibManager(); LIB_SYMBOL_LIBRARY_MANAGER& libMgr = m_frame->GetLibManager();
SYMBOL_LIB_TABLE_ROW* lib = libMgr.GetLibrary( node->m_LibId.GetLibNickname() ); SYMBOL_LIB_TABLE_ROW* lib = libMgr.GetLibrary( node->m_LibId.GetLibNickname() );
@ -307,7 +308,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
wxCHECK( node, false ); wxCHECK( node, false );
// Mark both columns of unloaded libraries using grey text color (to look disabled) // Mark both columns of unloaded libraries using grey text color (to look disabled)
if( node->m_Type == LIB_TREE_NODE::LIB && !m_libMgr->IsLibraryLoaded( node->m_Name ) ) if( node->m_Type == LIB_TREE_NODE::LIBRARY && !m_libMgr->IsLibraryLoaded( node->m_Name ) )
{ {
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
return true; return true;
@ -321,7 +322,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
switch( node->m_Type ) switch( node->m_Type )
{ {
case LIB_TREE_NODE::LIB: case LIB_TREE_NODE::LIBRARY:
// mark modified libs with bold font // mark modified libs with bold font
aAttr.SetBold( m_libMgr->IsLibraryModified( node->m_Name ) ); aAttr.SetBold( m_libMgr->IsLibraryModified( node->m_Name ) );
@ -339,7 +340,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
} }
break; break;
case LIB_TREE_NODE::LIBID: case LIB_TREE_NODE::LIB_ITEM:
// mark modified part with bold font // mark modified part with bold font
aAttr.SetBold( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) ); aAttr.SetBold( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) );
@ -373,7 +374,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem
LIB_TREE_NODE* node = ToNode( aItem ); LIB_TREE_NODE* node = ToNode( aItem );
wxCHECK( node, false ); wxCHECK( node, false );
return node->m_Type == LIB_TREE_NODE::LIBID && node->m_LibId != m_frame->GetTargetLibId(); return node->m_Type == LIB_TREE_NODE::LIB_ITEM && node->m_LibId != m_frame->GetTargetLibId();
} }

View File

@ -54,7 +54,7 @@ public:
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override; virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
protected: protected:
void updateLibrary( LIB_TREE_NODE_LIB& aLibNode ); void updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode );
LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt ); LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt );

View File

@ -70,14 +70,14 @@ bool SYMBOL_EDITOR_CONTROL::Init()
auto pinnedLibSelectedCondition = auto pinnedLibSelectedCondition =
[ editFrame ]( const SELECTION& aSel ) [ editFrame ]( const SELECTION& aSel )
{ {
LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode(); LIB_TREE_NODE* node = editFrame->GetCurrentTreeNode();
return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned; return node && node->m_Type == LIB_TREE_NODE::LIBRARY && node->m_Pinned;
}; };
auto unpinnedLibSelectedCondition = auto unpinnedLibSelectedCondition =
[ editFrame ](const SELECTION& aSel ) [ editFrame ](const SELECTION& aSel )
{ {
LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode(); LIB_TREE_NODE* node = editFrame->GetCurrentTreeNode();
return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned; return node && node->m_Type == LIB_TREE_NODE::LIBRARY && !node->m_Pinned;
}; };
auto symbolSelectedCondition = auto symbolSelectedCondition =
[ editFrame ]( const SELECTION& aSel ) [ editFrame ]( const SELECTION& aSel )

View File

@ -112,8 +112,8 @@ public:
enum TYPE enum TYPE
{ {
ROOT, ROOT,
LIB, LIBRARY,
LIBID, LIB_ITEM,
UNIT, UNIT,
INVALID INVALID
}; };
@ -185,15 +185,15 @@ public:
/** /**
* Node type: #LIB_ID. * Node type: #LIB_ID.
*/ */
class LIB_TREE_NODE_LIB_ID: public LIB_TREE_NODE class LIB_TREE_NODE_LIB_ITEM : public LIB_TREE_NODE
{ {
public: public:
/** /**
* The addresses of CMP_TREE_NODEs are used as unique IDs for the * The addresses of CMP_TREE_NODEs are used as unique IDs for the
* wxDataViewModel, so don't let them be copied around. * wxDataViewModel, so don't let them be copied around.
*/ */
LIB_TREE_NODE_LIB_ID( LIB_TREE_NODE_LIB_ID const& _ ) = delete; LIB_TREE_NODE_LIB_ITEM( LIB_TREE_NODE_LIB_ITEM const& _ ) = delete;
void operator=( LIB_TREE_NODE_LIB_ID const& _ ) = delete; void operator=( LIB_TREE_NODE_LIB_ITEM const& _ ) = delete;
/** /**
* Construct a #LIB_ID node. * Construct a #LIB_ID node.
@ -207,7 +207,7 @@ public:
* @param aParent parent node, should be a CMP_TREE_NODE_LIB * @param aParent parent node, should be a CMP_TREE_NODE_LIB
* @param aItem LIB_COMPONENT to populate the node. * @param aItem LIB_COMPONENT to populate the node.
*/ */
LIB_TREE_NODE_LIB_ID( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem ); LIB_TREE_NODE_LIB_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem );
/** /**
* Update the node using data from a LIB_ALIAS object. * Update the node using data from a LIB_ALIAS object.
@ -233,15 +233,15 @@ protected:
/** /**
* Node type: library * Node type: library
*/ */
class LIB_TREE_NODE_LIB: public LIB_TREE_NODE class LIB_TREE_NODE_LIBRARY : public LIB_TREE_NODE
{ {
public: public:
/** /**
* The addresses of CMP_TREE_NODEs are used as unique IDs for the * The addresses of CMP_TREE_NODEs are used as unique IDs for the
* wxDataViewModel, so don't let them be copied around. * wxDataViewModel, so don't let them be copied around.
*/ */
LIB_TREE_NODE_LIB( LIB_TREE_NODE_LIB const& _ ) = delete; LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE_LIBRARY const& _ ) = delete;
void operator=( LIB_TREE_NODE_LIB const& _ ) = delete; void operator=( LIB_TREE_NODE_LIBRARY const& _ ) = delete;
/** /**
* Construct an empty library node. * Construct an empty library node.
@ -250,14 +250,14 @@ public:
* @param aName display name of the library * @param aName display name of the library
* @param aDesc a description of the library * @param aDesc a description of the library
*/ */
LIB_TREE_NODE_LIB( LIB_TREE_NODE* aParent, const wxString& aName, const wxString& aDesc ); LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE* aParent, const wxString& aName, const wxString& aDesc );
/** /**
* Construct a new alias node, add it to this library, and return it. * Construct a new alias node, add it to this library, and return it.
* *
* @param aItem LIB_COMPONENT to provide data * @param aItem LIB_COMPONENT to provide data
*/ */
LIB_TREE_NODE_LIB_ID& AddItem( LIB_TREE_ITEM* aItem ); LIB_TREE_NODE_LIB_ITEM& AddItem( LIB_TREE_ITEM* aItem );
virtual void UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, virtual void UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib,
std::function<bool( LIB_TREE_NODE& aNode )>* aFilter ) override; std::function<bool( LIB_TREE_NODE& aNode )>* aFilter ) override;
@ -285,7 +285,7 @@ public:
/** /**
* Construct an empty library node, add it to the root, and return it. * Construct an empty library node, add it to the root, and return it.
*/ */
LIB_TREE_NODE_LIB& AddLib( wxString const& aName, wxString const& aDesc ); LIB_TREE_NODE_LIBRARY& AddLib( wxString const& aName, wxString const& aDesc );
virtual void UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, virtual void UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib,
std::function<bool( LIB_TREE_NODE& aNode )>* aFilter ) override; std::function<bool( LIB_TREE_NODE& aNode )>* aFilter ) override;

View File

@ -326,8 +326,8 @@ protected:
*/ */
LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, const wxString& aPinnedKey ); LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, const wxString& aPinnedKey );
LIB_TREE_NODE_LIB& DoAddLibraryNode( const wxString& aNodeName, const wxString& aDesc, LIB_TREE_NODE_LIBRARY& DoAddLibraryNode( const wxString& aNodeName, const wxString& aDesc,
bool pinned ); bool pinned );
/** /**
* Check whether a container has columns too * Check whether a container has columns too

View File

@ -159,7 +159,7 @@ FOOTPRINT_CHOOSER_FRAME::~FOOTPRINT_CHOOSER_FRAME()
bool FOOTPRINT_CHOOSER_FRAME::filterFootprint( LIB_TREE_NODE& aNode ) bool FOOTPRINT_CHOOSER_FRAME::filterFootprint( LIB_TREE_NODE& aNode )
{ {
if( aNode.m_Type == LIB_TREE_NODE::TYPE::LIB ) if( aNode.m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
{ {
// Normally lib nodes get scored by the max of their children's scores. However, if a // Normally lib nodes get scored by the max of their children's scores. However, if a
// lib node *has* no children then the scorer will call the filter on the lib node itself, // lib node *has* no children then the scorer will call the filter on the lib node itself,

View File

@ -156,7 +156,7 @@ void FOOTPRINT_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem,
if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
// from file therefore not yet in tree. // from file therefore not yet in tree.
{ {
static_cast<LIB_TREE_NODE_LIB_ID*>( aTreeItem.GetID() )->Update( &footprintInfo ); static_cast<LIB_TREE_NODE_LIB_ITEM*>( aTreeItem.GetID() )->Update( &footprintInfo );
m_treePane->GetLibTree()->RefreshLibTree(); m_treePane->GetLibTree()->RefreshLibTree();
} }
} }

View File

@ -64,7 +64,7 @@ TOOL_INTERACTIVE* FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool()
bool FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const bool FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const
{ {
const LIB_TREE_NODE* node = ToNode( aItem ); const LIB_TREE_NODE* node = ToNode( aItem );
return node ? node->m_Type == LIB_TREE_NODE::LIB : true; return node ? node->m_Type == LIB_TREE_NODE::LIBRARY : true;
} }
@ -88,7 +88,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::Sync( FP_LIB_TABLE* aLibs )
continue; continue;
} }
updateLibrary( *(LIB_TREE_NODE_LIB*) it->get() ); updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() );
++it; ++it;
} }
@ -128,7 +128,7 @@ int FP_TREE_SYNCHRONIZING_ADAPTER::GetLibrariesCount() const
} }
void FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIB& aLibNode ) void FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode )
{ {
std::vector<LIB_TREE_ITEM*> footprints = getFootprints( aLibNode.m_Name ); std::vector<LIB_TREE_ITEM*> footprints = getFootprints( aLibNode.m_Name );
@ -148,7 +148,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIB& aLibNode )
{ {
// footprint exists both in the lib tree and the footprint info list; just // footprint exists both in the lib tree and the footprint info list; just
// update the node data // update the node data
static_cast<LIB_TREE_NODE_LIB_ID*>( nodeIt->get() )->Update( *footprintIt ); static_cast<LIB_TREE_NODE_LIB_ITEM*>( nodeIt->get() )->Update( *footprintIt );
footprints.erase( footprintIt ); footprints.erase( footprintIt );
++nodeIt; ++nodeIt;
} }
@ -229,7 +229,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte
{ {
node->m_Desc = m_frame->GetBoard()->GetFirstFootprint()->GetLibDescription(); node->m_Desc = m_frame->GetBoard()->GetFirstFootprint()->GetLibDescription();
} }
else if( node->m_Type == LIB_TREE_NODE::LIB ) else if( node->m_Type == LIB_TREE_NODE::LIBRARY )
{ {
try try
{ {
@ -277,7 +277,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign
switch( node->m_Type ) switch( node->m_Type )
{ {
case LIB_TREE_NODE::LIB: case LIB_TREE_NODE::LIBRARY:
if( node->m_Name == m_frame->GetLoadedFPID().GetLibNickname() ) if( node->m_Name == m_frame->GetLoadedFPID().GetLibNickname() )
{ {
#ifdef __WXGTK__ #ifdef __WXGTK__
@ -295,7 +295,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign
} }
break; break;
case LIB_TREE_NODE::LIBID: case LIB_TREE_NODE::LIB_ITEM:
if( node->m_LibId == m_frame->GetLoadedFPID() ) if( node->m_LibId == m_frame->GetLoadedFPID() )
{ {
#ifdef __WXGTK__ #ifdef __WXGTK__
@ -326,7 +326,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem )
LIB_TREE_NODE* node = ToNode( aItem ); LIB_TREE_NODE* node = ToNode( aItem );
wxCHECK( node, false ); wxCHECK( node, false );
return node->m_Type == LIB_TREE_NODE::LIBID && node->m_LibId != m_frame->GetLoadedFPID(); return node->m_Type == LIB_TREE_NODE::LIB_ITEM && node->m_LibId != m_frame->GetLoadedFPID();
} }

View File

@ -52,7 +52,7 @@ public:
protected: protected:
FP_TREE_SYNCHRONIZING_ADAPTER( FOOTPRINT_EDIT_FRAME* aFrame, FP_LIB_TABLE* aLibs ); FP_TREE_SYNCHRONIZING_ADAPTER( FOOTPRINT_EDIT_FRAME* aFrame, FP_LIB_TABLE* aLibs );
void updateLibrary( LIB_TREE_NODE_LIB& aLibNode ); void updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode );
LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt ); LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary( LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt );

View File

@ -96,13 +96,13 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
[ this ]( const SELECTION& aSel ) [ this ]( const SELECTION& aSel )
{ {
LIB_TREE_NODE* current = m_frame->GetCurrentTreeNode(); LIB_TREE_NODE* current = m_frame->GetCurrentTreeNode();
return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned; return current && current->m_Type == LIB_TREE_NODE::LIBRARY && current->m_Pinned;
}; };
auto unpinnedLibSelectedCondition = auto unpinnedLibSelectedCondition =
[ this ](const SELECTION& aSel ) [ this ](const SELECTION& aSel )
{ {
LIB_TREE_NODE* current = m_frame->GetCurrentTreeNode(); LIB_TREE_NODE* current = m_frame->GetCurrentTreeNode();
return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned; return current && current->m_Type == LIB_TREE_NODE::LIBRARY && !current->m_Pinned;
}; };
auto fpSelectedCondition = auto fpSelectedCondition =
[ this ]( const SELECTION& aSel ) [ this ]( const SELECTION& aSel )