Added MacOSX 10.4 methods to NSControl and reworked the whole cell

editing mechanism.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24380 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2007-01-18 17:24:33 +00:00
parent 34b0abf4d0
commit ebc0de97f3
8 changed files with 294 additions and 240 deletions

View file

@ -1,3 +1,26 @@
2007-01-18 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCell.m (-setFloatingPointFormat:left:right): Basic
implementation.
* Source/NSCell.m (-setUpFieldEditorAttributes:,
_setupTextWithFrame:inView:editor:delegate:range:, endEditing:,
editWithFrame:...event:, selectWithFrame:...length:): Changed to
handle more text attributes and non-scrolling text.
* Source/NSCell.m (-setScrollable:): If switched on, switch wraps off.
* Headers/AppKit/NSCell.h: Corrected version number for some methods.
* Headers/AppKit/NSControl.h: Add MacOS 10.4 methods.
* Source/NSControl.m: Implement new MacOS 10.4 methods.
* Source/NSControl.m (-mouseDown): Once more removed action mask
fiddling. This time there is protection that the control itself
does not go away.
* Source/NSControl.m (-textDidBeginEditing:, -textDidChange:,
-textDidEndEditing:): Extracted code to be shared between subclasses.
* Source/NSTextField.m,
* Source/NSTableView.m,
* Source/NSMatrix.m (-textDidBeginEditing:, -textDidChange:,
-textDidEndEditing:): Call shared super code.
2007-01-17 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSResponder.h: Add MacOS 10.4 methods.

View file

