Corrected table view to support drop on root with -1 as the drop row (as

explained in the Cocoa documentation).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29137 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Quentin Mathe 2009-12-17 13:51:40 +00:00
parent 06dc196682
commit 0f48d893e8
2 changed files with 16 additions and 16 deletions

View file

@ -1,3 +1,9 @@
2009-12-17 Quentin Mathe <quentin.mathe@gmail.com>
* Source/NSTableView.m (-setDropRow:dropOperation:, -draggingUpdated):
Corrected to support a drop on root with -1 as the drop row as explained
in Cocoa documentation.
2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/GSThemeDrawing.m (-drawProgressIndicator:withBounds:...):

View file

@ -5548,26 +5548,17 @@ static BOOL selectContiguousRegion(NSTableView *self,
- (void) setDropRow: (int)row
dropOperation: (NSTableViewDropOperation)operation
{
if (row < 0)
if (row < -1 || row > _numberOfRows
|| (operation == NSTableViewDropOn && row == _numberOfRows))
{
currentDropRow = 0;
}
else if (operation == NSTableViewDropOn)
{
if (row >= _numberOfRows)
currentDropRow = _numberOfRows;
}
else if (row > _numberOfRows)
{
currentDropRow = _numberOfRows;
currentDropRow = -1;
currentDropOperation = NSTableViewDropOn;
}
else
{
currentDropRow = row;
currentDropOperation = operation;
}
currentDropOperation = operation;
}
- (void) setVerticalMotionCanBeginDrag: (BOOL)flag
@ -6341,10 +6332,13 @@ static BOOL selectContiguousRegion(NSTableView *self,
}
// Are we in the two middle quarters of the row? Use TableViewDropOn
if (positionInRow > _rowHeight/4 && positionInRow <= (3*_rowHeight)/4)
if ((positionInRow > _rowHeight / 4 && positionInRow <= (3 * _rowHeight) / 4)
|| row > _numberOfRows)
{
currentDropRow = (int)(p.y - _bounds.origin.y) / (int)_rowHeight;
currentDropOperation = NSTableViewDropOn;
if (currentDropRow >= _numberOfRows)
currentDropRow = -1;
}
else // drop above
{
@ -6377,7 +6371,7 @@ static BOOL selectContiguousRegion(NSTableView *self,
[[NSColor darkGrayColor] set];
if (currentDropRow > _numberOfRows)
if (currentDropRow == -1)
{
newRect = [self bounds];
NSFrameRectWithWidth(newRect, 2.0);