'From etoys3.0 of 24 February 2008 [latest update: #2083] on 23 August 2008 at 4:15:28 pm'! "Change Set: retreatOnDirArrow-sw Date: 23 August 2008 Author: Scott Wallace Step back (for the moment) from requiring the shift key to be down in order to operate the direction handle, because of the emergence of a sporadic but intractable issue that was revealed by update 2082centerOfRot. With this update, you can now operate the direction-arrow with the shift key either down or up. Also, fixes the long-standing bug that if a morph bearing a halo is dragged and then dropped, the direction and center-of-rotation handles reappear behind the morph, hence usually invisible and inaccessible. When an unexpected drag results from the bug relating to shift-drag of the forward-direction handle, this fix becomes especially important, since at least the forward-direction handle will reappear after the drag."! !Morph methodsFor: 'dropping/grabbing' stamp: 'sw 8/23/2008 12:37'! justDroppedInto: aMorph event: anEvent "This message is sent to a dropped morph after it has been dropped on -- and been accepted by -- a drop-sensitive morph" | aWindow partsBinCase cmd aStack | self formerOwner: nil. self formerPosition: nil. cmd _ self valueOfProperty: #undoGrabCommand. cmd ifNotNil:[aMorph rememberCommand: cmd. self removeProperty: #undoGrabCommand]. (partsBinCase _ aMorph isPartsBin) ifFalse: [self isPartsDonor: false]. (aWindow _ aMorph ownerThatIsA: SystemWindow) ifNotNil: [aWindow isActive ifFalse: [aWindow activate]]. (self isInWorld and: [partsBinCase not]) ifTrue: [self world startSteppingSubmorphsOf: self]. "Note an unhappy inefficiency here: the startStepping... call will often have already been called in the sequence leading up to entry to this method, but unfortunately the isPartsDonor: call often will not have already happened, with the result that the startStepping... call will not have resulted in the startage of the steppage." "An object launched by certain parts-launcher mechanisms should end up fully visible..." (self hasProperty: #beFullyVisibleAfterDrop) ifTrue: [aMorph == ActiveWorld ifTrue: [self goHome]. self removeProperty: #beFullyVisibleAfterDrop]. (self holdsSeparateDataForEachInstance and: [(aStack _ self stack) notNil]) ifTrue: [aStack reassessBackgroundShape]. self halo ifNotNilDo: [:h | h comeToFront]! ! !Morph methodsFor: 'halos and balloon help' stamp: 'sw 8/23/2008 16:08'! balloonHelpTextForHandle: aHandle "Answer a string providing balloon help for the given halo handle" | itsSelector | itsSelector _ aHandle eventHandler firstMouseSelector. #( (addFullHandles 'More halo handles' translatedNoop) (addSimpleHandles 'Fewer halo handles' translatedNoop) (chooseEmphasisOrAlignment 'Emphasis & alignment' translatedNoop) (chooseFont 'Change font' translatedNoop) (chooseNewGraphicFromHalo 'Choose a new graphic' translatedNoop) (chooseStyle 'Change style' translatedNoop) (dismiss 'Remove' translatedNoop) (doDebug:with: 'Debug (press shift to inspect morph)' translatedNoop) (doDirection:with: 'Choose forward direction' translatedNoop) (doDup:with: 'Duplicate' translatedNoop) (doDupOrMakeSibling:with: 'Duplicate (press shift to make a sibling)' translatedNoop) (doMakeSiblingOrDup:with: 'Make a sibling (press shift to make simple duplicate)' translatedNoop) (doMakeSibling:with: 'Make a sibling' translatedNoop) (doMenu:with: 'Menu' translatedNoop) (doGrab:with: 'Pick up' translatedNoop) (editButtonsScript 'See the script for this button' translatedNoop) (editDrawing 'Repaint' translatedNoop) (maybeDoDup:with: 'Duplicate' translatedNoop) (makeNascentScript 'Make a scratch script' translatedNoop) (makeNewDrawingWithin 'Paint new object' translatedNoop) (mouseDownInCollapseHandle:with: 'Collapse' translatedNoop) (mouseDownOnHelpHandle: 'Help' translatedNoop) (openViewerForArgument 'Open a Viewer for me' translatedNoop) (openViewerForTarget:with: 'Open a Viewer for me') (paintBackground 'Paint background' translatedNoop) (prepareToTrackCenterOfRotation:with: 'Center of rotation (hold down shift key and drag to change it)' translatedNoop) (presentViewMenu 'Present the Viewing menu' translatedNoop) (startDrag:with: 'Move' translatedNoop) (startGrow:with: 'Change size (press shift to preserve aspect)' translatedNoop) (startRot:with: 'Rotate' translatedNoop) (startScale:with: 'Change scale' translatedNoop) (tearOffTile 'Make a tile representing this object' translatedNoop) (tearOffTileForTarget:with: 'Make a tile representing this object') (trackCenterOfRotation:with: 'Set center of rotation' translatedNoop)) do: [:pair | itsSelector == pair first ifTrue: [^ pair second]]. (itsSelector == #mouseDownInDimissHandle:with:) ifTrue: [^ Preferences preserveTrash ifTrue: ['Move to trash' translatedNoop] ifFalse: ['Remove from screen' translatedNoop]]. (itsSelector == #doRecolor:with:) ifTrue: [ ^ Preferences propertySheetFromHalo ifTrue: ['Property Sheet (press shift for simple recolor)' translatedNoop] ifFalse: ['Change color (press shift for more properties)' translatedNoop]]. ^ 'unknown halo handle'! ! !HaloMorph methodsFor: 'private' stamp: 'sw 8/23/2008 16:12'! addDirectionHandles "If appropriate, add center-of-rotation and forward-direction handles to the halo." | centerHandle d w directionShaft patch patchColor crossHairColor | self showingDirectionHandles ifFalse: [^ self]. directionArrowAnchor _ (target point: target referencePosition in: self world) rounded. patch _ target imageFormForRectangle: (Rectangle center: directionArrowAnchor extent: 3@3). patchColor _ patch colorAt: 1@1. (directionShaft _ LineMorph newSticky makeForwardArrow) borderWidth: 2; borderColor: (Color green orColorUnlike: patchColor). self positionDirectionShaft: directionShaft. self addMorphFront: directionShaft. directionShaft setCenteredBalloonText: 'Set forward direction' translated; on: #mouseDown send: #doDirection:with: to: self; on: #mouseMove send: #trackDirectionArrow:with: to: self; on: #mouseUp send: #setDirection:with: to: self. directionShaft setProperty: #activateOnShift toValue: true. d _ 15. "diameter" w _ 3. "borderWidth" crossHairColor _ Color red orColorUnlike: patchColor. (centerHandle _ EllipseMorph newBounds: (0@0 extent: d@d) color: Color transparent) borderWidth: w; borderColor: (Color blue orColorUnlike: patchColor); addMorph: (LineMorph from: (d//2)@w to: (d//2)@(d-w-1) color: crossHairColor width: 1) lock; addMorph: (LineMorph from: w@(d//2) to: (d-w-1)@(d//2) color: crossHairColor width: 1) lock; align: centerHandle bounds center with: directionArrowAnchor. self addMorph: centerHandle. centerHandle setCenteredBalloonText: 'Rotation center (hold down the shift key and drag to change it)' translated; on: #mouseDown send: #prepareToTrackCenterOfRotation:with: to: self; on: #mouseMove send: #trackCenterOfRotation:with: to: self; on: #mouseUp send: #setCenterOfRotation:with: to: self ! ! !HaloMorph methodsFor: 'private' stamp: 'sw 8/23/2008 12:19'! doDirection: anEvent with: directionHandle "The mouse went down on the forward-direction halo handle; respond appropriately." anEvent hand obtainHalo: self. "anEvent shiftPressed " true ifTrue: [self removeAllHandlesBut: directionHandle] ifFalse: [PopUpMenu informCenteredAboveCursor: 'To change the forward-direction, hold down the shift key as you drag from the green arrowhead.' translated. ^ self]! !