--- a/UIPainterView.st Tue Sep 21 16:30:12 2004 +0200
+++ b/UIPainterView.st Tue Sep 21 22:10:04 2004 +0200
@@ -370,102 +370,102 @@
!
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNil
- "add the specs to the object view; returns list of pasted components
- "
+ "add the specs to the object view; returns list of pasted components"
+
|paste pasteOrigin pasteOffset builder newSel bounds containerToPasteInto|
treeView askForSelectionChangeAllowed ifFalse:[^ nil].
containerToPasteInto := self singleSelection.
containerToPasteInto isNil ifTrue:[
- self selection size > 0 ifTrue:[
- containerToPasteInto := self commonContainerOf:self selection
- ] ifFalse:[
- containerToPasteInto := self
- ].
- self selection:containerToPasteInto.
+ self selection size > 0 ifTrue:[
+ containerToPasteInto := self commonContainerOf:self selection
+ ] ifFalse:[
+ containerToPasteInto := self
+ ].
+ self selection:containerToPasteInto.
].
(self canPasteInto:containerToPasteInto) ifFalse:[
- containerToPasteInto notNil ifTrue:[
- "/ search up parent list for something we can paste into
- [containerToPasteInto notNil and:[(self canPasteInto:containerToPasteInto) not]] whileTrue:[
- containerToPasteInto := containerToPasteInto container.
- ].
- self selection:containerToPasteInto.
- ].
+ containerToPasteInto notNil ifTrue:[
+ "/ search up parent list for something we can paste into
+ [containerToPasteInto notNil and:[(self canPasteInto:containerToPasteInto) not]] whileTrue:[
+ containerToPasteInto := containerToPasteInto container.
+ ].
+ self selection:containerToPasteInto.
+ ].
].
containerToPasteInto isNil ifTrue:[
- containerToPasteInto := self
+ containerToPasteInto := self
].
(self canPaste:aSpecificationOrList) ifFalse:[
- Dialog warn:'Cannot paste into selected component (not a container ?)'.
- ^ nil
+ Dialog warn:'Cannot paste into selected component (not a container ?)'.
+ ^ nil
].
aSpecificationOrList isCollection ifTrue:[
- paste := aSpecificationOrList
+ paste := aSpecificationOrList
] ifFalse:[
- paste := Array with:aSpecificationOrList
+ paste := Array with:aSpecificationOrList
].
- self setSelection:nil.
+ self setClipboardObject:nil.
newSel := OrderedCollection new.
builder := UIBuilder new isEditing:true.
className notNil ifTrue:[
- builder applicationClass:(self resolveName:className)
+ builder applicationClass:(self resolveName:className)
].
(keepLayout not or:[keepPosition]) ifTrue:[
- pasteOffset := 0@0.
-
- keepPosition ifTrue:[
- pasteOrigin := device translatePoint:0@0
- fromView:self
- toView:containerToPasteInto.
- ] ifFalse:[
- aPointOrNil isNil ifTrue:[
- pasteOrigin := self sensor mousePoint.
- pasteOrigin := device translatePoint:pasteOrigin
- fromView:nil
- toView:containerToPasteInto.
- ] ifFalse:[
- pasteOrigin := device translatePoint:aPointOrNil
- fromView:self
- toView:containerToPasteInto.
- ]
- ].
-
- bounds := Rectangle origin:0@0 extent:(containerToPasteInto bounds extent)
+ pasteOffset := 0@0.
+
+ keepPosition ifTrue:[
+ pasteOrigin := device translatePoint:0@0
+ fromView:self
+ toView:containerToPasteInto.
+ ] ifFalse:[
+ aPointOrNil isNil ifTrue:[
+ pasteOrigin := self sensor mousePoint.
+ pasteOrigin := device translatePoint:pasteOrigin
+ fromView:nil
+ toView:containerToPasteInto.
+ ] ifFalse:[
+ pasteOrigin := device translatePoint:aPointOrNil
+ fromView:self
+ toView:containerToPasteInto.
+ ]
+ ].
+
+ bounds := Rectangle origin:0@0 extent:(containerToPasteInto bounds extent)
].
paste do:[:aSpec|
- |view newOrigin|
-
- view := self addSpec:aSpec builder:builder in:containerToPasteInto.
-
- keepPosition ifTrue:[
- self moveObject:view to:(view origin + pasteOrigin).
- ] ifFalse:[
- keepLayout ifFalse:[
- (bounds containsPoint:pasteOrigin) ifFalse:[
- newOrigin := pasteOffset.
- ] ifTrue:[
- newOrigin := pasteOrigin + pasteOffset.
- ].
- self moveObject:view to:newOrigin.
- pasteOffset := pasteOffset + 4
- ].
- ].
- view realize.
- newSel add:view.
+ |view newOrigin|
+
+ view := self addSpec:aSpec builder:builder in:containerToPasteInto.
+
+ keepPosition ifTrue:[
+ self moveObject:view to:(view origin + pasteOrigin).
+ ] ifFalse:[
+ keepLayout ifFalse:[
+ (bounds containsPoint:pasteOrigin) ifFalse:[
+ newOrigin := pasteOffset.
+ ] ifTrue:[
+ newOrigin := pasteOrigin + pasteOffset.
+ ].
+ self moveObject:view to:newOrigin.
+ pasteOffset := pasteOffset + 4
+ ].
+ ].
+ view realize.
+ newSel add:view.
].
self withinTransaction:#paste objects:newSel do:[
- undoHistory addUndoSelector:#undoCreate:
- withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier])
+ undoHistory addUndoSelector:#undoCreate:
+ withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier])
].
self realizeAllSubViews.