Always explicitly set split orientation in DeselectBlock()

No real changes, just make the code more clear by always explicitly
selecting either wxHORIZONTAL or wxVERTICAL instead of default for the
former for no good reason (by symmetry, it is not a better choice than
wxVERTICAL).

Also list all wxGridSelection enum elements in the switch over selection
mode to avoid warnings about not handling wxGridSelectRows.
This commit is contained in:
Vadim Zeitlin
2020-04-15 00:01:56 +02:00
parent 5d90688723
commit 3ebc76eea5

View File

@@ -269,33 +269,29 @@ wxGridSelection::DeselectBlock(const wxGridBlockCoords& block,
if ( !m_selection[n].Intersects(canonicalizedBlock) )
continue;
int splitOrientation = wxHORIZONTAL;
int splitOrientation = -1;
switch ( m_selectionMode )
{
case wxGrid::wxGridSelectCells:
if ( selBlock.GetLeftCol() == 0 &&
selBlock.GetRightCol() == m_grid->GetNumberCols() - 1 )
break;
if ( selBlock.GetTopRow() == 0 &&
selBlock.GetBottomRow() == m_grid->GetNumberRows() - 1 )
splitOrientation = wxVERTICAL;
case wxGrid::wxGridSelectRows:
splitOrientation = wxHORIZONTAL;
break;
case wxGrid::wxGridSelectColumns:
splitOrientation = wxVERTICAL;
break;
case wxGrid::wxGridSelectCells:
case wxGrid::wxGridSelectRowsOrColumns:
if ( selBlock.GetLeftCol() == 0 &&
selBlock.GetRightCol() == m_grid->GetNumberCols() - 1 )
break;
splitOrientation = wxVERTICAL;
splitOrientation = wxHORIZONTAL;
else
splitOrientation = wxVERTICAL;
break;
}
wxASSERT_MSG( splitOrientation != -1, "unknown selection mode" );
const wxGridBlockDiffResult result =
selBlock.Difference(canonicalizedBlock, splitOrientation);