From 0958b9778b988e0ed15388fe86755de2b6db7352 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Thu, 22 Dec 2022 10:50:18 -0500 Subject: [PATCH] Schematic: assigning netclass multiple times should replace, not add --- common/dialogs/dialog_assign_netclass.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/dialogs/dialog_assign_netclass.cpp b/common/dialogs/dialog_assign_netclass.cpp index 0ba635377c..06808da32a 100644 --- a/common/dialogs/dialog_assign_netclass.cpp +++ b/common/dialogs/dialog_assign_netclass.cpp @@ -65,6 +65,17 @@ bool DIALOG_ASSIGN_NETCLASS::TransferDataFromWindow() if( m_patternCtrl->GetValue().IsEmpty() ) return true; + // Replace existing assignment if we have one + for( auto& assignment : netSettings->m_NetClassPatternAssignments ) + { + if( assignment.first->GetPattern() == m_patternCtrl->GetValue() ) + { + assignment.second = m_netclassCtrl->GetStringSelection(); + return true; + } + } + + // No assignment, add a new one netSettings->m_NetClassPatternAssignments.push_back( { std::make_unique( m_patternCtrl->GetValue(), CTX_NETCLASS ),