--- a/SelectionInListView.st Fri May 16 15:44:34 2003 +0200
+++ b/SelectionInListView.st Mon May 19 10:51:45 2003 +0200
@@ -2964,8 +2964,6 @@
"auto scroll action; scroll and reinstall timed-block"
self scrollDown.
- self invalidate.
-
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
"Modified: / 3.2.2000 / 22:41:59 / cg"
@@ -3322,49 +3320,49 @@
|movedLine delta newSelection|
clickLine isNil ifTrue:[^ self].
+ self multipleSelectOk ifFalse:[ ^ self].
movedLine := self visibleLineToAbsoluteLine:(self visibleLineOfY:y).
- self multipleSelectOk ifTrue:[
- selectionAtClickTime isNil ifTrue:[
- selectionAtClickTime := selection copy.
- ].
-
- newSelection := selectionAtClickTime copy.
- newSelection isNil ifTrue:[newSelection := OrderedCollection new].
-
- "/ compute new selection
- delta := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1].
- clickLine to:movedLine by:delta do:[:ln |
- |isSelected doSelect doUnselect|
-
- doSelect := doUnselect := false.
-
- isSelected := self is:ln inSelection:selectionAtClickTime.
- selectMode == true ifTrue:[
- doSelect := isSelected not
+
+ selectionAtClickTime isNil ifTrue:[
+ selectionAtClickTime := selection copy.
+ ].
+
+ newSelection := selectionAtClickTime copy.
+ newSelection isNil ifTrue:[newSelection := OrderedCollection new].
+
+ "/ compute new selection
+ delta := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1].
+ clickLine to:movedLine by:delta do:[:ln |
+ |isSelected doSelect doUnselect|
+
+ doSelect := doUnselect := false.
+
+ isSelected := self is:ln inSelection:selectionAtClickTime.
+ selectMode == true ifTrue:[
+ doSelect := isSelected not
+ ] ifFalse:[
+ selectMode == false ifTrue:[
+ doUnselect := isSelected
] ifFalse:[
- selectMode == false ifTrue:[
- doUnselect := isSelected
- ] ifFalse:[
- selectMode == #toggle ifTrue:[
- doUnselect := isSelected.
- doSelect := doUnselect not.
- ]
- ]
- ].
-
- doSelect ifTrue:[
- newSelection add:ln.
- ] ifFalse:[
- doUnselect ifTrue:[
- newSelection remove:ln.
+ selectMode == #toggle ifTrue:[
+ doUnselect := isSelected.
+ doSelect := doUnselect not.
]
]
].
- newSelection ~= selection ifTrue:[
- self selection:newSelection.
- ].
+ doSelect ifTrue:[
+ newSelection add:ln.
+ ] ifFalse:[
+ doUnselect ifTrue:[
+ newSelection remove:ln.
+ ]
+ ]
+ ].
+
+ newSelection ~= selection ifTrue:[
+ self selection:newSelection.
].
"Created: / 14.11.1996 / 15:48:10 / cg"
@@ -3635,7 +3633,7 @@
"select line, aNumber or deselect if argument is nil.
*** No model and/or actionBlock notification is done here."
- |prevSelection newSelection multipleSelectOk|
+ |prevSelection newSelection multipleSelectOk oldItems newItems addedItems removedItems|
multipleSelectOk := self multipleSelectOk.
@@ -3676,38 +3674,67 @@
(newSelection = selection) ifTrue: [^ self].
- "
- redraw old selection unhighlighted
- "
- selection notNil ifTrue: [
- prevSelection := selection.
- selection := nil.
- multipleSelectOk ifTrue:[
- prevSelection do:[:line |
- self redrawElement:line
- ]
+ multipleSelectOk ifTrue:[
+ oldItems := selection ? #().
+ newItems := newSelection ? #().
+ ] ifFalse:[
+ (selection isNil or:[selection == 0]) ifTrue:[
+ oldItems := #()
] ifFalse:[
- self redrawElement:prevSelection
- ]
+ oldItems := Array with:selection
+ ].
+ (newItems isNil or:[newItems == 0]) ifTrue:[
+ oldItems := #()
+ ] ifFalse:[
+ oldItems := Array with:newItems
+ ].
].
+ addedItems := newItems select:[:item | (oldItems includes:item) not].
+ removedItems := oldItems select:[:item | (newItems includes:item) not].
+
selection := newSelection.
- "
- redraw new selection unhighlighted
- "
- newSelection notNil ifTrue:[
- multipleSelectOk ifTrue:[
-"/ newSelection isCollection ifFalse:[
-"/ selection := OrderedCollection with:newSelection.
-"/ ].
- selection do:[:line |
- self redrawElement:line
- ]
- ] ifFalse:[
- self redrawElement:selection
- ]
- ]
+ ((OrderedCollection new)
+ addAll:addedItems;
+ addAll:removedItems;
+ sort)
+ do:[:line |
+ self redrawElement:line
+ ].
+
+"/ "
+"/ redraw old selection unhighlighted
+"/ "
+"/ selection notnil iftrue: [
+"/ prevselection := selection.
+"/ selection := nil.
+"/ multipleselectok iftrue:[
+"/ prevselection do:[:line |
+"/ self redrawelement:line
+"/ ]
+"/ ] iffalse:[
+"/ self redrawelement:prevselection
+"/ ]
+"/ ].
+"/
+"/ selection := newSelection.
+"/
+"/ "
+"/ redraw new selection unhighlighted
+"/ "
+"/ newSelection notNil ifTrue:[
+"/ multipleSelectOk ifTrue:[
+"/"/ newSelection isCollection ifFalse:[
+"/"/ selection := OrderedCollection with:newSelection.
+"/"/ ].
+"/ selection do:[:line |
+"/ self redrawElement:line
+"/ ]
+"/ ] ifFalse:[
+"/ self redrawElement:selection
+"/ ]
+"/ ]
"Modified: 15.11.1996 / 16:58:46 / cg"
!
@@ -3917,5 +3944,5 @@
!SelectionInListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.215 2003-05-13 16:50:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.216 2003-05-19 08:51:45 cg Exp $'
! !