[squeak-dev] [Help] How do you work deep copier?
peace_the_dreamer at yahoo.com
Sun Apr 25 07:13:16 UTC 2010
I could use some advice on the how deep copier does its work and how to use it to achieve a particular result.
Use case described below.
I want to write some event handling s.t.
1) I can avoid the usual click,dblclick,drag handler (it has deep bugs)
2) I can distinguish behaviors on mouse up between clickup and dragup.
3) I can implement some fairly fancy mousemove drag handling.
4) Hopefully for any morph.
Now I have achieved 1 thru 4 up to the point that I use the mouse halos to make a copy of the morph. Then it breaks down.
The success was to create an event listener (and travel agent) using the
morphs #on:sendTo: mechanism to send the morphs events to this travel agent.
The agent keeps track of the origin and destination of the morph on each leg of its journey. It also holds on to the movement model for the morph.
Each morph needs its own agent so that the origin and destination state apply to it alone.
problem: When the halos duplicates the morph they give the new morph the same agent as the old morph.
The result is that changing destinations for one or the other affects the behavior of both adversely.
analysis so far: the halo dup handle sends the #duplicate message to the morph. Which in turn sends deep copy. I tried looking into it further but deep copy is a horror. Knowing so many special cases it has grown a page long. I gave up for the moment.
The agent object is pointed to in several places in the event handlers ivars. So it needs to be changed into the same something else in about three places.
Question: Is there some message that the agent will be sent during the deep copy process. And if so how should it handle that message to produce the desired result?
Yours in curiosity and service, --Jerome Peace
More information about the Squeak-dev