Author: paullanders
Date: Mon Aug 17 19:41:37 2015
New Revision: 38903
URL: http://svn.gna.org/viewcvs/gnustep?rev=38903&view=rev
Log:
Fixes for undoing in the field editor. Added usage of NSCellUndoManager class.
Modified:
libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSTextView.h
libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSWindow.h
libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m
libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m
Modified: libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSTextView.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSTextView.h?rev=38903&r1=38902&r2=38903&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSTextView.h
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSTextView.h
Mon Aug 17 19:41:37 2015
@@ -248,6 +248,8 @@
// Text checking (spelling/grammar)
NSTimer *_textCheckingTimer;
NSRect _lastCheckedRect;
+
+ NSUndoManager *_fieldEditorUndoManager;
}
@@ -344,6 +346,7 @@
-(void) setAllowsUndo: (BOOL)flag; /* mosx */
-(BOOL) smartInsertDeleteEnabled;
-(void) setSmartInsertDeleteEnabled: (BOOL)flag;
+-(void)_setFieldEditorUndoManager:(NSUndoManager *)undoManager;
/* These methods are like paste: (from NSResponder) but they restrict
Modified: libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSWindow.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSWindow.h?rev=38903&r1=38902&r2=38903&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSWindow.h
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Headers/AppKit/NSWindow.h
Mon Aug 17 19:41:37 2015
@@ -48,6 +48,7 @@
@class NSNotification;
@class NSString;
@class NSUndoManager;
+@class NSCellUndoManager;
@class NSButton;
@class NSButtonCell;
Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m?rev=38903&r1=38902&r2=38903&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m (original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m Mon Aug 17
19:41:37 2015
@@ -2318,6 +2318,16 @@
_cell.shows_first_responder = YES;
_cell.in_editing = YES;
+ if ([textObject isKindOfClass:[NSTextView class]])
+ {
+ NSCellUndoManager * undoManager = [[NSCellUndoManager alloc] init];
+ [undoManager setNextUndoManager:[[controlView window] undoManager]];
+ [(NSTextView *)textObject _setFieldEditorUndoManager:undoManager];
+ [undoManager release];
+ [(NSTextView *)textObject setAllowsUndo:YES];
+ }
+
+
#if 0
// Testplant-MAL-2015-06-20: merging removal causes focus ring issues...
// FIXME: we need to draw the focus ring, this works but
Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m?rev=38903&r1=38902&r2=38903&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m Mon Aug
17 19:41:37 2015
@@ -1137,6 +1137,7 @@
DESTROY(_defaultParagraphStyle);
DESTROY(_linkTextAttributes);
DESTROY(_undoObject);
+ DESTROY(_fieldEditorUndoManager);
[super dealloc];
}
@@ -1705,7 +1706,7 @@
[notificationCenter postNotificationName: NSTextDidEndEditingNotification
object: _notifObject];
- if (_tf.is_field_editor)
+ if (_tf.is_field_editor && ![[self undoManager] isUndoing] && ![[self
undoManager] isRedoing] )
{
[[self undoManager] removeAllActions];
}
@@ -2603,10 +2604,23 @@
if (![_delegate respondsToSelector: @selector(undoManagerForTextView:)]
|| ((undo = [_delegate undoManagerForTextView: self]) == nil))
{
- undo = [super undoManager];
+ if (_fieldEditorUndoManager)
+ {
+ undo = _fieldEditorUndoManager;
+ }
+ else
+ {
+ undo = [super undoManager];
+ }
}
return undo;
+}
+
+-(void)_setFieldEditorUndoManager:(NSUndoManager *)undoManager
+{
+ [_fieldEditorUndoManager autorelease];
+ _fieldEditorUndoManager = [undoManager retain];
}
/*
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs