Merge branch 'grid-resize-fixes'
Fix spurious asserts about invalid drag row/column index in wxGrid. See https://github.com/wxWidgets/wxWidgets/pull/2413
This commit is contained in:
@@ -2951,6 +2951,8 @@ private:
|
|||||||
wxGridWindow* gridWindow);
|
wxGridWindow* gridWindow);
|
||||||
|
|
||||||
// Update the width/height of the column/row being drag-resized.
|
// Update the width/height of the column/row being drag-resized.
|
||||||
|
// Should be only called when m_dragRowOrCol != -1, i.e. dragging is
|
||||||
|
// actually in progress.
|
||||||
void DoGridDragResize(const wxPoint& position,
|
void DoGridDragResize(const wxPoint& position,
|
||||||
const wxGridOperations& oper,
|
const wxGridOperations& oper,
|
||||||
wxGridWindow* gridWindow);
|
wxGridWindow* gridWindow);
|
||||||
@@ -2989,6 +2991,8 @@ private:
|
|||||||
void DoStartResizeRowOrCol(int col);
|
void DoStartResizeRowOrCol(int col);
|
||||||
void DoStartMoveCol(int col);
|
void DoStartMoveCol(int col);
|
||||||
|
|
||||||
|
// These functions should only be called when actually resizing/moving,
|
||||||
|
// i.e. m_dragRowOrCol and m_dragMoveCol, respectively, are valid.
|
||||||
void DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow *gridWindow);
|
void DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow *gridWindow);
|
||||||
void DoEndDragResizeCol(const wxMouseEvent& event, wxGridWindow *gridWindow);
|
void DoEndDragResizeCol(const wxMouseEvent& event, wxGridWindow *gridWindow);
|
||||||
void DoEndMoveCol(int pos);
|
void DoEndMoveCol(int pos);
|
||||||
|
@@ -3828,13 +3828,10 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo
|
|||||||
switch ( m_cursorMode )
|
switch ( m_cursorMode )
|
||||||
{
|
{
|
||||||
case WXGRID_CURSOR_RESIZE_ROW:
|
case WXGRID_CURSOR_RESIZE_ROW:
|
||||||
{
|
|
||||||
DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case WXGRID_CURSOR_SELECT_ROW:
|
case WXGRID_CURSOR_SELECT_ROW:
|
||||||
{
|
|
||||||
if ( !m_selection || m_numRows == 0 || m_numCols == 0 )
|
if ( !m_selection || m_numRows == 0 || m_numCols == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -3851,8 +3848,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo
|
|||||||
event,
|
event,
|
||||||
wxEVT_GRID_RANGE_SELECTING);
|
wxEVT_GRID_RANGE_SELECTING);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
// default label to suppress warnings about "enumeration value
|
// default label to suppress warnings about "enumeration value
|
||||||
// 'xxx' not handled in switch
|
// 'xxx' not handled in switch
|
||||||
@@ -4172,10 +4168,9 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo
|
|||||||
{
|
{
|
||||||
case WXGRID_CURSOR_RESIZE_COL:
|
case WXGRID_CURSOR_RESIZE_COL:
|
||||||
DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXGRID_CURSOR_SELECT_COL:
|
case WXGRID_CURSOR_SELECT_COL:
|
||||||
{
|
|
||||||
if ( col != -1 )
|
if ( col != -1 )
|
||||||
{
|
{
|
||||||
if ( !m_selection || m_numRows == 0 || m_numCols == 0 )
|
if ( !m_selection || m_numRows == 0 || m_numCols == 0 )
|
||||||
@@ -4193,8 +4188,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo
|
|||||||
event,
|
event,
|
||||||
wxEVT_GRID_RANGE_SELECTING);
|
wxEVT_GRID_RANGE_SELECTING);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case WXGRID_CURSOR_MOVE_COL:
|
case WXGRID_CURSOR_MOVE_COL:
|
||||||
{
|
{
|
||||||
@@ -4713,11 +4707,13 @@ bool wxGrid::DoGridDragEvent(wxMouseEvent& event,
|
|||||||
return DoGridCellDrag(event, coords, isFirstDrag);
|
return DoGridCellDrag(event, coords, isFirstDrag);
|
||||||
|
|
||||||
case WXGRID_CURSOR_RESIZE_ROW:
|
case WXGRID_CURSOR_RESIZE_ROW:
|
||||||
DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
if ( m_dragRowOrCol != -1 )
|
||||||
|
DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXGRID_CURSOR_RESIZE_COL:
|
case WXGRID_CURSOR_RESIZE_COL:
|
||||||
DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
if ( m_dragRowOrCol != -1 )
|
||||||
|
DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -4870,12 +4866,14 @@ wxGrid::DoGridCellLeftUp(wxMouseEvent& event,
|
|||||||
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
|
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
|
||||||
{
|
{
|
||||||
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
|
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
|
||||||
DoEndDragResizeRow(event, gridWindow);
|
if ( m_dragRowOrCol != -1 )
|
||||||
|
DoEndDragResizeRow(event, gridWindow);
|
||||||
}
|
}
|
||||||
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_COL )
|
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_COL )
|
||||||
{
|
{
|
||||||
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
|
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
|
||||||
DoEndDragResizeCol(event, gridWindow);
|
if ( m_dragRowOrCol != -1 )
|
||||||
|
DoEndDragResizeCol(event, gridWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dragLastPos = -1;
|
m_dragLastPos = -1;
|
||||||
@@ -5053,6 +5051,9 @@ void wxGrid::DoGridDragResize(const wxPoint& position,
|
|||||||
const wxGridOperations& oper,
|
const wxGridOperations& oper,
|
||||||
wxGridWindow* gridWindow)
|
wxGridWindow* gridWindow)
|
||||||
{
|
{
|
||||||
|
wxCHECK_RET( m_dragRowOrCol != -1,
|
||||||
|
"shouldn't be called when not drag resizing" );
|
||||||
|
|
||||||
// Get the logical position from the physical one we're passed.
|
// Get the logical position from the physical one we're passed.
|
||||||
const wxPoint
|
const wxPoint
|
||||||
logicalPos = CalcGridWindowUnscrolledPosition(position, gridWindow);
|
logicalPos = CalcGridWindowUnscrolledPosition(position, gridWindow);
|
||||||
|
Reference in New Issue
Block a user