Attempt to correct side effect of last NSActionCell change.

Small cleanup in NSCell.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29020 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2009-11-16 11:40:14 +00:00
parent 8bd9424ef9
commit 40a81ac812
3 changed files with 49 additions and 34 deletions

View file

@ -1,3 +1,10 @@
2009-11-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCell.m (-setObjectValue:, -setStringValue:): Handle a
value of nil identically in both cases.
* Source/NSActionCell.m (-setObjectValue:, -setStringValue:):
Only mark the cell for redraw when there is no editor.
2009-11-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-validateUserIntefaceItem:): Move this

View file

@ -223,7 +223,10 @@ static Class controlClass;
[self _updateFieldEditor:
[(NSControl *)_control_view currentEditor]];
}
[(NSControl *)_control_view updateCell: self];
else
{
[(NSControl *)_control_view updateCell: self];
}
}
}
}
@ -232,7 +235,7 @@ static Class controlClass;
* Set the value of the receiver from aString.
*/
// This method is currently needed, as NSCells implementation
// does not call setObjectValue:
// sometimes does not call setObjectValue:
- (void) setStringValue: (NSString*)aString
{
[super setStringValue: aString];
@ -245,7 +248,10 @@ static Class controlClass;
[self _updateFieldEditor:
[(NSControl *)_control_view currentEditor]];
}
[(NSControl *)_control_view updateCell: self];
else
{
[(NSControl *)_control_view updateCell: self];
}
}
}
}

View file

@ -33,35 +33,35 @@
*/
#include "config.h"
#include <Foundation/NSString.h>
#include <Foundation/NSGeometry.h>
#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>
#import <Foundation/NSString.h>
#import <Foundation/NSGeometry.h>
#import <Foundation/NSException.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSNumberFormatter.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSFormatter.h>
#import <Foundation/NSRunLoop.h>
#include <GNUstepBase/GSCategories.h>
#include "AppKit/AppKitExceptions.h"
#include "AppKit/NSAttributedString.h"
#include "AppKit/NSApplication.h"
#include "AppKit/NSControl.h"
#include "AppKit/NSCell.h"
#include "AppKit/NSClipView.h"
#include "AppKit/NSColor.h"
#include "AppKit/NSCursor.h"
#include "AppKit/NSEvent.h"
#include "AppKit/NSFont.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSImage.h"
#include "AppKit/NSMenu.h"
#include "AppKit/NSParagraphStyle.h"
#include "AppKit/NSTextView.h"
#include "AppKit/NSTextContainer.h"
#include "AppKit/NSView.h"
#include "AppKit/NSWindow.h"
#import "AppKit/AppKitExceptions.h"
#import "AppKit/NSAttributedString.h"
#import "AppKit/NSApplication.h"
#import "AppKit/NSControl.h"
#import "AppKit/NSCell.h"
#import "AppKit/NSClipView.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSCursor.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSFont.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSMenu.h"
#import "AppKit/NSParagraphStyle.h"
#import "AppKit/NSTextView.h"
#import "AppKit/NSTextContainer.h"
#import "AppKit/NSView.h"
#import "AppKit/NSWindow.h"
#include "GNUstepGUI/GSTheme.h"
static Class colorClass;
@ -315,7 +315,7 @@ static NSColor *dtxtCol;
if (_formatter == nil)
{
if ([object isKindOfClass: [NSString class]] == YES)
if (object == nil || [object isKindOfClass: [NSString class]] == YES)
{
newContents = object;
_cell.contents_is_attributed_string = NO;
@ -327,7 +327,7 @@ static NSColor *dtxtCol;
_cell.contents_is_attributed_string = YES;
_cell.has_valid_object_value = YES;
}
else if([_object_value respondsToSelector: @selector(attributedStringValue)])
else if ([_object_value respondsToSelector: @selector(attributedStringValue)])
{
newContents = [_object_value attributedStringValue];
_cell.contents_is_attributed_string = YES;
@ -431,12 +431,14 @@ static NSColor *dtxtCol;
if (_formatter == nil)
{
/* if we are a string, we do an optimization and set the value here instead of using setObjectValue
/* if we are a string, we do an optimization and set the value here instead of
* using setObjectValue.
* also, we check for nil, since isKindOfClass fails for nil objects */
if([aString isKindOfClass: [NSString class]] == YES || aString == nil)
if (aString == nil || [aString isKindOfClass: [NSString class]] == YES)
{
ASSIGN (_contents, aString);
ASSIGN (_object_value, aString);
_cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = YES;
}
else