mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 04:31:00 +00:00
Further undo improvements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20562 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
616a70c202
commit
fd88c0e77b
2 changed files with 53 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-01-16 06:39 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSDocument.m: In validateMenuItem: added code to
|
||||||
|
properly set the undo/redo title and disable the menus when
|
||||||
|
appropriate.
|
||||||
|
|
||||||
2005-01-15 05:59 Gregory John Casamento <greg_casamento@yahoo.com>
|
2005-01-15 05:59 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/NSDocument.m: Added undo:/redo: here. Smarter use
|
* Source/NSDocument.m: Added undo:/redo: here. Smarter use
|
||||||
|
|
|
@ -579,12 +579,56 @@
|
||||||
|
|
||||||
- (BOOL)validateMenuItem: (NSMenuItem *)anItem
|
- (BOOL)validateMenuItem: (NSMenuItem *)anItem
|
||||||
{
|
{
|
||||||
if ([anItem action] == @selector(revertDocumentToSaved:))
|
BOOL result = YES;
|
||||||
return ([self fileName] != nil && [self isDocumentEdited]);
|
SEL action = [anItem action];
|
||||||
|
|
||||||
// FIXME should validate spa popup items; return YES if it's a native type.
|
// FIXME should validate spa popup items; return YES if it's a native type.
|
||||||
|
if (sel_eq(action, @selector(revertDocumentToSaved:)))
|
||||||
|
{
|
||||||
|
result = ([self fileName] != nil && [self isDocumentEdited]);
|
||||||
|
}
|
||||||
|
else if (sel_eq(action, @selector(undo:)))
|
||||||
|
{
|
||||||
|
if(_undoManager == nil)
|
||||||
|
{
|
||||||
|
result = NO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if([_undoManager canUndo])
|
||||||
|
{
|
||||||
|
[anItem setTitle: [_undoManager undoMenuItemTitle]];
|
||||||
|
result = YES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[anItem setTitle: [_undoManager undoMenuTitleForUndoActionName: @""]];
|
||||||
|
result = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sel_eq(action, @selector(redo:)))
|
||||||
|
{
|
||||||
|
if(_undoManager == nil)
|
||||||
|
{
|
||||||
|
result = NO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if([_undoManager canRedo])
|
||||||
|
{
|
||||||
|
[anItem setTitle: [_undoManager redoMenuItemTitle]];
|
||||||
|
result = YES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[anItem setTitle: [_undoManager redoMenuTitleForUndoActionName: @""]];
|
||||||
|
result = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return YES;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>)anItem
|
- (BOOL)validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>)anItem
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue