Re: Lion: Lock documents and custom undomanager
Re: Lion: Lock documents and custom undomanager
- Subject: Re: Lion: Lock documents and custom undomanager
- From: Mike Abdullah <email@hidden>
- Date: Sat, 11 Feb 2012 15:24:35 +0000
On 11 Feb 2012, at 03:17, Quincey Morris wrote:
> On Feb 10, 2012, at 15:03 , Mike Abdullah wrote:
>
>> My line of thinking:
>>
>> Each time one of your undo managers is about to close its top-level group, register that with the doc's main undo manager. Thus the doc's undo manager will see the change while locked, prompt the user to unlock, and if they do choose to cancel, will undo the change to individual undo manager. Something like:
>>
>> - (void)undoManagerWillCloseGroup:(NSNotification *)notification
>> {
>> NSUndoManager *manager = [notification object];
>> if ([manager groupingLevel] == 1)
>> {
>> [[[self document] undoManager] registerUndoWithTarget:manager selector:@selector(undo) object:nil];
>> }
>> }
>
> Won't this have the effect of causing successive undos to affect various pages, according to the order things were originally done, rather than just undoing within the current "page"? That is, won't it undo on a global "timeline" rather than a per-page timeline?
I'm assuming the doc's undo manger is hidden from the user; that there's no way from the UI to make it undo/redo.
>
> I don't recall that this was discussed, but what happens if the document's undo manager is changed to the page undo manager every time page switch occurs? I can't work out if the OP tried this and found that the document's "edited" status doesn't capture the undo manager states properly, or if the OP didn't try this.
In theory I reckon that could work. Not sure I'd trust the framework to accept a regularly changing undo manager enough though.
_______________________________________________
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