From 78e00ade7a07d5fd72d080d6f5704b58e8f03798 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 8 Nov 2023 17:34:14 +0000 Subject: [PATCH] Clearer naming. --- common/lib_tree_model.cpp | 30 +++++++++---------- common/lib_tree_model_adapter.cpp | 21 ++++++------- common/widgets/lib_tree.cpp | 8 ++--- eeschema/symbol_editor/symbol_edit_frame.cpp | 2 +- .../symbol_tree_synchronizing_adapter.cpp | 25 ++++++++-------- eeschema/symbol_tree_synchronizing_adapter.h | 2 +- eeschema/tools/symbol_editor_control.cpp | 8 ++--- include/lib_tree_model.h | 24 +++++++-------- include/lib_tree_model_adapter.h | 4 +-- pcbnew/footprint_chooser_frame.cpp | 2 +- pcbnew/footprint_editor_utils.cpp | 2 +- pcbnew/fp_tree_synchronizing_adapter.cpp | 16 +++++----- pcbnew/fp_tree_synchronizing_adapter.h | 2 +- pcbnew/tools/footprint_editor_control.cpp | 4 +-- 14 files changed, 76 insertions(+), 74 deletions(-) diff --git a/common/lib_tree_model.cpp b/common/lib_tree_model.cpp index 10ee9889a9..107ca4b394 100644 --- a/common/lib_tree_model.cpp +++ b/common/lib_tree_model.cpp @@ -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_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 ); m_Children.push_back( std::unique_ptr( 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.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, - std::function* aFilter ) +void LIB_TREE_NODE_LIB_ITEM::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, + std::function* aFilter ) { // aMatcher test is additive 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, - wxString const& aDesc ) +LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE* aParent, wxString const& aName, + wxString const& aDesc ) { - m_Type = LIB; + m_Type = LIBRARY; m_Name = aName; m_Desc = aDesc; 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( item ) ); return *item; } -void LIB_TREE_NODE_LIB::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, - std::function* aFilter ) +void LIB_TREE_NODE_LIBRARY::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, + std::function* aFilter ) { 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 ) ); return *lib; } diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp index 16731bfcdf..caf3c546b5 100644 --- a/common/lib_tree_model_adapter.cpp +++ b/common/lib_tree_model_adapter.cpp @@ -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, - const wxString& aDesc, bool pinned ) +LIB_TREE_NODE_LIBRARY& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( const wxString& aNodeName, + 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; @@ -125,7 +126,7 @@ void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( const wxString& aNodeName, const wxSt const std::vector& aItemList, 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 ) lib_node.AddItem( item ); @@ -416,8 +417,8 @@ unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem, unsigned int count = 0; if( node->m_Type == LIB_TREE_NODE::TYPE::ROOT - || node->m_Type == LIB_TREE_NODE::LIB - || ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::LIBID ) ) + || node->m_Type == LIB_TREE_NODE::LIBRARY + || ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::LIB_ITEM ) ) { for( std::unique_ptr const& child: node->m_Children ) { @@ -591,7 +592,7 @@ bool LIB_TREE_MODEL_ADAPTER::GetAttr( const wxDataViewItem& aItem, LIB_TREE_NODE* node = ToNode( aItem ); 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 ) { @@ -625,7 +626,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults() recursiveDescent( m_tree, [&]( 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 ) firstMatch = n; @@ -644,7 +645,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults() recursiveDescent( m_tree, [&]( 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 ) && m_preselect_lib_id == n->m_LibId ) { @@ -671,7 +672,7 @@ const LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults() recursiveDescent( m_tree, [&]( 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 ) { firstMatch = n; diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index cf3251882f..896fcb44ef 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -584,7 +584,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke ) case WXK_ADD: updateRecentSearchMenu(); - if( type == LIB_TREE_NODE::LIB ) + if( type == LIB_TREE_NODE::LIBRARY ) m_tree_ctrl->Expand( sel ); break; @@ -592,7 +592,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke ) case WXK_SUBTRACT: updateRecentSearchMenu(); - if( type == LIB_TREE_NODE::LIB ) + if( type == LIB_TREE_NODE::LIBRARY ) m_tree_ctrl->Collapse( sel ); break; @@ -603,7 +603,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke ) if( GetSelectedLibId().IsValid() ) postSelectEvent(); - else if( type == LIB_TREE_NODE::LIB ) + else if( type == LIB_TREE_NODE::LIBRARY ) toggleExpand( sel ); break; @@ -878,7 +878,7 @@ void LIB_TREE::onItemContextMenu( wxDataViewEvent& aEvent ) { 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 ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index e7d0a431e5..f0846ec083 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -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 // from file therefore not yet in tree. { - static_cast( aTreeItem.GetID() )->Update( aSymbol ); + static_cast( aTreeItem.GetID() )->Update( aSymbol ); m_treePane->GetLibTree()->RefreshLibTree(); } } diff --git a/eeschema/symbol_tree_synchronizing_adapter.cpp b/eeschema/symbol_tree_synchronizing_adapter.cpp index b254eb17cd..0386c06d12 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.cpp +++ b/eeschema/symbol_tree_synchronizing_adapter.cpp @@ -63,7 +63,7 @@ TOOL_INTERACTIVE* SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool() bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const { 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 { - updateLibrary( *(LIB_TREE_NODE_LIB*) it->get() ); + updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() ); } ++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 ) || 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 ); } @@ -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 ); @@ -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, // update only the node data. - static_cast( nodeIt->get() )->Update( *aliasIt ); + static_cast( nodeIt->get() )->Update( *aliasIt ); aliases.erase( aliasIt ); ++nodeIt; } @@ -244,12 +245,12 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie aVariant = UnescapeString( node->m_Name ); // 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 ) ) 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 ) ) aVariant = aVariant.GetString() + " *"; @@ -260,7 +261,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie default: 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(); 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 ); // 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 ) ); return true; @@ -321,7 +322,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un switch( node->m_Type ) { - case LIB_TREE_NODE::LIB: + case LIB_TREE_NODE::LIBRARY: // mark modified libs with bold font aAttr.SetBold( m_libMgr->IsLibraryModified( node->m_Name ) ); @@ -339,7 +340,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un } break; - case LIB_TREE_NODE::LIBID: + case LIB_TREE_NODE::LIB_ITEM: // mark modified part with bold font 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 ); 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(); } diff --git a/eeschema/symbol_tree_synchronizing_adapter.h b/eeschema/symbol_tree_synchronizing_adapter.h index 3ca7c08db4..72313d574e 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.h +++ b/eeschema/symbol_tree_synchronizing_adapter.h @@ -54,7 +54,7 @@ public: virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override; 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 ); diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp index f4427bc013..7d15a1538a 100644 --- a/eeschema/tools/symbol_editor_control.cpp +++ b/eeschema/tools/symbol_editor_control.cpp @@ -70,14 +70,14 @@ bool SYMBOL_EDITOR_CONTROL::Init() auto pinnedLibSelectedCondition = [ editFrame ]( const SELECTION& aSel ) { - LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode(); - return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned; + LIB_TREE_NODE* node = editFrame->GetCurrentTreeNode(); + return node && node->m_Type == LIB_TREE_NODE::LIBRARY && node->m_Pinned; }; auto unpinnedLibSelectedCondition = [ editFrame ](const SELECTION& aSel ) { - LIB_TREE_NODE* current = editFrame->GetCurrentTreeNode(); - return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned; + LIB_TREE_NODE* node = editFrame->GetCurrentTreeNode(); + return node && node->m_Type == LIB_TREE_NODE::LIBRARY && !node->m_Pinned; }; auto symbolSelectedCondition = [ editFrame ]( const SELECTION& aSel ) diff --git a/include/lib_tree_model.h b/include/lib_tree_model.h index af408250fc..e325e4688d 100644 --- a/include/lib_tree_model.h +++ b/include/lib_tree_model.h @@ -112,8 +112,8 @@ public: enum TYPE { ROOT, - LIB, - LIBID, + LIBRARY, + LIB_ITEM, UNIT, INVALID }; @@ -185,15 +185,15 @@ public: /** * 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: /** * 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_LIB_ID( LIB_TREE_NODE_LIB_ID const& _ ) = delete; - void operator=( 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_ITEM const& _ ) = delete; /** * Construct a #LIB_ID node. @@ -207,7 +207,7 @@ public: * @param aParent parent node, should be a CMP_TREE_NODE_LIB * @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. @@ -233,15 +233,15 @@ protected: /** * Node type: library */ -class LIB_TREE_NODE_LIB: public LIB_TREE_NODE +class LIB_TREE_NODE_LIBRARY : public LIB_TREE_NODE { public: /** * 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_LIB( LIB_TREE_NODE_LIB const& _ ) = delete; - void operator=( LIB_TREE_NODE_LIB const& _ ) = delete; + LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE_LIBRARY const& _ ) = delete; + void operator=( LIB_TREE_NODE_LIBRARY const& _ ) = delete; /** * Construct an empty library node. @@ -250,14 +250,14 @@ public: * @param aName display name 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. * * @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, std::function* aFilter ) override; @@ -285,7 +285,7 @@ public: /** * 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, std::function* aFilter ) override; diff --git a/include/lib_tree_model_adapter.h b/include/lib_tree_model_adapter.h index 2eeb749d21..69fbd2fa9f 100644 --- a/include/lib_tree_model_adapter.h +++ b/include/lib_tree_model_adapter.h @@ -326,8 +326,8 @@ protected: */ LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, const wxString& aPinnedKey ); - LIB_TREE_NODE_LIB& DoAddLibraryNode( const wxString& aNodeName, const wxString& aDesc, - bool pinned ); + LIB_TREE_NODE_LIBRARY& DoAddLibraryNode( const wxString& aNodeName, const wxString& aDesc, + bool pinned ); /** * Check whether a container has columns too diff --git a/pcbnew/footprint_chooser_frame.cpp b/pcbnew/footprint_chooser_frame.cpp index f70b726483..406706cc56 100644 --- a/pcbnew/footprint_chooser_frame.cpp +++ b/pcbnew/footprint_chooser_frame.cpp @@ -159,7 +159,7 @@ FOOTPRINT_CHOOSER_FRAME::~FOOTPRINT_CHOOSER_FRAME() 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 // lib node *has* no children then the scorer will call the filter on the lib node itself, diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 78697d1d0a..60b7c6c2fd 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -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 // from file therefore not yet in tree. { - static_cast( aTreeItem.GetID() )->Update( &footprintInfo ); + static_cast( aTreeItem.GetID() )->Update( &footprintInfo ); m_treePane->GetLibTree()->RefreshLibTree(); } } diff --git a/pcbnew/fp_tree_synchronizing_adapter.cpp b/pcbnew/fp_tree_synchronizing_adapter.cpp index c356ef20a6..04b2e088d0 100644 --- a/pcbnew/fp_tree_synchronizing_adapter.cpp +++ b/pcbnew/fp_tree_synchronizing_adapter.cpp @@ -64,7 +64,7 @@ TOOL_INTERACTIVE* FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool() bool FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const { 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; } - updateLibrary( *(LIB_TREE_NODE_LIB*) it->get() ); + updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() ); ++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 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 // update the node data - static_cast( nodeIt->get() )->Update( *footprintIt ); + static_cast( nodeIt->get() )->Update( *footprintIt ); footprints.erase( footprintIt ); ++nodeIt; } @@ -229,7 +229,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte { 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 { @@ -277,7 +277,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign switch( node->m_Type ) { - case LIB_TREE_NODE::LIB: + case LIB_TREE_NODE::LIBRARY: if( node->m_Name == m_frame->GetLoadedFPID().GetLibNickname() ) { #ifdef __WXGTK__ @@ -295,7 +295,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign } break; - case LIB_TREE_NODE::LIBID: + case LIB_TREE_NODE::LIB_ITEM: if( node->m_LibId == m_frame->GetLoadedFPID() ) { #ifdef __WXGTK__ @@ -326,7 +326,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem ) LIB_TREE_NODE* node = ToNode( aItem ); 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(); } diff --git a/pcbnew/fp_tree_synchronizing_adapter.h b/pcbnew/fp_tree_synchronizing_adapter.h index 72093ea077..32865fe73b 100644 --- a/pcbnew/fp_tree_synchronizing_adapter.h +++ b/pcbnew/fp_tree_synchronizing_adapter.h @@ -52,7 +52,7 @@ public: protected: 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 ); diff --git a/pcbnew/tools/footprint_editor_control.cpp b/pcbnew/tools/footprint_editor_control.cpp index bcde261204..fd6113b96f 100644 --- a/pcbnew/tools/footprint_editor_control.cpp +++ b/pcbnew/tools/footprint_editor_control.cpp @@ -96,13 +96,13 @@ bool FOOTPRINT_EDITOR_CONTROL::Init() [ this ]( const SELECTION& aSel ) { 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 = [ this ](const SELECTION& aSel ) { 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 = [ this ]( const SELECTION& aSel )