Correction for #bug9608 and bug#18073.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23931 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-10-21 15:34:16 +00:00
parent efcfc85f6b
commit f4cd637e0d
2 changed files with 69 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2006-10-21 11:30-EDT Matt Rice <ratmice@yahoo.com>
* Source/NSTableView.m: If the tableview is smaller than
it's clipview, then resize it so that it fits.
Corrects bug#9608 and bug#18073.
Patch committed by: Gregory Casamento <greg_casamento@yahoo.com>
2006-10-19 21:17-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSMenuItemCell.m: Correct menu highlighting issue

View file

@ -3350,7 +3350,6 @@ static inline float computePeriod(NSPoint mouseLocationWin,
// Pathological case -- ignore mouse down
if ((_numberOfRows == 0) || (_numberOfColumns == 0))
{
[super mouseDown: theEvent];
return;
}
@ -3384,7 +3383,8 @@ static inline float computePeriod(NSPoint mouseLocationWin,
if (![self _isCellEditableColumn: _clickedColumn row: _clickedRow ])
{
// Send double-action but don't edit
[self sendAction: _doubleAction to: _target];
if (_clickedRow != -1)
[self sendAction: _doubleAction to: _target];
}
else
{
@ -3475,6 +3475,8 @@ static inline float computePeriod(NSPoint mouseLocationWin,
id originalValue;
// Prepare the cell
if (_clickedRow != -1)
{
tb = [_tableColumns objectAtIndex: _clickedColumn];
/* we should copy the cell here, as we do on editing.
otherwise validation on a cell being edited could
@ -3520,6 +3522,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
RELEASE(cell);
[self setNeedsDisplayInRect: cellFrame];
lastEvent = [NSApp currentEvent];
}
}
while (done != YES)
@ -3731,6 +3734,15 @@ static inline float computePeriod(NSPoint mouseLocationWin,
if (shouldComputeNewSelection == YES)
{
if (originalRow == -1)
{
originalRow = currentRow;
}
if (currentRow == -1)
{
currentRow = _numberOfRows - 1;
}
computeNewSelection(self,
oldSelectedRows,
_selectedRows,
@ -3769,7 +3781,8 @@ static inline float computePeriod(NSPoint mouseLocationWin,
TODO: should we ask the data source/column for the cell for this
row/column and check whether it has its own action/target?
*/
[self sendAction: _action to: _target];
if (_clickedRow != -1)
[self sendAction: _action to: _target];
}
return;
}
@ -4002,7 +4015,42 @@ static inline float computePeriod(NSPoint mouseLocationWin,
- (void) setFrame: (NSRect)frameRect
{
[super setFrame: frameRect];
NSRect tmpRect = frameRect;
if ([_super_view respondsToSelector:@selector(documentRect)])
{
NSRect docRect = [(NSClipView *)_super_view documentRect];
if (docRect.size.height > tmpRect.size.height)
{
tmpRect.size.height = docRect.size.height;
}
// TODO width?
}
[super setFrame: tmpRect];
}
- (void) setFrameSize: (NSSize)frameSize
{
NSSize tmpSize = frameSize;
if ([_super_view respondsToSelector:@selector(documentRect)])
{
NSRect docRect = [(NSClipView *)_super_view documentRect];
if (docRect.size.height > tmpSize.height)
{
tmpSize.height = docRect.size.height;
}
// TODO width?
}
[super setFrameSize: tmpSize];
}
- (void) viewWillMoveToSuperview:(NSView *)newSuper
{
[super viewWillMoveToSuperview:newSuper];
/* need to potentially enlarge to fill the documentRect of the clip view */
[self setFrame:_frame];
}
- (void) sizeToFit
@ -5697,6 +5745,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
}
_superview_width = visible_width;
}
[self setFrame:_frame];
}
@ -5802,8 +5851,15 @@ static inline float computePeriod(NSPoint mouseLocationWin,
[self displayIfNeeded];
[[NSColor darkGrayColor] set];
if (currentDropOperation == NSTableViewDropAbove)
if (currentDropRow > _numberOfRows)
{
newRect = [self bounds];
NSFrameRectWithWidth(newRect, 2.0);
oldDraggingRect = newRect;
currentDropRow = _numberOfRows;
}
else if (currentDropOperation == NSTableViewDropAbove)
{
if (currentDropRow == 0)
{