Don't treat new netclass as changing a netclass name.

In particular, since it goes from empty string to non-empty, the
oldName comparison will cause it to pick up all unassigned nets.

Fixes https://gitlab.com/kicad/code/kicad/issues/4922
This commit is contained in:
Jeff Young 2020-07-18 10:58:10 +01:00
parent a25f7cc0a4
commit 49d242944d
1 changed files with 9 additions and 3 deletions

View File

@ -309,6 +309,7 @@ void PANEL_SETUP_NETCLASSES::rebuildNetclassDropdowns()
for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ ) for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
{ {
wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME ); wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME );
if( !netclassName.IsEmpty() ) if( !netclassName.IsEmpty() )
netclassNames.push_back( netclassName ); netclassNames.push_back( netclassName );
} }
@ -421,16 +422,21 @@ void PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging( wxGridEvent& event )
wxString oldName = m_netclassGrid->GetCellValue( event.GetRow(), GRID_NAME ); wxString oldName = m_netclassGrid->GetCellValue( event.GetRow(), GRID_NAME );
wxString newName = event.GetString(); wxString newName = event.GetString();
for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row ) if( !oldName.IsEmpty() )
{ {
if( m_membershipGrid->GetCellValue( row, 1 ) == oldName ) for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
m_membershipGrid->SetCellValue( row, 1, newName ); {
if( m_membershipGrid->GetCellValue( row, 1 ) == oldName )
m_membershipGrid->SetCellValue( row, 1, newName );
}
} }
m_netclassesDirty = true; m_netclassesDirty = true;
} }
else else
{
event.Veto(); event.Veto();
}
} }
} }