* Source/NSTableView.m (rowAtPoint:): Return -1 if the point is under

the last row.
        (mouseDown:): Handle rowAtPoint: returning -1.
        (rectOfRows:): Ditto.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24070 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2006-11-10 17:05:20 +00:00
parent edf055a980
commit 86c8735342
2 changed files with 33 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2006-11-10 Matt Rice <ratmice@gmail.com>
* Source/NSTableView.m (rowAtPoint:): Return -1 if the point is under
the last row.
(mouseDown:): Handle rowAtPoint: returning -1.
(rectOfRows:): Ditto.
2006-11-10 Matt Rice <ratmice@gmail.com> 2006-11-10 Matt Rice <ratmice@gmail.com>
* Source/NSTableView.m (mouseDown:): Rename some local variables * Source/NSTableView.m (mouseDown:): Rename some local variables

View file

@ -3219,9 +3219,6 @@ byExtendingSelection: (BOOL)flag
flag = YES; flag = YES;
} }
[self scrollRowToVisible: rowIndex];
[self scrollColumnToVisible: columnIndex];
if (rowIndex != _selectedRow) if (rowIndex != _selectedRow)
{ {
[NSException raise:NSInvalidArgumentException [NSException raise:NSInvalidArgumentException
@ -3235,6 +3232,9 @@ byExtendingSelection: (BOOL)flag
format: @"Row/column out of index in edit"]; format: @"Row/column out of index in edit"];
} }
[self scrollRowToVisible: rowIndex];
[self scrollColumnToVisible: columnIndex];
if (_textObject != nil) if (_textObject != nil)
{ {
[self validateEditing]; [self validateEditing];
@ -3747,7 +3747,10 @@ static inline float computePeriod(NSPoint mouseLocationWin,
case NSPeriodic: case NSPeriodic:
if (mouseBelowView == YES) if (mouseBelowView == YES)
{ {
if (currentRow < _numberOfRows - 1) if (currentRow == -1 && oldRow != -1)
currentRow = oldRow + 1;
if (currentRow != -1 && currentRow < _numberOfRows - 1)
{ {
oldRow = currentRow; oldRow = currentRow;
currentRow++; currentRow++;
@ -3758,6 +3761,9 @@ static inline float computePeriod(NSPoint mouseLocationWin,
} }
else else
{ {
if (currentRow == -1 && oldRow != -1)
currentRow = oldRow - 1;
if (currentRow > 0) if (currentRow > 0)
{ {
oldRow = currentRow; oldRow = currentRow;
@ -3779,10 +3785,8 @@ static inline float computePeriod(NSPoint mouseLocationWin,
originalRow = currentRow; originalRow = currentRow;
} }
if (currentRow == -1) if (currentRow >= 0 && currentRow < _numberOfRows)
{ {
currentRow = _numberOfRows - 1;
}
computeNewSelection(self, computeNewSelection(self,
oldSelectedRows, oldSelectedRows,
_selectedRows, _selectedRows,
@ -3791,8 +3795,10 @@ static inline float computePeriod(NSPoint mouseLocationWin,
currentRow, currentRow,
&_selectedRow, &_selectedRow,
selectionMode); selectionMode);
[self displayIfNeeded]; [self displayIfNeeded];
} }
}
if (done == NO) if (done == NO)
{ {
@ -4243,10 +4249,18 @@ static BOOL selectContiguousRegion(NSTableView *self,
- (NSRange) rowsInRect: (NSRect)aRect - (NSRange) rowsInRect: (NSRect)aRect
{ {
NSRange range; NSRange range;
int lastRowInRect;
range.location = [self rowAtPoint: aRect.origin]; range.location = [self rowAtPoint: aRect.origin];
range.length = [self rowAtPoint: lastRowInRect = [self rowAtPoint:
NSMakePoint (_bounds.origin.x, NSMaxY (aRect))]; NSMakePoint (_bounds.origin.x, NSMaxY (aRect))];
if (lastRowInRect == -1)
{
lastRowInRect = _numberOfRows - 1;
}
range.length = lastRowInRect;
range.length -= range.location; range.length -= range.location;
range.length += 1; range.length += 1;
return range; return range;
@ -4286,7 +4300,7 @@ static BOOL selectContiguousRegion(NSTableView *self,
/* This could happen if point lies on the grid line or below the last row */ /* This could happen if point lies on the grid line or below the last row */
if (return_value >= _numberOfRows) if (return_value >= _numberOfRows)
{ {
return_value = _numberOfRows - 1; return_value = -1;
} }
return return_value; return return_value;
} }