change selection behavior caused by new tree view
authorca
Sun, 20 Jul 1997 12:25:40 +0200
changeset 225 a40d26ed5e74
parent 224 c1d7bffe73f1
child 226 07e81ce2d32f
change selection behavior caused by new tree view
UIObjectView.st
--- a/UIObjectView.st	Sun Jul 20 12:24:32 1997 +0200
+++ b/UIObjectView.st	Sun Jul 20 12:25:40 1997 +0200
@@ -453,7 +453,6 @@
                 self sensor flushExposeEventsFor:v.
                 v exposeX:0 y:0 width:9999 height:9999.
             ].
-
             self showSelected:aComponent
         ]
     ]
@@ -623,7 +622,7 @@
         self setSelection:movedObject withRedraw:true.
         movedObject := nil.
         self setDefaultActions.
-        self changed:#layout.
+        self layoutChanged.
     ].
 !
 
@@ -797,7 +796,7 @@
     ].
 
     self setSelection:object withRedraw:true.
-    self changed:#layout.
+    self layoutChanged.
 !
 
 startResizeBorder:b of:selection
@@ -1135,29 +1134,12 @@
   ^ 1
 !
 
-select:something
-    "change selection to something
-    "
-    (self enabled and:[something ~= self selection]) ifTrue:[
-        self setSelection:something withRedraw:true.
-        self selectionChanged
-    ]
-
-!
-
 selection:something
     "change selection to something
     "
     self select:something
 !
 
-selectionChanged
-    "called whenever the selection changed
-    "
-    self subclassResponsibility
-
-!
-
 selectionDo:aBlock
     "apply block to every selected object
     "
@@ -1251,40 +1233,6 @@
 
 !UIObjectView methodsFor:'selections basic'!
 
-addToSelection:anObject
-    "add an object to the selection
-    "
-    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
-        selection isCollection ifFalse:[
-            selection isNil ifTrue:[
-                selection := anObject
-            ] ifFalse:[
-                selection := OrderedCollection with:selection with:anObject
-            ]
-        ] ifTrue:[
-            selection add:anObject
-        ].
-        self showSelected:anObject.
-        self selectionChanged.
-    ]
-!
-
-removeFromSelection:anObject
-    "remove an object from the selection
-    "
-    (self isSelected:anObject) ifTrue:[
-        self showUnselected:anObject.
-
-        selection size > 1 ifTrue:[
-            selection remove:anObject ifAbsent:nil.
-            self showSelection.
-        ] ifFalse:[
-            selection := nil
-        ].
-        self selectionChanged.
-    ]
-!
-
 selection
     "returns the current selection
     "
@@ -1296,12 +1244,18 @@
 setSelection:aNewSelection withRedraw:doRedraw
     "set a new selection without change notifications
     "
+    |sel|
+
+    (sel := aNewSelection) == self ifTrue:[
+        sel := nil
+    ].
+
     doRedraw ifTrue:[
         self hideSelection.
-        selection := aNewSelection.
+        selection := sel.
         self showSelection
     ] ifFalse:[
-        selection := aNewSelection
+        selection := sel
     ]
 ! !
 
@@ -1327,49 +1281,6 @@
 
 !
 
-canPaste:something
-    "returns true if something could be paste
-    "
-    something notNil ifTrue:[
-        something isCollection ifTrue:[
-            something notEmpty ifTrue:[
-                ^ (something at:1) isKindOf:UISpecification
-            ]
-        ] ifFalse:[
-            ^ something isKindOf:UISpecification
-        ]
-    ].
-    ^ false
-
-!
-
-canPasteInto:something
-    "can paste into something ?
-    "
-
-    |theView theSpec|
-
-    something notNil ifTrue:[
-        something isCollection ifFalse:[
-            theView := something
-        ] ifTrue:[
-            something size == 1 ifTrue:[
-                theView := (something at:1)
-            ]
-        ].
-        theView notNil ifTrue:[
-            theSpec := self specFor:theView.
-            theSpec isNil ifTrue:[
-                ^ theView specClass supportsSubComponents
-            ].
-            ^ theSpec class supportsSubComponents
-        ]
-    ].
-    ^ false
-
-    "Modified: 8.4.1997 / 01:19:14 / cg"
-!
-
 hasSelection
     "returns true if any selected object exists
     "
@@ -1558,7 +1469,7 @@
             ]
         ]
     ].
-    self changed:#layout
+    self layoutChanged
 
 ! !
 
@@ -1583,7 +1494,7 @@
             self selectionDo:[:aView| aOneArgBlock value:aView ].
             Delay waitForSeconds:tm.
             tm := 0.02.
-            self changed:#layout.
+            self layoutChanged.
             sensor leftButtonPressed.
         ] whileTrue.
 
@@ -1707,7 +1618,7 @@
                 ]
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 
 
@@ -1743,7 +1654,7 @@
                 self shiftLayout:v left:delta right:delta
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 
 
@@ -1779,7 +1690,7 @@
                 self shiftLayout:v top:delta bottom:delta
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 !
 
@@ -1806,7 +1717,7 @@
                 ]
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 !
 
@@ -1846,7 +1757,7 @@
                 ]
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ].
 
 !
@@ -1874,7 +1785,7 @@
                 ]
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 !
 
@@ -1901,7 +1812,7 @@
                 ]
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 
 !
@@ -1942,7 +1853,7 @@
                 ]
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 !
 
@@ -1993,7 +1904,7 @@
                 ]
             ]
         ].
-        self changed:#layout
+        self layoutChanged
     ]
 
 
@@ -2071,7 +1982,7 @@
             min := min + aView computeExtent x + space
         ]
     ].
-    self changed:#layout
+    self layoutChanged
 
 !
 
@@ -2114,7 +2025,7 @@
             min := min + aView height + space
         ]
     ].
-    self changed:#layout
+    self layoutChanged
 ! !
 
 !UIObjectView methodsFor:'user actions - undo history'!