From a4a946ab75e4c76da1ac33900e4f82bd57e11152 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 17 Nov 2023 18:17:50 +0000 Subject: [PATCH] Clearer naming. --- common/lib_tree_model.cpp | 16 ++++++++-------- common/lib_tree_model_adapter.cpp | 10 +++++----- eeschema/symbol_editor/symbol_edit_frame.cpp | 2 +- eeschema/symbol_tree_synchronizing_adapter.cpp | 8 ++++---- include/lib_tree_model.h | 12 ++++++------ pcbnew/footprint_editor_utils.cpp | 2 +- pcbnew/fp_tree_synchronizing_adapter.cpp | 6 +++--- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/common/lib_tree_model.cpp b/common/lib_tree_model.cpp index 946bdaea08..d2658cea35 100644 --- a/common/lib_tree_model.cpp +++ b/common/lib_tree_model.cpp @@ -177,9 +177,9 @@ void LIB_TREE_NODE_UNIT::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxSt } -LIB_TREE_NODE_LIB_ITEM::LIB_TREE_NODE_LIB_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem ) +LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem ) { - m_Type = LIB_ITEM; + m_Type = ITEM; m_Parent = aParent; m_LibId.SetLibNickname( aItem->GetLibNickname() ); @@ -204,7 +204,7 @@ LIB_TREE_NODE_LIB_ITEM::LIB_TREE_NODE_LIB_ITEM( LIB_TREE_NODE* aParent, LIB_TREE } -LIB_TREE_NODE_UNIT& LIB_TREE_NODE_LIB_ITEM::AddUnit( LIB_TREE_ITEM* aItem, int aUnit ) +LIB_TREE_NODE_UNIT& LIB_TREE_NODE_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 ) ); @@ -212,7 +212,7 @@ LIB_TREE_NODE_UNIT& LIB_TREE_NODE_LIB_ITEM::AddUnit( LIB_TREE_ITEM* aItem, int a } -void LIB_TREE_NODE_LIB_ITEM::Update( LIB_TREE_ITEM* aItem ) +void LIB_TREE_NODE_ITEM::Update( LIB_TREE_ITEM* aItem ) { m_LibId.SetLibNickname( aItem->GetLibId().GetLibNickname() ); m_LibId.SetLibItemName( aItem->GetName() ); @@ -232,8 +232,8 @@ void LIB_TREE_NODE_LIB_ITEM::Update( LIB_TREE_ITEM* aItem ) } -void LIB_TREE_NODE_LIB_ITEM::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, - std::function* aFilter ) +void LIB_TREE_NODE_ITEM::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, + std::function* aFilter ) { // aMatcher test is additive if( aMatcher ) @@ -269,9 +269,9 @@ LIB_TREE_NODE_LIBRARY::LIB_TREE_NODE_LIBRARY( LIB_TREE_NODE* aParent, wxString c } -LIB_TREE_NODE_LIB_ITEM& LIB_TREE_NODE_LIBRARY::AddItem( LIB_TREE_ITEM* aItem ) +LIB_TREE_NODE_ITEM& LIB_TREE_NODE_LIBRARY::AddItem( LIB_TREE_ITEM* aItem ) { - LIB_TREE_NODE_LIB_ITEM* item = new LIB_TREE_NODE_LIB_ITEM( this, aItem ); + LIB_TREE_NODE_ITEM* item = new LIB_TREE_NODE_ITEM( this, aItem ); m_Children.push_back( std::unique_ptr( item ) ); return *item; } diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp index 001c23ab93..b9eb3dcdb6 100644 --- a/common/lib_tree_model_adapter.cpp +++ b/common/lib_tree_model_adapter.cpp @@ -418,7 +418,7 @@ unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem, if( node->m_Type == LIB_TREE_NODE::TYPE::ROOT || node->m_Type == LIB_TREE_NODE::LIBRARY - || ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::LIB_ITEM ) ) + || ( m_show_units && node->m_Type == LIB_TREE_NODE::TYPE::ITEM ) ) { for( std::unique_ptr const& child: node->m_Children ) { @@ -592,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::LIB_ITEM ) + if( node->m_Type == LIB_TREE_NODE::ITEM ) { if( !node->m_IsRoot && aCol == 0 ) { @@ -626,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::LIB_ITEM && n->m_Score > 1 ) + if( n->m_Type == LIB_TREE_NODE::TYPE::ITEM && n->m_Score > 1 ) { if( !firstMatch ) firstMatch = n; @@ -645,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::LIB_ITEM + if( n->m_Type == LIB_TREE_NODE::ITEM && ( n->m_Children.empty() || !m_preselect_unit ) && m_preselect_lib_id == n->m_LibId ) { @@ -683,7 +683,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::LIB_ITEM ) + if( n->m_Type == LIB_TREE_NODE::TYPE::ITEM ) { firstMatch = n; m_widget->ExpandAncestors( ToItem( n ) ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index f0846ec083..7da69722c8 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 73644a0f9f..a5257ed796 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.cpp +++ b/eeschema/symbol_tree_synchronizing_adapter.cpp @@ -181,7 +181,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIBRARY& aL { // 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; } @@ -250,7 +250,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie if( m_libMgr->IsLibraryModified( node->m_Name ) ) aVariant = aVariant.GetString() + " *"; } - else if( node->m_Type == LIB_TREE_NODE::LIB_ITEM ) + else if( node->m_Type == LIB_TREE_NODE::ITEM ) { if( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) ) aVariant = aVariant.GetString() + " *"; @@ -340,7 +340,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un } break; - case LIB_TREE_NODE::LIB_ITEM: + case LIB_TREE_NODE::ITEM: // mark modified part with bold font aAttr.SetBold( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) ); @@ -374,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::LIB_ITEM && node->m_LibId != m_frame->GetTargetLibId(); + return node->m_Type == LIB_TREE_NODE::ITEM && node->m_LibId != m_frame->GetTargetLibId(); } diff --git a/include/lib_tree_model.h b/include/lib_tree_model.h index 39587db6ac..613afe8578 100644 --- a/include/lib_tree_model.h +++ b/include/lib_tree_model.h @@ -113,7 +113,7 @@ public: { ROOT, LIBRARY, - LIB_ITEM, + ITEM, UNIT, INVALID }; @@ -181,15 +181,15 @@ public: /** * Node type: #LIB_ID. */ -class LIB_TREE_NODE_LIB_ITEM : public LIB_TREE_NODE +class LIB_TREE_NODE_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_ITEM( LIB_TREE_NODE_LIB_ITEM const& _ ) = delete; - void operator=( LIB_TREE_NODE_LIB_ITEM const& _ ) = delete; + LIB_TREE_NODE_ITEM( LIB_TREE_NODE_ITEM const& _ ) = delete; + void operator=( LIB_TREE_NODE_ITEM const& _ ) = delete; /** * Construct a #LIB_ID node. @@ -203,7 +203,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_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem ); + LIB_TREE_NODE_ITEM( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* aItem ); /** * Update the node using data from a LIB_ALIAS object. @@ -253,7 +253,7 @@ public: * * @param aItem LIB_COMPONENT to provide data */ - LIB_TREE_NODE_LIB_ITEM& AddItem( LIB_TREE_ITEM* aItem ); + LIB_TREE_NODE_ITEM& AddItem( LIB_TREE_ITEM* aItem ); void UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib, std::function* aFilter ) override; diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 60b7c6c2fd..f3503589e4 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 77b3c1fabe..8cf8f9b4b9 100644 --- a/pcbnew/fp_tree_synchronizing_adapter.cpp +++ b/pcbnew/fp_tree_synchronizing_adapter.cpp @@ -148,7 +148,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNo { // 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; } @@ -295,7 +295,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign } break; - case LIB_TREE_NODE::LIB_ITEM: + case LIB_TREE_NODE::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::LIB_ITEM && node->m_LibId != m_frame->GetLoadedFPID(); + return node->m_Type == LIB_TREE_NODE::ITEM && node->m_LibId != m_frame->GetLoadedFPID(); }