Clear selections before deleting grid rows (KICAD-J40).

(cherry picked from commit a2cf59cc89)
This commit is contained in:
Jeff Young
2025-07-08 08:44:22 +01:00
parent 10f4e340ba
commit b5f808e6fb
+12 -3
View File
@@ -144,6 +144,9 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortTrackWidthsClick( wxCommandEvent& aEvent
std::vector<int> trackWidths;
wxString msg;
m_trackWidthsGrid->ClearSelection();
wxSafeYield();
wxGridUpdateLocker lock( m_trackWidthsGrid );
for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
@@ -155,7 +158,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortTrackWidthsClick( wxCommandEvent& aEvent
}
std::sort( trackWidths.begin(), trackWidths.end() );
m_trackWidthsGrid->DeleteRows(0, m_trackWidthsGrid->GetNumberRows(), false);
m_trackWidthsGrid->DeleteRows( 0, m_trackWidthsGrid->GetNumberRows(), false );
for( int width : trackWidths )
AppendTrackWidth( width );
@@ -167,6 +170,9 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortViaSizesClick( wxCommandEvent& aEvent )
std::vector<VIA_DIMENSION> vias;
wxString msg;
m_trackWidthsGrid->ClearSelection();
wxSafeYield();
wxGridUpdateLocker lock( m_viaSizesGrid );
for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
@@ -188,7 +194,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortViaSizesClick( wxCommandEvent& aEvent )
}
std::sort( vias.begin(), vias.end() );
m_viaSizesGrid->DeleteRows(0, m_viaSizesGrid->GetNumberRows(), false );
m_viaSizesGrid->DeleteRows( 0, m_viaSizesGrid->GetNumberRows(), false );
for( const VIA_DIMENSION& via : vias )
AppendViaSize( via.m_Diameter, via.m_Drill );
@@ -200,6 +206,9 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortDiffPairsClick( wxCommandEvent& aEvent )
wxString msg;
std::vector<DIFF_PAIR_DIMENSION> diffPairs;
m_trackWidthsGrid->ClearSelection();
wxSafeYield();
wxGridUpdateLocker lock( m_diffPairsGrid );
for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
@@ -224,7 +233,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortDiffPairsClick( wxCommandEvent& aEvent )
}
std::sort( diffPairs.begin(), diffPairs.end() );
m_diffPairsGrid->DeleteRows(0, m_diffPairsGrid->GetNumberRows(), false );
m_diffPairsGrid->DeleteRows( 0, m_diffPairsGrid->GetNumberRows(), false );
for( const DIFF_PAIR_DIMENSION& dp : diffPairs )
AppendDiffPairs( dp.m_Width, dp.m_Gap, dp.m_ViaGap );