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: Fri, 10 Feb 2012 23:03:43 +0000
On 7 Feb 2012, at 11:28, Georg Seifert wrote:
> Hi,
>
> I have several undomanagers in my app. (I know that is unusual. Think of it as if you had a page layout app and every page has its own undo.)
>
> This all works well except if the document is locked. Then the documents undomanager knows about this and prevents the change and generates a error. But my undomanagers are not in sync with the document. I do not find anything about that in the docs. So, is there any way to get the locked state of the document or to connect the undomanagers with the document?
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];
}
}
_______________________________________________
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