[Drawkit] permanent objects
James Maxwell
jbmaxwell at rubato-music.com
Wed Jun 4 19:43:22 PDT 2008
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?
J.
On 4-Jun-08, at 7:24 PM, Graham Cox wrote:
>
> On 5 Jun 2008, at 12:01 pm, James Maxwell wrote:
>
>> Hey Graham,
>>
>> Yes, it's just a DKDrawableShape, so I could most certainly lock
>> it! Can't believe I didn't think of that! :-\
>> Mind you, will this prevent its initial instantiation from being
>> undone? It all gets a bit weird, because I will want to be able to
>> undo creation of later instances of these objects... I may have to
>> think this through a bit more, I suppose.
>
>
> Undo will still work fine. Locking an object is really a contract
> between it and various tools/layers - if they see that flag they
> basically agree not to touch it. But if they went ahead and did
> anyway, the object itself would be unable to entirely enforce the
> lock status. Thus, adding and deleting locked objects
> programatically is still possible and thus undoable (but user
> interaction such as hitting 'delete' will honour the lock flag).
>
> In the next update I added an overrideable method -
> objectMayBecomeSelected that will also help you in this situation -
> normally all objects return YES, but if you return NO your object
> can't ever be selected and will never display a selection highlight.
> It is intended to permit non-editable content to be intermixed with
> editable content.
>
> There are other approaches too - you could add these objects to a
> separate layer and lock the layer as a whole for example.
>
>> Basically, I'm creating something similar to a timeline with
>> barlines for this app (music app), but they're only barlines in the
>> most basic formal sense - they demarcate a border between two
>> metric formalisms - which in this app means they split the
>> timeline. They're not barlines in a traditional sense. So, each
>> time I create one of these quasi-barlines, I will be "splitting"
>> the existing timeline object; shortening the existing one to end at
>> the barline, and creating a new one, which starts at the barline.
>> I'm not sure how I'll make this undoable yet, but I'm just
>> experimenting with ideas, at this point...
>>
>
> OK, well I don't see any special case necessarily being needed here
> - adding new objects will be undoable anyway. If you perform a split
> by resizing the object that also will be undoable by default.
>
>
> cheers, Graham
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
More information about the Drawkit
mailing list