@ -272,11 +272,9 @@ enum {
- (void)setTitle:(NSString *)aString;
- (NSString *)title;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
- (NSWritingDirection)baseWritingDirection;
- (void)setBaseWritingDirection:(NSWritingDirection)direction;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
- (NSLineBreakMode)lineBreakMode;
- (void)setLineBreakMode:(NSLineBreakMode)mode;
#endif

View file

@ -31,7 +31,9 @@
#define _GNUstep_H_NSControl
#import <GNUstepBase/GSVersionMacros.h>
#include <AppKit/NSText.h>
// for NSWritingDirection
#include <AppKit/NSParagraphStyle.h>
#include <AppKit/NSView.h>
@class NSString;
@class NSNotification;
@ -113,6 +115,10 @@
- (void)setFormatter:(NSFormatter*)newFormatter;
- (id)formatter;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
- (NSWritingDirection)baseWritingDirection;
- (void)setBaseWritingDirection:(NSWritingDirection)direction;
#endif
//
// Managing the Field Editor

View file

@ -37,6 +37,7 @@
#include <Foundation/NSException.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSNumberFormatter.h>
#include <Foundation/NSDebug.h>
#include <Foundation/NSFormatter.h>
#include <Foundation/NSRunLoop.h>
@ -904,6 +905,10 @@ static NSColor *shadowCol;
- (void) setScrollable: (BOOL)flag
{
_cell.is_scrollable = flag;
if (flag)
{
[self setWraps: NO];
}
}
- (void) setWraps: (BOOL)flag
@ -1008,32 +1013,6 @@ static NSColor *shadowCol;
return _cell.imports_graphics;
}
- (NSText*) setUpFieldEditorAttributes: (NSText*)textObject
{
[textObject setString: @""];
[textObject setTextColor: [self textColor]];
if (_cell.contents_is_attributed_string == NO)
{
/* TODO: Manage scrollable attribute */
[textObject setFont: _font];
[textObject setAlignment: _cell.text_align];
}
else
{
/* FIXME/TODO. What do we do if we are an attributed string.
Think about what happens when the user ends editing.
Allows editing text attributes... Formatter... TODO. */
}
[textObject setEditable: _cell.is_editable];
[textObject setSelectable: _cell.is_selectable || _cell.is_editable];
[textObject setRichText: _cell.is_rich_text];
[textObject setImportsGraphics: _cell.imports_graphics];
[textObject setSelectedRange: NSMakeRange(0, 0)];
[textObject scrollRangeToVisible: NSMakeRange(0, 0)];
return textObject;
}
- (NSString*) title
{
return [self stringValue];
@ -1199,12 +1178,41 @@ static NSColor *shadowCol;
left: (unsigned int)leftDigits
right: (unsigned int)rightDigits
{
// TODO: Pass this on to the formatter to handle
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
NSMutableString *format = [[NSMutableString alloc] init];
if (autoRange)
{
unsigned fieldWidth = leftDigits + rightDigits + 1;
// FIXME: this does not fully match the documentation.
while (fieldWidth--)
{
[format appendString: @"#"];
}
}
else
{
while (leftDigits--)
{
[format appendString: @"#"];
}
[format appendString: @"."];
while (rightDigits--)
{
[format appendString: @"0"];
}
}
[formatter setFormat: format];
RELEASE(format);
[self setFormatter: formatter];
RELEASE(formatter);
}
- (void) setFormatter: (NSFormatter*)newFormatter
{
ASSIGN (_formatter, newFormatter);
ASSIGN(_formatter, newFormatter);
}
- (id) formatter
@ -1378,6 +1386,7 @@ static NSColor *shadowCol;
if (controlView != nil)
{
NSWindow *cvWin = [controlView window];
NSDate *limit = [NSDate dateWithTimeIntervalSinceNow: 0.1];
[controlView lockFocus];
@ -1386,12 +1395,10 @@ static NSColor *shadowCol;
[cvWin flushWindow];
// Wait approx 1/10 seconds
[[NSRunLoop currentRunLoop]
runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
[[NSRunLoop currentRunLoop] runUntilDate: limit];
[self highlight: NO withFrame: cellFrame inView: controlView];
[cvWin flushWindow];
[controlView unlockFocus];
if (action)
@ -2072,29 +2079,126 @@ static NSColor *shadowCol;
return [NSColor selectedControlColor];
}
- (NSText*) setUpFieldEditorAttributes: (NSText*)textObject
{
// Reset the string to have a well defined state. The real string gets set later on.
[textObject setString: @""];
[textObject setTextColor: [self textColor]];
if ([self isBezeled])
{
[textObject setBackgroundColor: [NSColor textBackgroundColor]];
[textObject setDrawsBackground: YES];
}
else
{
[textObject setDrawsBackground: NO];
}
[textObject setFont: [self font]];
[textObject setAlignment: [self alignment]];
// FIXME: Add base writing direction
[textObject setEditable: [self isEditable]];
[textObject setSelectable: [self isSelectable]];
[textObject setRichText: [self allowsEditingTextAttributes]];
[textObject setImportsGraphics: [self importsGraphics]];
[(NSTextView*)textObject setAllowsUndo: [self allowsUndo]];
return textObject;
}
- (void) _setupTextWithFrame: (NSRect)aRect
inView: (NSView*)controlView
editor: (NSText*)textObject
delegate: (id)anObject
range: (NSRange)selection
{
NSRect titleRect = [self titleRectForBounds: aRect];
/* See comments in NSStringDrawing.m about the choice of maximum size. */
NSSize maxSize = NSMakeSize(1e6, titleRect.size.height);
NSClipView *cv = [[NSClipView alloc]
initWithFrame: titleRect];
NSTextContainer *ct = [(NSTextView*)textObject textContainer];
NSRect maxRect;
[controlView addSubview: cv];
RELEASE(cv);
[cv setAutoresizesSubviews: NO];
[cv setDocumentView: textObject];
[textObject setFrame: NSMakeRect(0, 0, maxSize.width, maxSize.height)];
// A clip view should is only created for scrollable text
if ([self isScrollable])
{
/* See comments in NSStringDrawing.m about the choice of maximum size. */
NSSize maxSize = NSMakeSize(1e6, titleRect.size.height);
NSClipView *cv = [[NSClipView alloc] initWithFrame: titleRect];
NSTextContainer *ct = [(NSTextView*)textObject textContainer];
maxRect = NSMakeRect(0, 0, maxSize.width, maxSize.height);
[controlView addSubview: cv];
RELEASE(cv);
[cv setAutoresizesSubviews: NO];
[cv setDocumentView: textObject];
[ct setContainerSize: maxSize];
[ct setHeightTracksTextView: NO];
[ct setWidthTracksTextView: NO];
}
else
{
maxRect = titleRect;
[controlView addSubview: textObject];
}
[textObject setFrame: maxRect];
[textObject setHorizontallyResizable: NO];
[textObject setVerticallyResizable: NO];
[textObject setMaxSize: maxSize];
[textObject setMaxSize: maxRect.size];
[textObject setMinSize: titleRect.size];
[ct setContainerSize: maxSize];
[ct setHeightTracksTextView: NO];
[ct setWidthTracksTextView: NO];
if (_formatter != nil)
{
NSString *contents;
contents = [_formatter editingStringForObjectValue: _object_value];
if (contents == nil)
{
contents = _contents;
}
[textObject setText: contents];
}
else
{
if (_cell.contents_is_attributed_string == NO)
{
[textObject setText: _contents];
}
else
{
// The curent text has size 0, so this replaces the whole text.
[textObject replaceCharactersInRange: NSMakeRange(0, 0)
withAttributedString: (NSAttributedString *)_contents];
}
}
[textObject sizeToFit];
[textObject setSelectedRange: selection];
[textObject scrollRangeToVisible: selection];
[textObject setDelegate: anObject];
[[controlView window] makeFirstResponder: textObject];
}
/**<p>Ends any text editing. This method sets the text object's delegate
to nil, and remove the NSClipView and the text object used for editing</p>
<p>See Also: -editWithFrame:inView:editor:delegate:event:</p>
*/
- (void) endEditing: (NSText*)textObject
{
[textObject setString: @""];
[textObject setDelegate: nil];
if ([self isScrollable])
{
NSClipView *clipView;
clipView = (NSClipView*)[textObject superview];
[textObject removeFromSuperview];
[clipView removeFromSuperview];
}
else
{
[textObject removeFromSuperview];
}
}
/*
@ -2115,35 +2219,9 @@ static NSColor *shadowCol;
[self _setupTextWithFrame: aRect
inView: controlView
editor: textObject];
if (_formatter != nil)
{
NSString *contents;
contents = [_formatter editingStringForObjectValue: _object_value];
if (contents == nil)
{
contents = _contents;
}
[textObject setText: contents];
}
else
{
if (_cell.contents_is_attributed_string == NO)
{
[textObject setText: _contents];
}
else
{
/* FIXME/TODO make sure this is correct. */
[textObject setText: [(NSAttributedString *)_contents string]];
}
}
[textObject sizeToFit];
[textObject setDelegate: anObject];
[[controlView window] makeFirstResponder: textObject];
editor: textObject
delegate: anObject
range: NSMakeRange(0, 0)];
if ([theEvent type] == NSLeftMouseDown)
{
@ -2151,20 +2229,6 @@ static NSColor *shadowCol;
}
}
/**<p>Ends any text editing. This method sets the text object's delegate
to nil, and remove the NSClipView and the text object used for editing</p>
<p>See Also: -editWithFrame:inView:editor:delegate:event:</p>
*/
- (void) endEditing: (NSText*)textObject
{
NSClipView *clipView;
[textObject setDelegate: nil];
clipView = (NSClipView*)[textObject superview];
[textObject removeFromSuperview];
[clipView removeFromSuperview];
}
/** <p> This method does nothing if the <var>controlView</var> is nil,
if text object does not exist or if the cell's type is not <ref type="type"
id="NSCellType">NSTextCellType</ref> </p>
@ -2181,37 +2245,9 @@ static NSColor *shadowCol;
[self _setupTextWithFrame: aRect
inView: controlView
editor: textObject];
if (_formatter != nil)
{
NSString *contents;
contents = [_formatter editingStringForObjectValue: _object_value];
if (contents == nil)
{
contents = _contents;
}
[textObject setText: contents];
}
else
{
if (_cell.contents_is_attributed_string == NO)
{
[textObject setText: _contents];
}
else
{
/* FIXME/TODO make sure this is correct. */
[textObject setText: [(NSAttributedString *)_contents string]];
}
}
[textObject sizeToFit];
[textObject setSelectedRange: NSMakeRange (selStart, selLength)];
[textObject scrollRangeToVisible: NSMakeRange(selStart, selLength)];
[textObject setDelegate: anObject];
[[controlView window] makeFirstResponder: textObject];
editor: textObject
delegate: anObject
range: NSMakeRange(selStart, selLength)];
}
- (BOOL) sendsActionOnEndEditing

