UIPainterView.st
changeset 1621 112670159075
parent 1574 e4897b61395c
child 1635 116bf6f0ff62
--- a/UIPainterView.st	Tue Oct 08 17:28:30 2002 +0200
+++ b/UIPainterView.st	Tue Oct 08 18:00:46 2002 +0200
@@ -252,6 +252,8 @@
     "
     |specs coll index oldSelection newSelection treeModel children size nd|
 
+    treeView askForSelectionChangeAllowed ifFalse:[^ self].
+
     coll := self minSetOfSuperViews:(self selection).
 
     coll notNil ifTrue:[
@@ -364,7 +366,19 @@
 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNil
     "add the specs to the object view; returns list of pasted components
     "
-    |paste frame pasteOrigin pasteOffset builder newSel bounds|
+    |paste frame pasteOrigin pasteOffset builder newSel bounds container|
+
+    treeView askForSelectionChangeAllowed ifFalse:[^ nil].
+
+    (self canPasteInto:(self singleSelection)) ifFalse:[
+        (container := self singleSelection) notNil ifTrue:[
+            "/ search up parent list for something we can paste into
+            [container notNil and:[(self canPasteInto:container) not]] whileTrue:[
+                container := container container.                
+            ].
+            self selection:container.
+        ].
+    ].
 
     (self canPaste:aSpecificationOrList) ifFalse:[
         ^ nil
@@ -378,7 +392,7 @@
     (frame := self singleSelection) isNil ifTrue:[
         frame := self
     ].
-    self selection:nil.
+    self setSelection:nil.
 
     newSel  := OrderedCollection new.
     builder := UIBuilder new isEditing:true.
@@ -2293,4 +2307,5 @@
 version
     ^ '$Header$'
 ! !
+
 UIPainterView initialize!