mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-16 08:31:06 +00:00
Use Preferences color methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@38425 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ea33c39542
commit
da0b2d8249
2 changed files with 9 additions and 31 deletions
|
@ -1,3 +1,8 @@
|
|||
2015-03-22 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m
|
||||
Use Preferences color methods.
|
||||
|
||||
2015-03-22 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Headers/Protocols/Preferences.h
|
||||
|
|
|
@ -187,16 +187,13 @@
|
|||
[editorColumnsField setStringValue:val];
|
||||
|
||||
// Colors
|
||||
val = [prefs stringForKey:EditorForegroundColor defaultValue:@"White 0.0"];
|
||||
currentForegroundColor = [prefs colorFromString:val];
|
||||
currentForegroundColor = [prefs colorForKey:EditorForegroundColor defaultValue:[NSColor whiteColor]];
|
||||
[foregroundColorWell setColor:currentForegroundColor];
|
||||
|
||||
val = [prefs stringForKey:EditorBackgroundColor defaultValue:@"White 1.0"];
|
||||
currentBackgroundColor = [prefs colorFromString:val];
|
||||
currentBackgroundColor = [prefs colorForKey:EditorBackgroundColor defaultValue:[NSColor blackColor]];
|
||||
[backgroundColorWell setColor:currentBackgroundColor];
|
||||
|
||||
val = [prefs stringForKey:EditorSelectionColor defaultValue:@"White 0.66"];
|
||||
currentSelectionColor = [prefs colorFromString:val];
|
||||
currentSelectionColor = [prefs colorForKey:EditorSelectionColor defaultValue:[NSColor darkGrayColor]];
|
||||
[selectionColorWell setColor:currentSelectionColor];
|
||||
}
|
||||
|
||||
|
@ -243,49 +240,25 @@
|
|||
- (void)setEditorColor:(id)sender
|
||||
{
|
||||
NSColor *color;
|
||||
NSString *colorString;
|
||||
NSString *key;
|
||||
NSString *colorSpaceName;
|
||||
|
||||
if (sender == foregroundColorWell)
|
||||
{
|
||||
NSLog(@"foregroundColorWell");
|
||||
color = [foregroundColorWell color];
|
||||
key = EditorForegroundColor;
|
||||
}
|
||||
else if (sender == backgroundColorWell)
|
||||
{
|
||||
NSLog(@"backgroundColorWell");
|
||||
color = [backgroundColorWell color];
|
||||
key = EditorBackgroundColor;
|
||||
}
|
||||
else // selectionColorWell
|
||||
{
|
||||
NSLog(@"selectionColorWell");
|
||||
color = [selectionColorWell color];
|
||||
key = EditorSelectionColor;
|
||||
}
|
||||
|
||||
colorSpaceName = [color colorSpaceName];
|
||||
|
||||
if ([colorSpaceName isEqualToString:@"NSCalibratedWhiteColorSpace"])
|
||||
{
|
||||
colorString = [NSString stringWithFormat:@"White %0.1f",
|
||||
[color whiteComponent]];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (![colorSpaceName isEqualToString:NSCalibratedRGBColorSpace])
|
||||
color = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
|
||||
colorString = [NSString stringWithFormat:@"RGB %0.1f %0.1f %0.1f",
|
||||
[color redComponent],
|
||||
[color greenComponent],
|
||||
[color blueComponent]];
|
||||
}
|
||||
|
||||
NSLog(@"Selected color: '%@'", colorString);
|
||||
|
||||
[prefs setString:colorString forKey:key notify:YES];
|
||||
[prefs setColor:color forKey:key notify:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue