[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFA/base] NSUndoManager cleanup
From: |
David Ayers |
Subject: |
Re: [RFA/base] NSUndoManager cleanup |
Date: |
Tue, 15 Jul 2003 13:54:17 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507 |
Adam Fedor wrote:
Wow documentation! I'd approve it just for that :-)
Caught the bait ;-)
I sort-of hate to remove ivars unnecessarily, due to the (small)
incompatibility it creates between different library versions. Perhaps
just replace it by _unused1? I don't think an extra ivar adds that
much memory...
Good point, done as such.
Plus I've added:
(-[NSUndoManager methodSignatureForSelector:]): Overriden to
forward request to target supplied by
-prepareWithInvocationTarget: if available.
(-[NSUndoManager init]): Have receiver default to group by event.
As required by Apple's [NSObject -forwardInvocation:] docs (recently
cited on the list) and [NSUndoManager groupsByEvent].
Here's the whole ChangeLog again:
* Headers/gnustep/base/NSUndoManager.h: Add
NSUndoCloseGroupingRunLoopOrdering enum. Replace instance
variables _registeredUndo with _runLoopGroupingPending and
_actionName with _unused1.
* Source/NSUndoManager.m: Added documentation.
Added actionName instance variable to PrivateUndoGroup.
(-[PrivateUndoGroup actionName]): New method.
(-[PrivateUndoGroup setActionName]): Ditto.
(-[PrivateUndoGroup dealloc]): Release new instance variable.
(-[PrivateUndoGroup initWithParent:]): Initialize actionName.
(-[NSUndoManager forwardInvocation]): Implicitly call
beginUndoGrouping if group has not been setup and we are grouping
by events. Register _loop: invocation if none is already pending
and if we are grouping by event.
(-[NSUndoManager registerUndoWithTarget:selector:object]): Ditto.
(-[NSUndoManager methodSignatureForSelector:]): Overriden to
forward request to target supplied by
-prepareWithInvocationTarget: if available.
(-[NSUndoManager _loop:]): Set flag to determine pending _loop:
processing.
(-[NSUndoManager init]): Removed access to _actionName. Have
receiver default to group by event.
(-[NSUndoManager dealloc]): Ditto.
(-[NSUndoManager enableUndoRegistration]): Remove access to
_registeredUndo.
(-[NSUndoManager redo]): Simplified implementation.
(-[NSUndoManager redoActionName:]: Retrieve action name from first
grouping of the redo stack.
(-[NSUndoManager redoMenuTitleForUndoActionName:]): Add comment
about localization.
(-[NSUndoManager undoMenuTitleForUndoActionName:]): Ditto.
(-[NSUndoManager setActionName:]): Forward call to current
grouping.
(-[NSUndoManager undoActionName:]: Retrieve action name from first
grouping of the undo stack.
(-[NSUndoManager setRunLoopModes:]): Use correct run loop ordering
and set flag for pending _loop: invocation.
(-[NSUndoManager undoNestedGroup]): Removed special case handling
of _registeredUndo. Raise NSInternalInconsistencyException if
grouping is still in progress. Simplified implementation.
Commited.
Yet the follow up to fix EOEditingContext to use this will still take a
/little/ looking into. For now the gdl2.patch attaced to the bug report
will work, for the simple case even if it's a bit inefficient.
Cheers.
David
FYI: the implementation.
/**
* If the reciever was sent a [-prepareWithInvocationTarget:] and
* the target's method hasn't been invoked on the reciever yet, this
* method forwards the request to the target.
* Otherwise or if the target didn't return a signature, the message
* is sent to super.
*/
- (NSMethodSignature*) methodSignatureForSelector: (SEL)selector
{
NSMethodSignature *sig = nil;
if (_nextTarget != nil)
{
sig = [_nextTarget methodSignatureForSelector: selector];
}
if (sig == nil)
{
sig = [super methodSignatureForSelector: selector];
}
return sig;
}