From 4cde93cc824ae961abd30d27ac2ea967bea4c5b7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Apr 2020 21:45:54 +0200 Subject: [PATCH] Optimize test for the row/column selection Use wxGridSelection::IsInSelection() instead of GetSelectedRows/Cols() which can be much slower as they need to produce an array containing indices of all the selected rows/columns. --- src/generic/grid.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index d2f7a68f1e..4365fe4170 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3748,7 +3748,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo } else if ( event.CmdDown() && !event.ShiftDown() ) { - if ( GetSelectedRows().Index(row) != wxNOT_FOUND ) + if ( m_selection->IsInSelection(row, 0) ) { DeselectRow(row); makeRowCurrent = true; @@ -4159,7 +4159,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo } else if ( event.CmdDown() && !event.ShiftDown() ) { - if ( GetSelectedCols().Index(col) != wxNOT_FOUND ) + if ( m_selection->IsInSelection(0, col) ) { DeselectCol(col); makeColCurrent = true;