Author: rmottola
Date: Sun Mar 22 23:55:22 2015
New Revision: 38425

URL: http://svn.gna.org/viewcvs/gnustep?rev=38425&view=rev
Log:
Use Preferences color methods

Modified:
    apps/projectcenter/trunk/ChangeLog
    apps/projectcenter/trunk/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m

Modified: apps/projectcenter/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/ChangeLog?rev=38425&r1=38424&r2=38425&view=diff
==============================================================================
--- apps/projectcenter/trunk/ChangeLog  (original)
+++ apps/projectcenter/trunk/ChangeLog  Sun Mar 22 23:55:22 2015
@@ -1,3 +1,8 @@
+2015-03-22 Riccardo Mottola <r...@gnu.org>
+
+       * Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m
+       Use Preferences color methods.
+
 2015-03-22 Riccardo Mottola <r...@gnu.org>
 
        * Headers/Protocols/Preferences.h

Modified: 
apps/projectcenter/trunk/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m?rev=38425&r1=38424&r2=38425&view=diff
==============================================================================
--- apps/projectcenter/trunk/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m   
(original)
+++ apps/projectcenter/trunk/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m   
Sun Mar 22 23:55:22 2015
@@ -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


_______________________________________________
Gnustep-cvs mailing list
Gnustep-cvs@gna.org
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to