View file

@ -31,6 +31,7 @@
#include <Foundation/NSDebug.h>
#include <Foundation/NSException.h>
#include <Foundation/NSNotification.h>
#include "AppKit/NSActionCell.h"
#include "AppKit/NSApplication.h"
#include "AppKit/NSCell.h"
@ -47,6 +48,7 @@
static Class usedCellClass;
static Class cellClass;
static Class actionCellClass;
static NSNotificationCenter *nc;
/**<p>TODO Description</p>
*/
@ -64,6 +66,8 @@ static Class actionCellClass;
cellClass = [NSCell class];
usedCellClass = cellClass;
actionCellClass = [NSActionCell class];
// Cache the notifiaction centre for editing notifications
nc = [NSNotificationCenter defaultCenter];
}
}
@ -440,6 +444,21 @@ static Class actionCellClass;
return [_cell formatter];
}
- (NSWritingDirection) baseWritingDirection
{
return [_cell baseWritingDirection];
}
- (void) setBaseWritingDirection: (NSWritingDirection)direction
{
if (_cell)
{
[_cell setBaseWritingDirection: direction];
if (![_cell isKindOfClass: actionCellClass])
[self setNeedsDisplay: YES];
}
}
/**<p>Sends an [NSCell-endEditing:] message to the current object used to
edit the NSControl. Returns NO if the the currentEditor does not exists,
YES otherwise.</p>
@ -508,6 +527,70 @@ static Class actionCellClass;
}
}
/*
* Text delegate methods
*/
/**<p>Invokes when the text cell starts to be editing.This methods posts
a NSControlTextDidBeginEditingNotification with a dictionary containing
the NSFieldEditor as user info </p><p>See Also:
[NSNotificationCenter-postNotificationName:object:userInfo:]</p>
*/
- (void) textDidBeginEditing: (NSNotification *)aNotification
{
NSMutableDictionary *dict;
dict = [[NSMutableDictionary alloc] initWithDictionary:
[aNotification userInfo]];
[dict setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidBeginEditingNotification
object: self
userInfo: dict];
RELEASE(dict);
}
/**<p>Invokes when the text cell is changed. This methods posts a
NSControlTextDidChangeNotification with a dictionary containing the
NSFieldEditor as user info </p><p>See Also:
[NSNotificationCenter-postNotificationName:object:userInfo:]</p>
*/
- (void) textDidChange: (NSNotification *)aNotification
{
NSMutableDictionary *dict;
dict = [[NSMutableDictionary alloc] initWithDictionary:
[aNotification userInfo]];
[dict setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidChangeNotification
object: self
userInfo: dict];
RELEASE(dict);
}
/**<p>Invokes when the text cell is changed.
This methods posts a NSControlTextDidEndEditingNotification
a dictionary containing the NSFieldEditor as user info </p><p>See Also:
[NSNotificationCenter-postNotificationName:object:userInfo:]</p>
*/
- (void) textDidEndEditing: (NSNotification *)aNotification
{
NSMutableDictionary *dict;
[self validateEditing];
[self abortEditing];
dict = [[NSMutableDictionary alloc] initWithDictionary:
[aNotification userInfo]];
[dict setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidEndEditingNotification
object: self
userInfo: dict];
RELEASE(dict);
}
/**<p>Recalculates the internal size by sending [NSCell-calcDrawInfo:]
to the cell.</p>
*/
@ -675,7 +758,7 @@ static Class actionCellClass;
return AUTORELEASE([NSAttributedString new]);
}
// As this mehtod is not defined for NSActionCell, we have
// As this method is not defined for NSActionCell, we have
// to do the validation here.
[self validateEditing];
@ -732,8 +815,6 @@ static Class actionCellClass;
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask
| NSMouseMovedMask | NSLeftMouseDraggedMask | NSOtherMouseDraggedMask
| NSRightMouseDraggedMask;
BOOL mouseUp = NO;
int oldActionMask = 0;
NSEvent *e = nil;
// If not enabled ignore mouse clicks
@ -747,8 +828,8 @@ static Class actionCellClass;
return;
}
// stop cell from sending action while tracking the mouse...
oldActionMask = [_cell sendActionOn: ([_cell isContinuous]?NSPeriodicMask:0)];
// Make sure self does not go away during the processing of the event
RETAIN(self);
// loop until mouse goes up
e = theEvent;
@ -774,7 +855,6 @@ static Class actionCellClass;
if (done)
{
mouseUp = YES;
break;
}
}
@ -785,19 +865,12 @@ static Class actionCellClass;
dequeue: YES];
if ([e type] == NSLeftMouseUp)
{
mouseUp = YES;
break;
}
}
// allow the cell to send actions again...
[_cell sendActionOn: oldActionMask];
// Mouse went up inside the control but not inside the cell
if (mouseUp)
{
[self sendAction: [self action] to: [self target]];
}
// undo initial retain
RELEASE(self);
}
- (BOOL) shouldBeTreatedAsInkEvent: (NSEvent *)theEvent

