Misc Bugfixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3866 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-03-08 09:32:09 +00:00
parent f07570306d
commit 3085e90faa
3 changed files with 63 additions and 38 deletions

View file

@ -1,3 +1,10 @@
Mon Mar 8 8:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSClipView.m: Tidied a little, including minor fixes for
cases where the doucment view is nil.
* Source/NSScrollView.m: Tidied and fixed bugs in scrolling for
document views whose origins are not 0,0.
Sun Mar 7 6:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Sun Mar 7 6:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSView.m: ([-removeFromSuperview]) Fixed error invalidating * Source/NSView.m: ([-removeFromSuperview]) Fixed error invalidating

View file

@ -47,10 +47,17 @@
- (void) setDocumentView: (NSView*)aView - (void) setDocumentView: (NSView*)aView
{ {
NSNotificationCenter *nc;
if (_documentView == aView) if (_documentView == aView)
return; return;
nc = [NSNotificationCenter defaultCenter];
if (_documentView) if (_documentView)
[_documentView removeFromSuperview]; {
[nc removeObserver: self name: nil object: _documentView];
[_documentView removeFromSuperview];
}
ASSIGN(_documentView, aView); ASSIGN(_documentView, aView);
@ -69,12 +76,14 @@
[_documentView setPostsFrameChangedNotifications: YES]; [_documentView setPostsFrameChangedNotifications: YES];
[_documentView setPostsBoundsChangedNotifications: YES]; [_documentView setPostsBoundsChangedNotifications: YES];
[[NSNotificationCenter defaultCenter] addObserver: self [nc addObserver: self
selector: @selector(viewFrameChanged:) selector: @selector(viewFrameChanged:)
name: NSViewFrameDidChangeNotification object: _documentView]; name: NSViewFrameDidChangeNotification
[[NSNotificationCenter defaultCenter] addObserver: self object: _documentView];
selector: @selector(viewBoundsChanged:) [nc addObserver: self
name: NSViewBoundsDidChangeNotification object: _documentView]; selector: @selector(viewBoundsChanged:)
name: NSViewBoundsDidChangeNotification
object: _documentView];
} }
/* TODO: invoke superview's reflectScrolledClipView: ? */ /* TODO: invoke superview's reflectScrolledClipView: ? */
@ -197,7 +206,7 @@
NSPoint new = proposedNewOrigin; NSPoint new = proposedNewOrigin;
if (_documentView == nil) if (_documentView == nil)
return NSZeroPoint; return bounds.origin;
documentFrame = [_documentView frame]; documentFrame = [_documentView frame];
if (documentFrame.size.width <= bounds.size.width) if (documentFrame.size.width <= bounds.size.width)
@ -233,7 +242,7 @@
NSRect rect; NSRect rect;
if (_documentView == nil) if (_documentView == nil)
return NSZeroRect; return bounds;
documentFrame = [_documentView frame]; documentFrame = [_documentView frame];
clipViewBounds = bounds; clipViewBounds = bounds;
@ -254,11 +263,8 @@
return NSZeroRect; return NSZeroRect;
documentBounds = [_documentView bounds]; documentBounds = [_documentView bounds];
clipViewBounds = bounds; clipViewBounds = [self convertRect: bounds toView: _documentView];
rect.origin = clipViewBounds.origin; rect = NSIntersectionRect(documentBounds, clipViewBounds);
rect.size.width = MIN(documentBounds.size.width, clipViewBounds.size.width);
rect.size.height = MIN(documentBounds.size.height,
clipViewBounds.size.height);
return rect; return rect;
} }
@ -373,13 +379,16 @@
/* Disable rotation of clip view */ /* Disable rotation of clip view */
- (void) rotateByAngle: (float)angle - (void) rotateByAngle: (float)angle
{} {
}
- (void) setBoundsRotation: (float)angle - (void) setBoundsRotation: (float)angle
{} {
}
- (void) setFrameRotation: (float)angle - (void) setFrameRotation: (float)angle
{} {
}
/* Managing responder chain */ /* Managing responder chain */
- (BOOL) becomeFirstResponder - (BOOL) becomeFirstResponder

View file

