#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Wed, 13 Jun 2018 23:01:17 +0200
changeset 6342 fda4ec431379
parent 6341 0dc29699b648
child 6343 38dfd16a2888
#REFACTORING by cg class: ListView scroll actions refactored/cleaned up to not mix line scrolling (textViews) with pixel scrolling (wheel + drag and drop) added: #mouseWheelScrollDown: #mouseWheelScrollUp: #scrollDown #scrollDownLines: #scrollUp #scrollUpLines: removed: #scrollDownPixels: #scrollUpPixels: comment/format in: #scrollUp: changed: #halfPageDown (send #scrollDownLines: instead of #scrollDown:) #halfPageUp (send #scrollUpLines: instead of #scrollUp:) #keyPress:x:y: (send #scrollUpLines: instead of #scrollUp:, send #scrollDownLines: instead of #scrollDown:) #scrollDown: #scrollToLine: (send #scrollUpLines: instead of #scrollUp:, send #scrollDownLines: instead of #scrollDown:)
ListView.st
--- a/ListView.st	Wed Jun 13 23:00:39 2018 +0200
+++ b/ListView.st	Wed Jun 13 23:01:17 2018 +0200
@@ -2405,14 +2405,16 @@
 
     (key == #ScrollUp) ifTrue:[
         n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollUp).
-        ^ self scrollUp:n
+        ^ self scrollUpLines:n
     ].
     (key == #ScrollDown) ifTrue:[
         n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown).
-        ^ self scrollDown:n
+        ^ self scrollDownLines:n
     ].
 
     super keyPress:key x:x y:y
+
+    "Modified: / 13-06-2018 / 22:09:00 / Claus Gittinger"
 !
 
 keyboardZoom:largerBoolean
@@ -4055,13 +4057,17 @@
 halfPageDown
     "scroll down half a page"
 
-    self scrollDown:(nFullLinesShown // 2)
+    self scrollDownLines:(nFullLinesShown // 2)
+
+    "Modified: / 13-06-2018 / 22:01:55 / Claus Gittinger"
 !
 
 halfPageUp
     "scroll up half a page"
 
-    self scrollUp:(nFullLinesShown // 2)
+    self scrollUpLines:(nFullLinesShown // 2)
+
+    "Modified: / 13-06-2018 / 22:02:21 / Claus Gittinger"
 !
 
 horizontalScrollStep
@@ -4173,6 +4179,18 @@
     "Modified (comment): / 30-05-2017 / 17:34:32 / mawalch"
 !
 
+mouseWheelScrollDown:units
+    self scrollDownLines:units
+
+    "Created: / 13-06-2018 / 22:12:59 / Claus Gittinger"
+!
+
+mouseWheelScrollUp:units
+    self scrollUpLines:units
+
+    "Created: / 13-06-2018 / 22:12:53 / Claus Gittinger"
+!
+
 needScrollToMakeLine:aListLineNr
     "return true, if a scroll is needd to make a line visible.
      Numbering starts with 1 for the very first line of the text."
@@ -4221,27 +4239,36 @@
     "Modified: / 15-12-2010 / 10:12:41 / cg"
 !
 
-scrollDown:nLines
-    "change origin to scroll down some lines (towards the bottom of the text)"
+scrollDown
+    "scroll down by one line; 
+     this is called (among other) when the scrollbar's
+     scroll-step down button is pressed."
+
+    self scrollDownLines:1
+
+    "Created: / 13-06-2018 / 22:41:01 / Claus Gittinger"
+!
+
+scrollDown:nPixels
+    "change origin to scroll down some pixels 
+     (towards the bottom of the text)"
+
+    super scrollDown:nPixels
+
+    "Modified: / 21-05-1999 / 15:59:52 / cg"
+    "Modified (comment): / 13-06-2018 / 22:42:05 / Claus Gittinger"
+!
+
+scrollDownLines:nLines
+    "change origin to scroll down some lines 
+     (towards the bottom of the text)"
 
     nLines ~~ 0 ifTrue:[
-	self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
-	       redraw:true
+        self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
+               redraw:true
     ]
 
-    "Modified: / 21.5.1999 / 15:59:52 / cg"
-!
-
-scrollDownPixels:pix
-    "change origin to scroll down some pixels
-     (towards the bottom of the text)
-     THIS WILL VANISH!!"
-
-    pix > 0 ifTrue:[
-	self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
-    ]
-
-
+    "Created: / 13-06-2018 / 21:55:56 / Claus Gittinger"
 !
 
 scrollHorizontalTo:aPixelOffset
@@ -4335,12 +4362,14 @@
     "change origin to make aLineNr be the top line"
 
     aLineNr < firstLineShown ifTrue:[
-	self scrollUp:(firstLineShown - aLineNr)
+        self scrollUpLines:(firstLineShown - aLineNr)
     ] ifFalse:[
-	aLineNr > firstLineShown ifTrue:[
-	    self scrollDown:(aLineNr - firstLineShown)
-	]
+        aLineNr > firstLineShown ifTrue:[
+            self scrollDownLines:(aLineNr - firstLineShown)
+        ]
     ]
+
+    "Modified: / 13-06-2018 / 21:59:44 / Claus Gittinger"
 !
 
 scrollToPercent:percentOrigin
@@ -4358,27 +4387,36 @@
     self scrollToLine:1
 !
 
-scrollUp:nLines
-    "change origin to scroll up some lines (towards the top of the text)"
+scrollUp
+    "scroll up by one line; 
+     this is called (among other) when the scrollbar's
+     scroll-step up button is pressed."
+
+    self scrollUpLines:1
+
+    "Created: / 13-06-2018 / 22:41:07 / Claus Gittinger"
+!
+
+scrollUp:nPixels
+    "change origin to scroll up some pixels 
+     (towards the top of the text)"
+
+    super scrollUp:nPixels
+
+    "Modified: / 21-05-1999 / 15:59:45 / cg"
+    "Modified (comment): / 13-06-2018 / 22:42:20 / Claus Gittinger"
+!
+
+scrollUpLines:nLines
+    "change origin to scroll up some lines 
+     (towards the top of the text)"
 
     nLines ~~ 0 ifTrue:[
-	self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
-	       redraw:true
+        self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
+               redraw:true
     ]
 
-    "Modified: / 21.5.1999 / 15:59:45 / cg"
-!
-
-scrollUpPixels:pix
-    "change origin to scroll up some pixels
-     (towards the top of the text)
-    THIS WILL VANISH!!"
-
-    pix > 0 ifTrue:[
-	self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
-    ]
-
-
+    "Created: / 13-06-2018 / 21:57:42 / Claus Gittinger"
 !
 
 scrollVerticalToPercent:percent