Access superclass ivars directly.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4786 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-09-01 08:35:16 +00:00
parent 33c1be1a1f
commit 738bb09559
15 changed files with 87 additions and 73 deletions

View file

@ -1,3 +1,22 @@
Wed Sep 1 9:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Added patches from n.pero@mi.flashnet.it to access ivars of
superclasses directly. Generated changes for NSClipView.m myself.
* NSBox.m: (frame)
* NSClipView.m: (superview, window, bounds)
* NSMatrix.m: (bounds)
* NSMenuView.m: (frame, window, bounds)
* NSPopUpButton.m: (frame, window)
* NSProgressIndicator (window, bounds)
* NSSavePanel.m: (frame)
* NSScroller.m: (frame)
* NSScrollView.m: (bounds)
* NSSlider.m: (bounds)
* NSSplitView.m: (frame, window, bounds)
* NSTabView.m: (frame)
* NSTableView.m: (superview)
* NSView.m: (superview, autoresizeSubviews)
Wed Sep 1 9:28:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Tools/GNUmakefile.preamble: patch by doko@cs.tu-berlin.de so that

View file

@ -213,7 +213,7 @@
{
// First calc the sizes to see how much we are off by
NSRect r = [self calcSizesAllowingNegative: YES];
NSRect f = [self frame];
NSRect f = frame;
NSAssert(contentFrame.size.width >= 0 && contentFrame.size.height >= 0,
@"illegal content frame supplied");

View file

@ -89,12 +89,12 @@
_rFlags.flipped_view = [self isFlipped];
/* TODO: invoke superview's reflectScrolledClipView: ? */
[[self superview] reflectScrolledClipView: self];
[super_view reflectScrolledClipView: self];
}
- (void) resetCursorRects
{
[self addCursorRect: [self bounds] cursor: _cursor];
[self addCursorRect: bounds cursor: _cursor];
}
- (void) scrollToPoint: (NSPoint)point
@ -104,7 +104,7 @@
- (void) setBoundsOrigin: (NSPoint)point
{
NSRect originalBounds = [self bounds];
NSRect originalBounds = bounds;
NSRect newBounds = originalBounds;
NSRect intersection;
@ -116,7 +116,7 @@
if (_documentView == nil)
return;
if (_copiesOnScroll && [self window])
if (_copiesOnScroll && window)
{
// copy the portion of the view that is common before and after scrolling.
// then tell docview to draw the exposed parts.
@ -127,7 +127,7 @@
// no intersection -- docview should draw everything
[super setBoundsOrigin: newBounds.origin];
[_documentView setNeedsDisplayInRect:
[self convertRect: newBounds toView: _documentView]];
[self convertRect: newBounds toView: _documentView]];
}
else
{
@ -165,7 +165,7 @@
+ intersection.size.width;
}
[_documentView setNeedsDisplayInRect:
[self convertRect: redrawRect toView: _documentView]];
[self convertRect: redrawRect toView: _documentView]];
}
if (dy != 0)
@ -190,7 +190,7 @@
+ intersection.size.height;
}
[_documentView setNeedsDisplayInRect:
[self convertRect: redrawRect toView: _documentView]];
[self convertRect: redrawRect toView: _documentView]];
}
}
}
@ -199,7 +199,7 @@
// dont copy anything -- docview draws it all
[super setBoundsOrigin: newBounds.origin];
[_documentView setNeedsDisplayInRect:
[self convertRect: newBounds toView: _documentView]];
[self convertRect: newBounds toView: _documentView]];
}
[super_view reflectScrolledClipView: self];
}
@ -275,7 +275,7 @@
- (void) drawRect: (NSRect)rect
{
[[self backgroundColor] set];
[_backgroundColor set];
NSRectFill(rect);
}

View file

@ -683,11 +683,10 @@ static int mouseDownFlags = 0;
float approxRowsHeight = approxRow * (cellSize.height + intercell.height);
int approxCol = point.x / (cellSize.width + intercell.width);
float approxColsWidth = approxCol * (cellSize.width + intercell.width);
NSRect theBounds = [self bounds];
/* First check the limit cases */
beyondCols = (point.x > theBounds.size.width || point.x < 0);
beyondRows = (point.y > theBounds.size.height || point.y < 0);
beyondCols = (point.x > bounds.size.width || point.x < 0);
beyondRows = (point.y > bounds.size.height || point.y < 0);
/* Determine if the point is inside the cell */
betweenRows = !(point.y > approxRowsHeight

View file

@ -373,7 +373,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
- (NSRect)innerRect
{
return [self bounds];
return bounds;
// this could change if we drew menuitemcells as
// plain rects with no bezel like in macOSX. Talk to Michael Hanni if
@ -388,9 +388,9 @@ static float GSMenuBarHeight = 25.0; // a guess.
[self sizeToFit];
if (index == 0)
theRect.origin.y = [self frame].size.height - cellSize.height;
theRect.origin.y = frame.size.height - cellSize.height;
else
theRect.origin.y = [self frame].size.height - (cellSize.height * (index + 1));
theRect.origin.y = frame.size.height - (cellSize.height * (index + 1));
theRect.origin.x = 0;
theRect.size = cellSize;
@ -406,7 +406,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
NSRect aRect = [self rectOfItemAtIndex: 0];
// this will need some finnessing but should be close.
return ([self frame].size.height - point.y) / aRect.size.height;
return (frame.size.height - point.y) / aRect.size.height;
}
- (void)setNeedsDisplayForItemAtIndex: (int)index
@ -445,7 +445,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
- (void)drawRect: (NSRect)rect
{
int i;
NSRect aRect = [self frame];
NSRect aRect = frame;
int howMany = [menuv_items_link count];
// This code currently doesn't take intercell spacing into account. I'll
@ -473,7 +473,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
- (BOOL)trackWithEvent: (NSEvent *)event
{
NSPoint lastLocation = [event locationInWindow];
float height = [self frame].size.height;
float height = frame.size.height;
int index;
int lastIndex = 0;
unsigned eventMask = NSLeftMouseUpMask | NSLeftMouseDownMask
@ -494,7 +494,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
// Get our mouse location, regardless of where it may be it the event
// stream.
lastLocation = [[self window] mouseLocationOutsideOfEventStream];
lastLocation = [window mouseLocationOutsideOfEventStream];
index = (height - lastLocation.y) / cellSize.height;
@ -521,21 +521,21 @@ static float GSMenuBarHeight = 25.0; // a guess.
break;
case NSRightMouseDragged:
case NSLeftMouseDragged:
lastLocation = [[self window] mouseLocationOutsideOfEventStream];
lastLocation = [window mouseLocationOutsideOfEventStream];
lastLocation = [self convertPoint: lastLocation fromView: nil];
#if 0
NSLog (@"location = (%f, %f, %f)", lastLocation.x, [[self window]
frame].origin.x, [[self window] frame].size.width);
NSLog (@"location = %f (%f, %f)", lastLocation.y, [[self window]
frame].origin.y, [[self window] frame].size.height);
NSLog (@"location = (%f, %f, %f)", lastLocation.x, [window
frame].origin.x, [window frame].size.width);
NSLog (@"location = %f (%f, %f)", lastLocation.y, [window
frame].origin.y, [window frame].size.height);
#endif
/* If the location of the mouse is inside the window on the
x-axis. */
if (lastLocation.x > 0
&& lastLocation.x < [[self window] frame].size.width)
&& lastLocation.x < [window frame].size.width)
{
/* Get the index from some simple math. */
@ -570,7 +570,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
the current view. This should check to see if the
current item, if any, has an open submenu. */
if (lastLocation.y > [[self window] frame].size.height
if (lastLocation.y > [window frame].size.height
|| lastLocation.y < 0)
{
weWereOut = YES;
@ -583,7 +583,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
the current window we need to see if we should display a
submenu. */
else if (lastLocation.x > [[self window] frame].size.width)
else if (lastLocation.x > [window frame].size.width)
{
NSRect aRect = [self rectOfItemAtIndex: lastIndex];
if (lastLocation.y > aRect.origin.y
@ -768,7 +768,7 @@ cell do the following */
else if (weRightMenu)
{
NSPoint cP = [[self window] convertBaseToScreen: lastLocation];
NSPoint cP = [window convertBaseToScreen: lastLocation];
[self setHighlightedItemIndex: -1];
@ -779,7 +779,7 @@ cell do the following */
location: cP
modifierFlags: [event modifierFlags]
timestamp: [event timestamp]
windowNumber: [[self window] windowNumber]
windowNumber: [window windowNumber]
context: [event context]
eventNumber: [event eventNumber]
clickCount: [event clickCount]
@ -802,7 +802,7 @@ cell do the following */
else if (weLeftMenu)
{ /* The weLeftMenu case */
NSPoint cP = [[self window] convertBaseToScreen: lastLocation];
NSPoint cP = [window convertBaseToScreen: lastLocation];
selectedCell = [menuv_items_link objectAtIndex: lastIndex];
if ([selectedCell hasSubmenu])
@ -812,7 +812,7 @@ cell do the following */
location: cP
modifierFlags: [event modifierFlags]
timestamp: [event timestamp]
windowNumber: [[self window] windowNumber]
windowNumber: [window windowNumber]
context: [event context]
eventNumber: [event eventNumber]
clickCount: [event clickCount]

View file

@ -451,7 +451,7 @@
{
NSPoint cP;
cP = [[self window] convertBaseToScreen: [theEvent locationInWindow]];
cP = [window convertBaseToScreen: [theEvent locationInWindow]];
cP = [popb_win convertScreenToBase: cP];
//NSLog(@"location x = %d, y = %d\n", (int)cP.x, (int)cP.y);
@ -475,7 +475,7 @@
{
// First check ourselves
// if ([self mouse:aPoint inRect:bounds]) return self;
if ([self mouse:aPoint inRect:[self frame]]) return self;
if ([self mouse:aPoint inRect:frame]) return self;
return nil;
}

View file

@ -149,24 +149,22 @@
- (void)drawRect:(NSRect)rect
{
NSRect bnds,r;
bnds = [self bounds];
NSRect r;
// Draw the Bezel
if (isBezeled)
NSDrawGrayBezel(bnds,rect);
NSDrawGrayBezel(bounds,rect);
// Calc the inside rect to be drawn
if (isBezeled)
{
r = NSMakeRect(NSMinX(bnds) + 2.0,
NSMinY(bnds) + 2.0,
NSWidth(bnds) - 4.0,
NSHeight(bnds) - 4.0);
r = NSMakeRect(NSMinX(bounds) + 2.0,
NSMinY(bounds) + 2.0,
NSWidth(bounds) - 4.0,
NSHeight(bounds) - 4.0);
}
else
r = bnds;
r = bounds;
if (isIndeterminate) // Draw indeterminate
{
@ -263,10 +261,10 @@
- (void)_update
{
if ([self window] != nil)
if ([[self window] isVisible])
if (window != nil)
if ([window isVisible])
{
[[self window] display];
[window display];
#warning It does not seem that GNUstep has a NSDPSContext
// [[NSDPSContext currentContext] flush];
}

View file

@ -386,7 +386,7 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
- (int) runModalForDirectory:(NSString *) path file:(NSString *) filename
{
NSRect panelFrame = [self frame];
NSRect panelFrame = frame;
NSRect screenFrame = [[NSScreen mainScreen] frame];
NSDebugLLog(@"NSSavePanel", @"NSSavePanel -runModalForDirectory: filename:");

View file

@ -467,8 +467,7 @@ static Class rulerViewClass = nil;
- (void) tile
{
NSRect boundsRect = [self bounds];
NSSize contentSize = [isa contentSizeForFrameSize: boundsRect.size
NSSize contentSize = [isa contentSizeForFrameSize: bounds.size
hasHorizontalScroller: _hasHorizScroller
hasVerticalScroller: _hasVertScroller
borderType: _borderType];
@ -498,10 +497,10 @@ static Class rulerViewClass = nil;
if (_hasVertScroller)
{
vertScrollerRect.origin.x = boundsRect.origin.x + borderThickness;
vertScrollerRect.origin.y = boundsRect.origin.y + borderThickness;
vertScrollerRect.origin.x = bounds.origin.x + borderThickness;
vertScrollerRect.origin.y = bounds.origin.y + borderThickness;
vertScrollerRect.size.width = scrollerWidth;
vertScrollerRect.size.height =bounds.size.height - 2 * borderThickness;
vertScrollerRect.size.height = bounds.size.height - 2 * borderThickness;
contentRect.origin.x += scrollerWidth + 1;
}
@ -509,7 +508,7 @@ static Class rulerViewClass = nil;
if (_hasHorizScroller)
{
horizScrollerRect.origin.x = contentRect.origin.x;
horizScrollerRect.origin.y = boundsRect.origin.y + borderThickness;
horizScrollerRect.origin.y = bounds.origin.y + borderThickness;
horizScrollerRect.size.width = contentRect.size.width;
horizScrollerRect.size.height = scrollerWidth;

View file

@ -262,7 +262,7 @@ static BOOL preCalcValues = NO;
- (void) checkSpaceForParts
{
NSSize frameSize = [self frame].size;
NSSize frameSize = frame.size;
float size = (_isHorizontal ? frameSize.width : frameSize.height);
float scrollerWidth = [isa scrollerWidth];

View file

@ -259,7 +259,7 @@ static Class cellClass;
if (floatValue != oldFloatValue)
{
[theCell setFloatValue: floatValue];
[theCell drawWithFrame: [self bounds] inView: self];
[theCell drawWithFrame: bounds inView: self];
[window flushWindow];
if (isContinuous)
[target performSelector: action withObject: self];
@ -294,7 +294,7 @@ static Class cellClass;
if ([self isContinuous])
[[theCell target] performSelector: [theCell action]
withObject: self];
[theCell drawWithFrame: [self bounds] inView: self];
[theCell drawWithFrame: bounds inView: self];
[window flushWindow];
}

View file

@ -72,7 +72,7 @@
if (count < 2)
return;
[[self window] setAcceptsMouseMovedEvents: YES];
[window setAcceptsMouseMovedEvents: YES];
vis = [self visibleRect];
/* find out which divider it is */
@ -140,7 +140,7 @@
if ([self isVertical] == NO)
{
divVertical = div;
divHorizontal = NSWidth([self frame]);
divHorizontal = NSWidth(frame);
/* set the default limits on the dragging */
minCoord = NSMinY(bigRect) + divVertical;
maxCoord = NSHeight(bigRect) + NSMinY(bigRect) - divVertical;
@ -148,7 +148,7 @@
else
{
divHorizontal = div;
divVertical = NSHeight([self frame]);
divVertical = NSHeight(frame);
/* set the default limits on the dragging */
minCoord = NSMinX(bigRect) + divHorizontal;
maxCoord = NSWidth(bigRect) + NSMinX(bigRect) - divHorizontal;
@ -284,10 +284,10 @@
(int)NSMinX(r1),(int)NSMinY(r1),(int)NSWidth(r1),
(int)NSHeight(r1));
[[self window] invalidateCursorRectsForView: self];
[window invalidateCursorRectsForView: self];
RETURN_LABEL:
[[self window] setAcceptsMouseMovedEvents: NO];
[window setAcceptsMouseMovedEvents: NO];
[self setNeedsDisplay: YES];
[self display];
@ -312,7 +312,6 @@ RETURN_LABEL:
unsigned count = [subs count];
NSView *views[count];
NSRect frames[count];
NSRect bd = [self bounds];
float thickness = [self dividerThickness];
NSSize newSize;
NSPoint newPoint;
@ -326,7 +325,7 @@ RETURN_LABEL:
[subs getObjects: views];
if ([self isVertical] == NO)
{
newTotal = NSHeight(bd) - thickness*(count - 1);
newTotal = NSHeight(bounds) - thickness*(count - 1);
oldTotal = 0.0;
for (i = 0; i < count; i++)
{
@ -345,7 +344,7 @@ RETURN_LABEL:
newHeight = floor(newHeight);
else
newHeight = ceil(newHeight);
newSize = NSMakeSize(NSWidth(bd), newHeight);
newSize = NSMakeSize(NSWidth(bounds), newHeight);
running -= newHeight;
newPoint = NSMakePoint(0.0, running);
running -= thickness;
@ -355,7 +354,7 @@ RETURN_LABEL:
}
else
{
newTotal = NSWidth(bd) - thickness*(count - 1);
newTotal = NSWidth(bounds) - thickness*(count - 1);
oldTotal = 0.0;
for (i = 0; i < count; i++)
{
@ -373,7 +372,7 @@ RETURN_LABEL:
newWidth = floor(newWidth);
else
newWidth = ceil(newWidth);
newSize = NSMakeSize(newWidth, NSHeight(bd));
newSize = NSMakeSize(newWidth, NSHeight(bounds));
newPoint = NSMakePoint(running, 0.0);
running += newWidth + thickness;
[views[i] setFrameSize: newSize];
@ -541,7 +540,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
{
[super resizeWithOldSuperviewSize: oldSize];
[self adjustSubviews];
[[self window] invalidateCursorRectsForView: self];
[window invalidateCursorRectsForView: self];
}
- (id) delegate

View file

@ -235,7 +235,7 @@
- (NSRect)contentRect
{
NSRect cRect = [self frame];
NSRect cRect = frame;
cRect.origin.x = 0;
cRect.origin.y = 0;

View file

@ -613,12 +613,12 @@ object with the NSTableView as the text delegate. */
- (void)scrollRowToVisible:(int)rowIndex
{
[(NSClipView *)[self superview] scrollToPoint:NSZeroPoint];
[(NSClipView *)super_view scrollToPoint:NSZeroPoint];
}
- (void)scrollColumnToVisible:(int)columnIndex
{
[(NSClipView *)[self superview] scrollToPoint:NSZeroPoint];
[(NSClipView *)super_view scrollToPoint:NSZeroPoint];
}
- (BOOL)textShouldBeginEditing:(NSText *)textObject

View file

@ -313,14 +313,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
* If neither are descendants of each other and either does not have a
* superview then they cannot have a common ancestor
*/
if (![self superview])
if (!super_view)
return nil;
if (![aView superview])
return nil;
/* Find the common ancestor of superviews */
return [[self superview] ancestorSharedWithView: [aView superview]];
return [super_view ancestorSharedWithView: [aView superview]];
}
- (BOOL) isDescendantOf: (NSView*)aView
@ -999,7 +999,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
id e, o;
if ([self autoresizesSubviews] == NO || is_rotated_from_base == YES)
if (autoresize_subviews == NO || is_rotated_from_base == YES)
return;
e = [sub_views objectEnumerator];