*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Wed, 04 May 2005 16:12:12 +0200
changeset 2813 74cfefd3a0a4
parent 2812 190f880769cb
child 2814 612c60d1a9ba
*** empty log message ***
DSVColumnView.st
--- a/DSVColumnView.st	Wed May 04 09:39:01 2005 +0200
+++ b/DSVColumnView.st	Wed May 04 16:12:12 2005 +0200
@@ -2124,7 +2124,7 @@
 buttonPress:button x:x y:y
     "a button was pressed - handle selection here"
 
-    |rowNr colNr firstRowNr menu sensor clickPoint|
+    |rowNr colNr firstRowNr menu sensor clickPoint clickedIntoSelection|
 
     clickPoint := x @ y.
 
@@ -2153,6 +2153,8 @@
 
     (self isRowSelectable:rowNr) ifFalse:[^ self ].
 
+    clickedIntoSelection := self isInSelection:rowNr.
+
     sensor shiftDown ifTrue:[
         (multipleSelectOk and:[selectedRowIndex size ~~ 0]) ifTrue:[
             self selectRowFrom:(selectedRowIndex min min:rowNr)
@@ -2166,10 +2168,7 @@
     sensor ctrlDown ifTrue:[
         self buttonControlPressAtRowNr:rowNr.
 "/        ^ self
-    ].
-
-    sensor ctrlDown ifFalse:[
-"/    self withWaitCursorDo:[
+    ] ifFalse:[
         (self isInSelection:rowNr) ifTrue:[
             buttonReleaseAction := 
                 [ 
@@ -2180,22 +2179,33 @@
         ]
     ].
 
+    clickedIntoSelection ifTrue:[
+        buttonMotionAction := [:p|
+            self canDrag ifTrue:[
+                (((p x dist:clickPoint x) > (UserPreferences current motionDistanceToStartDrag))     
+                or:[p x < -5 or:[p x > (width+5)]]) ifTrue:[     
+                    buttonReleaseAction := buttonMotionAction := nil.
+                    self startDragAt:p
+                ]
+            ].
+        ].
+        ^ self.
+    ].
+
     buttonMotionAction := [:p|
         |r2|
 
-"/ cg: disabled: I dont want to loose the selection when starting
-"/     a drag.
-"/        (self bounds containsPoint:p) ifTrue:[
-"/            multipleSelectOk ifTrue:[
-"/                r2 := self yVisibleToRowNr:(p y).
-"/                r2 notNil ifTrue:[
+        (self bounds containsPoint:p) ifTrue:[
+            multipleSelectOk ifTrue:[
+                r2 := self yVisibleToRowNr:(p y).
+                r2 notNil ifTrue:[
 "/                    r2 ~~ self lastIndexSelected ifTrue:[
-"/                        self selectRowFrom:firstRowNr to:r2.
-"/                        clickPoint := p.
+                        self selectRowFrom:firstRowNr to:r2.
+                        clickPoint := p.
 "/                    ].
-"/                ].
-"/            ].
-"/        ].
+                ].
+            ].
+        ].
 
         self canDrag ifTrue:[
             (((p x dist:clickPoint x) > (UserPreferences current motionDistanceToStartDrag))     
@@ -2205,20 +2215,6 @@
             ]
         ].
     ].
-
-"/    (multipleSelectOk and:[selectedColIndex == 0 and:[selectedRowIndex size == 1]]) ifTrue:[
-"/        buttonMotionAction := [:p| 
-"/            |r|
-"/
-"/            (self bounds contains:p) ifFalse:[
-"/                buttonReleaseAction := buttonMotionAction := nil.
-"/                self startDragAt:p.
-"/                ^ self.
-"/            ].
-"/            r := self yVisibleToRowNr:(p y).
-"/            r notNil ifTrue:[ self selectRowFrom:rowNr to:r ].
-"/        ]
-"/    ].
 !
 
 buttonRelease:button x:x y:y
@@ -4058,5 +4054,5 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.201 2005-05-04 07:39:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.202 2005-05-04 14:12:12 cg Exp $'
 ! !