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 Frith-MacDonald 1999-03-08 09:32:09 +00:00
parent 83e3e52e34
commit 37609220a9
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>
* Source/NSView.m: ([-removeFromSuperview]) Fixed error invalidating

View file

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

View file

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