UIPainterView.st
changeset 312 386932d91a97
parent 310 a68c182d050f
child 315 056c9fe74cc6
equal deleted inserted replaced
311:52f954630dca 312:386932d91a97
   223 !
   223 !
   224 
   224 
   225 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
   225 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
   226     "add the specs to the object view; returns list of pasted components
   226     "add the specs to the object view; returns list of pasted components
   227     "
   227     "
   228     |paste frame pasteOrigin pasteOffset builder newSel|
   228     |paste frame pasteOrigin pasteOffset builder newSel bounds|
   229 
   229 
   230     (self canPaste:aSpecificationOrList) ifFalse:[
   230     (self canPaste:aSpecificationOrList) ifFalse:[
   231         ^ nil
   231         ^ nil
   232     ].
   232     ].
   233 
   233 
   248             builder applicationClass:(Smalltalk classNamed:className).
   248             builder applicationClass:(Smalltalk classNamed:className).
   249         ].
   249         ].
   250 
   250 
   251         keepLayout ifFalse:[
   251         keepLayout ifFalse:[
   252             pasteOffset := 0@0.
   252             pasteOffset := 0@0.
       
   253 
   253             aPointOrNil isNil ifTrue:[
   254             aPointOrNil isNil ifTrue:[
   254                 pasteOrigin := self sensor mousePoint.
   255                 pasteOrigin := self sensor mousePoint.
   255                 pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
   256                 pasteOrigin := device translatePoint:pasteOrigin
       
   257                                             from:device rootView id
       
   258                                               to:frame id.
   256             ] ifFalse:[
   259             ] ifFalse:[
   257                 pasteOrigin := aPointOrNil
   260                 pasteOrigin := device translatePoint:aPointOrNil
   258             ].
   261                                                 from:self id
       
   262                                                   to:frame id.
       
   263             ]
       
   264         ].
       
   265         keepLayout ifFalse:[
       
   266             bounds := Rectangle origin:0@0 extent:(frame bounds extent)
   259         ].
   267         ].
   260 
   268 
   261         paste do:[:aSpec|
   269         paste do:[:aSpec|
   262             |view|
   270             |view|
   263 
   271 
   264             view := self addSpec:aSpec builder:builder in:frame.
   272             view := self addSpec:aSpec builder:builder in:frame.
   265 
   273 
   266             keepLayout ifFalse:[
   274             keepLayout ifFalse:[
   267                 (frame bounds containsPoint:pasteOrigin) ifFalse:[
   275                 (bounds containsPoint:pasteOrigin) ifFalse:[
   268                     self moveObject:view to:pasteOffset.
   276                     self moveObject:view to:pasteOffset.    self halt.
   269                 ] ifTrue:[
   277                 ] ifTrue:[
   270                     self moveObject:view to:pasteOrigin + pasteOffset.
   278                     self moveObject:view to:pasteOrigin + pasteOffset.
   271                 ].
   279                 ].
   272                 pasteOffset := pasteOffset + 4
   280                 pasteOffset := pasteOffset + 4
   273             ].
   281             ].