mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Fix a few issues with NSUndoManager, the most serious of which was
that NSUndoManager did no longer record redo actions properly since the recent Mac OS X compatibililty changes to it. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28320 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
de58729919
commit
93131db09d
2 changed files with 31 additions and 20 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2009-06-02 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSUndoManager.m (-undo, -redo): Call -_begin instead of
|
||||||
|
-beginUndoGrouping to avoid creation of a spurious top-level group
|
||||||
|
while performing undo or redo operations, which was causing the
|
||||||
|
recorded actions to be dropped silently.
|
||||||
|
|
||||||
|
* Source/NSUndoManager.m (-beginUndoGrouping): Post
|
||||||
|
NSUndoManagerCheckpointNotification also during undo as on OS X.
|
||||||
|
|
||||||
|
* Source/NSUndoManager.m (-endUndoGrouping): Post
|
||||||
|
NSUndoManagerWillCloseUndoGroupNotification before changing the
|
||||||
|
group so that clients see the same grouping level as on OS X.
|
||||||
|
|
||||||
2009-05-29 Riccardo Mottola <rmottola@users.sf.net>
|
2009-05-29 Riccardo Mottola <rmottola@users.sf.net>
|
||||||
|
|
||||||
* Source/NSObject.m: Atomic increment and decrement functions for m68k
|
* Source/NSObject.m: Atomic increment and decrement functions for m68k
|
||||||
|
|
|
@ -162,9 +162,9 @@
|
||||||
|
|
||||||
@implementation NSUndoManager (Private)
|
@implementation NSUndoManager (Private)
|
||||||
/* This method is used to begin undo grouping internally.
|
/* This method is used to begin undo grouping internally.
|
||||||
* It's necessary to have a different mechanism from the -beginUndoGroup
|
* It's necessary to have a different mechanism from the -beginUndoGrouping
|
||||||
* because it seems that in MacOS-X 10.5 a call to -beginUndoGroup when
|
* because it seems that in MacOS X a call to -beginUndoGrouping when at the
|
||||||
* at the top level will actually create two undo groups.
|
* top level will actually create two undo groups.
|
||||||
*/
|
*/
|
||||||
- (void) _begin
|
- (void) _begin
|
||||||
{
|
{
|
||||||
|
@ -222,14 +222,14 @@
|
||||||
* It first posts an NSUndoManagerCheckpointNotification
|
* It first posts an NSUndoManagerCheckpointNotification
|
||||||
* unless an undo is currently in progress.<br />
|
* unless an undo is currently in progress.<br />
|
||||||
* The order of these notifications is undefined, but the GNUstep
|
* The order of these notifications is undefined, but the GNUstep
|
||||||
* implementation currently mimics the observed order in MacOS-X 10.5
|
* implementation currently mimics the observed order in MacOS X 10.5
|
||||||
*/
|
*/
|
||||||
- (void) beginUndoGrouping
|
- (void) beginUndoGrouping
|
||||||
{
|
{
|
||||||
/* It seems that MacOS-X 10.5 implicitly creates a top-level group
|
/* It seems that MacOS X implicitly creates a top-level group if this
|
||||||
* if this method is called when groupsByEvent is set and there is
|
* method is called when groupsByEvent is set and there is no existing
|
||||||
* no existing top level group. There is no checkpoint notification
|
* top level group. There is no checkpoint notification posted for the
|
||||||
* posted for the implicit group creation.
|
* implicit group creation.
|
||||||
*/
|
*/
|
||||||
if (_group == nil && [self groupsByEvent])
|
if (_group == nil && [self groupsByEvent])
|
||||||
{
|
{
|
||||||
|
@ -238,12 +238,9 @@
|
||||||
|
|
||||||
/* Post the checkpoint notification and THEN create the group.
|
/* Post the checkpoint notification and THEN create the group.
|
||||||
*/
|
*/
|
||||||
if (_isUndoing == NO)
|
[[NSNotificationCenter defaultCenter]
|
||||||
{
|
postNotificationName: NSUndoManagerCheckpointNotification
|
||||||
[[NSNotificationCenter defaultCenter]
|
object: self];
|
||||||
postNotificationName: NSUndoManagerCheckpointNotification
|
|
||||||
object: self];
|
|
||||||
}
|
|
||||||
[self _begin]; // Start a new group
|
[self _begin]; // Start a new group
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,14 +350,14 @@
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSUndoManagerCheckpointNotification
|
postNotificationName: NSUndoManagerCheckpointNotification
|
||||||
object: self];
|
object: self];
|
||||||
g = (PrivateUndoGroup*)_group;
|
|
||||||
p = RETAIN([g parent]);
|
|
||||||
_group = p;
|
|
||||||
[g orphan];
|
|
||||||
if (_isUndoing == NO && _isRedoing == NO)
|
if (_isUndoing == NO && _isRedoing == NO)
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSUndoManagerWillCloseUndoGroupNotification
|
postNotificationName: NSUndoManagerWillCloseUndoGroupNotification
|
||||||
object: self];
|
object: self];
|
||||||
|
g = (PrivateUndoGroup*)_group;
|
||||||
|
p = RETAIN([g parent]);
|
||||||
|
_group = p;
|
||||||
|
[g orphan];
|
||||||
if (p == nil)
|
if (p == nil)
|
||||||
{
|
{
|
||||||
if (_isUndoing)
|
if (_isUndoing)
|
||||||
|
@ -640,7 +637,7 @@
|
||||||
_group = nil;
|
_group = nil;
|
||||||
_isRedoing = YES;
|
_isRedoing = YES;
|
||||||
|
|
||||||
[self beginUndoGrouping];
|
[self _begin];
|
||||||
[groupToRedo perform];
|
[groupToRedo perform];
|
||||||
RELEASE(groupToRedo);
|
RELEASE(groupToRedo);
|
||||||
[self endUndoGrouping];
|
[self endUndoGrouping];
|
||||||
|
@ -1053,7 +1050,7 @@
|
||||||
|
|
||||||
name = [NSString stringWithString: [groupToUndo actionName]];
|
name = [NSString stringWithString: [groupToUndo actionName]];
|
||||||
|
|
||||||
[self beginUndoGrouping];
|
[self _begin];
|
||||||
[groupToUndo perform];
|
[groupToUndo perform];
|
||||||
RELEASE(groupToUndo);
|
RELEASE(groupToUndo);
|
||||||
[self endUndoGrouping];
|
[self endUndoGrouping];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue