UIPainterView.st
changeset 278 5b7dfe33b497
parent 238 882be7e03af4
child 279 ef937b65a7f6
equal deleted inserted replaced
277:935f9a055594 278:5b7dfe33b497
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 UIObjectView subclass:#UIPainterView
    13 UIObjectView subclass:#UIPainterView
    14 	instanceVariableNames:'treeView listHolder superclassName className methodName categoryName'
    14 	instanceVariableNames:'treeView listHolder superclassName className methodName
       
    15 		categoryName'
    15 	classVariableNames:'HandCursor'
    16 	classVariableNames:'HandCursor'
    16 	poolDictionaries:''
    17 	poolDictionaries:''
    17 	category:'Interface-UIPainter'
    18 	category:'Interface-UIPainter'
    18 !
    19 !
    19 
    20 
   210 !
   211 !
   211 
   212 
   212 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
   213 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
   213     "add the specs to the object view; returns list of pasted components
   214     "add the specs to the object view; returns list of pasted components
   214     "
   215     "
       
   216 
       
   217     ^ self
       
   218         pasteSpecifications:aSpecificationOrList 
       
   219         keepLayout:keepLayout 
       
   220         at:nil
       
   221 
       
   222     "Modified: 11.8.1997 / 01:00:35 / cg"
       
   223 !
       
   224 
       
   225 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
       
   226     "add the specs to the object view; returns list of pasted components
       
   227     "
   215     |paste frame pasteOrigin pasteOffset builder newSel|
   228     |paste frame pasteOrigin pasteOffset builder newSel|
   216 
   229 
   217     (self canPaste:aSpecificationOrList) ifFalse:[
   230     (self canPaste:aSpecificationOrList) ifFalse:[
   218         ^ nil
   231         ^ nil
   219     ].
   232     ].
   235             builder applicationClass:(Smalltalk classNamed:className).
   248             builder applicationClass:(Smalltalk classNamed:className).
   236         ].
   249         ].
   237 
   250 
   238         keepLayout ifFalse:[
   251         keepLayout ifFalse:[
   239             pasteOffset := 0@0.
   252             pasteOffset := 0@0.
   240             pasteOrigin := self sensor mousePoint.
   253             aPointOrNil isNil ifTrue:[
   241             pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
   254                 pasteOrigin := self sensor mousePoint.
       
   255                 pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
       
   256             ] ifFalse:[
       
   257                 pasteOrigin := aPointOrNil
       
   258             ].
   242         ].
   259         ].
   243 
   260 
   244         paste do:[:aSpec|
   261         paste do:[:aSpec|
   245             |view|
   262             |view|
   246 
   263 
   269         self realizeAllSubViews.
   286         self realizeAllSubViews.
   270         inputView raise.
   287         inputView raise.
   271         self elementChangedSize:frame.
   288         self elementChangedSize:frame.
   272     ].
   289     ].
   273     ^ newSel
   290     ^ newSel
       
   291 
       
   292     "Created: 11.8.1997 / 00:59:38 / cg"
       
   293     "Modified: 11.8.1997 / 01:05:27 / cg"
   274 !
   294 !
   275 
   295 
   276 pasteWithLayout
   296 pasteWithLayout
   277     "add the objects in the paste-buffer to the object view; don't change the
   297     "add the objects in the paste-buffer to the object view; don't change the
   278      layout
   298      layout
   331     ^ false
   351     ^ false
   332 
   352 
   333 !
   353 !
   334 
   354 
   335 drop:anObjectOrCollection at:aPoint
   355 drop:anObjectOrCollection at:aPoint
   336     |spec newSel oldSel|
   356     |spec newSel oldSel dragOffset|
       
   357 
       
   358 Transcript showCR:aPoint.
   337 
   359 
   338     (oldSel := selection) isCollection ifTrue:[
   360     (oldSel := selection) isCollection ifTrue:[
   339         oldSel := selection copy
   361         oldSel := selection copy
   340     ].
   362     ].
   341     spec := (anObjectOrCollection at:1) theObject.
   363     spec := (anObjectOrCollection at:1) theObject.
   342     newSel := self pasteSpecifications:spec keepLayout:false.
   364     dragOffset := DragAndDropManager dragOffsetQuerySignal raise.
       
   365     newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
   343 
   366 
   344     oldSel isNil ifTrue:[self select:newSel]
   367     oldSel isNil ifTrue:[self select:newSel]
   345                 ifFalse:[self select:oldSel]
   368                 ifFalse:[self select:oldSel]
       
   369 
       
   370     "Modified: 11.8.1997 / 01:07:09 / cg"
   346 ! !
   371 ! !
   347 
   372 
   348 !UIPainterView methodsFor:'generating output'!
   373 !UIPainterView methodsFor:'generating output'!
   349 
   374 
   350 generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
   375 generateActionMethodFor:aspect spec:protoSpec inClass:targetClass