Commit scroll adjustment patch by Benhur Stein.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26678 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2008-06-17 20:20:15 +00:00
parent 266998d2ee
commit a280fa3721
3 changed files with 45 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2008-06-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSClipView.m (_scrollToPoint:): New method for adjusted
scrolling.
* Source/NSScrollView.m: Use this new method.
Patch by Benhur Stein <benhur.stein@gmail.com>.
2008-06-14 Adam Fedor <fedor@gnu.org>
* Version 0.14.0

View file

@ -42,6 +42,10 @@
DEFINE_RINT_IF_MISSING
@interface NSClipView (Private)
- (void) _scrollToPoint: (NSPoint)aPoint;
@end
/*
* Return the biggest integral (in device space) rect contained in rect.
* Conversion to/from device space is done using view.
@ -538,7 +542,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
*/
- (void) viewFrameChanged: (NSNotification*)aNotification
{
[self scrollToPoint: _bounds.origin];
[self _scrollToPoint: _bounds.origin];
/* If document frame does not completely cover _bounds */
if (NSContainsRect([_documentView frame], _bounds) == NO)
@ -817,3 +821,26 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
return self;
}
@end
@implementation NSClipView (Private)
- (void) _scrollToPoint: (NSPoint)aPoint
{
NSRect proposedBounds;
NSRect proposedVisibleRect;
NSRect newVisibleRect;
NSRect newBounds;
// give documentView a chance to adjust its visible rectangle
proposedBounds = _bounds;
proposedBounds.origin = aPoint;
proposedVisibleRect = [self convertRect: proposedBounds
toView: _documentView];
newVisibleRect = [_documentView adjustScroll: proposedVisibleRect];
newBounds = [self convertRect: newVisibleRect fromView: _documentView];
[self scrollToPoint: newBounds.origin];
}
@end

View file

@ -49,6 +49,10 @@
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSTheme.h"
@interface NSClipView (Private)
- (void) _scrollToPoint: (NSPoint)aPoint;
@end
//
// For nib compatibility, this is used to properly
// initialize the object from a OS X nib file in initWithCoder:.
@ -406,7 +410,7 @@ static float scrollerWidth;
/* scrollToPoint: will call reflectScrolledClipView:, which will
* update rules, headers, and scrollers. */
[_contentView scrollToPoint: point];
[_contentView _scrollToPoint: point];
}
- (void) keyDown: (NSEvent *)theEvent
@ -462,7 +466,7 @@ static float scrollerWidth;
amount = -amount;
}
point.y = clipViewBounds.origin.y - amount;
[_contentView scrollToPoint: point];
[_contentView _scrollToPoint: point];
}
@ -490,7 +494,7 @@ static float scrollerWidth;
amount = -amount;
}
point.y = clipViewBounds.origin.y + amount;
[_contentView scrollToPoint: point];
[_contentView _scrollToPoint: point];
}
/**
@ -534,7 +538,7 @@ static float scrollerWidth;
amount = -amount;
}
point.y = clipViewBounds.origin.y - amount;
[_contentView scrollToPoint: point];
[_contentView _scrollToPoint: point];
}
/**
@ -577,7 +581,7 @@ static float scrollerWidth;
amount = -amount;
}
point.y = clipViewBounds.origin.y + amount;
[_contentView scrollToPoint: point];
[_contentView _scrollToPoint: point];
}
- (void) _doScroll: (NSScroller*)scroller
@ -686,7 +690,7 @@ static float scrollerWidth;
/* scrollToPoint will call reflectScrollerClipView, and that will
* update scrollers, rulers and headers */
[_contentView scrollToPoint: point];
[_contentView _scrollToPoint: point];
}
//