ChangeCount for Multiple Undo Managers
ChangeCount for Multiple Undo Managers
- Subject: ChangeCount for Multiple Undo Managers
- From: Gordon Apple <email@hidden>
- Date: Wed, 30 Dec 2009 12:19:25 -0600
- Thread-topic: ChangeCount for Multiple Undo Managers
When in the course of undo events, it becomes necessary to introduce
multiple undo managers, certain issues arise. For example: How to handle
the document change count?
I currently have at least a half dozen independent undo managers for my
document, which I keep in a bank near the document level. Each undo manager
is monitored for change notifications, and dings the document's change count
appropriately. This seems to work, except that, being the meticulous
systems engineer that I am, I'm a strong believer in Murphy. For a new or
newly opened document, this will correctly ask the user to save when the
document is closed, and then zeros the doc's change count. However, if the
user first saves the document, then decides to change something in one undo
context, then undoes something in another undo context, the change count
will be zero and closing the doc will not ask for a save. (Doing such
changes in the opposite order will pop the "undo after save" dialog.)
Anyway, this is not the desired result.
It looks like I need to maintain individual change counts for each undo
manager, zero them all on "save". When closing the doc, ANY non-zero
(positive or negative) change count should trigger the "save" dialog.
Am I making this too hard, or is there a more straightforward way?
Also, why the heck is there no accessor to read the doc's change count? I
could let the doc handle it if non-zero, and otherwise scan the undo bank
and pop the save dialog is necesssary.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden