mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:20:47 +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
|
@ -1,3 +1,8 @@
|
||||||
|
2009-02-16 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSCell.m (-setStringValue:, -setObjectValue:): Try to fix
|
||||||
|
bugs in last change.
|
||||||
|
|
||||||
2009-02-15 22:21-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
2009-02-15 22:21-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/NSOpenPanel.m: Corrects bug #25471. Only enable
|
* Source/NSOpenPanel.m: Corrects bug #25471. Only enable
|
||||||
|
|
|
@ -321,32 +321,33 @@ static NSColor *dtxtCol;
|
||||||
_cell.contents_is_attributed_string = NO;
|
_cell.contents_is_attributed_string = NO;
|
||||||
_cell.has_valid_object_value = YES;
|
_cell.has_valid_object_value = YES;
|
||||||
}
|
}
|
||||||
if ([object isKindOfClass: [NSAttributedString class]] == YES)
|
else if ([object isKindOfClass: [NSAttributedString class]] == YES)
|
||||||
{
|
{
|
||||||
newContents = object;
|
newContents = object;
|
||||||
_cell.contents_is_attributed_string = YES;
|
_cell.contents_is_attributed_string = YES;
|
||||||
_cell.has_valid_object_value = 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
|
else
|
||||||
{
|
{
|
||||||
///
|
newContents = [_object_value description];
|
||||||
// If the thing that was assigned is not a string, but
|
_cell.contents_is_attributed_string = NO;
|
||||||
// responds to stringValue then get that.
|
_cell.has_valid_object_value = YES;
|
||||||
///
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newContents = [_formatter stringForObjectValue: _object_value];
|
newContents = [_formatter stringForObjectValue: _object_value];
|
||||||
|
@ -415,11 +416,9 @@ static NSColor *dtxtCol;
|
||||||
*/
|
*/
|
||||||
- (void) setStringValue: (NSString*)aString
|
- (void) setStringValue: (NSString*)aString
|
||||||
{
|
{
|
||||||
NSString *string = aString;
|
|
||||||
|
|
||||||
/* We warn about nil for compatibiliy with MacOS X, which refuses
|
/* We warn about nil for compatibiliy with MacOS X, which refuses
|
||||||
nil. */
|
nil. */
|
||||||
if (string == nil)
|
if (aString == nil)
|
||||||
{
|
{
|
||||||
NSDebugMLLog (@"MacOSXCompatibility",
|
NSDebugMLLog (@"MacOSXCompatibility",
|
||||||
@"Attempt to use nil as string value");
|
@"Attempt to use nil as string value");
|
||||||
|
@ -429,44 +428,26 @@ static NSColor *dtxtCol;
|
||||||
{
|
{
|
||||||
[self setType: NSTextCellType];
|
[self setType: NSTextCellType];
|
||||||
}
|
}
|
||||||
_cell.contents_is_attributed_string = NO;
|
|
||||||
|
|
||||||
if (_formatter == nil)
|
if (_formatter == nil)
|
||||||
{
|
{
|
||||||
if([string isKindOfClass: [NSString class]] == NO)
|
[self setObjectValue: aString];
|
||||||
{
|
|
||||||
///
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id newObjectValue;
|
id newObjectValue;
|
||||||
|
|
||||||
if ([_formatter getObjectValue: &newObjectValue
|
if ([_formatter getObjectValue: &newObjectValue
|
||||||
forString: string
|
forString: aString
|
||||||
errorDescription: NULL])
|
errorDescription: NULL])
|
||||||
{
|
{
|
||||||
[self setObjectValue: newObjectValue];
|
[self setObjectValue: newObjectValue];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ASSIGN (_contents, aString);
|
||||||
|
_cell.contents_is_attributed_string = NO;
|
||||||
_cell.has_valid_object_value = NO;
|
_cell.has_valid_object_value = NO;
|
||||||
ASSIGN (_contents, string);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue