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.
This commit is contained in:
Vadim Zeitlin 2020-04-13 21:45:54 +02:00
parent ee0b70a3a9
commit 4cde93cc82

View File

@ -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;