mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 18:11:31 +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>
|
2015-03-22 Riccardo Mottola <rm@gnu.org>
|
||||||
|
|
||||||
* Headers/Protocols/Preferences.h
|
* Headers/Protocols/Preferences.h
|
||||||
|
|
|
@ -187,16 +187,13 @@
|
||||||
[editorColumnsField setStringValue:val];
|
[editorColumnsField setStringValue:val];
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
val = [prefs stringForKey:EditorForegroundColor defaultValue:@"White 0.0"];
|
currentForegroundColor = [prefs colorForKey:EditorForegroundColor defaultValue:[NSColor whiteColor]];
|
||||||
currentForegroundColor = [prefs colorFromString:val];
|
|
||||||
[foregroundColorWell setColor:currentForegroundColor];
|
[foregroundColorWell setColor:currentForegroundColor];
|
||||||
|
|
||||||
val = [prefs stringForKey:EditorBackgroundColor defaultValue:@"White 1.0"];
|
currentBackgroundColor = [prefs colorForKey:EditorBackgroundColor defaultValue:[NSColor blackColor]];
|
||||||
currentBackgroundColor = [prefs colorFromString:val];
|
|
||||||
[backgroundColorWell setColor:currentBackgroundColor];
|
[backgroundColorWell setColor:currentBackgroundColor];
|
||||||
|
|
||||||
val = [prefs stringForKey:EditorSelectionColor defaultValue:@"White 0.66"];
|
currentSelectionColor = [prefs colorForKey:EditorSelectionColor defaultValue:[NSColor darkGrayColor]];
|
||||||
currentSelectionColor = [prefs colorFromString:val];
|
|
||||||
[selectionColorWell setColor:currentSelectionColor];
|
[selectionColorWell setColor:currentSelectionColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,49 +240,25 @@
|
||||||
- (void)setEditorColor:(id)sender
|
- (void)setEditorColor:(id)sender
|
||||||
{
|
{
|
||||||
NSColor *color;
|
NSColor *color;
|
||||||
NSString *colorString;
|
|
||||||
NSString *key;
|
NSString *key;
|
||||||
NSString *colorSpaceName;
|
|
||||||
|
|
||||||
if (sender == foregroundColorWell)
|
if (sender == foregroundColorWell)
|
||||||
{
|
{
|
||||||
NSLog(@"foregroundColorWell");
|
|
||||||
color = [foregroundColorWell color];
|
color = [foregroundColorWell color];
|
||||||
key = EditorForegroundColor;
|
key = EditorForegroundColor;
|
||||||
}
|
}
|
||||||
else if (sender == backgroundColorWell)
|
else if (sender == backgroundColorWell)
|
||||||
{
|
{
|
||||||
NSLog(@"backgroundColorWell");
|
|
||||||
color = [backgroundColorWell color];
|
color = [backgroundColorWell color];
|
||||||
key = EditorBackgroundColor;
|
key = EditorBackgroundColor;
|
||||||
}
|
}
|
||||||
else // selectionColorWell
|
else // selectionColorWell
|
||||||
{
|
{
|
||||||
NSLog(@"selectionColorWell");
|
|
||||||
color = [selectionColorWell color];
|
color = [selectionColorWell color];
|
||||||
key = EditorSelectionColor;
|
key = EditorSelectionColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
colorSpaceName = [color colorSpaceName];
|
[prefs setColor:color forKey:key notify:YES];
|
||||||
|
|
||||||
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];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue