'From Squeak3.3alpha of 18 January 2002 [latest update: #4829] on 20 April 2002 at 1:48:26 am'! "Change Set: resist-swjg Date: 20 April 2002 Author: Scott Wallace, Joshua Gargus Fixes up a bug in the interaction between the resists-removal property and the animate-to-trash code. Makes menu-wording improvements in the two 'resist' items, which are also propagated into the corresponding Viewer wordings."! !Morph methodsFor: 'submorphs-add/remove' stamp: 'sw 4/19/2002 22:56'! dismissViaHalo "The user has clicked in the delete halo-handle. This provides a hook in case some concomitant action should be taken, or if the particular morph is not one which should be put in the trash can, for example." Preferences preserveTrash ifFalse: [^ self dismissMorph: ActiveEvent]. TrashCanMorph moveToTrash: self! ! !Morph methodsFor: 'menus' stamp: 'sw 4/20/2002 01:38'! addToggleItemsToHaloMenu: aMenu "Add standard true/false-checkbox items to the memu" #((resistsRemovalString toggleResistsRemoval 'whether I should be reistant to easy deletion via the pink X handle') (stickinessString toggleStickiness 'whether I should be resistant to a drag done by mousing down on me') (lockedString lockUnlockMorph 'when "locked", I am inert to all user interactions') (hasClipSubmorphsString changeClipSubmorphs 'whether the parts of objects within me that are outside my bounds should be masked.') (hasDirectionHandlesString changeDirectionHandles 'whether direction handles are shown with the halo') (hasDragAndDropEnabledString changeDragAndDrop 'whether I am open to having objects dropped into me')) do: [:trip | aMenu addUpdating: trip first action: trip second. aMenu balloonTextForLastItem: trip third]. self couldHaveRoundedCorners ifTrue: [aMenu addUpdating: #roundedCornersString action: #toggleCornerRounding. aMenu balloonTextForLastItem: 'whether my corners should be rounded']! ! !Morph methodsFor: 'menus' stamp: 'sw 4/20/2002 01:50'! resistsRemovalString "Answer the string to be shown in a menu to represent the 'resistsRemoval' status" ^ self resistsRemoval ifTrue: ['resist being deleted'] ifFalse: ['resist being deleted']! ! !Morph methodsFor: 'menus' stamp: 'jcg 4/19/2002 22:14'! stickinessString "Answer the string to be shown in a menu to represent the stickiness status" ^ self isSticky ifTrue: ['resist being picked up'] ifFalse: ['resist being picked up']! ! !HaloMorph methodsFor: 'private' stamp: 'sw 4/19/2002 23:56'! maybeDismiss: evt with: dismissHandle "Ask hand to dismiss my target if mouse comes up in it." evt hand obtainHalo: self. (dismissHandle containsPoint: evt cursorPoint) ifFalse: [self delete. target addHalo: evt] ifTrue: [target resistsRemoval ifTrue: [(PopUpMenu confirm: 'Really throw this away' trueChoice: 'Yes' falseChoice: 'Um, no, let me reconsider') ifFalse: [^ self]]. Preferences preserveTrash ifTrue: [Preferences soundsEnabled ifTrue: [TrashCanMorph playDeleteSound]. self stopStepping. super delete. target slideToTrash: evt] ifFalse: [self delete. target dismissViaHalo]]! ! !Morph class methodsFor: 'scripting' stamp: 'sw 4/20/2002 00:47'! additionsToViewerCategoryDragAndDrop "Answer viewer additions for the 'drag & drop' category" ^#( #'drag & drop' ( (slot 'drop enabled' 'Whether drop is enabled' Boolean readWrite Player getDropEnabled Player setDropEnabled:) (slot 'resist being picked up' 'Whether a simple mouse-drag on this object should allow it to be picked up' Boolean readWrite Player getSticky Player setSticky:) (slot 'resist deletion' 'Whether this is resistant to easy removal via the pink X halo handle.' Boolean readWrite Player getResistsRemoval Player setResistsRemoval:) (slot 'be locked' 'Whether this object should be blind to all input' Boolean readWrite Player getIsLocked Player setIsLocked:) ))! ! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'sw 4/20/2002 01:38'! addWorldToggleItemsToHaloMenu: aMenu "Add toggle items for the world to the halo menu" #( (hasDragAndDropEnabledString changeDragAndDrop 'whether I am open to having objects dropped into me') (roundedCornersString toggleCornerRounding 'whether the world should have rounded corners')) do: [:trip | aMenu addUpdating: trip first action: trip second. aMenu balloonTextForLastItem: trip third]! ! Morph removeSelector: #dismissMorph!