UIPainterView.st
changeset 1520 eb77c52704c7
parent 1500 36c0b4b268b8
child 1543 09c4ed98434d
equal deleted inserted replaced
1519:6196930f9a1d 1520:eb77c52704c7
   514     ^ false
   514     ^ false
   515 
   515 
   516 !
   516 !
   517 
   517 
   518 drop:anObjectOrCollection at:aPoint
   518 drop:anObjectOrCollection at:aPoint
   519     |spec newSel oldSel dragOffset|
   519     |spec newSel oldSel dragOffset widg|
   520 
   520 
   521     self selection notNil ifTrue:[
   521     self selection notNil ifTrue:[
   522         oldSel := self singleSelection.
   522         oldSel := self singleSelection.
   523 
   523 
   524         (self canPasteInto:oldSel) ifFalse:[
   524         "/ search selections hierarchy for a widget into which we can paste
   525             oldSel := nil.
   525         widg := oldSel.
   526             self setSelection:nil withRedraw:true
   526         [widg isNil or:[self canPasteInto:widg]] whileFalse:[
   527         ]
   527             widg notNil ifTrue:[
       
   528                 widg := widg container
       
   529             ].
       
   530         ].
       
   531 
       
   532         oldSel := nil.
       
   533         self setSelection:widg withRedraw:true.
   528     ].
   534     ].
   529     spec := (anObjectOrCollection at:1) theObject.
   535     spec := (anObjectOrCollection at:1) theObject.
   530     dragOffset := DragAndDropManager dragOffsetQuerySignal query.
   536     dragOffset := DragAndDropManager dragOffsetQuerySignal query.
   531     newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
   537     newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
   532 
   538 
   533     oldSel isNil ifTrue:[self select:newSel]
   539     self select:(oldSel ? newSel)
   534                 ifFalse:[self select:oldSel]
       
   535 
   540 
   536     "Modified: / 18.3.1999 / 18:29:43 / stefan"
   541     "Modified: / 18.3.1999 / 18:29:43 / stefan"
       
   542     "Modified: / 30.10.2001 / 14:02:35 / cg"
   537 ! !
   543 ! !
   538 
   544 
   539 !UIPainterView methodsFor:'event handling'!
   545 !UIPainterView methodsFor:'event handling'!
   540 
   546 
   541 keyPress:key x:x y:y view:aView
   547 keyPress:key x:x y:y view:aView
  1960                 name = props name ifFalse:[
  1966                 name = props name ifFalse:[
  1961                     (self propertyOfName:name) notNil ifTrue:[
  1967                     (self propertyOfName:name) notNil ifTrue:[
  1962                         name := props name
  1968                         name := props name
  1963                     ]
  1969                     ]
  1964                 ].
  1970                 ].
       
  1971 
  1965                 aSpec name:name.
  1972                 aSpec name:name.
  1966                 self createUndoSpecModify:props.
  1973                 self createUndoSpecModify:props.
  1967                 self rebuildView:aView fromSpec:aSpec withBuilder:nil.
  1974                 self rebuildView:aView fromSpec:aSpec withBuilder:nil.
  1968                 props spec:(aSpec copy).
  1975                 props spec:(aSpec copy).
  1969                 treeView propertyChanged:props.
  1976                 treeView propertyChanged:props.
  1970             ]
  1977             ]
  1971         ]
  1978         ]
  1972     ]
  1979     ]
  1973 
  1980 
  1974     "Modified: 4.7.1997 / 23:49:44 / cg"
  1981     "Modified: / 30.10.2001 / 13:59:45 / cg"
  1975 ! !
  1982 ! !
  1976 
  1983 
  1977 !UIPainterView methodsFor:'testing'!
  1984 !UIPainterView methodsFor:'testing'!
  1978 
  1985 
  1979 canChangeLayoutOfView:aView
  1986 canChangeLayoutOfView:aView
  2125     "undo method for creating or pasting an object
  2132     "undo method for creating or pasting an object
  2126     "
  2133     "
  2127     self forEach:something do:[:anId|self remove:(self findViewWithId:anId)].
  2134     self forEach:something do:[:anId|self remove:(self findViewWithId:anId)].
  2128 !
  2135 !
  2129 
  2136 
       
  2137 undoHistory
       
  2138     ^ undoHistory
       
  2139 
       
  2140     "Created: / 30.10.2001 / 13:42:45 / cg"
       
  2141 !
       
  2142 
  2130 undoLayout:args
  2143 undoLayout:args
  2131     "undo method to set the old layout; see 'createUndoLayout:'
  2144     "undo method to set the old layout; see 'createUndoLayout:'
  2132     "
  2145     "
  2133     |view|
  2146     |view|
  2134 
  2147