Really fix resizing of wxGird column/rows after a hidden one.

The previous fix (r73399) broke resizing from the side of the preceding grid
line, restore the old code and just add a loop finding the first visible line
before the one being clicked.

See #14947.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73460 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-02-05 20:46:06 +00:00
parent 7c99eaa1f8
commit 6df84c5ca3

View File

@ -6675,17 +6675,28 @@ int wxGrid::PosToEdgeOfLine(int pos, const wxGridOperations& oper) const
// Get the bottom or rightmost line that could match.
int line = oper.PosToLine(this, pos, true);
// Go backwards until we find a line that is big enough.
while ( oper.GetLineSize(this, line) <= WXGRID_LABEL_EDGE_ZONE )
if ( oper.GetLineSize(this, line) > WXGRID_LABEL_EDGE_ZONE )
{
line = oper.GetLineBefore(this, line);
if ( line <= 0 )
break;
}
// If the bottom or right touches then we have a match
// We know that we are in this line, test whether we are close enough
// to start or end border, respectively.
if ( abs(oper.GetLineEndPos(this, line) - pos) < WXGRID_LABEL_EDGE_ZONE )
return line;
else if ( line > 0 &&
pos - oper.GetLineStartPos(this,
line) < WXGRID_LABEL_EDGE_ZONE )
{
// We need to find the previous visible line, so skip all the
// hidden (of size 0) ones.
do
{
line = oper.GetLineBefore(this, line);
}
while ( line >= 0 && oper.GetLineSize(this, line) == 0 );
// It can possibly be -1 here.
return line;
}
}
return -1;
}