mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 00:21:36 +00:00
Enable horizontal scrolling with shift key.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16584 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
496c641984
commit
f4ad5aa21d
2 changed files with 40 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2003-04-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSScrollView.m: ([scrollWheel:]) enable horizontal scrolling
|
||||||
|
with shift key.
|
||||||
|
|
||||||
2003-04-28 18:35 Alexander Malmberg <alexander@malmberg.org>
|
2003-04-28 18:35 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Headers/gnustep/gui/NSTextContainer.h: Documented.
|
* Headers/gnustep/gui/NSTextContainer.h: Documented.
|
||||||
|
|
|
@ -290,7 +290,7 @@ static float scrollerWidth;
|
||||||
- (void) scrollWheel: (NSEvent *)theEvent
|
- (void) scrollWheel: (NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
NSRect clipViewBounds;
|
NSRect clipViewBounds;
|
||||||
float deltaY = [theEvent deltaY];
|
float delta = [theEvent deltaY];
|
||||||
float amount;
|
float amount;
|
||||||
NSPoint point;
|
NSPoint point;
|
||||||
|
|
||||||
|
@ -303,25 +303,46 @@ static float scrollerWidth;
|
||||||
clipViewBounds = [_contentView bounds];
|
clipViewBounds = [_contentView bounds];
|
||||||
}
|
}
|
||||||
point = clipViewBounds.origin;
|
point = clipViewBounds.origin;
|
||||||
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
|
||||||
|
|
||||||
|
if (_hasHorizScroller == YES
|
||||||
|
&& ([theEvent modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask)
|
||||||
{
|
{
|
||||||
amount = - (clipViewBounds.size.height - _vPageScroll) * deltaY;
|
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
||||||
|
{
|
||||||
|
amount = - (clipViewBounds.size.width - _hPageScroll) * delta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
amount = - _hLineScroll * delta;
|
||||||
|
}
|
||||||
|
NSDebugLLog (@"NSScrollView",
|
||||||
|
@"increment/decrement: amount = %f, horizontal", amount);
|
||||||
|
|
||||||
|
point.x = clipViewBounds.origin.x + amount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
amount = - _vLineScroll * deltaY;
|
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
||||||
}
|
{
|
||||||
|
amount = - (clipViewBounds.size.height - _vPageScroll) * delta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
amount = - _vLineScroll * delta;
|
||||||
|
}
|
||||||
|
|
||||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||||
{
|
{
|
||||||
/* If view is flipped reverse the scroll direction */
|
/* If view is flipped reverse the scroll direction */
|
||||||
amount = -amount;
|
amount = -amount;
|
||||||
}
|
}
|
||||||
NSDebugLLog (@"NSScrollView",
|
NSDebugLLog (@"NSScrollView",
|
||||||
@"increment/decrement: amount = %f, flipped = %d",
|
@"increment/decrement: amount = %f, flipped = %d",
|
||||||
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
||||||
|
|
||||||
point.y = clipViewBounds.origin.y + amount;
|
point.y = clipViewBounds.origin.y + amount;
|
||||||
|
}
|
||||||
|
|
||||||
/* scrollToPoint: will call reflectScrolledClipView:, which will
|
/* scrollToPoint: will call reflectScrolledClipView:, which will
|
||||||
* update rules, headers, and scrollers. */
|
* update rules, headers, and scrollers. */
|
||||||
|
|
Loading…
Reference in a new issue