UIObjectView.st
changeset 284 995078a58977
parent 251 ea4577f6cc41
child 353 6687441ccd4d
--- a/UIObjectView.st	Mon Aug 18 13:06:03 1997 +0200
+++ b/UIObjectView.st	Mon Aug 18 13:08:22 1997 +0200
@@ -431,11 +431,12 @@
     "some element has changed its size; collect them during selectionHiddenLevel 
      is on
     "
-    selectionHiddenLevel ~~ 0 ifTrue:[
-        setOfSuperViewsSizeChanged add:aView superView
-    ] ifFalse:[
-        aView superView sizeChanged:nil
-    ]
+    |spv|
+
+    spv := self findContainerOfView:aView.
+
+    selectionHiddenLevel ~~ 0 ifTrue:[setOfSuperViewsSizeChanged add:spv]
+                             ifFalse:[spv sizeChanged:nil]
 !
 
 exposeX:x y:y width:w height:h
@@ -526,6 +527,14 @@
 
 !
 
+map
+    "make the view visible on the screen and in case of a none empty
+     selection the selection will be shown.
+    "
+    super map.
+    self showSelection.
+!
+
 realize
     super realize.
     self windowGroup postEventHook:self
@@ -684,14 +693,16 @@
 startSelectOrMove:aPoint
     "a button is pressed at a point; start moving or selection
     "
-    |aView b|
+    |aView b v|
 
     self enabled ifFalse:[^ self].
 
     aView := self singleSelection.
 
     aView notNil ifTrue:[
-        (aView superView specClass canResizeSubComponents) ifTrue:[
+        v := self findContainerOfView:aView.
+
+        v specClass canResizeSubComponents ifTrue:[
             b := self whichHandleOf:aView isHitBy:aPoint.
 
             (b notNil and:[b ~~ #view]) ifTrue:[
@@ -699,7 +710,7 @@
             ]
         ].
 
-        (self sensor ctrlDown and:[self canMove:aView]) ifFalse:[
+        (self sensor ctrlDown and:[self canChangeLayoutOfView:aView]) ifFalse:[
             aView := nil
         ]
     ].
@@ -709,7 +720,7 @@
             ^ self select:nil
         ].
 
-        (self canMove:aView) ifFalse:[
+        (self canChangeLayoutOfView:aView) ifFalse:[
             ^ self select:aView
         ]
     ].
@@ -1055,14 +1066,6 @@
 
 !UIObjectView methodsFor:'searching'!
 
-findContainerViewAt:aPoint
-    "find container view responds to aPoint.
-    "
-    ^ self subclassResponsibility
-
-
-!
-
 findObjectAt:aPoint
     "find the origin/corner of the currentWidget
     "
@@ -1261,31 +1264,24 @@
 
 !UIObjectView methodsFor:'testing'!
 
-canMove:something
-    "returns always true; all contained views can be moved
+hasSelection
+    "returns true if any widget is selected
     "
-    |sv|
-
-    something notNil ifTrue:[
-        self forEach:something do:[:v|
-            sv ~~ v superView ifTrue:[
-                (sv notNil or:[v superView specClass isLayoutContainer]) ifTrue:[
-                    ^ false
-                ].
-                sv := v superView
-            ]
-        ].
-        ^ true
-    ].
-    ^ false
+    ^ self numberOfSelections ~~ 0
 
 !
 
-hasSelection
-    "returns true if any selected object exists
+hasSingleSelection
+    "returns true if one widget is selected
     "
-    ^ self numberOfSelections ~~ 0
-
+    ^ self numberOfSelections == 1
+
+!
+
+hasUndoHistory
+    "returns true if undos exists
+    "
+    ^ undoHistory isEmpty not
 !
 
 isModified
@@ -1636,7 +1632,8 @@
             view := self singleSelection.
 
             view notNil ifTrue:[
-                view   := view superView.
+                
+                view   := self findContainerOfView:view.
                 center := view computeExtent
             ] ifFalse:[
                 view   := sel first.
@@ -1672,7 +1669,7 @@
             view := self singleSelection.
 
             view notNil ifTrue:[
-                view   := view superView.
+                view   := self findContainerOfView:view.
                 center := view computeExtent
             ] ifFalse:[
                 view   := sel first.
@@ -1872,9 +1869,9 @@
 
         self selectionDo:[:aView |
             superview isNil ifTrue:[
-                superview := aView superView
+                superview := self findContainerOfView:aView
             ] ifFalse:[
-                (aView superView == superview) ifFalse:[
+                (self findContainerOfView:aView) == superview ifFalse:[
                     ^ self notify:'views must have same superview'.
                 ]
             ].