[Drawkit] Drawing Changed Indicator?
Graham Cox
graham.cox at bigpond.com
Fri Feb 5 01:07:46 PST 2010
Hi Allan,
Are you using any form of Undo? If so, that's probably the easiest way to tell - if there is anything to undo, there are unsaved changes. This is essentially how NSDocument works as well - it receives notifications from the undo manager which drive the save change status.
If you're not using Undo, it's going to be a lot trickier, since DK in itself doesn't have much of a concept of 'unsaved', as it is not responsible for saving apart from supplying the data to be saved when requested. It might be possible to observe objects via KVO and track changes that way but it's not going to be very straightforward. Really, undo is the only object that is informed for all possible changes that occur. If you don't want to use undo you could still set a private undo manager and receive notifications from it, perhaps settings it history length to 1 (the minimum length possible) to avoid it accumulating too much stuff in memory.
--Graham
On 05/02/2010, at 5:24 PM, Allan Daly wrote:
> Hi Graham,
>
> I'm using DK drawings and views in my application and I'm at a point where it would be useful to be able to know if a user has changed the content or configuration of a drawing such that it needs to be saved. Is there a way to look at the properties of a drawing or drawing view and find out if the drawing has been changed since the last save?
>
> I'm not using DKDrawingDocument objects -- just straight DKDrawings and DKDrawingViews.
>
> Thanks for any ideas you might have.
>
> -Allan
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
More information about the Drawkit
mailing list