mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 10:01:14 +00:00
Fixes for undoing in the field editor. Added usage of NSCellUndoManager class.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38903 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
71dd745382
commit
9bcec86989
4 changed files with 30 additions and 2 deletions
|
@ -248,6 +248,8 @@ therefore be stored in the NSLayoutManager to avoid problems.
|
|||
// Text checking (spelling/grammar)
|
||||
NSTimer *_textCheckingTimer;
|
||||
NSRect _lastCheckedRect;
|
||||
|
||||
NSUndoManager *_fieldEditorUndoManager;
|
||||
}
|
||||
|
||||
|
||||
|
@ -344,6 +346,7 @@ to the set of non-range taking varieties. */
|
|||
-(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
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
@class NSNotification;
|
||||
@class NSString;
|
||||
@class NSUndoManager;
|
||||
@class NSCellUndoManager;
|
||||
|
||||
@class NSButton;
|
||||
@class NSButtonCell;
|
||||
|
|
|
@ -2318,6 +2318,16 @@ static NSColor *dtxtCol;
|
|||
_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
|
||||
|
|
|
@ -1137,6 +1137,7 @@ that makes decoding and encoding compatible with the old code.
|
|||
DESTROY(_defaultParagraphStyle);
|
||||
DESTROY(_linkTextAttributes);
|
||||
DESTROY(_undoObject);
|
||||
DESTROY(_fieldEditorUndoManager);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -1705,7 +1706,7 @@ to make sure syncing is handled properly in all cases.
|
|||
[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,12 +2604,25 @@ Move to NSTextView_actions.m?
|
|||
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];
|
||||
}
|
||||
|
||||
/*
|
||||
* Began editing flag. There are quite some different ways in which
|
||||
* editing can be started. Each time editing is started, we need to check
|
||||
|
|
Loading…
Reference in a new issue