diff --git a/eeschema/sync_sheet_pin/panel_sync_sheet_pins.cpp b/eeschema/sync_sheet_pin/panel_sync_sheet_pins.cpp index 1c461e3fed..03f687fbc6 100644 --- a/eeschema/sync_sheet_pin/panel_sync_sheet_pins.cpp +++ b/eeschema/sync_sheet_pin/panel_sync_sheet_pins.cpp @@ -126,21 +126,9 @@ void PANEL_SYNC_SHEET_PINS::UpdateForms() pins_list.push_back( std::make_shared( static_cast( pin ), m_sheet ) ); - for( const auto& [idx, model] : m_models ) - { - switch( idx ) - { - case SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL: - model->UpdateItems( std::move( labels_list ) ); - break; - case SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN: - model->UpdateItems( std::move( pins_list ) ); - break; - case SHEET_SYNCHRONIZATION_MODEL::ASSOCIATED: - model->UpdateItems( std::move( associated_list ) ); - break; - } - } + m_models[SHEET_SYNCHRONIZATION_MODEL::HIRE_LABEL]->UpdateItems( std::move( labels_list ) ); + m_models[SHEET_SYNCHRONIZATION_MODEL::SHEET_PIN]->UpdateItems( std::move( pins_list ) ); + m_models[SHEET_SYNCHRONIZATION_MODEL::ASSOCIATED]->UpdateItems( std::move( associated_list ) ); UpdatePageImage(); } diff --git a/eeschema/sync_sheet_pin/sheet_synchronization_agent.cpp b/eeschema/sync_sheet_pin/sheet_synchronization_agent.cpp index 34d0e6d234..45e6abe4a8 100644 --- a/eeschema/sync_sheet_pin/sheet_synchronization_agent.cpp +++ b/eeschema/sync_sheet_pin/sheet_synchronization_agent.cpp @@ -47,16 +47,17 @@ SHEET_SYNCHRONIZATION_AGENT::SHEET_SYNCHRONIZATION_AGENT( DO_MODIFY_ITEM aDoMod SHEET_SYNCHRONIZATION_AGENT::~SHEET_SYNCHRONIZATION_AGENT() = default; -void SHEET_SYNCHRONIZATION_AGENT::ModifyItem( SHEET_SYNCHRONIZATION_ITEM& aItem, - std::function aDoModify, - SCH_SHEET_PATH const& aPath ) +void SHEET_SYNCHRONIZATION_AGENT::ModifyItem( SHEET_SYNCHRONIZATION_ITEM& aItem, + std::function const& aDoModify, + SCH_SHEET_PATH const& aPath ) { return ModifyItem( aItem.GetItem(), aDoModify, aPath, aItem.GetKind() ); } -void SHEET_SYNCHRONIZATION_AGENT::ModifyItem( SCH_ITEM* sch_item, std::function aDoModify, - const SCH_SHEET_PATH& aPath, +void SHEET_SYNCHRONIZATION_AGENT::ModifyItem( SCH_ITEM* sch_item, + std::function const& aDoModify, + const SCH_SHEET_PATH& aPath, SHEET_SYNCHRONIZATION_ITEM_KIND aKind ) { if( !aDoModify ) @@ -100,7 +101,7 @@ void SHEET_SYNCHRONIZATION_AGENT::RemoveItem( SHEET_SYNCHRONIZATION_ITEM& aItem, { SCH_SHEET_PATH path_cp = aPath; path_cp.pop_back(); - m_doDelete( aItem.GetItem(), path_cp ); + m_doDelete( aItem.GetItem(), std::move( path_cp ) ); break; } case SHEET_SYNCHRONIZATION_ITEM_KIND::HIERLABEL_AND_SHEET_PIN: diff --git a/eeschema/sync_sheet_pin/sheet_synchronization_agent.h b/eeschema/sync_sheet_pin/sheet_synchronization_agent.h index 5f78352d91..79fce58802 100644 --- a/eeschema/sync_sheet_pin/sheet_synchronization_agent.h +++ b/eeschema/sync_sheet_pin/sheet_synchronization_agent.h @@ -56,7 +56,7 @@ public: using MODIFICATION = std::function; - using DO_MODIFY_ITEM = std::function; + using DO_MODIFY_ITEM = std::function; using DO_PLACE_ITEM = std::function; @@ -67,11 +67,11 @@ public: SCH_EDIT_FRAME* a_frame ); ~SHEET_SYNCHRONIZATION_AGENT(); - void ModifyItem( SHEET_SYNCHRONIZATION_ITEM& aItem, std::function aDoModify, + void ModifyItem( SHEET_SYNCHRONIZATION_ITEM& aItem, std::function const& aDoModify, const SCH_SHEET_PATH& aPath ); - void ModifyItem( SCH_ITEM* aItem, std::function aDoModify, const SCH_SHEET_PATH& aPath, - SHEET_SYNCHRONIZATION_ITEM_KIND aKind ); + void ModifyItem( SCH_ITEM* aItem, std::function const& aDoModify, + const SCH_SHEET_PATH& aPath, SHEET_SYNCHRONIZATION_ITEM_KIND aKind ); void RemoveItem( SHEET_SYNCHRONIZATION_ITEM& aItem, SCH_SHEET* aSheet, SCH_SHEET_PATH const& aPath ); diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 86977594e0..54e8f57eb9 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -2486,7 +2486,7 @@ int SCH_DRAWING_TOOLS::doSyncSheetsPins( std::list sheetPaths ) m_frame, std::move( sheetPaths ), std::make_shared( [&]( EDA_ITEM* aItem, SCH_SHEET_PATH aPath, - SHEET_SYNCHRONIZATION_AGENT::MODIFICATION aModify ) + SHEET_SYNCHRONIZATION_AGENT::MODIFICATION const& aModify ) { SCH_COMMIT commit( m_toolMgr ); @@ -2609,7 +2609,7 @@ int SCH_DRAWING_TOOLS::SyncAllSheetsPins( const TOOL_EVENT& aEvent ) SCH_SHEET_PATH current; current.push_back( &m_frame->Schematic().Root() ); getSheetChildren( sheetPaths, m_frame->Schematic().Root().GetScreen(), visited, current ); - return doSyncSheetsPins( sheetPaths ); + return doSyncSheetsPins( std::move( sheetPaths ) ); }