On 01/02/2010, at 9:27 PM, Ernesto Giannotta wrote:
> Hello list,
>
> I'm using NSDocument default undoManager but want to override it's change
> counting behaviour
> (I want the black modifed dot to not show when some minor changes are done,
> but still have them undoable)
>
> I've discovered it's internally handled by these methods observing the
> undoManager's notifications:
>
> - (void) _changeWasDone: (NSNotification *)notification
>
> - (void) _changeWasUndone: (NSNotification *)notification
>
> - (void) _changeWasRedone: (NSNotification *)notification
>
> I can hack these just fine by overriding them in my NSDocument subclass but I
> feel uncomfortable with that
> (and with those compiler warnings obviously thrown by XCode)
>
> I've also tried to intercept the undoManager's notifications
> which I can do but can't find a way to prevent them from propagating to the
> default handlers
>
>
> Am I missing something or should I implement my own undoManager just to
> handle this minor tweak?
You can override the public method -updateChangeCount: which I think the
private methods you mention call.
The difficulty you will have is to detect which undo task was "major" and which
was "minor", since the default undo manager makes no distinction. That strikes
me as your biggest problem here.
On the other hand, why confuse your users? If something's important enough to
be undoable it should be important enough to save, so should set the dirty
flag. Every other app does that, so yours will appear broken, with undoable
changes not allowing a save. The user will not be able to tell what is 'major'
and what is 'minor' as you've decided that for them, without giving them a
proper way to tell. Alternatively, if a change really is minor, why bother
making it undoable?
--Graham
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com