[Drawkit] permanent objects

Graham Cox graham.cox at bigpond.com
Fri Jun 13 23:36:04 PDT 2008


Just noticed I hadn't responded - sorry about that.

If you disable the undo manager before adding the object to the layer,  
then re-enabling it, that ought to work (not tried it though).  
Instantiating the object itself doesn't involve the undo manager which  
is maybe why you didn't see any effect. It's the adding the object to  
the layer that is actually undone (if you think about it, this also  
manages the object's existence, because the layer retains the object -  
if the object is never added to a layer, it will be released or  
autoreleased and dealloced. When the undo manager undoes the adding to  
the layer, it also undoes the retain that the layer has on the object.  
 From your point of view it has been deleted as a result - though in  
fact the undo manager is also retaining it for a later possible redo,  
so it still exists in reality - but now "owned" by the undo manager.)

Don't worry - thinking about where objects go when undo is involved  
makes my head spin sometimes too ;-)

cheers, Graham



On 5 Jun 2008, at 12:43 pm, James Maxwell wrote:

> Oh, sorry... I think I wasn't clear. The creation of the first  
> timeline object (done during init) should never be undoable. Other  
> than the first one, all future timelines, created by "splitting" the  
> first one can, and should, be undoable. But how can I make sure that  
> first one won't get undone? I tried disabling the undomanager before  
> instantiating it, then re-enabling it after, but that didn't work...  
> I think this may be because the undo event is being registered  
> somewhere else... yes? Maybe by the layer?



More information about the Drawkit mailing list