From 8e587afba5e9732ce42c3f09b5d0f3a784a70ba9 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Sun, 14 Nov 1999 03:19:36 +0000 Subject: [PATCH] Many little fixes for editing. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5175 72102866-910b-0410-8b05-ffd578937521 --- Source/NSCell.m | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/Source/NSCell.m b/Source/NSCell.m index 9954f9427..1c55fa7a6 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -505,6 +505,8 @@ static NSColor *shadowCol; [textObject setFont: [self font]]; [textObject setAlignment: [self alignment]]; + [textObject setEditable: [self isEditable]]; + [textObject setSelectable: [self isSelectable]]; return textObject; } @@ -518,33 +520,25 @@ static NSColor *shadowCol; (cell_type != NSTextCellType)) return; - textObject = [self setUpFieldEditorAttributes: textObject]; [textObject setDelegate: anObject]; - [textObject setFrame: aRect]; + [textObject setFrame: [self drawingRectForBounds: aRect]]; [textObject setText: [self stringValue]]; - [controlView addSubview:textObject]; + [controlView addSubview: textObject]; + [[controlView window] makeFirstResponder: textObject]; + // Attention: if you see crashes, they are likely to come + // from the following message. Fix NSText. [textObject display]; - [[controlView window] makeFirstResponder: textObject]; - if ([theEvent type] == NSLeftMouseDown) - [textObject mouseDown:theEvent]; + [textObject mouseDown: theEvent]; } -/* - * editing is complete, remove the text obj acting as the field - * editor from window's view heirarchy, set our contents from it - */ - (void) endEditing: (NSText*)textObject { [textObject setDelegate: nil]; - [textObject retain]; [textObject removeFromSuperview]; - [self setStringValue: [textObject text]]; - [textObject setString: @""]; } -// TODO: Check, what exactly this method is supposed to do? - (void) selectWithFrame: (NSRect)aRect inView: (NSView *)controlView editor: (NSText *)textObject @@ -556,13 +550,14 @@ static NSColor *shadowCol; (cell_type != NSTextCellType)) return; - textObject = [self setUpFieldEditorAttributes: textObject]; - [textObject setFrame: aRect]; + [textObject setFrame: [self drawingRectForBounds: aRect]]; [textObject setText: [self stringValue]]; [textObject setDelegate: anObject]; - [textObject setSelectedRange: NSMakeRange (selStart, selLength)]; [controlView addSubview: textObject]; + [textObject setSelectedRange: NSMakeRange (selStart, selLength)]; [[controlView window] makeFirstResponder: textObject]; + // Attention: if you see crashes, they are likely to come + // from the following message. Fix NSText. [textObject display]; }