'From Squeak3.1alpha of 4 February 2001 [latest update: #3533] on 6 February 2001 at 10:26:05 pm'! "Change Set: MoreTileTweaks-ar Date: 6 February 2001 Author: Andreas Raab Some niceties for the latest tile tweak. Generalize the notification about morphs that were just grabbed by implementing Morph>>justGrabbedFrom:, rename the method #markEdited into #recompileScript ('cause that's what it does), remove the obsolete change notification when grabbing tiles, and clean up the #topEditor implementation while we're at it."! !Morph methodsFor: 'dropping/grabbing' stamp: 'ar 2/6/2001 22:12'! justGrabbedFrom: formerOwner "The receiver was just grabbed from its former owner and is now attached to the hand. By default, we pass this message on if we're a renderer." (self isRenderer and:[self hasSubmorphs]) ifTrue:[self firstSubmorph justGrabbedFrom: formerOwner].! ! !Morph methodsFor: 'e-toy support' stamp: 'ar 2/6/2001 22:16'! topEditor owner ifNil:[^nil]. ^owner topEditor! ! !HandMorph methodsFor: 'grabbing/dropping' stamp: 'ar 2/6/2001 22:15'! grabMorph: aMorph from: formerOwner "Grab the given morph (i.e., add it to this hand and remove it from its current owner) without changing its position. This is used to pick up a morph under the hand's current position, versus attachMorph: which is used to pick up a morph that may not be near this hand." | grabbed offset targetPoint grabTransform fullTransform | self releaseMouseFocus. "Break focus" grabbed _ aMorph. "Compute the transform to apply to the grabbed morph" grabTransform _ formerOwner ifNil: [IdentityTransform new] ifNotNil: [formerOwner grabTransform]. "Compute the full transform for the grabbed morph" fullTransform _ formerOwner ifNil: [IdentityTransform new] ifNotNil: [formerOwner transformFrom: owner]. "targetPoint is point in aMorphs reference frame" targetPoint _ fullTransform globalPointToLocal: self position. "but current position will be determined by grabTransform, so compute offset" offset _ targetPoint - (grabTransform globalPointToLocal: self position). "apply the transform that should be used after grabbing" grabbed _ grabbed transformedBy: grabTransform. grabbed == aMorph ifFalse: [grabbed setProperty: #addedFlexAtGrab toValue: true]. "offset target to compensate for differences in transforms" grabbed position: grabbed position - offset asIntegerPoint. "And compute distance from hand's position" targetOffset _ grabbed position - self position. self addMorphBack: grabbed. grabbed justGrabbedFrom: formerOwner.! ! !ScriptEditorMorph methodsFor: 'other' stamp: 'ar 2/6/2001 22:07'! recompileScript "A hook called in several places in the UI when something has been dragged & dropped into or out of the script." self install. "self stopScript"! ! !ScriptEditorMorph methodsFor: 'other' stamp: 'ar 2/6/2001 22:17'! topEditor ^super topEditor ifNil:[self]! ! !ScriptEditorMorph methodsFor: 'private' stamp: 'ar 2/6/2001 22:07'! scriptEdited | anEditor | (anEditor _ self topEditor) ifNotNil: [anEditor recompileScript]! ! !TileLikeMorph methodsFor: 'dropping/grabbing' stamp: 'ar 2/6/2001 22:13'! justGrabbedFrom: formerOwner | editor | editor _ formerOwner topEditor. editor ifNotNil:[editor scriptEdited].! ! !CompoundTileMorph methodsFor: 'miscellaneous' stamp: 'ar 2/6/2001 22:07'! recompileScript "Pertains only when the test is outside a script?!!" ! ! !CompoundTileMorph methodsFor: 'miscellaneous' stamp: 'ar 2/6/2001 22:17'! topEditor "I can act as the top editor" ^super topEditor ifNil:[self]! ! !TileMorph methodsFor: 'dropping/grabbing' stamp: 'ar 2/6/2001 22:13'! justGrabbedFrom: formerOwner | editor | editor _ formerOwner topEditor. editor ifNotNil:[editor scriptEdited].! ! TilePadMorph removeSelector: #topEditor! TileMorph removeSelector: #aboutToBeGrabbedBy:! TileMorph removeSelector: #topEditor! PhraseTileMorph removeSelector: #topEditor! CompoundTileMorph removeSelector: #markEdited! TileLikeMorph removeSelector: #aboutToBeGrabbedBy:! ScriptEditorMorph removeSelector: #markEdited!