Commit 9250eb4e authored by charras's avatar charras

some enhancements and cleanup. Fixed problem when deleting Netclasses in Design rules dialog window

parent 89535a13
...@@ -484,8 +484,8 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) ...@@ -484,8 +484,8 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
// Sort selection by decreasing index order: // Sort selection by decreasing index order:
select.Sort(sort_int); select.Sort(sort_int);
bool reinit = false; bool reinit = false;
// rows labels seem have problems when deleting rows: they are not deleted properly. // rows labels are not removed when deleting rows: they are not deleted.
// Workaround: store them, delete rows and reinit row labels (wxWidgets <= 2.9 ) // So we must store them, remove correponding labels and reinit them
wxArrayString labels; wxArrayString labels;
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ ) for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
labels.Add(m_grid->GetRowLabelValue(ii)); labels.Add(m_grid->GetRowLabelValue(ii));
...@@ -498,7 +498,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) ...@@ -498,7 +498,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
{ {
wxString classname = m_grid->GetRowLabelValue( grid_row ); wxString classname = m_grid->GetRowLabelValue( grid_row );
m_grid->DeleteRows( grid_row ); m_grid->DeleteRows( grid_row );
labels.RemoveAt(grid_row); labels.RemoveAt(grid_row); // Remove corresponding row label
reinit = true; reinit = true;
// reset the net class to default for members of the removed class // reset the net class to default for members of the removed class
...@@ -509,7 +509,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) ...@@ -509,7 +509,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
} }
if( reinit ) if( reinit )
{ {
// Workaround: reinit labels (wxWidgets <= 2.9 ) // Reinit labels :
for( unsigned ii = 1; ii < labels.GetCount(); ii++ ) for( unsigned ii = 1; ii < labels.GetCount(); ii++ )
m_grid->SetRowLabelValue(ii, labels[ii]); m_grid->SetRowLabelValue(ii, labels[ii]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment