From 84a779733b0312a24b88bc4a04d660ae33b51e39 Mon Sep 17 00:00:00 2001 From: ratmice Date: Fri, 10 Nov 2006 19:12:32 +0000 Subject: [PATCH] * Source/NSOutlineView.m: Handle rowAtPoint: returning -1. * Source/NSTableView.m (drawRect:): Only call -highlightSelectionInClipRect: and -drawGridInClipRect: once. (-drawGridInClipRect:): Constrain the vertical grid line to the last row drawn in the rect. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24071 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Source/NSOutlineView.m | 3 ++- Source/NSTableView.m | 28 ++++------------------------ 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 141bf134b..2d48e8a31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-11-10 Matt Rice + + * Source/NSOutlineView.m: Handle rowAtPoint: returning -1. + * Source/NSTableView.m (drawRect:): Only call + -highlightSelectionInClipRect: and -drawGridInClipRect: once. + (-drawGridInClipRect:): Constrain the vertical grid line to the last row + drawn in the rect. + 2006-11-10 Matt Rice * Source/NSTableView.m (rowAtPoint:): Return -1 if the point is under diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index 1ddffebe3..78bda88ba 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -832,7 +832,8 @@ static NSImage *unexpandable = nil; _clickedRow = [self rowAtPoint: location]; _clickedColumn = [self columnAtPoint: location]; - if ([_tableColumns objectAtIndex: _clickedColumn] == _outlineTableColumn) + if (_clickedRow != -1 + && [_tableColumns objectAtIndex: _clickedColumn] == _outlineTableColumn) { NSImage *image; diff --git a/Source/NSTableView.m b/Source/NSTableView.m index 6c43e5ebc..80d394a28 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -4964,6 +4964,7 @@ static BOOL selectContiguousRegion(NSTableView *self, if (_numberOfColumns > 0) { + int lastRowPosition = position - _rowHeight; /* Draw vertical lines */ if (startingColumn == -1) startingColumn = 0; @@ -4973,7 +4974,7 @@ static BOOL selectContiguousRegion(NSTableView *self, for (i = startingColumn; i <= endingColumn; i++) { DPSmoveto (ctxt, _columnOrigins[i], minY); - DPSlineto (ctxt, _columnOrigins[i], maxY); + DPSlineto (ctxt, _columnOrigins[i], lastRowPosition); DPSstroke (ctxt); } position = _columnOrigins[endingColumn]; @@ -4982,7 +4983,7 @@ static BOOL selectContiguousRegion(NSTableView *self, if (endingColumn == (_numberOfColumns - 1)) position -= 1; DPSmoveto (ctxt, position, minY); - DPSlineto (ctxt, position, maxY); + DPSlineto (ctxt, position, lastRowPosition); DPSstroke (ctxt); } @@ -5072,7 +5073,7 @@ static BOOL selectContiguousRegion(NSTableView *self, } /* Draw selection */ - // [self highlightSelectionInClipRect: aRect]; + [self highlightSelectionInClipRect: aRect]; /* Draw grid */ if (_drawsGrid) @@ -5098,31 +5099,10 @@ static BOOL selectContiguousRegion(NSTableView *self, SEL sel = @selector(drawRow:clipRect:); IMP imp = [self methodForSelector: sel]; - NSRect localBackground; - localBackground = aRect; - localBackground.size.height = _rowHeight; - localBackground.origin.y = _bounds.origin.y + (_rowHeight * startingRow); - for (i = startingRow; i <= endingRow; i++) { - [_backgroundColor set]; - NSRectFill (localBackground); - [self highlightSelectionInClipRect: localBackground]; - if (_drawsGrid) - { - [self drawGridInClipRect: localBackground]; - } - localBackground.origin.y += _rowHeight; (*imp)(self, sel, i, aRect); } - - if (NSMaxY(aRect) > NSMaxY(localBackground) - _rowHeight) - { - [_backgroundColor set]; - localBackground.size.height = - aRect.size.height - aRect.origin.y + localBackground.origin.y; - NSRectFill (localBackground); - } } }