skip over disabled lines, when moving selection via cursor keys.
authorClaus Gittinger <cg@exept.de>
Sat, 08 Aug 1998 13:34:52 +0200
changeset 1640 1ddc9c17b4bf
parent 1639 ae51010bd1dc
child 1641 437779c3a0cb
skip over disabled lines, when moving selection via cursor keys.
MenuView.st
SelListV.st
SelectionInListView.st
--- a/MenuView.st	Fri Aug 07 20:01:33 1998 +0200
+++ b/MenuView.st	Sat Aug 08 13:34:52 1998 +0200
@@ -2628,9 +2628,12 @@
     |line|
 
     (super isValidSelection:aNumber) ifFalse:[^ false].
+    (enableFlags at:aNumber) ifFalse:[^ false].
 
     line := self listAt:aNumber.
     ^ (self isGraphicItem:line) not
+
+    "Modified: / 8.8.1998 / 03:31:14 / cg"
 ! !
 
 !MenuView methodsFor:'showing'!
@@ -2702,5 +2705,5 @@
 !MenuView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.114 1998-07-30 09:18:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.115 1998-08-08 11:34:52 cg Exp $'
 ! !
--- a/SelListV.st	Fri Aug 07 20:01:33 1998 +0200
+++ b/SelListV.st	Sat Aug 08 13:34:52 1998 +0200
@@ -2071,7 +2071,7 @@
         enabled ifTrue:[
             listLineNr := self visibleLineToListLine:(self visibleLineOfY:y).
             listLineNr notNil ifTrue:[
-                (self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self].
+                (self lineIsEnabled:listLineNr) ifFalse:[^ self].
 
                 (selectConditionBlock notNil 
                  and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
@@ -2098,8 +2098,8 @@
         super buttonPress:button x:x y:y
     ]
 
-    "Created: 14.11.1996 / 15:51:41 / cg"
-    "Modified: 17.6.1997 / 18:03:19 / cg"
+    "Created: / 14.11.1996 / 15:51:41 / cg"
+    "Modified: / 8.8.1998 / 03:24:03 / cg"
 !
 
 buttonMotion:buttonMask x:x y:y
@@ -2764,18 +2764,30 @@
 isValidSelection:aNumberOrCollection
     "return true, if aNumber is ok as a selection index"
 
+    |sz|
+
     aNumberOrCollection isNil ifTrue:[^ false].
 
+    sz := self size.
     (aNumberOrCollection isCollection) ifTrue:[
-	multipleSelectOk ifFalse:[^ false].
-	aNumberOrCollection do:[:index |
-	    (index between:1 and:self size) ifFalse:[^ false].
-	].
-	^ true.
+        multipleSelectOk ifFalse:[^ false].
+        aNumberOrCollection do:[:index |
+            (index between:1 and:sz) ifFalse:[^ false].
+            (self lineIsEnabled:index) ifFalse:[^ false].
+        ].
     ] ifFalse:[
-	^ (aNumberOrCollection between:1 and:self size).
+        (aNumberOrCollection between:1 and:sz) ifFalse:[^ false].
+        (self lineIsEnabled:aNumberOrCollection) ifFalse:[^ false].
     ].
-
+    ^ true.
+
+    "Modified: / 8.8.1998 / 03:34:27 / cg"
+!
+
+lineIsEnabled:lineNr
+    ^ (self line:lineNr hasAttribute:#disabled) not
+
+    "Modified: / 8.8.1998 / 03:22:50 / cg"
 !
 
 positionToSelectionX:x y:y
@@ -2816,7 +2828,7 @@
             oldSelection := selection copy.
             self removeFromSelection:listLineNr
         ] ifFalse:[
-            (self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self].
+            (self lineIsEnabled:listLineNr) ifFalse:[^ self].
 
             (selectConditionBlock notNil 
              and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
@@ -2836,8 +2848,8 @@
         clickLine := listLineNr
     ]
 
-    "Created: 14.11.1996 / 16:27:17 / cg"
-
+    "Created: / 14.11.1996 / 16:27:17 / cg"
+    "Modified: / 8.8.1998 / 03:22:26 / cg"
 !
 
 visibleLineNeedsSpecialCare:visLineNr
@@ -2992,12 +3004,9 @@
             ^ self
         ].
         listAttributes notNil ifTrue:[
-            (self line:listLine hasAttribute:#halfIntensity) ifTrue:[
+            ((self line:listLine hasAttribute:#halfIntensity) 
+            or:[ (self lineIsEnabled:listLine) not ]) ifTrue:[
                 fg := halfIntensityFgColor
-            ] ifFalse:[
-                (self line:listLine hasAttribute:#disabled) ifTrue:[
-                    fg := halfIntensityFgColor
-                ].
             ].
             (self line:listLine hasAttribute:#bold) ifTrue:[
                 newFont := font asBold.
@@ -3036,7 +3045,7 @@
     ].
     ^ self drawVisibleLine:visLineNr with:fg and:bg
 
-    "Modified: / 21.6.1998 / 03:26:28 / cg"
+    "Modified: / 8.8.1998 / 03:42:13 / cg"
 !
 
 redrawVisibleLine:visLineNr col:colNr
@@ -3155,7 +3164,7 @@
     "return the index of the next selectable entry after the selection.
      Wrap at end."
 
-    |next|
+    |next sz|
 
     selection isNil ifTrue:[
         next := firstLineShown
@@ -3170,20 +3179,25 @@
             next := selection + 1
         ].
     ].
+
     (self isValidSelection:next) ifFalse:[
-        next > self size ifTrue:[
+        sz := self size.
+        next > sz ifTrue:[
             next := 1.
         ] ifFalse:[
-            [next <= self size
-             and:[(self isValidSelection:next) not]] whileTrue:[
+            [next <= sz
+             and:[(self isValidSelection:next) not ]] whileTrue:[
                 next := next + 1
             ].
         ].
     ].
+
     (self isValidSelection:next) ifFalse:[
         next := nil
     ].
     ^ next
+
+    "Modified: / 8.8.1998 / 03:36:55 / cg"
 !
 
 numberOfSelections
@@ -3558,5 +3572,5 @@
 !SelectionInListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.132 1998-08-07 18:00:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.133 1998-08-08 11:33:52 cg Exp $'
 ! !
--- a/SelectionInListView.st	Fri Aug 07 20:01:33 1998 +0200
+++ b/SelectionInListView.st	Sat Aug 08 13:34:52 1998 +0200
@@ -2071,7 +2071,7 @@
         enabled ifTrue:[
             listLineNr := self visibleLineToListLine:(self visibleLineOfY:y).
             listLineNr notNil ifTrue:[
-                (self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self].
+                (self lineIsEnabled:listLineNr) ifFalse:[^ self].
 
                 (selectConditionBlock notNil 
                  and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
@@ -2098,8 +2098,8 @@
         super buttonPress:button x:x y:y
     ]
 
-    "Created: 14.11.1996 / 15:51:41 / cg"
-    "Modified: 17.6.1997 / 18:03:19 / cg"
+    "Created: / 14.11.1996 / 15:51:41 / cg"
+    "Modified: / 8.8.1998 / 03:24:03 / cg"
 !
 
 buttonMotion:buttonMask x:x y:y
@@ -2764,18 +2764,30 @@
 isValidSelection:aNumberOrCollection
     "return true, if aNumber is ok as a selection index"
 
+    |sz|
+
     aNumberOrCollection isNil ifTrue:[^ false].
 
+    sz := self size.
     (aNumberOrCollection isCollection) ifTrue:[
-	multipleSelectOk ifFalse:[^ false].
-	aNumberOrCollection do:[:index |
-	    (index between:1 and:self size) ifFalse:[^ false].
-	].
-	^ true.
+        multipleSelectOk ifFalse:[^ false].
+        aNumberOrCollection do:[:index |
+            (index between:1 and:sz) ifFalse:[^ false].
+            (self lineIsEnabled:index) ifFalse:[^ false].
+        ].
     ] ifFalse:[
-	^ (aNumberOrCollection between:1 and:self size).
+        (aNumberOrCollection between:1 and:sz) ifFalse:[^ false].
+        (self lineIsEnabled:aNumberOrCollection) ifFalse:[^ false].
     ].
-
+    ^ true.
+
+    "Modified: / 8.8.1998 / 03:34:27 / cg"
+!
+
+lineIsEnabled:lineNr
+    ^ (self line:lineNr hasAttribute:#disabled) not
+
+    "Modified: / 8.8.1998 / 03:22:50 / cg"
 !
 
 positionToSelectionX:x y:y
@@ -2816,7 +2828,7 @@
             oldSelection := selection copy.
             self removeFromSelection:listLineNr
         ] ifFalse:[
-            (self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self].
+            (self lineIsEnabled:listLineNr) ifFalse:[^ self].
 
             (selectConditionBlock notNil 
              and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
@@ -2836,8 +2848,8 @@
         clickLine := listLineNr
     ]
 
-    "Created: 14.11.1996 / 16:27:17 / cg"
-
+    "Created: / 14.11.1996 / 16:27:17 / cg"
+    "Modified: / 8.8.1998 / 03:22:26 / cg"
 !
 
 visibleLineNeedsSpecialCare:visLineNr
@@ -2992,12 +3004,9 @@
             ^ self
         ].
         listAttributes notNil ifTrue:[
-            (self line:listLine hasAttribute:#halfIntensity) ifTrue:[
+            ((self line:listLine hasAttribute:#halfIntensity) 
+            or:[ (self lineIsEnabled:listLine) not ]) ifTrue:[
                 fg := halfIntensityFgColor
-            ] ifFalse:[
-                (self line:listLine hasAttribute:#disabled) ifTrue:[
-                    fg := halfIntensityFgColor
-                ].
             ].
             (self line:listLine hasAttribute:#bold) ifTrue:[
                 newFont := font asBold.
@@ -3036,7 +3045,7 @@
     ].
     ^ self drawVisibleLine:visLineNr with:fg and:bg
 
-    "Modified: / 21.6.1998 / 03:26:28 / cg"
+    "Modified: / 8.8.1998 / 03:42:13 / cg"
 !
 
 redrawVisibleLine:visLineNr col:colNr
@@ -3155,7 +3164,7 @@
     "return the index of the next selectable entry after the selection.
      Wrap at end."
 
-    |next|
+    |next sz|
 
     selection isNil ifTrue:[
         next := firstLineShown
@@ -3170,20 +3179,25 @@
             next := selection + 1
         ].
     ].
+
     (self isValidSelection:next) ifFalse:[
-        next > self size ifTrue:[
+        sz := self size.
+        next > sz ifTrue:[
             next := 1.
         ] ifFalse:[
-            [next <= self size
-             and:[(self isValidSelection:next) not]] whileTrue:[
+            [next <= sz
+             and:[(self isValidSelection:next) not ]] whileTrue:[
                 next := next + 1
             ].
         ].
     ].
+
     (self isValidSelection:next) ifFalse:[
         next := nil
     ].
     ^ next
+
+    "Modified: / 8.8.1998 / 03:36:55 / cg"
 !
 
 numberOfSelections
@@ -3558,5 +3572,5 @@
 !SelectionInListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.132 1998-08-07 18:00:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.133 1998-08-08 11:33:52 cg Exp $'
 ! !