Update to get system colors working with backend

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3346 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-11-28 07:38:26 +00:00
parent 9af04949cd
commit 546b56a22e
3 changed files with 240 additions and 337 deletions

View file

@ -271,6 +271,8 @@ enum {
+ (NSColor*) textColor; + (NSColor*) textColor;
+ (NSColor*) windowFrameColor; + (NSColor*) windowFrameColor;
+ (NSColor*) windowFrameTextColor; + (NSColor*) windowFrameTextColor;
extern NSString *NSSystemColorsDidChangeNotification;
#endif #endif
@end @end

View file

@ -34,7 +34,7 @@
@interface NSColor (GNUstepPrivate) @interface NSColor (GNUstepPrivate)
+ (NSColor*) colorFromString: (NSString*)string; + (NSColor*) colorFromString: (NSString*)string;
+ (void) defaultSystemColors; + (NSColor*) systemColorWithName: (NSString*)name;
+ (void) defaultsDidChange: (NSNotification*)notification; + (void) defaultsDidChange: (NSNotification*)notification;
- (void) supportMaxColorSpaces; - (void) supportMaxColorSpaces;

View file

@ -41,11 +41,15 @@
#include <AppKit/NSView.h> #include <AppKit/NSView.h>
#include <AppKit/NSGraphics.h> #include <AppKit/NSGraphics.h>
NSString *NSSystemColorsDidChangeNotification =
@"NSSystemColorsDidChangeNotification";
@implementation NSColor @implementation NSColor
// Class variables // Class variables
static BOOL gnustep_gui_ignores_alpha = YES; static BOOL gnustep_gui_ignores_alpha = YES;
static NSColorList *systemColors = nil; static NSColorList *systemColors = nil;
static NSMutableDictionary *colorStrings = nil;
// //
// Class methods // Class methods
@ -54,23 +58,69 @@ static NSColorList *systemColors = nil;
{ {
if (self == [NSColor class]) if (self == [NSColor class])
{ {
NSString *white;
NSString *lightGray;
NSString *gray;
NSString *darkGray;
NSString *black;
// Set the version number // Set the version number
[self setVersion:2]; [self setVersion:2];
// ignore alpha by default // ignore alpha by default
gnustep_gui_ignores_alpha = YES; gnustep_gui_ignores_alpha = YES;
// Set up a dictionary containing the names of all the system colors
// as keys and with colors in string format as values.
white = [NSString stringWithFormat: @"%f %f %f",
NSWhite, NSWhite, NSWhite];
lightGray = [NSString stringWithFormat: @"%f %f %f",
NSLightGray, NSLightGray, NSLightGray];
gray = [NSString stringWithFormat: @"%f %f %f",
NSGray, NSGray, NSGray];
darkGray = [NSString stringWithFormat: @"%f %f %f",
NSDarkGray, NSDarkGray, NSDarkGray];
black = [NSString stringWithFormat: @"%f %f %f",
NSBlack, NSBlack, NSBlack];
colorStrings = (NSMutableDictionary*)[[NSMutableDictionary
dictionaryWithObjectsAndKeys:
lightGray, @"controlBackgroundColor",
lightGray, @"controlColor",
lightGray, @"controlHighlightColor",
white, @"controlLightHighlightColor",
darkGray, @"controlShadowColor",
black, @"controlDarkShadowColor",
black, @"controlTextColor",
darkGray, @"disabledControlTextColor",
gray, @"gridColor",
white, @"highlightColor",
lightGray, @"knobColor",
lightGray, @"scrollBarColor",
white, @"selectedControlColor",
black, @"selectedControlTextColor",
white, @"selectedMenuItemColor",
black, @"selectedMenuItemTextColor",
lightGray, @"selectedTextBackgroundColor",
black, @"selectedTextColor",
lightGray, @"selectedKnobColor",
black, @"shadowColor",
white, @"textBackgroundColor",
black, @"textColor",
black, @"windowFrameColor",
white, @"windowFrameTextColor",
nil] retain];
// Set up default system colors // Set up default system colors
systemColors = [[NSColorList alloc] initWithName: @"System"]; systemColors = [[NSColorList alloc] initWithName: @"System"];
[self defaultSystemColors];
// ensure user defaults are loaded, then use them and watch for changes. // ensure user defaults are loaded, then use them and watch for changes.
[NSUserDefaults standardUserDefaults]; [NSUserDefaults standardUserDefaults];
[self defaultsDidChange: nil]; [self defaultsDidChange: nil];
// [NSNotificationCenter addObserver: self [NSNotificationCenter addObserver: self
// selector: @selector(defaultsDidChange:) selector: @selector(defaultsDidChange:)
// name: NSUserDefaultsDidChangeNotification name: NSUserDefaultsDidChangeNotification
// object: nil]; object: nil];
} }
} }
@ -351,123 +401,219 @@ static NSColorList *systemColors = nil;
// //
+ (NSColor*) controlBackgroundColor + (NSColor*) controlBackgroundColor
{ {
return [systemColors colorWithKey: @"controlBackgroundColor"]; NSColor *color = [systemColors colorWithKey: @"controlBackgroundColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"controlBackgroundColor"];
return color;
} }
+ (NSColor*) controlColor + (NSColor*) controlColor
{ {
return [systemColors colorWithKey: @"controlColor"]; NSColor *color = [systemColors colorWithKey: @"controlColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"controlColor"];
return color;
} }
+ (NSColor*) controlHighlightColor + (NSColor*) controlHighlightColor
{ {
return [systemColors colorWithKey: @"controlHighlightColor"]; NSColor *color = [systemColors colorWithKey: @"controlHighlightColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"controlHighlightColor"];
return color;
} }
+ (NSColor*) controlLightHighlightColor + (NSColor*) controlLightHighlightColor
{ {
return [systemColors colorWithKey: @"controlLightHighlightColor"]; NSColor *color = [systemColors colorWithKey: @"controlLightHighlightColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"controlLightHighlightColor"];
return color;
} }
+ (NSColor*) controlShadowColor + (NSColor*) controlShadowColor
{ {
return [systemColors colorWithKey: @"controlShadowColor"]; NSColor *color = [systemColors colorWithKey: @"controlShadowColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"controlShadowColor"];
return color;
} }
+ (NSColor*) controlDarkShadowColor + (NSColor*) controlDarkShadowColor
{ {
return [systemColors colorWithKey: @"controlDarkShadowColor"]; NSColor *color = [systemColors colorWithKey: @"controlDarkShadowColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"controlDarkShadowColor"];
return color;
} }
+ (NSColor*) controlTextColor + (NSColor*) controlTextColor
{ {
return [systemColors colorWithKey: @"controlTextColor"]; NSColor *color = [systemColors colorWithKey: @"controlTextColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"controlTextColor"];
return color;
} }
+ (NSColor*) disabledControlTextColor + (NSColor*) disabledControlTextColor
{ {
return [systemColors colorWithKey: @"disabledControlTextColor"]; NSColor *color = [systemColors colorWithKey: @"disabledControlTextColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"disabledControlTextColor"];
return color;
} }
+ (NSColor*) gridColor + (NSColor*) gridColor
{ {
return [systemColors colorWithKey: @"gridColor"]; NSColor *color = [systemColors colorWithKey: @"gridColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"gridColor"];
return color;
} }
+ (NSColor*) highlightColor + (NSColor*) highlightColor
{ {
return [systemColors colorWithKey: @"highlightColor"]; NSColor *color = [systemColors colorWithKey: @"highlightColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"highlightColor"];
return color;
} }
+ (NSColor*) knobColor + (NSColor*) knobColor
{ {
return [systemColors colorWithKey: @"knobColor"]; NSColor *color = [systemColors colorWithKey: @"knobColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"knobColor"];
return color;
} }
+ (NSColor*) scrollBarColor + (NSColor*) scrollBarColor
{ {
return [systemColors colorWithKey: @"scrollBarColor"]; NSColor *color = [systemColors colorWithKey: @"scrollBarColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"scrollBarColor"];
return color;
} }
+ (NSColor*) selectedControlColor + (NSColor*) selectedControlColor
{ {
return [systemColors colorWithKey: @"selectedControlColor"]; NSColor *color = [systemColors colorWithKey: @"selectedControlColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"selectedControlColor"];
return color;
} }
+ (NSColor*) selectedControlTextColor + (NSColor*) selectedControlTextColor
{ {
return [systemColors colorWithKey: @"selectedControlTextColor"]; NSColor *color = [systemColors colorWithKey: @"selectedControlTextColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"selectedControlTextColor"];
return color;
} }
+ (NSColor*) selectedMenuItemColor + (NSColor*) selectedMenuItemColor
{ {
return [systemColors colorWithKey: @"selectedMenuItemColor"]; NSColor *color = [systemColors colorWithKey: @"selectedMenuItemColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"selectedMenuItemColor"];
return color;
} }
+ (NSColor*) selectedMenuItemTextColor + (NSColor*) selectedMenuItemTextColor
{ {
return [systemColors colorWithKey: @"selectedMenuItemTextColor"]; NSColor *color = [systemColors colorWithKey: @"selectedMenuItemTextColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"selectedMenuItemTextColor"];
return color;
} }
+ (NSColor*) selectedTextBackgroundColor + (NSColor*) selectedTextBackgroundColor
{ {
return [systemColors colorWithKey: @"selectedTextBackgroundColor"]; NSColor *color = [systemColors colorWithKey: @"selectedTextBackgroundColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"selectedTextBackgroundColor"];
return color;
} }
+ (NSColor*) selectedTextColor + (NSColor*) selectedTextColor
{ {
// return [systemColors colorWithKey: @"selectedTextColor"]; // FIX ME NSColor *color = [systemColors colorWithKey: @"selectedTextColor"];
return [self colorWithCalibratedRed:.12 green:.12 blue:0 alpha:1.0];
//[self colorWithCalibratedRed:.12 green:.12 blue:0 alpha:1.0];
if (color == nil)
color = [NSColor systemColorWithName: @"selectedTextColor"];
return color;
} }
+ (NSColor*) selectedKnobColor + (NSColor*) selectedKnobColor
{ {
return [systemColors colorWithKey: @"selectedKnobColor"]; NSColor *color = [systemColors colorWithKey: @"selectedKnobColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"selectedKnobColor"];
return color;
} }
+ (NSColor*) shadowColor + (NSColor*) shadowColor
{ {
return [systemColors colorWithKey: @"shadowColor"]; NSColor *color = [systemColors colorWithKey: @"shadowColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"shadowColor"];
return color;
} }
+ (NSColor*) textBackgroundColor + (NSColor*) textBackgroundColor
{ {
return [systemColors colorWithKey: @"textBackgroundColor"]; NSColor *color = [systemColors colorWithKey: @"textBackgroundColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"textBackgroundColor"];
return color;
} }
+ (NSColor*) textColor + (NSColor*) textColor
{ {
return [systemColors colorWithKey: @"textColor"]; NSColor *color = [systemColors colorWithKey: @"textColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"textColor"];
return color;
} }
+ (NSColor*) windowFrameColor + (NSColor*) windowFrameColor
{ {
return [systemColors colorWithKey: @"windowFrameColor"]; NSColor *color = [systemColors colorWithKey: @"windowFrameColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"windowFrameColor"];
return color;
} }
+ (NSColor*) windowFrameTextColor + (NSColor*) windowFrameTextColor
{ {
return [systemColors colorWithKey: @"windowFrameTextColor"]; NSColor *color = [systemColors colorWithKey: @"windowFrameTextColor"];
if (color == nil)
color = [NSColor systemColorWithName: @"windowFrameTextColor"];
return color;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -1077,329 +1223,84 @@ static NSColorList *systemColors = nil;
return nil; return nil;
} }
+ (void) defaultSystemColors + (NSColor*) systemColorWithName: (NSString*)name
{ {
NSColor *color; NSColor *color = [systemColors colorWithKey: name];
color = [self lightGrayColor]; if (color == nil)
[systemColors setColor: color forKey: @"controlBackgroundColor"]; {
NSString *rep = [colorStrings objectForKey: name];
color = [self lightGrayColor]; if (rep == nil)
[systemColors setColor: color forKey: @"controlColor"]; {
NSLog(@"Request for unknown system color - '%@'\n", name);
color = [self lightGrayColor]; return nil;
[systemColors setColor: color forKey: @"controlHighlightColor"]; }
color = [NSColor colorFromString: rep];
color = [self whiteColor]; if (color == nil)
[systemColors setColor: color forKey: @"controlLightHighlightColor"]; {
NSLog(@"System color '%@' has bad string rep - '%@'\n", name, rep);
color = [self darkGrayColor]; return nil;
[systemColors setColor: color forKey: @"controlShadowColor"]; }
[systemColors setColor: color forKey: name];
color = [self blackColor]; }
[systemColors setColor: color forKey: @"controlDarkShadowColor"]; return color;
color = [self blackColor];
[systemColors setColor: color forKey: @"controlTextColor"];
color = [self darkGrayColor];
[systemColors setColor: color forKey: @"disabledControlTextColor"];
color = [self grayColor];
[systemColors setColor: color forKey: @"gridColor"];
color = [self whiteColor];
[systemColors setColor: color forKey: @"highlightColor"];
color = [self lightGrayColor];
[systemColors setColor: color forKey: @"knobColor"];
color = [self lightGrayColor];
[systemColors setColor: color forKey: @"scrollBarColor"];
color = [self whiteColor];
[systemColors setColor: color forKey: @"selectedControlColor"];
color = [self blackColor];
[systemColors setColor: color forKey: @"selectedControlTextColor"];
color = [self whiteColor];
[systemColors setColor: color forKey: @"selectedMenuItemColor"];
color = [self blackColor];
[systemColors setColor: color forKey: @"selectedMenuItemTextColor"];
color = [self lightGrayColor];
[systemColors setColor: color forKey: @"selectedTextBackgroundColor"];
color = [self blackColor];
[systemColors setColor: color forKey: @"selectedTextColor"];
color = [self lightGrayColor];
[systemColors setColor: color forKey: @"selectedKnobColor"];
color = [self blackColor];
[systemColors setColor: color forKey: @"shadowColor"];
color = [self whiteColor];
[systemColors setColor: color forKey: @"textBackgroundColor"];
color = [self blackColor];
[systemColors setColor: color forKey: @"textColor"];
color = [self blackColor];
[systemColors setColor: color forKey: @"windowFrameColor"];
color = [self whiteColor];
[systemColors setColor: color forKey: @"windowFrameTextColor"];
} }
/*
* Go through all the names of ssystem colors - for each color where
* there is a value in the defaults database, see if the current
* istring value of the color differs from the old one.
* Where there is a difference, update the color strings dictionary
* and, where a color object exists, update the system colors list
* to contain the new color.
* Finally, issue a notification if appropriate.
*/
+ (void) defaultsDidChange: (NSNotification*)notification + (void) defaultsDidChange: (NSNotification*)notification
{ {
static NSString *controlBackgroundColor = nil;
static NSString *controlColor = nil;
static NSString *controlHighlightColor = nil;
static NSString *controlLightHighlightColor = nil;
static NSString *controlShadowColor = nil;
static NSString *controlDarkShadowColor = nil;
static NSString *controlTextColor = nil;
static NSString *disabledControlTextColor = nil;
static NSString *gridColor = nil;
static NSString *highlightColor = nil;
static NSString *knobColor = nil;
static NSString *scrollBarColor = nil;
static NSString *selectedControlColor = nil;
static NSString *selectedControlTextColor = nil;
static NSString *selectedMenuItemColor = nil;
static NSString *selectedMenuItemTextColor = nil;
static NSString *selectedTextBackgroundColor = nil;
static NSString *selectedTextColor = nil;
static NSString *selectedKnobColor = nil;
static NSString *shadowColor = nil;
static NSString *textBackgroundColor = nil;
static NSString *textColor = nil;
static NSString *windowFrameColor = nil;
static NSString *windowFrameTextColor = nil;
NSUserDefaults *defs; NSUserDefaults *defs;
NSString *str; NSEnumerator *enumerator;
NSColor *color; NSString *key;
BOOL didChange = NO;
defs = [NSUserDefaults standardUserDefaults]; defs = [NSUserDefaults standardUserDefaults];
str = [defs stringForKey: @"controlBackgroundColor"]; enumerator = [colorStrings keyEnumerator];
if (str != nil && (controlBackgroundColor == nil || [controlBackgroundColor isEqualToString: str] == NO)) while ((key = [enumerator nextObject]) != nil)
{ {
[controlBackgroundColor release]; NSString *def = [defs stringForKey: key];
controlBackgroundColor = [str retain];
color = [self colorFromString: controlBackgroundColor];
[systemColors setColor: color forKey: @"controlBackgroundColor"];
}
str = [defs stringForKey: @"controlColor"]; if (def != nil)
if (str != nil && (controlColor == nil || [controlColor isEqualToString: str] == NO))
{ {
[controlColor release]; NSString *old = [colorStrings objectForKey: key];
controlColor = [str retain];
color = [self colorFromString: controlColor];
[systemColors setColor: color forKey: @"controlColor"];
}
str = [defs stringForKey: @"controlHighlightColor"]; if ([def isEqualToString: old] == NO)
if (str != nil && (controlHighlightColor == nil || [controlHighlightColor isEqualToString: str] == NO))
{ {
[controlHighlightColor release]; NSColor *color;
controlHighlightColor = [str retain];
color = [self colorFromString: controlHighlightColor];
[systemColors setColor: color forKey: @"controlHighlightColor"];
}
str = [defs stringForKey: @"controlLightHighlightColor"]; didChange = YES;
if (str != nil && (controlLightHighlightColor == nil || [controlLightHighlightColor isEqualToString: str] == NO)) [colorStrings setObject: def forKey: key];
color = [systemColors colorWithKey: key];
if (color != nil)
{ {
[controlLightHighlightColor release]; color = [NSColor colorFromString: def];
controlLightHighlightColor = [str retain]; if (color == nil)
color = [self colorFromString: controlLightHighlightColor]; {
[systemColors setColor: color forKey: @"controlLightHighlightColor"]; NSLog(@"System color '%@' has bad string rep - '%@'\n",
key, def);
} }
else
str = [defs stringForKey: @"controlShadowColor"];
if (str != nil && (controlShadowColor == nil || [controlShadowColor isEqualToString: str] == NO))
{ {
[controlShadowColor release]; [systemColors setColor: color forKey: key];
controlShadowColor = [str retain];
color = [self colorFromString: controlShadowColor];
[systemColors setColor: color forKey: @"controlShadowColor"];
} }
str = [defs stringForKey: @"controlDarkShadowColor"];
if (str != nil && (controlDarkShadowColor == nil || [controlDarkShadowColor isEqualToString: str] == NO))
{
[controlDarkShadowColor release];
controlDarkShadowColor = [str retain];
color = [self colorFromString: controlDarkShadowColor];
[systemColors setColor: color forKey: @"controlDarkShadowColor"];
} }
str = [defs stringForKey: @"controlTextColor"];
if (str != nil && (controlTextColor == nil || [controlTextColor isEqualToString: str] == NO))
{
[controlTextColor release];
controlTextColor = [str retain];
color = [self colorFromString: controlTextColor];
[systemColors setColor: color forKey: @"controlTextColor"];
} }
str = [defs stringForKey: @"disabledControlTextColor"];
if (str != nil && (disabledControlTextColor == nil || [disabledControlTextColor isEqualToString: str] == NO))
{
[disabledControlTextColor release];
disabledControlTextColor = [str retain];
color = [self colorFromString: disabledControlTextColor];
[systemColors setColor: color forKey: @"disabledControlTextColor"];
} }
str = [defs stringForKey: @"gridColor"];
if (str != nil && (gridColor == nil || [gridColor isEqualToString: str] == NO))
{
[gridColor release];
gridColor = [str retain];
color = [self colorFromString: gridColor];
[systemColors setColor: color forKey: @"gridColor"];
} }
if (didChange)
str = [defs stringForKey: @"highlightColor"];
if (str != nil && (highlightColor == nil || [highlightColor isEqualToString: str] == NO))
{ {
[highlightColor release]; [[NSNotificationCenter defaultCenter]
highlightColor = [str retain]; postNotificationName: NSSystemColorsDidChangeNotification object: nil];
color = [self colorFromString: highlightColor];
[systemColors setColor: color forKey: @"highlightColor"];
}
str = [defs stringForKey: @"knobColor"];
if (str != nil && (knobColor == nil || [knobColor isEqualToString: str] == NO))
{
[knobColor release];
knobColor = [str retain];
color = [self colorFromString: knobColor];
[systemColors setColor: color forKey: @"knobColor"];
}
str = [defs stringForKey: @"scrollBarColor"];
if (str != nil && (scrollBarColor == nil || [scrollBarColor isEqualToString: str] == NO))
{
[scrollBarColor release];
scrollBarColor = [str retain];
color = [self colorFromString: scrollBarColor];
[systemColors setColor: color forKey: @"scrollBarColor"];
}
str = [defs stringForKey: @"selectedControlColor"];
if (str != nil && (selectedControlColor == nil || [selectedControlColor isEqualToString: str] == NO))
{
[selectedControlColor release];
selectedControlColor = [str retain];
color = [self colorFromString: selectedControlColor];
[systemColors setColor: color forKey: @"selectedControlColor"];
}
str = [defs stringForKey: @"selectedControlTextColor"];
if (str != nil && (selectedControlTextColor == nil || [selectedControlTextColor isEqualToString: str] == NO))
{
[selectedControlTextColor release];
selectedControlTextColor = [str retain];
color = [self colorFromString: selectedControlTextColor];
[systemColors setColor: color forKey: @"selectedControlTextColor"];
}
str = [defs stringForKey: @"selectedMenuItemColor"];
if (str != nil && (selectedMenuItemColor == nil || [selectedMenuItemColor isEqualToString: str] == NO))
{
[selectedMenuItemColor release];
selectedMenuItemColor = [str retain];
color = [self colorFromString: selectedMenuItemColor];
[systemColors setColor: color forKey: @"selectedMenuItemColor"];
}
str = [defs stringForKey: @"selectedMenuItemTextColor"];
if (str != nil && (selectedMenuItemTextColor == nil || [selectedMenuItemTextColor isEqualToString: str] == NO))
{
[selectedMenuItemTextColor release];
selectedMenuItemTextColor = [str retain];
color = [self colorFromString: selectedMenuItemTextColor];
[systemColors setColor: color forKey: @"selectedMenuItemTextColor"];
}
str = [defs stringForKey: @"selectedTextBackgroundColor"];
if (str != nil && (selectedTextBackgroundColor == nil || [selectedTextBackgroundColor isEqualToString: str] == NO))
{
[selectedTextBackgroundColor release];
selectedTextBackgroundColor = [str retain];
color = [self colorFromString: selectedTextBackgroundColor];
[systemColors setColor: color forKey: @"selectedTextBackgroundColor"];
}
str = [defs stringForKey: @"selectedTextColor"];
if (str != nil && (selectedTextColor == nil || [selectedTextColor isEqualToString: str] == NO))
{
[selectedTextColor release];
selectedTextColor = [str retain];
color = [self colorFromString: selectedTextColor];
[systemColors setColor: color forKey: @"selectedTextColor"];
}
str = [defs stringForKey: @"selectedKnobColor"];
if (str != nil && (selectedKnobColor == nil || [selectedKnobColor isEqualToString: str] == NO))
{
[selectedKnobColor release];
selectedKnobColor = [str retain];
color = [self colorFromString: selectedKnobColor];
[systemColors setColor: color forKey: @"selectedKnobColor"];
}
str = [defs stringForKey: @"shadowColor"];
if (str != nil && (shadowColor == nil || [shadowColor isEqualToString: str] == NO))
{
[shadowColor release];
shadowColor = [str retain];
color = [self colorFromString: shadowColor];
[systemColors setColor: color forKey: @"shadowColor"];
}
str = [defs stringForKey: @"textBackgroundColor"];
if (str != nil && (textBackgroundColor == nil || [textBackgroundColor isEqualToString: str] == NO))
{
[textBackgroundColor release];
textBackgroundColor = [str retain];
color = [self colorFromString: textBackgroundColor];
[systemColors setColor: color forKey: @"textBackgroundColor"];
}
str = [defs stringForKey: @"textColor"];
if (str != nil && (textColor == nil || [textColor isEqualToString: str] == NO))
{
[textColor release];
textColor = [str retain];
color = [self colorFromString: textColor];
[systemColors setColor: color forKey: @"textColor"];
}
str = [defs stringForKey: @"windowFrameColor"];
if (str != nil && (windowFrameColor == nil || [windowFrameColor isEqualToString: str] == NO))
{
[windowFrameColor release];
windowFrameColor = [str retain];
color = [self colorFromString: windowFrameColor];
[systemColors setColor: color forKey: @"windowFrameColor"];
}
str = [defs stringForKey: @"windowFrameTextColor"];
if (str != nil && (windowFrameTextColor == nil || [windowFrameTextColor isEqualToString: str] == NO))
{
[windowFrameTextColor release];
windowFrameTextColor = [str retain];
color = [self colorFromString: windowFrameTextColor];
[systemColors setColor: color forKey: @"windowFrameTextColor"];
} }
} }