diff --git a/ChangeLog b/ChangeLog index 584aa5631..59a39c72f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-26 Richard Frith-Macdonald + + * Source/NSTableView.m: ([-noteNumberOfRowsChanged]) fid to redraw + the rectangle in the superview if the receiver shrinks. + 2009-11-25 Wolfgang Lux * Source/NSCell.m (-_updateFieldEditor:): Don't write back diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 18ce5e215..be4a243b9 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -2174,6 +2174,7 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException)); if (resp != nil) { IMP actionIMP = [resp methodForSelector: aSelector]; + if (0 != actionIMP) { actionIMP(resp, aSelector, sender); diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index c2a318c36..75e972a03 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -139,7 +139,7 @@ static NSImage *unexpandable = nil; * the superclass method initWithFrame: as well to initialize the object. * */ -- (id)initWithFrame: (NSRect)frame +- (id) initWithFrame: (NSRect)frame { self = [super initWithFrame: frame]; @@ -177,8 +177,8 @@ static NSImage *unexpandable = nil; } /** - * Causes the outline column, the column containing the expand/collapse gadget, to - * resize based on the amount of space needed by widest content. + * Causes the outline column, the column containing the expand/collapse + * gadget, to resize based on the amount of space needed by widest content. */ - (BOOL)autoResizesOutlineColumn { @@ -186,8 +186,8 @@ static NSImage *unexpandable = nil; } /** - * Causes the outline column, the column containing the expand/collapse gadget, to - * resize based on the amount of space needed by widest content. + * Causes the outline column, the column containing the expand/collapse + * gadget, to resize based on the amount of space needed by widest content. */ - (BOOL)autosaveExpandedItems { @@ -198,17 +198,17 @@ static NSImage *unexpandable = nil; * Collapses the given item only. This is the equivalent of calling * [NSOutlineView-collapseItem:collapseChildren:] with NO. */ -- (void)collapseItem: (id)item +- (void) collapseItem: (id)item { [self collapseItem: item collapseChildren: NO]; } /** - * Collapses the specified item. If collapseChildren is set to YES, then all of the - * expandable children of this item all also collapsed in a recursive fashion (i.e. - * all children, grandchildren and etc). + * Collapses the specified item. If collapseChildren is set to YES, + * then all of the expandable children of this item all also collapsed + * in a recursive fashion (i.e. all children, grandchildren and etc). */ -- (void)collapseItem: (id)item collapseChildren: (BOOL)collapseChildren +- (void) collapseItem: (id)item collapseChildren: (BOOL)collapseChildren { const SEL shouldSelector = @selector(outlineView:shouldCollapseItem:); BOOL canCollapse = YES; @@ -250,7 +250,7 @@ static NSImage *unexpandable = nil; allChildren = NSMapGet(_itemDict, sitem); numchild = [allChildren count]; - for (index = 0;index < numchild;index++) + for (index = 0; index < numchild; index++) { id child = [allChildren objectAtIndex: index]; @@ -328,7 +328,7 @@ static NSImage *unexpandable = nil; allChildren = NSMapGet(_itemDict, sitem); numchild = [allChildren count]; - for (index = 0;index < numchild;index++) + for (index = 0; index < numchild; index++) { id child = [allChildren objectAtIndex: index]; @@ -930,7 +930,7 @@ static NSImage *unexpandable = nil; if (_autoResizesOutlineColumn) { float widest = 0; - for (index = 0;index < _numberOfRows; index++) + for (index = 0; index < _numberOfRows; index++) { float offset = [self levelForRow: index] * [self indentationPerLevel]; @@ -1764,7 +1764,7 @@ static NSImage *unexpandable = nil; // For the close method it doesn't matter what order they are // removed in. - for (i=0; i < numchildren; i++) + for (i = 0; i < numchildren; i++) { id child = [removeAll objectAtIndex: i]; [_items removeObject: child]; @@ -1798,7 +1798,7 @@ static NSImage *unexpandable = nil; insertionPoint++; } - for (i=numchildren-1; i >= 0; i--) + for (i = numchildren-1; i >= 0; i--) { id obj = NSMapGet(_itemDict, sitem); id child = [obj objectAtIndex: i]; diff --git a/Source/NSTableView.m b/Source/NSTableView.m index 2b1a207d2..edbc8707f 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -4414,6 +4414,7 @@ static BOOL selectContiguousRegion(NSTableView *self, - (void) setFrame: (NSRect)frameRect { NSRect tmpRect = frameRect; + if ([_super_view respondsToSelector: @selector(documentVisibleRect)]) { float rowsHeight = ((_numberOfRows * _rowHeight) + 1); @@ -4758,6 +4759,8 @@ static BOOL selectContiguousRegion(NSTableView *self, - (void) noteNumberOfRowsChanged { + NSRect newFrame; + _numberOfRows = [self _numRows]; /* If we are selecting rows, we have to check that we have no @@ -4832,10 +4835,13 @@ static BOOL selectContiguousRegion(NSTableView *self, } } - [self setFrame: NSMakeRect (_frame.origin.x, - _frame.origin.y, - _frame.size.width, - (_numberOfRows * _rowHeight) + 1)]; + newFrame = _frame; + newFrame.size.height = (_numberOfRows * _rowHeight) + 1; + if (NO == NSEqualRects(newFrame, NSUnionRect(newFrame, _frame))) + { + [_super_view setNeedsDisplayInRect: _frame]; + } + [self setFrame: newFrame]; /* If we are shorter in height than the enclosing clipview, we should redraw us now. */ @@ -4844,7 +4850,7 @@ static BOOL selectContiguousRegion(NSTableView *self, NSRect superviewBounds; // Get this *after* [self setFrame:] superviewBounds = [_super_view bounds]; if ((superviewBounds.origin.x <= _frame.origin.x) - && (NSMaxY(superviewBounds) >= NSMaxY(_frame))) + && (NSMaxY(superviewBounds) >= NSMaxY(_frame))) { [self setNeedsDisplay: YES]; }