View file

@ -1686,16 +1686,7 @@ static SEL getSel;
*/
- (void) textDidBeginEditing: (NSNotification *)aNotification
{
NSMutableDictionary *dict;
dict = [[NSMutableDictionary alloc] initWithDictionary:
[aNotification userInfo]];
AUTORELEASE (dict);
[dict setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidBeginEditingNotification
object: self
userInfo: dict];
[super textDidBeginEditing: aNotification];
}
/**<p>Invokes when the text cell is changed. This methods posts a
@ -1705,7 +1696,6 @@ static SEL getSel;
*/
- (void) textDidChange: (NSNotification *)aNotification
{
NSMutableDictionary *dict;
NSFormatter *formatter;
// MacOS-X asks us to inform the cell if possible.
@ -1713,16 +1703,9 @@ static SEL getSel;
@selector(textDidChange:)])
[_selectedCell textDidChange: aNotification];
dict = [[NSMutableDictionary alloc] initWithDictionary:
[aNotification userInfo]];
AUTORELEASE (dict);
[dict setObject: [aNotification object] forKey: @"NSFieldEditor"];
[super textDidChange: aNotification];
[nc postNotificationName: NSControlTextDidChangeNotification
object: self
userInfo: dict];
formatter = [_cell formatter];
formatter = [_selectedCell formatter];
if (formatter != nil)
{
/*
@ -1742,9 +1725,14 @@ static SEL getSel;
if (wasAccepted == NO)
{
[_delegate control:self
didFailToValidatePartialString: partialString
errorDescription: error];
SEL sel = @selector(control:didFailToValidatePartialString:errorDescription:);
if ([_delegate respondsToSelector: sel])
{
[_delegate control: self
didFailToValidatePartialString: partialString
errorDescription: error];
}
}
if (newString != nil)
@ -1772,22 +1760,9 @@ static SEL getSel;
*/
- (void) textDidEndEditing: (NSNotification *)aNotification
{
NSMutableDictionary *dict;
id textMovement;
[self validateEditing];
[_selectedCell endEditing: [aNotification object]];
_textObject = nil;
dict = [[NSMutableDictionary alloc] initWithDictionary:
[aNotification userInfo]];
AUTORELEASE (dict);
[dict setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidEndEditingNotification
object: self
userInfo: dict];
[super textDidEndEditing: aNotification];
textMovement = [[aNotification userInfo] objectForKey: @"NSTextMovement"];
if (textMovement)
@ -1888,7 +1863,7 @@ static SEL getSel;
NSFormatter *formatter;
id newObjectValue;
formatter = [_cell formatter];
formatter = [_selectedCell formatter];
if ([formatter getObjectValue: &newObjectValue
forString: [_textObject text]

View file

@ -5200,59 +5200,29 @@ static BOOL selectContiguousRegion(NSTableView *self,
- (void) textDidBeginEditing: (NSNotification *)aNotification
{
NSMutableDictionary *d;
d = [NSMutableDictionary dictionaryWithDictionary:
[aNotification userInfo]];
[d setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidBeginEditingNotification
object: self
userInfo: d];
[super textDidBeginEditing: aNotification];
}
- (void) textDidChange: (NSNotification *)aNotification
{
NSMutableDictionary *d;
// MacOS-X asks us to inform the cell if possible.
if ((_editedCell != nil) && [_editedCell respondsToSelector:
@selector(textDidChange:)])
[_editedCell textDidChange: aNotification];
d = [NSMutableDictionary dictionaryWithDictionary:
[aNotification userInfo]];
[d setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidChangeNotification
object: self
userInfo: d];
[super textDidChange: aNotification];
}
- (void) textDidEndEditing: (NSNotification *)aNotification
{
NSMutableDictionary *d;
id textMovement;
int row, column;
[self validateEditing];
[_editedCell endEditing: [aNotification object]];
[self setNeedsDisplayInRect:
[self frameOfCellAtColumn: _editedColumn row: _editedRow]];
_textObject = nil;
DESTROY (_editedCell);
/* Save values */
row = _editedRow;
column = _editedColumn;
/* Only then Reset them */
_editedColumn = -1;
_editedRow = -1;
d = [NSMutableDictionary dictionaryWithDictionary:
[aNotification userInfo]];
[d setObject: [aNotification object] forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidEndEditingNotification
object: self
userInfo: d];
[super textDidEndEditing: aNotification];
textMovement = [[aNotification userInfo] objectForKey: @"NSTextMovement"];
if (textMovement)

View file

@ -488,32 +488,17 @@ static Class textFieldCellClass;
}
}
/**<p>Posts a NSControlTextDidBeginEditingNotification notification with object
self and a NSDictionary containing the NSFieldEditor for key
as user Info</p>
*/
- (void) textDidBeginEditing: (NSNotification *)aNotification
{
NSDictionary *notifDict;
notifDict = [NSDictionary dictionaryWithObject:[aNotification object]
forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidBeginEditingNotification
object: self
userInfo: notifDict];
[super textDidBeginEditing: aNotification];
}
- (void) textDidChange: (NSNotification *)aNotification
{
NSDictionary *d;
NSFormatter *formatter;
d = [NSDictionary dictionaryWithObject: [aNotification object]
forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidChangeNotification
object: self
userInfo: d];
[super textDidChange: aNotification];
formatter = [_cell formatter];
if (formatter != nil)
@ -559,26 +544,14 @@ static Class textFieldCellClass;
NSLog (@"Unimplemented: should delete last typed character");
}
}
}
}
- (void) textDidEndEditing: (NSNotification *)aNotification
{
NSDictionary *d;
id textMovement;
[self validateEditing];
[_cell endEditing: [aNotification object]];
_text_object = nil;
d = [NSDictionary dictionaryWithObject: [aNotification object]
forKey: @"NSFieldEditor"];
[nc postNotificationName: NSControlTextDidEndEditingNotification
object: self
userInfo: d];
[super textDidEndEditing: aNotification];
textMovement = [[aNotification userInfo] objectForKey: @"NSTextMovement"];
if (textMovement)