Re: Inspector-aware undo in Doc-based app
Re: Inspector-aware undo in Doc-based app
- Subject: Re: Inspector-aware undo in Doc-based app
- From: Greg Titus <email@hidden>
- Date: Thu, 3 Apr 2003 07:37:15 -0800
Implement the NSWindow delegate method -windowWillReturnUndoManager: on
the delegate of your inspector window. The implementation should look
at the current document window's responder chain for the current undo
manager and return that. Something like this:
- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)aWindow;
{
NSWindow *mainWindow;
NSResponder *nextResponder;
NSUndoManager *undoManager = nil;
mainWindow = [NSApp mainWindow];
nextResponder = [mainWindow firstResponder];
if (nextResponder == nil)
nextResponder = mainWindow;
do {
if ([nextResponder respondsToSelector:@selector(undoManager)])
undoManager = [nextResponder undoManager];
else if ([nextResponder respondsToSelector:@selector(delegate)]
&& [[(id)nextResponder delegate]
respondsToSelector:@selector(undoManager)])
undoManager = [[(id)nextResponder delegate] undoManager];
nextResponder = [nextResponder nextResponder];
} while (nextResponder && !undoManager);
return undoManager;
}
Hope this helps,
- Greg
On Thursday, April 3, 2003, at 05:20 AM, Raphael Sebbe wrote:
>
I am not sure to understand. All undoable operations are implemented
>
on the model, as they should. My problem is about showing the undo
>
actions in the Edit menu, not record it.
>
>
Raphael
>
>
On Thursday, April 3, 2003, at 02:45 PM, j o a r wrote:
>
>
> Implement all related undo methods in the inspector, and every time
>
> they are called, forward the request to the currently inspected >
>
> window.
>
>
>
> j o a r
>
>
>
> On Thursday, Apr 3, 2003, at 14:31 Europe/Stockholm, Raphael Sebbe
>
> wrote:
>
>
>
>> I have a doc-based app with a unique inspector (common to all
>
>> documents). Whenever I click on the inspector, the undo menu item in
>
>> Edit becomes gray, what I want is that it still applies to the
>
>> current document.
>
>>
>
>> Reading the doc, I thought of adding the current document to the
>
>> responder chain (as inspector panel's delegate) but it doesn't work.
>
>> Of course, this is a hack, yet it doesn't work.
>
>>
>
>> So my question, is there a neat way to do that ?
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.