mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:10:47 +00:00
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:
parent
4b24e5cd48
commit
ec6135aade
3 changed files with 45 additions and 7 deletions
|
@ -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>
|
2008-06-14 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Version 0.14.0
|
* Version 0.14.0
|
||||||
|
|
|
@ -42,6 +42,10 @@
|
||||||
|
|
||||||
DEFINE_RINT_IF_MISSING
|
DEFINE_RINT_IF_MISSING
|
||||||
|
|
||||||
|
@interface NSClipView (Private)
|
||||||
|
- (void) _scrollToPoint: (NSPoint)aPoint;
|
||||||
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the biggest integral (in device space) rect contained in rect.
|
* Return the biggest integral (in device space) rect contained in rect.
|
||||||
* Conversion to/from device space is done using view.
|
* 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
|
- (void) viewFrameChanged: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
[self scrollToPoint: _bounds.origin];
|
[self _scrollToPoint: _bounds.origin];
|
||||||
|
|
||||||
/* If document frame does not completely cover _bounds */
|
/* If document frame does not completely cover _bounds */
|
||||||
if (NSContainsRect([_documentView frame], _bounds) == NO)
|
if (NSContainsRect([_documentView frame], _bounds) == NO)
|
||||||
|
@ -817,3 +821,26 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@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
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,10 @@
|
||||||
#include "AppKit/PSOperators.h"
|
#include "AppKit/PSOperators.h"
|
||||||
#include "GNUstepGUI/GSTheme.h"
|
#include "GNUstepGUI/GSTheme.h"
|
||||||
|
|
||||||
|
@interface NSClipView (Private)
|
||||||
|
- (void) _scrollToPoint: (NSPoint)aPoint;
|
||||||
|
@end
|
||||||
|
|
||||||
//
|
//
|
||||||
// For nib compatibility, this is used to properly
|
// For nib compatibility, this is used to properly
|
||||||
// initialize the object from a OS X nib file in initWithCoder:.
|
// initialize the object from a OS X nib file in initWithCoder:.
|
||||||
|
@ -406,7 +410,7 @@ static float scrollerWidth;
|
||||||
|
|
||||||
/* scrollToPoint: will call reflectScrolledClipView:, which will
|
/* scrollToPoint: will call reflectScrolledClipView:, which will
|
||||||
* update rules, headers, and scrollers. */
|
* update rules, headers, and scrollers. */
|
||||||
[_contentView scrollToPoint: point];
|
[_contentView _scrollToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) keyDown: (NSEvent *)theEvent
|
- (void) keyDown: (NSEvent *)theEvent
|
||||||
|
@ -462,7 +466,7 @@ static float scrollerWidth;
|
||||||
amount = -amount;
|
amount = -amount;
|
||||||
}
|
}
|
||||||
point.y = clipViewBounds.origin.y - amount;
|
point.y = clipViewBounds.origin.y - amount;
|
||||||
[_contentView scrollToPoint: point];
|
[_contentView _scrollToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -490,7 +494,7 @@ static float scrollerWidth;
|
||||||
amount = -amount;
|
amount = -amount;
|
||||||
}
|
}
|
||||||
point.y = clipViewBounds.origin.y + amount;
|
point.y = clipViewBounds.origin.y + amount;
|
||||||
[_contentView scrollToPoint: point];
|
[_contentView _scrollToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -534,7 +538,7 @@ static float scrollerWidth;
|
||||||
amount = -amount;
|
amount = -amount;
|
||||||
}
|
}
|
||||||
point.y = clipViewBounds.origin.y - amount;
|
point.y = clipViewBounds.origin.y - amount;
|
||||||
[_contentView scrollToPoint: point];
|
[_contentView _scrollToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -577,7 +581,7 @@ static float scrollerWidth;
|
||||||
amount = -amount;
|
amount = -amount;
|
||||||
}
|
}
|
||||||
point.y = clipViewBounds.origin.y + amount;
|
point.y = clipViewBounds.origin.y + amount;
|
||||||
[_contentView scrollToPoint: point];
|
[_contentView _scrollToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _doScroll: (NSScroller*)scroller
|
- (void) _doScroll: (NSScroller*)scroller
|
||||||
|
@ -686,7 +690,7 @@ static float scrollerWidth;
|
||||||
|
|
||||||
/* scrollToPoint will call reflectScrollerClipView, and that will
|
/* scrollToPoint will call reflectScrollerClipView, and that will
|
||||||
* update scrollers, rulers and headers */
|
* update scrollers, rulers and headers */
|
||||||
[_contentView scrollToPoint: point];
|
[_contentView _scrollToPoint: point];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue