--- a/Scroller.st Fri Aug 23 10:49:39 2002 +0200
+++ b/Scroller.st Sat Aug 31 13:34:15 2002 +0200
@@ -21,7 +21,8 @@
tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor
ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered
thumbActiveLevel originBeforeMove thumbImage enabled keyboardStep
- autoRepeat repeatBlock initialRepeatDelay repeatDelay'
+ autoRepeat repeatBlock initialRepeatDelay repeatDelay
+ lastMousePosition'
classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground
DefaultShadowColor DefaultLightColor DefaultThumbColor
DefaultThumbShadowColor DefaultThumbLightColor
@@ -33,7 +34,8 @@
DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground
DefaultThumbEnteredColor DefaultThumbActiveLevel SnapBackDistance
DefaultMiddleButtonJump NewCursors DefaultThumbImage HandleImage
- DefaultHScrollerHeight DefaultVScrollerWidth'
+ DefaultHScrollerHeight DefaultVScrollerWidth
+ DefaultStopPagerAtThumb'
poolDictionaries:''
category:'Views-Interactors'
!
@@ -349,22 +351,23 @@
"extract values from the styleSheet and cache them in class variables"
<resource: #style (#'scroller.viewBackground' #'scroller.fullViewBackground'
- #'scroller.thumbColor'
- #'scroller.shadowColor' #'scroller.lightColor'
- #'scroller.thumbShadowColor' #'scroller.thumbLightColor'
- #'scroller.thumbHalfShadowColor' #'scroller.thumbHalfLightColor'
- #'scroller.thumbFrameColor' #'scroller.ghostColor'
- #'scroller.ghostLevel' #'scroller.ghostFrameColor'
- #'scroller.NTallyMarks' #'scroller.tallyLevel'
- #'scroller.level' #'scroller.borderWidth'
- #'scroller.thumbLevel' #'scroller.thumbInset'
- #'scroller.thumbFixHeight' #'scroller.thumbEdgeStyle'
- #'scroller.thumbEnteredColor' #'scroller.thumbActiveLevel'
- #'scroller.middleButtonJump'
- #'scroller.newCursors'
- #'scroller.thumbImage' #'scroller.handleImage'
- #'scroller.vScrollerWidth' #'scroller.hScrollerHeight'
- )>
+ #'scroller.thumbColor'
+ #'scroller.shadowColor' #'scroller.lightColor'
+ #'scroller.thumbShadowColor' #'scroller.thumbLightColor'
+ #'scroller.thumbHalfShadowColor' #'scroller.thumbHalfLightColor'
+ #'scroller.thumbFrameColor' #'scroller.ghostColor'
+ #'scroller.ghostLevel' #'scroller.ghostFrameColor'
+ #'scroller.NTallyMarks' #'scroller.tallyLevel'
+ #'scroller.level' #'scroller.borderWidth'
+ #'scroller.thumbLevel' #'scroller.thumbInset'
+ #'scroller.thumbFixHeight' #'scroller.thumbEdgeStyle'
+ #'scroller.thumbEnteredColor' #'scroller.thumbActiveLevel'
+ #'scroller.middleButtonJump'
+ #'scroller.newCursors'
+ #'scroller.thumbImage' #'scroller.handleImage'
+ #'scroller.vScrollerWidth' #'scroller.hScrollerHeight'
+ #'scroller.stopPagerAtThumb'
+ )>
DefaultViewBackground := StyleSheet colorAt:#'scroller.viewBackground'.
DefaultFullViewBackground := StyleSheet colorAt:#'scroller.fullViewBackground'.
@@ -383,7 +386,7 @@
DefaultTallyMarks := StyleSheet at:#'scroller.NTallyMarks' default:0.
DefaultTallyLevel := 0.
DefaultTallyMarks ~~ 0 ifTrue:[
- DefaultTallyLevel := StyleSheet at:#'scroller.tallyLevel' default:1.
+ DefaultTallyLevel := StyleSheet at:#'scroller.tallyLevel' default:1.
].
DefaultLevel := StyleSheet at:#'scroller.level' default:0.
DefaultBorderWidth := StyleSheet at:#'scroller.borderWidth' default:(StyleSheet at:#'borderWidth').
@@ -401,12 +404,14 @@
DefaultHScrollerHeight := StyleSheet at:#'scroller.hScrollerHeight' default:nil.
StyleSheet fileReadFailed ifTrue:[
- DefaultViewBackground := Grey.
- DefaultThumbColor := White.
- DefaultThumbFrameColor := Black.
- DefaultInset := 1.
+ DefaultViewBackground := Grey.
+ DefaultThumbColor := White.
+ DefaultThumbFrameColor := Black.
+ DefaultInset := 1.
].
+ DefaultStopPagerAtThumb := StyleSheet at:#'scroller.stopPagerAtThumb' default:true.
+
SnapBackDistance := 30.
"
@@ -1015,8 +1020,32 @@
]
!
+pagedAbovePointer
+ lastMousePosition notNil ifTrue:[
+ orientation == #horizontal ifTrue:[
+ ^ lastMousePosition x > thumbFrame center x
+ ] ifFalse:[
+ ^ lastMousePosition y > thumbFrame center y
+ ].
+ ].
+ ^ false.
+!
+
+pagedBelowPointer
+ lastMousePosition notNil ifTrue:[
+ orientation == #horizontal ifTrue:[
+ ^ lastMousePosition x < thumbFrame center x
+ ] ifFalse:[
+ ^ lastMousePosition y < thumbFrame center y
+ ].
+ ].
+ ^ false.
+!
+
repeatPageDown
repeatBlock notNil ifTrue:[
+ "stop scroll"
+ (DefaultStopPagerAtThumb and:[self pagedBelowPointer]) ifTrue:[^ self].
self windowGroup repairDamage.
self pageDown.
self installRepeat.
@@ -1025,6 +1054,8 @@
repeatPageUp
repeatBlock notNil ifTrue:[
+ "stop scroll"
+ (DefaultStopPagerAtThumb and:[self pagedAbovePointer]) ifTrue:[^ self].
self windowGroup repairDamage.
self pageUp.
self installRepeat.
@@ -1272,6 +1303,8 @@
|pos curr limit prevOrigin newOrigin snap sensor|
+ lastMousePosition := x@y.
+
(sensor := self sensor) notNil ifTrue:[
(sensor hasButtonMotionEventFor:self) ifTrue:[
^ self.
@@ -1423,6 +1456,8 @@
|rect mustDrawThumb|
+ lastMousePosition := nil.
+
repeatBlock notNil ifTrue:[
repeatBlock := nil.
Processor removeTimedBlock:repeatBlock.
@@ -2539,5 +2574,5 @@
!Scroller class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.160 2002-02-11 10:00:47 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.161 2002-08-31 11:34:15 cg Exp $'
! !