@ -7,6 +7,8 @@
Date: July 1997 Date: July 1997
Author: Felipe A. Rodriguez <far@ix.netcom.com> Author: Felipe A. Rodriguez <far@ix.netcom.com>
Date: October 1998 Date: October 1998
Author: Richard Frith-Macdoanld <richard@brainstorm.co.uk>
Date: February 1999
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
@ -181,7 +183,7 @@ static Class rulerViewClass = nil;
- (void) setContentView: (NSView*)aView - (void) setContentView: (NSView*)aView
{ {
ASSIGN(_contentView, aView); ASSIGN((id)_contentView, (id)aView);
[self addSubview: _contentView]; [self addSubview: _contentView];
[_contentView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; [_contentView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[self tile]; [self tile];
@ -319,6 +321,7 @@ static Class rulerViewClass = nil;
{ {
point.x = floatValue * (documentRect.size.width point.x = floatValue * (documentRect.size.width
- clipViewBounds.size.width); - clipViewBounds.size.width);
point.x += documentRect.origin.x;
} }
else else
{ {
@ -326,6 +329,7 @@ static Class rulerViewClass = nil;
floatValue = 1 - floatValue; floatValue = 1 - floatValue;
point.y = floatValue * (documentRect.size.height point.y = floatValue * (documentRect.size.height
- clipViewBounds.size.height); - clipViewBounds.size.height);
point.y += documentRect.origin.y;
} }
} }
@ -356,10 +360,10 @@ static Class rulerViewClass = nil;
else else
{ {
[_vertScroller setEnabled: YES]; [_vertScroller setEnabled: YES];
knobProportion = clipViewBounds.size.height / knobProportion = clipViewBounds.size.height
documentFrame.size.height; / documentFrame.size.height;
floatValue = clipViewBounds.origin.y / (documentFrame.size.height floatValue = (clipViewBounds.origin.y - documentFrame.origin.y)
- clipViewBounds.size.height); / (documentFrame.size.height - clipViewBounds.size.height);
if (![_contentView isFlipped]) if (![_contentView isFlipped])
floatValue = 1 - floatValue; floatValue = 1 - floatValue;
[_vertScroller setFloatValue: floatValue [_vertScroller setFloatValue: floatValue
@ -374,10 +378,10 @@ static Class rulerViewClass = nil;
else else
{ {
[_horizScroller setEnabled: YES]; [_horizScroller setEnabled: YES];
knobProportion = clipViewBounds.size.width / knobProportion = clipViewBounds.size.width
documentFrame.size.width; / documentFrame.size.width;
floatValue = clipViewBounds.origin.x / (documentFrame.size.width - floatValue = (clipViewBounds.origin.x - documentFrame.origin.x)
clipViewBounds.size.width); / (documentFrame.size.width - clipViewBounds.size.width);
[_horizScroller setFloatValue: floatValue [_horizScroller setFloatValue: floatValue
knobProportion: knobProportion]; knobProportion: knobProportion];
} }
@ -602,16 +606,26 @@ static Class rulerViewClass = nil;
return _borderType; return _borderType;
} }
- (BOOL) hasVerticalScroller
{
return _hasVertScroller;
}
- (BOOL) hasHorizontalRuler - (BOOL) hasHorizontalRuler
{ {
return _hasHorizRuler; return _hasHorizRuler;
} }
- (BOOL) hasHorizontalScroller
{
return _hasHorizScroller;
}
- (BOOL) hasVerticalRuler
{
return _hasVertRuler;
}
- (BOOL) hasVerticalScroller
{
return _hasVertScroller;
}
- (NSSize) contentSize - (NSSize) contentSize
{ {
return [_contentView bounds].size; return [_contentView bounds].size;
@ -627,11 +641,6 @@ static Class rulerViewClass = nil;
return _horizRuler; return _horizRuler;
} }
- (BOOL) hasVerticalRuler
{
return _hasVertRuler;
}
- (NSRulerView*) verticalRulerView - (NSRulerView*) verticalRulerView
{ {
return _vertRuler; return _vertRuler;
@ -677,9 +686,9 @@ static Class rulerViewClass = nil;
return _horizScroller; return _horizScroller;
} }
- (BOOL) hasHorizontalScroller - (NSScroller*) verticalScroller
{ {
return _hasHorizScroller; return _vertScroller;
} }
@end @end