Fixed CoordToRowOrCol according to Patch 607387.

Reverted the "Prevented dragging dividers outside cells" change which just
        worked around the symptoms of the bug in CoordToRowOrCol.
Removed posssibility to resize columns even from below the grid or rows from
        the right of the grid - that kind of "dragging dividers" wasn't even
        prevented by the previous change (according to Patch 607387).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis 2002-09-11 21:44:16 +00:00
parent 81a0614bf2
commit d57ad37701

View File

@ -3092,7 +3092,7 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows )
if ( numRows >= curNumRows )
{
m_data.Clear(); // don't release memory just yet
m_data.Clear();
}
else
{
@ -5308,6 +5308,13 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
//
else if ( event.Moving() && !event.IsButton() )
{
if( coords.GetRow() < 0 || coords.GetCol() < 0 )
{
// out of grid cell area
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
return;
}
int dragRow = YToEdgeOfRow( y );
int dragCol = XToEdgeOfCol( x );
@ -5320,7 +5327,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
return;
}
if ( dragRow >= 0 && dragRow < GetNumberRows())
if ( dragRow >= 0 )
{
m_dragRowOrCol = dragRow;
@ -5338,7 +5345,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
return;
}
if ( dragCol >= 0 && dragCol < GetNumberCols())
if ( dragCol >= 0 )
{
m_dragRowOrCol = dragCol;
@ -7331,11 +7338,12 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
defaultDist = 1;
size_t i_max = coord / defaultDist,
i_min = 0;
if (BorderArray.IsEmpty())
{
if((int) i_max <= nMax)
if((int) i_max < nMax)
return i_max;
return maxOnOverflow ? (int)i_max : -1;
return maxOnOverflow ? nMax - 1 : -1;
}
if ( i_max >= BorderArray.GetCount())