mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 15:20:38 +00:00
Try to fix bug in last change on NSCell.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27887 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c7059252b3
commit
67d368832d
2 changed files with 30 additions and 44 deletions
|
@ -321,32 +321,33 @@ static NSColor *dtxtCol;
|
|||
_cell.contents_is_attributed_string = NO;
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
if ([object isKindOfClass: [NSAttributedString class]] == YES)
|
||||
else if ([object isKindOfClass: [NSAttributedString class]] == YES)
|
||||
{
|
||||
newContents = object;
|
||||
_cell.contents_is_attributed_string = YES;
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
else if([_object_value respondsToSelector: @selector(attributedStringValue)])
|
||||
{
|
||||
newContents = [_object_value attributedStringValue];
|
||||
_cell.contents_is_attributed_string = YES;
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
else if([_object_value respondsToSelector: @selector(stringValue)])
|
||||
{
|
||||
// If the thing that was assigned is not a string, but
|
||||
// responds to stringValue then get that.
|
||||
newContents = [_object_value stringValue];
|
||||
_cell.contents_is_attributed_string = NO;
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
// If the thing that was assigned is not a string, but
|
||||
// responds to stringValue then get that.
|
||||
///
|
||||
if([_object_value respondsToSelector: @selector(attributedStringValue)])
|
||||
{
|
||||
newContents = [_object_value attributedStringValue];
|
||||
}
|
||||
else if([_object_value respondsToSelector: @selector(stringValue)])
|
||||
{
|
||||
newContents = [_object_value stringValue];
|
||||
}
|
||||
|
||||
newContents = [_object_value description];
|
||||
_cell.contents_is_attributed_string = NO;
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
}
|
||||
newContents = [_object_value description];
|
||||
_cell.contents_is_attributed_string = NO;
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newContents = [_formatter stringForObjectValue: _object_value];
|
||||
|
@ -415,11 +416,9 @@ static NSColor *dtxtCol;
|
|||
*/
|
||||
- (void) setStringValue: (NSString*)aString
|
||||
{
|
||||
NSString *string = aString;
|
||||
|
||||
/* We warn about nil for compatibiliy with MacOS X, which refuses
|
||||
nil. */
|
||||
if (string == nil)
|
||||
if (aString == nil)
|
||||
{
|
||||
NSDebugMLLog (@"MacOSXCompatibility",
|
||||
@"Attempt to use nil as string value");
|
||||
|
@ -429,44 +428,26 @@ static NSColor *dtxtCol;
|
|||
{
|
||||
[self setType: NSTextCellType];
|
||||
}
|
||||
_cell.contents_is_attributed_string = NO;
|
||||
|
||||
if (_formatter == nil)
|
||||
{
|
||||
if([string isKindOfClass: [NSString class]] == NO)
|
||||
{
|
||||
///
|
||||
// If the thing that was assigned is not a string, but
|
||||
// responds to stringValue then get that.
|
||||
///
|
||||
if([string respondsToSelector: @selector(attributedStringValue)])
|
||||
{
|
||||
string = (NSString *)[(id)string attributedStringValue];
|
||||
}
|
||||
else if([string respondsToSelector: @selector(stringValue)])
|
||||
{
|
||||
string = (NSString *)[(id)string stringValue];
|
||||
}
|
||||
}
|
||||
|
||||
ASSIGN (_contents, string);
|
||||
ASSIGN (_object_value, string);
|
||||
_cell.has_valid_object_value = YES;
|
||||
[self setObjectValue: aString];
|
||||
}
|
||||
else
|
||||
{
|
||||
id newObjectValue;
|
||||
|
||||
if ([_formatter getObjectValue: &newObjectValue
|
||||
forString: string
|
||||
forString: aString
|
||||
errorDescription: NULL])
|
||||
{
|
||||
[self setObjectValue: newObjectValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSIGN (_contents, aString);
|
||||
_cell.contents_is_attributed_string = NO;
|
||||
_cell.has_valid_object_value = NO;
|
||||
ASSIGN (_contents, string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue