mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 22:00:46 +00:00
Bugfix and optimisations
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4232 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
02aed28501
commit
977ca1a87e
2 changed files with 154 additions and 109 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun May 9 9:13:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSView.m: Further optimisations, plus bugfix to ensure that
|
||||
a view and it's children are moved to window 'nil' when the view is
|
||||
removed from it's superview.
|
||||
|
||||
Fri May 7 21:25:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
Large and complex changes made in order to speed up operation of the
|
||||
|
|
|
@ -280,17 +280,17 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
|
||||
if ([window firstResponder] == self)
|
||||
[window makeFirstResponder: window];
|
||||
[self retain];
|
||||
[super_view->sub_views removeObjectIdenticalTo: self];
|
||||
if ([super_view->sub_views count] == 0)
|
||||
super_view->_rFlags.has_subviews = 0;
|
||||
super_view = nil;
|
||||
[self viewWillMoveToWindow: nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void) removeFromSuperview
|
||||
{
|
||||
NSWindow *win;
|
||||
|
||||
/*
|
||||
* We MUST make sure that coordinates are invalidated even if we have
|
||||
* no superview - cos they may have been rebuilt since we lost the
|
||||
|
@ -307,13 +307,13 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
if ([window firstResponder] == self)
|
||||
[window makeFirstResponder: window];
|
||||
[super_view setNeedsDisplayInRect: frame];
|
||||
|
||||
[self retain];
|
||||
[super_view->sub_views removeObjectIdenticalTo: self];
|
||||
if ([super_view->sub_views count] == 0)
|
||||
super_view->_rFlags.has_subviews = 0;
|
||||
win = window;
|
||||
window = nil;
|
||||
super_view = nil;
|
||||
[self viewWillMoveToWindow: nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void) replaceSubview: (NSView*)oldView with: (NSView*)newView
|
||||
|
@ -394,11 +394,11 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
|
||||
- (void) viewWillMoveToWindow: (NSWindow*)newWindow
|
||||
{
|
||||
unsigned count;
|
||||
|
||||
window = newWindow;
|
||||
if (_rFlags.has_subviews)
|
||||
{
|
||||
unsigned count = [sub_views count];
|
||||
|
||||
count = [sub_views count];
|
||||
if (count > 0)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -409,6 +409,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
[array[i] viewWillMoveToWindow: newWindow];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) rotateByAngle: (float)angle
|
||||
{
|
||||
|
@ -882,6 +883,8 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
|
||||
// resize subviews only if we are supposed to and we have never been rotated
|
||||
- (void) resizeSubviewsWithOldSize: (NSSize)oldSize
|
||||
{
|
||||
if (_rFlags.has_subviews)
|
||||
{
|
||||
id e, o;
|
||||
|
||||
|
@ -892,10 +895,11 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
o = [e nextObject];
|
||||
while (o)
|
||||
{
|
||||
[o resizeWithOldSuperviewSize: oldSize]; // Resize the subview
|
||||
[o resizeWithOldSuperviewSize: oldSize];
|
||||
o = [e nextObject];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||
{
|
||||
|
@ -1082,10 +1086,24 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
|
||||
- (void) display
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
if (window)
|
||||
{
|
||||
NSRect rect;
|
||||
|
||||
[self displayRect: bounds];
|
||||
/*
|
||||
* Display the entire view - if there is nothing marked as needing
|
||||
* display, that's just the visible rect. If there is an area needing
|
||||
* display, do the entire area so that the view will no longer need
|
||||
* be marked as needing display.
|
||||
*/
|
||||
if (coordinates_valid == NO)
|
||||
[self _rebuildCoordinates];
|
||||
if (needs_display)
|
||||
rect = NSUnionRect(invalidRect, visibleRect);
|
||||
else
|
||||
rect = visibleRect;
|
||||
[self displayRect: rect];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) displayIfNeeded
|
||||
|
@ -1099,8 +1117,11 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
else
|
||||
{
|
||||
NSView *firstOpaque = [self opaqueAncestor];
|
||||
NSRect rect = bounds;
|
||||
NSRect rect;
|
||||
|
||||
if (coordinates_valid == NO)
|
||||
[self _rebuildCoordinates];
|
||||
rect = NSUnionRect(invalidRect, visibleRect);
|
||||
rect = [firstOpaque convertRect: rect fromView: self];
|
||||
[firstOpaque displayIfNeededInRectIgnoringOpacity: rect];
|
||||
}
|
||||
|
@ -1111,7 +1132,12 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
{
|
||||
if (needs_display)
|
||||
{
|
||||
[self displayIfNeededInRectIgnoringOpacity: bounds];
|
||||
NSRect rect;
|
||||
|
||||
if (coordinates_valid == NO)
|
||||
[self _rebuildCoordinates];
|
||||
rect = NSUnionRect(invalidRect, visibleRect);
|
||||
[self displayIfNeededInRectIgnoringOpacity: rect];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1157,6 +1183,8 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
[self unlockFocus];
|
||||
}
|
||||
|
||||
if (_rFlags.has_subviews)
|
||||
{
|
||||
count = [sub_views count];
|
||||
if (count > 0)
|
||||
{
|
||||
|
@ -1209,6 +1237,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If our invalid rectangle is entirely contained with the area we
|
||||
|
@ -1258,6 +1287,8 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
[self drawRect: aRect];
|
||||
[self unlockFocus];
|
||||
|
||||
if (_rFlags.has_subviews)
|
||||
{
|
||||
count = [sub_views count];
|
||||
|
||||
if (count > 0)
|
||||
|
@ -1279,7 +1310,8 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
intersection = NSIntersectionRect(aRect, subviewFrame);
|
||||
if (NSIsEmptyRect(intersection) == NO)
|
||||
{
|
||||
intersection = [subview convertRect: intersection fromView: self];
|
||||
intersection = [subview convertRect: intersection
|
||||
fromView: self];
|
||||
[subview displayRectIgnoringOpacity: intersection];
|
||||
}
|
||||
if (subview->needs_display)
|
||||
|
@ -1288,6 +1320,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the rect we displayed contains the invalidRect
|
||||
|
@ -1469,7 +1502,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
if ([array[i] tag] == aTag)
|
||||
return array[i];
|
||||
}
|
||||
*level++;
|
||||
*level += 1;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSView *v;
|
||||
|
@ -1478,7 +1511,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
if (v != nil)
|
||||
return v;
|
||||
}
|
||||
*level--;
|
||||
*level -= 1;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
@ -1494,7 +1527,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
{
|
||||
view = self;
|
||||
}
|
||||
else
|
||||
else if (_rFlags.has_subviews)
|
||||
{
|
||||
unsigned count = [sub_views count];
|
||||
|
||||
|
@ -1564,6 +1597,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
|
||||
p = [self convertPoint: aPoint fromView: super_view];
|
||||
|
||||
if (_rFlags.has_subviews)
|
||||
{
|
||||
count = [sub_views count]; // Check our sub_views
|
||||
if (count > 0)
|
||||
{
|
||||
|
@ -1579,6 +1614,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (v) // mouse is either in the subview or within self
|
||||
return v;
|
||||
else
|
||||
|
@ -1988,6 +2024,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
unsigned count;
|
||||
|
||||
coordinates_valid = NO;
|
||||
if (_rFlags.has_subviews)
|
||||
{
|
||||
count = [sub_views count];
|
||||
if (count > 0)
|
||||
{
|
||||
|
@ -2005,6 +2043,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The [-_matrixFromWindow] method returns a matrix that can be used to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue