Ensure the NSTableView rowAtPoint: method always returns a valid row number.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20584 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2005-01-20 09:44:52 +00:00
parent d297a62697
commit 90952ec827
2 changed files with 11 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2005-01-20 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-rowAtPoint:): If the heigh of the table
is incorrect and because of this the row would be greater than the
number of rows, return a usable number.
2005-01-18 17:06 Alexander Malmberg <alexander@malmberg.org>
* Source/NSWindow.m

View file

@ -3910,10 +3910,10 @@ static inline float computePeriod(NSPoint mouseLocationWin,
aPoint.y -= _bounds.origin.y;
return_value = (int) (aPoint.y / _rowHeight);
/* This could happen if point lies on the grid line below the last row */
if (return_value == _numberOfRows)
/* This could happen if point lies on the grid line or below the last row */
if (return_value >= _numberOfRows)
{
return_value--;
return_value = _numberOfRows - 1;
}
return return_value;
}
@ -4299,7 +4299,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
- (void) noteNumberOfRowsChanged
{
_numberOfRows = [_dataSource numberOfRowsInTableView: self];
/* If we are selecting rows, we have to check that we have no
selected rows below the new end of the table */
if (!_selectingColumns)
@ -4352,7 +4352,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
_frame.origin.y,
_frame.size.width,
(_numberOfRows * _rowHeight) + 1)];
/* If we are shorter in height than the enclosing clipview, we
should redraw us now. */
if (_super_view != nil)