thanks a lot alain I confirm that it works. I will start pushing down behavior and try to remove all these worldstate ifNilâ¦. I would really appreciate if you can review my code because it is a sensitive area :). I will create an issue. In particular I would like to remove World global variable and create a singleton what do you think? Stef On Jun 27, 2013, at 9:46 AM, plantec <alain.plantec@yahoo.com> wrote:
Hi all,
After a lot of freezes :) To create a new world and make it be the current world, thanks to PasteUpMorph>>install methods and to the MultiWorld code of sean (found in the bugtracker), I've implemented PasteUpMorph>> beCurrentWorld. Now I guess we are able to design a new clean world class and switch to it more smoothly :)
PasteUpMorph subclass: #WorldMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Worlds'. (Smalltalk at: #WorldMorph) new beCurrentWorld.
But, I don't understand everything. maybe something is missing or bad. maybe part of this code is not useful.
It would be cool is someone could comment this code that we understand and make it cleaner.
Thanks Alain
---------- PasteUpMorph>> beCurrentWorld | morphs | owner := nil. morphs := World submorphs. Sensor flushNonKbdEvents; flushKeyboard; flushEvents; shutDown. self class shutDown. worldState := WorldState new. self addHand: HandMorph new. self borderWidth: 0. self viewBox: Display boundingBox. self borderWidth: 0. "default" self color: self class defaultWorldColor. self addAllMorphs: morphs. SystemWindow noteTopWindowIn: self. World := self. ActiveWorld := self. ActiveHand := self hands first. "default" ActiveEvent := nil. worldState handsDo: [:h | h releaseCachedState]. Sensor startUp. self class startUp. self displayWorldSafely. ---------
Le 26 juin 2013 à 15:41, Stéphane Ducasse <stephane.ducasse@inria.fr> a écrit :
Hi
I think that it would be good to have
PasteUpMorph (a morph in which we can drop morph) subclass World (the world = a morph in which we can drop morph and that have a worldstate)
This would remove a lot of ifNil: everywhere.
Stef