[FIX] Menu embedding

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Sat May 6 11:52:26 UTC 2000


"Change Set:		menuembed-bf
Date:			4 May 2000
Author:			Bert Freudenberg

Extends the systemWindowEmbedOK preference to Menus so they don't get
embedded. IMHO this should be extended to book morphs etc. Maybe there
should be a dontEmbed flag for every morph?"

-- Bert
-------------- next part --------------
'From Squeak2.8alpha of 19 January 2000 [latest update: #2052] on 6 May 2000 at 1:27:45 pm'!
"Change Set:		menuembed-bf
Date:			4 May 2000
Author:			Bert Freudenberg

Extends the systemWindowEmbedOK preference to Menus so they don't get embedded. IMHO this should be extended to book morphs etc. Maybe there should be a dontEmbed flag for every morph?"!


!HandMorph methodsFor: 'grabbing/dropping' stamp: 'bf 5/4/2000 14:23'!
dropTargetFor: aMorph event: evt
	"Return the morph that the given morph is to be dropped onto.  Return nil if we must repel the morph.  Return the world, if no other morph wants the dropping morph."

	| root coreSample |
	root _ nil.
	owner submorphsReverseDo: [:m |
		((m fullContainsPoint: evt cursorPoint) and:
		 [(m isKindOf: HaloMorph) not]) ifTrue: [root _ m]].
	root == nil ifTrue: [^ self world].
	coreSample _ root morphsAt: evt cursorPoint.
	(Preferences systemWindowEmbedOK not and:
		[(aMorph isKindOf: SystemWindow) or: [aMorph isKindOf: MenuMorph]])
			ifTrue: [^ self world].
	coreSample do:
		[:m |
			(m repelsMorph: aMorph event: evt) ifTrue:
				[^ nil]].

	coreSample do:
		[:m |
			(m wantsDroppedMorph: aMorph event: evt) ifTrue: [^ m]].
	^ self world
! !


!PasteUpMorph methodsFor: 'dropping/grabbing' stamp: 'bf 5/4/2000 14:23'!
repelsMorph: aMorph event: ev
	(Preferences systemWindowEmbedOK not and:
		[(aMorph isKindOf: SystemWindow) or: [aMorph isKindOf: MenuMorph]])
			ifTrue: [^ false].
	(aMorph isKindOf: Viewer) ifTrue: [^ false].
	openToDragNDrop ifFalse: [^ true].
	(self wantsDroppedMorph: aMorph event: ev) ifFalse: [^ true].
	^ super repelsMorph: aMorph event: ev "consults #repelling flag"! !

!PasteUpMorph methodsFor: 'dropping/grabbing' stamp: 'bf 5/4/2000 14:24'!
wantsDroppedMorph: aMorph event: evt
	self visible ifFalse: [^ false].  "will be a call to #hidden again very soon"
	self openToDragNDrop ifFalse: [^ false].
	(self bounds containsPoint: (self pointFromWorld: evt cursorPoint)) ifFalse: [^ false].
	(Preferences systemWindowEmbedOK not and:
		[(aMorph isKindOf: SystemWindow) or: [aMorph isKindOf: MenuMorph]])
			ifTrue:	[^ false].
	((aMorph isKindOf: BookPageSorterMorph) and: [self isWorldMorph not])
		ifTrue:	[^ false].

	(aMorph isKindOf: Viewer) ifTrue: [^ self isWorldMorph].
	^ true! !



More information about the Squeak-dev mailing list