
Thomas Worthington schrieb:
On Tue, 13 Nov 2007 15:11:04 -0000, Maximilian Albert <Anhalter42@...173...> wrote:
But any ideas how to find out whether the document returned to a previously saved state by "bypassing" undo, i.e. via real modifications to the document? (Maybe it wouldn't be hard to implement a kind of checksum for the xml tree; but that's probably overkill).
Perhaps it seems overkill but wouldn't doing, say, an MD5 hash of the tree at file-open and another at file close (to decide if the "Save now" dialog is shown or not) simplify things overall? Nothing would ever need to be marked dirty and things like grid visibility/invisibility pairs would be handled for free.
Yes, that's roughly what I had in mind. There may be situations, however, when you still want the document's states to be considered "equal" even if the xml tree was slightly modified. Say you create a rectangle, add a gradient and then delete the rectangle. This leaves the gradient definition in the defs but the document is "empty". I'm not familiar enough with artists' needs to decide whether it makes sense to store empty documents that only contain some additional gradient definitions (maybe as a template for later reuse?). But when such changes can be safely discarded upon exit it would be nice to be able to detect this somehow.
Max