Encode/decode named colors

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14994 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-11-15 23:07:19 +00:00
parent 43c5671dd0
commit f49099ab2b

View file

@ -587,16 +587,9 @@ void __dummy_GMAppKit_functionForLinking() {}
[archiver encodeFloat:[self brightnessComponent] withName:@"brightness"];
}
else if ([colorSpaceName isEqual:@"NSNamedColorSpace"]) {
// TODO: change it when NSColor in GNUstep will have named color lists
#if 1
NSColor* new
= [self colorUsingColorSpaceName:@"NSCalibratedRGBColorSpace"];
[new encodeWithModelArchiver:archiver];
#else
[unarchiver encodeString:[self catalogNameComponent]
withName:@"catalogName"];
[unarchiver encodeString:[self colorNameComponent] withName:@"colorName"];
#endif
}
}
@ -647,7 +640,9 @@ void __dummy_GMAppKit_functionForLinking() {}
return [self colorWithCalibratedRed:red green:green blue:blue alpha:alpha];
}
else if ([colorSpaceName isEqual:@"NSNamedColorSpace"]) {
NSAssert (0, @"Named color spaces not supported yet!");
NSString *catalog = [unarchiver decodeObjecWithName: @"catalogName"];
NSString *colornm = [unarchiver decodeObjecWithName: @"colorName"];
return [self colorWithCatalogName: catalog colorName: colornm];
}
return nil;
}
@ -941,6 +936,7 @@ void __dummy_GMAppKit_functionForLinking() {}
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[archiver encodeRect: [self frame] withName: @"frame"];
[archiver encodeBOOL: [self pullsDown] withName: @"pullsDown"];
[archiver encodeBOOL: [self isEnabled] withName: @"isEnabled"];
[archiver encodeInt: [self tag] withName: @"tag"];
@ -960,10 +956,7 @@ void __dummy_GMAppKit_functionForLinking() {}
#endif
//[archiver encodeString:[self titleOfSelectedItem] withName:@"selectedItem"];
//[archiver encodeString:[self title] withName:@"selectedItem"];
//[super encodeWithModelArchiver:archiver];
[archiver encodeRect: [self frame] withName:@"frame"];
[archiver encodeString:[self title] withName:@"selectedItem"];
}
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver