Schematic: assigning netclass multiple times should replace, not add

This commit is contained in:
Mike Williams 2022-12-22 10:50:18 -05:00
parent 3037f2b444
commit 0958b9778b
1 changed files with 11 additions and 0 deletions

View File

@ -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<EDA_COMBINED_MATCHER>( m_patternCtrl->GetValue(), CTX_NETCLASS ),