'From Squeak3.1alpha of 28 February 2001 [latest update: #4193] on 11 July 2001 at 2:29:43 pm'! "Change Set: UniTiles-tk Date: 11 July 2001 Author: Ted Kaehler Three measures to make fewer bad things happen when you click in a random place. These are big changes, so tell me if they don't feel right. [1] To grab a bordered Morph, you must grab the border, or use a handle. This is to stop accidental picking up of objects that don't have any mouse action. [2] Any BookMorph or Stack, may be picked up by its border, its spacing, or its controls. But grabbing in the interior of a page will not pick it up. [3] Dialog boxes (GenericPropertiesMorphs) may not be dropped into anything except the world. Unless property #systemWindowEmbedOK is true. If you want to embed one in a stack, use Embed. "! !Morph methodsFor: 'meta-actions' stamp: 'tk 7/10/2001 17:16'! okToGrabAt: event "I say OK, but BorderedMorphs may not want to be grabbed in their interior." ^ true! ! !BorderedMorph methodsFor: 'geometry' stamp: 'tk 7/11/2001 13:40'! okToGrabAt: event "I may not want to be grabbed in my interior." self borderWidth = 0 ifTrue: [^ true]. "no border to grab, so grab anywhere" ^ (self innerBounds containsPoint: event position) not! ! !BookMorph methodsFor: 'dropping/grabbing' stamp: 'tk 7/11/2001 14:23'! okToGrabAt: event "Books may be grabbed anywhere except within the page itself." currentPage ifNotNil: [^ (currentPage bounds containsPoint: event position) not]. ^ true! ! !GenericPropertiesMorph methodsFor: 'as yet unclassified' stamp: 'tk 7/11/2001 14:00'! wantsToBeDroppedInto: aMorph "Return true if it's okay to drop the receiver into aMorph" ^aMorph isWorldMorph or:[Preferences systemWindowEmbedOK]! ! !PasteUpMorph methodsFor: 'event handling' stamp: 'tk 7/11/2001 13:04'! mouseDown: evt "Handle a mouse down event." | grabbedMorph handHadHalos | grabbedMorph _ self morphToGrab: evt. grabbedMorph ifNotNil:[ grabbedMorph isSticky ifTrue: [^self]. (grabbedMorph okToGrabAt: evt) ifFalse: [^self]. self isPartsBin ifFalse:[^evt hand grabMorph: grabbedMorph]. grabbedMorph _ grabbedMorph partRepresented duplicate. grabbedMorph restoreSuspendedEventHandler. (grabbedMorph fullBounds containsPoint: evt position) ifFalse:[grabbedMorph position: evt position]. "Note: grabbedMorph is ownerless after duplicate so use #grabMorph:from: instead" ^evt hand grabMorph: grabbedMorph from: self]. (super handlesMouseDown: evt) ifTrue:[^super mouseDown: evt]. handHadHalos _ evt hand halo notNil. evt hand halo: nil. "shake off halos" evt hand releaseKeyboardFocus. "shake of keyboard foci" evt shiftPressed ifTrue:[ ^evt hand waitForClicksOrDrag: self event: evt selectors: { #findWindow:. nil. #dragThroughOnDesktop:} threshold: 5]. self isWorldMorph ifTrue: [ handHadHalos ifTrue: [^self addAlarm: #invokeWorldMenu: with: evt after: 200]. ^self invokeWorldMenu: evt ]. "otherwise, explicitly ignore the event if we're not the world, so that we could be picked up if need be" self isWorldMorph ifFalse:[evt wasHandled: false]. ! ! !SystemWindow methodsFor: 'events' stamp: 'tk 7/11/2001 13:08'! okToGrabAt: event "Drag me from the title bar." ^ self labelRect containsPoint: event position! !