[Etoys] [fix] PasteUpMorph shall not accept ScriptEditorMorph version 3

Karl karl.ramberg at chello.se
Tue Dec 5 12:17:33 EST 2006


Karl wrote:
> Karl wrote:
>> Yoshiki Ohshima wrote:
>>>
>>>   * [fix] PasteUpMorph shall not accept ScriptEditorMorph (version 3)
>>>
>>>     This was also a feature.  Think Takashi's Demon Castle tutorial.
>>>     This one and the other one has upside and downside, and not
>>>     entirely obvious whether to be included or not.
>> Thinking about this a little I remembered that we have a preference 
>> that deals with this issue : systemWindowEmbedOK
>> Before the preference was introduced all menus and SystemWindows 
>> would embed into PasteUpMorphs etc.
>> What do you think of using the preference on ScriptEditorMorphs as 
>> well, I think they are a kind of SystemWindow and
>> it would be possible to change setting when one really wants to embed 
>> the ScriptEditorMorph. Maybe one wants to embed some menus and 
>> SystemWindows in the future as well and the preference is then 
>> already set for you :-) 
> Here is the change set with the preference systemWindowEmbedOK.
>
> Karl
>
And here _with_ the change set :-)
Karl
-------------- next part --------------
'From OLPC2.0 of ''24 October 2006'' [latest update: #1135] on 5 December 2006 at 6:13:09 pm'!

!PasteUpMorph methodsFor: 'dropping/grabbing' stamp: 'kfr 12/5/2006 18:11'!
acceptDroppingMorph: dropped event: evt
	"The supplied morph, known to be acceptable to the receiver, is now to be assimilated; the precipitating event is supplied"

	| mm tfm aMorph |
	aMorph _ self morphToDropFrom: dropped.
	self isWorldMorph
		ifTrue:["Add the given morph to this world and start stepping it if it wants to be."
				self addMorphFront: aMorph.
				(aMorph fullBounds intersects: self viewBox) ifFalse:
					[Beeper beep.  aMorph position: self bounds center]]
		ifFalse:[((dropped isKindOf: TileLikeMorph) and:[Preferences systemWindowEmbedOK not])
			ifTrue:[^ self world acceptDroppingMorph: aMorph event: evt].
			(((dropped isKindOf: ScriptEditorMorph) or:[ (dropped isKindOf: WatcherWrapper)]) and:[Preferences systemWindowEmbedOK not])
			ifTrue:[self world acceptDroppingMorph: aMorph event: evt]
			ifFalse:[super acceptDroppingMorph: aMorph event: evt]].

	aMorph submorphsDo: [:m | (m isKindOf: HaloMorph) ifTrue: [m delete]].
	aMorph allMorphsDo:  "Establish any penDown morphs in new world"
		[:m | m player ifNotNil:
			[m player getPenDown ifTrue:
				[((mm _ m player costume) notNil and: [(tfm _ mm owner transformFrom: self) notNil])
					ifTrue: [self noteNewLocation: (tfm localPointToGlobal: mm referencePosition)
									forPlayer: m player]]]].

	self isPartsBin
		ifTrue:
			[aMorph isPartsDonor: true.
			aMorph stopSteppingSelfAndSubmorphs.
			aMorph suspendEventHandler]
		ifFalse:
			[self world startSteppingSubmorphsOf: aMorph].

	self presenter morph: aMorph droppedIntoPasteUpMorph: self.

	self showingListView ifTrue:
		[self sortSubmorphsBy: (self valueOfProperty: #sortOrder).
		self currentWorld abandonAllHalos]! !



More information about the etoys-dev mailing list