Make Ctrl/Shift-Space apply to all cells of the current selection
This provides a convenient way to select multiple lines and is consistent with the operation of these keys in spreadsheet programs.
This commit is contained in:
@@ -5834,33 +5834,45 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_SPACE:
|
case WXK_SPACE:
|
||||||
// Ctrl-Space selects the current column, Shift-Space -- the
|
// Ctrl-Space selects the current column or, if there is a
|
||||||
// current row and Ctrl-Shift-Space -- everything
|
// selection, all columns containing the selected cells,
|
||||||
switch ( m_selection ? event.GetModifiers() : wxMOD_NONE )
|
// Shift-Space -- the current row (or all selection rows) and
|
||||||
|
// Ctrl-Shift-Space -- everything.
|
||||||
{
|
{
|
||||||
case wxMOD_CONTROL:
|
wxGridCellCoords selStart, selEnd;
|
||||||
m_selection->SelectCol(m_currentCellCoords.GetCol());
|
switch ( m_selection ? event.GetModifiers() : wxMOD_NONE )
|
||||||
break;
|
{
|
||||||
|
case wxMOD_CONTROL:
|
||||||
case wxMOD_SHIFT:
|
selStart.Set(0, m_currentCellCoords.GetCol());
|
||||||
m_selection->SelectRow(m_currentCellCoords.GetRow());
|
selEnd.Set(m_numRows - 1,
|
||||||
break;
|
m_selection->GetExtensionAnchor().GetCol());
|
||||||
|
|
||||||
case wxMOD_CONTROL | wxMOD_SHIFT:
|
|
||||||
m_selection->SelectBlock(0, 0,
|
|
||||||
m_numRows - 1, m_numCols - 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxMOD_NONE:
|
|
||||||
if ( !IsEditable() )
|
|
||||||
{
|
|
||||||
MoveCursorRight(false);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
wxFALLTHROUGH;
|
|
||||||
|
|
||||||
default:
|
case wxMOD_SHIFT:
|
||||||
event.Skip();
|
selStart.Set(m_currentCellCoords.GetRow(), 0);
|
||||||
|
selEnd.Set(m_selection->GetExtensionAnchor().GetRow(),
|
||||||
|
m_numCols - 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxMOD_CONTROL | wxMOD_SHIFT:
|
||||||
|
selStart.Set(0, 0);
|
||||||
|
selEnd.Set(m_numRows - 1, m_numCols - 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxMOD_NONE:
|
||||||
|
if ( !IsEditable() )
|
||||||
|
{
|
||||||
|
MoveCursorRight(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
wxFALLTHROUGH;
|
||||||
|
|
||||||
|
default:
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( selStart != wxGridNoCellCoords )
|
||||||
|
m_selection->SelectBlock(selStart, selEnd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user