Disallow resizing rows by dragging cell corners if disabled

Even when resizing rows by dragging their edges was disabled via
DisableDragRowSize(), it was still possible to try to resize them when
the mouse was over the cell corner.

Fix this and remove the special case for the corners entirely, it's not
necessary as the existing cases cover this one already.

Just rearrange them in the right order to prefer column resizing, as
this seems to be a much more commonly used operation than row resizing.
This commit is contained in:
Vadim Zeitlin
2020-06-25 22:51:05 +02:00
parent 7e79925fb7
commit c4fef08d39

View File

@@ -4716,24 +4716,10 @@ wxGrid::DoGridMouseMoveEvent(wxMouseEvent& WXUNUSED(event),
int dragRow = YToEdgeOfRow( pos.y );
int dragCol = XToEdgeOfCol( pos.x );
// Dragging on the corner of a cell to resize in both
// directions is not implemented yet...
//
if ( dragRow >= 0 && dragCol >= 0 )
{
ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, gridWindow, false);
return;
}
if ( dragRow >= 0 && CanDragGridRowEdges() && CanDragRowSize(dragRow) )
{
if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
{
DoStartResizeRowOrCol(dragRow);
ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, gridWindow, false);
}
}
else if ( dragCol >= 0 && CanDragGridColEdges() && CanDragColSize(dragCol) )
// Dragging on the corner of a cell to resize in both directions is not
// implemented, so choose to resize the column when the cursor is over the
// cell corner, as this is a more common operation.
if ( dragCol >= 0 && CanDragGridColEdges() && CanDragColSize(dragCol) )
{
if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
{
@@ -4741,6 +4727,14 @@ wxGrid::DoGridMouseMoveEvent(wxMouseEvent& WXUNUSED(event),
ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, gridWindow, false);
}
}
else if ( dragRow >= 0 && CanDragGridRowEdges() && CanDragRowSize(dragRow) )
{
if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
{
DoStartResizeRowOrCol(dragRow);
ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, gridWindow, false);
}
}
else // Neither on a row or col edge
{
if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL )