Revision: 2534
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2534&view=rev
Author:   hofman
Date:     2007-07-19 09:24:31 -0700 (Thu, 19 Jul 2007)

Log Message:
-----------
Convenience accessors for default colors. 

Add some remarks in windowDidLoad. 

Modified Paths:
--------------
    trunk/NSUserDefaultsController_SKExtensions.h
    trunk/NSUserDefaultsController_SKExtensions.m
    trunk/SKApplicationController.m
    trunk/SKMainWindowController.h
    trunk/SKMainWindowController.m
    trunk/SKPDFAnnotationNote.m
    trunk/SKPDFView.m

Modified: trunk/NSUserDefaultsController_SKExtensions.h
===================================================================
--- trunk/NSUserDefaultsController_SKExtensions.h       2007-07-19 13:33:06 UTC 
(rev 2533)
+++ trunk/NSUserDefaultsController_SKExtensions.h       2007-07-19 16:24:31 UTC 
(rev 2534)
@@ -49,3 +49,11 @@
 - (void)revertToInitialValuesForKeys:(NSArray *)keys;
 
 @end
+
+
[EMAIL PROTECTED] NSUserDefaults (SKExtensions)
+
+- (NSColor *)colorForKey:(NSString *)key;
+- (void)setColor:(NSColor *)color forKey:(NSString *)key;
+
[EMAIL PROTECTED]

Modified: trunk/NSUserDefaultsController_SKExtensions.m
===================================================================
--- trunk/NSUserDefaultsController_SKExtensions.m       2007-07-19 13:33:06 UTC 
(rev 2533)
+++ trunk/NSUserDefaultsController_SKExtensions.m       2007-07-19 16:24:31 UTC 
(rev 2534)
@@ -78,3 +78,18 @@
 }
 
 @end
+
+
[EMAIL PROTECTED] NSUserDefaults (SKExtensions)
+
+- (NSColor *)colorForKey:(NSString *)key {
+    NSData *data = [self dataForKey:key];
+    return data ? [NSUnarchiver unarchiveObjectWithData:data] : nil;
+}
+
+- (void)setColor:(NSColor *)color forKey:(NSString *)key {
+    NSData *data = color ? [NSArchiver archivedDataWithRootObject:color] : nil;
+    return [self setObject:data forKey:key];
+}
+
[EMAIL PROTECTED]

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2007-07-19 13:33:06 UTC (rev 2533)
+++ trunk/SKApplicationController.m     2007-07-19 16:24:31 UTC (rev 2534)
@@ -457,59 +457,59 @@
 }
 
 - (NSColor *)backgroundColor {
-    return [NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults 
standardUserDefaults] dataForKey:SKBackgroundColorKey]];
+    return [[NSUserDefaults standardUserDefaults] 
colorForKey:SKBackgroundColorKey];
 }
 
 - (void)setBackgroundColor:(NSColor *)color {
-    return [[NSUserDefaults standardUserDefaults] setObject:[NSArchiver 
archivedDataWithRootObject:color] forKey:SKBackgroundColorKey];
+    return [[NSUserDefaults standardUserDefaults] setColor:color 
forKey:SKBackgroundColorKey];
 }
 
 - (NSColor *)fullScreenBackgroundColor {
-    return [NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults 
standardUserDefaults] dataForKey:SKFullScreenBackgroundColorKey]];
+    return [[NSUserDefaults standardUserDefaults] 
colorForKey:SKFullScreenBackgroundColorKey];
 }
 
 - (void)setFullScreenBackgroundColor:(NSColor *)color {
-    return [[NSUserDefaults standardUserDefaults] setObject:[NSArchiver 
archivedDataWithRootObject:color] forKey:SKFullScreenBackgroundColorKey];
+    return [[NSUserDefaults standardUserDefaults] setColor:color 
forKey:SKFullScreenBackgroundColorKey];
 }
 
 - (NSDictionary *)defaultNoteColors {
     NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
     return [NSDictionary dictionaryWithObjectsAndKeys: 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKFreeTextNoteColorKey]], @"textNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKAnchoredNoteColorKey]], @"anchoredNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKCircleNoteColorKey]], @"circleNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKSquareNoteColorKey]], @"squareNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKHighlightNoteColorKey]], @"highlightNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKUnderlineNoteColorKey]], @"underlineNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKStrikeOutNoteColorKey]], @"strikeOutNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKLineNoteColorKey]], @"lineNote", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKCircleNoteInteriorColorKey]], @"circleNoteInterior", 
-        [NSUnarchiver unarchiveObjectWithData:[sud 
dataForKey:SKSquareNoteInteriorColorKey]], @"squareNoteInterior", nil];
+        [sud colorForKey:SKFreeTextNoteColorKey], @"textNote", 
+        [sud colorForKey:SKAnchoredNoteColorKey], @"anchoredNote", 
+        [sud colorForKey:SKCircleNoteColorKey], @"circleNote", 
+        [sud colorForKey:SKSquareNoteColorKey], @"squareNote", 
+        [sud colorForKey:SKHighlightNoteColorKey], @"highlightNote", 
+        [sud colorForKey:SKUnderlineNoteColorKey], @"underlineNote", 
+        [sud colorForKey:SKStrikeOutNoteColorKey], @"strikeOutNote", 
+        [sud colorForKey:SKLineNoteColorKey], @"lineNote", 
+        [sud colorForKey:SKCircleNoteInteriorColorKey], @"circleNoteInterior", 
+        [sud colorForKey:SKSquareNoteInteriorColorKey], @"squareNoteInterior", 
nil];
 }
 
 - (void)setDefaultNoteColors:(NSDictionary *)colorDict {
     NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
     NSColor *color;
     if (color = [colorDict objectForKey:@"textNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKFreeTextNoteColorKey];
+        [sud setColor:color forKey:SKFreeTextNoteColorKey];
     if (color = [colorDict objectForKey:@"anchoredNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKAnchoredNoteColorKey];
+        [sud setColor:color forKey:SKAnchoredNoteColorKey];
     if (color = [colorDict objectForKey:@"circleNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKCircleNoteColorKey];
+        [sud setColor:color forKey:SKCircleNoteColorKey];
     if (color = [colorDict objectForKey:@"squareNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKSquareNoteColorKey];
+        [sud setColor:color forKey:SKSquareNoteColorKey];
     if (color = [colorDict objectForKey:@"highlightNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKHighlightNoteColorKey];
+        [sud setColor:color forKey:SKHighlightNoteColorKey];
     if (color = [colorDict objectForKey:@"underlineNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKUnderlineNoteColorKey];
+        [sud setColor:color forKey:SKUnderlineNoteColorKey];
     if (color = [colorDict objectForKey:@"strikeOutNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKStrikeOutNoteColorKey];
+        [sud setColor:color forKey:SKStrikeOutNoteColorKey];
     if (color = [colorDict objectForKey:@"lineNote"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKLineNoteColorKey];
+        [sud setColor:color forKey:SKLineNoteColorKey];
     if (color = [colorDict objectForKey:@"circleNoteInterior"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKCircleNoteInteriorColorKey];
+        [sud setColor:color forKey:SKCircleNoteInteriorColorKey];
     if (color = [colorDict objectForKey:@"squareNoteInterior"])
-        [sud setObject:[NSArchiver archivedDataWithRootObject:color] 
forKey:SKSquareNoteInteriorColorKey];
+        [sud setColor:color forKey:SKSquareNoteInteriorColorKey];
 }
 
 - (unsigned int)countOfLines {

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2007-07-19 13:33:06 UTC (rev 2533)
+++ trunk/SKMainWindowController.h      2007-07-19 16:24:31 UTC (rev 2534)
@@ -48,6 +48,12 @@
     SKSnapshotSidePaneState
 } SKRightSidePaneState;
 
+enum {
+    SKDefaultWindowOption,
+    SKMaximizeWindowOption,
+    SKFitWindowOption
+};
+
 typedef struct _SKPDFViewState {
        int displayMode;
        BOOL autoScales;

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-07-19 13:33:06 UTC (rev 2533)
+++ trunk/SKMainWindowController.m      2007-07-19 16:24:31 UTC (rev 2534)
@@ -230,6 +230,10 @@
 }
 
 - (void)windowDidLoad{
+    NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+    
+    // Set up the panes and subviews, needs to be done before we resize them
+    
     [leftSideCollapsibleView setCollapseEdges:BDSKMaxXEdgeMask | 
BDSKMinYEdgeMask];
     [leftSideCollapsibleView setMinSize:NSMakeSize(100.0, 42.0)];
     
@@ -268,8 +272,10 @@
     
     [spinner setUsesThreadedAnimation:YES];
     
+    // Set up the tool bar
     [self setupToolbar];
     
+    // Set up the window
     // we retain as we might replace it with the full screen window
     mainWindow = [[self window] retain];
     
@@ -277,24 +283,30 @@
     
     [[self window] setBackgroundColor:[NSColor colorWithCalibratedWhite:0.9 
alpha:1.0]];
     
-    int windowSizeOption = [[NSUserDefaults standardUserDefaults] 
integerForKey:SKInitialWindowSizeOptionKey];
-    if (windowSizeOption == 1)
+    int windowSizeOption = [sud integerForKey:SKInitialWindowSizeOptionKey];
+    if (windowSizeOption == SKMaximizeWindowOption)
         [[self window] setFrame:[[NSScreen mainScreen] visibleFrame] 
display:NO];
     
-    [self applyPDFSettings:[[NSUserDefaults standardUserDefaults] 
dictionaryForKey:SKDefaultPDFDisplaySettingsKey]];
+    if ([sud boolForKey:SKShowStatusBarKey])
+        [self toggleStatusBar:nil];
     
-    [pdfView setShouldAntiAlias:[[NSUserDefaults standardUserDefaults] 
boolForKey:SKShouldAntiAliasKey]];
-    [pdfView setGreekingThreshold:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKGreekingThresholdKey]];
-    [pdfView setBackgroundColor:[NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKBackgroundColorKey]]];
+    [[self window] makeFirstResponder:[pdfView documentView]];
     
-    if ([[NSUserDefaults standardUserDefaults] 
objectForKey:SKLeftSidePaneWidthKey]) {
-        float width = [[NSUserDefaults standardUserDefaults] 
floatForKey:SKLeftSidePaneWidthKey];
+    // Set up the PDF
+    [self applyPDFSettings:[sud 
dictionaryForKey:SKDefaultPDFDisplaySettingsKey]];
+    
+    [pdfView setShouldAntiAlias:[sud boolForKey:SKShouldAntiAliasKey]];
+    [pdfView setGreekingThreshold:[sud floatForKey:SKGreekingThresholdKey]];
+    [pdfView setBackgroundColor:[sud colorForKey:SKBackgroundColorKey]];
+    
+    if ([sud objectForKey:SKLeftSidePaneWidthKey]) {
+        float width = [sud floatForKey:SKLeftSidePaneWidthKey];
         if (width >= 0.0) {
             frame = [leftSideContentBox frame];
             frame.size.width = width;
             [leftSideContentBox setFrame:frame];
         }
-        width = [[NSUserDefaults standardUserDefaults] 
floatForKey:SKRightSidePaneWidthKey];
+        width = [sud floatForKey:SKRightSidePaneWidthKey];
         if (width >= 0.0) {
             frame = [rightSideContentBox frame];
             frame.size.width = width;
@@ -307,9 +319,6 @@
         [pdfContentBox setFrame:frame];
     }
     
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:SKShowStatusBarKey])
-        [self toggleStatusBar:nil];
-    
     // this needs to be done before loading the PDFDocument
     [self resetThumbnailSizeIfNeeded];
     [self resetSnapshotSizeIfNeeded];
@@ -328,41 +337,41 @@
     // this is mainly needed when the pdf auto-scales
     [pdfView layoutDocumentView];
     
+    // Show/hide left side pane if necessary
+    if ([sud boolForKey:SKOpenContentsPaneOnlyForTOCKey] && 
(NSWidth([leftSideContentBox frame]) > 0.0) == (pdfOutline == nil))
+        [self toggleLeftSidePane:self];
     if (pdfOutline == nil) {
-        if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKOpenContentsPaneOnlyForTOCKey] &&
-            NSWidth([leftSideContentBox frame]) > 0.0)
-            [self toggleLeftSidePane:self];
         [self setLeftSidePaneState:SKThumbnailSidePaneState];
         [leftSideButton setEnabled:NO forSegment:SKOutlineSidePaneState];
-    } else if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKOpenContentsPaneOnlyForTOCKey] &&
-               NSWidth([leftSideContentBox frame]) <= 0.0) {
-        [self toggleLeftSidePane:self];
     }
     
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKRememberLastPageViewedKey]) {
+    // Go to page?
+    if ([sud boolForKey:SKRememberLastPageViewedKey]) {
         unsigned int pageIndex = [[SKBookmarkController 
sharedBookmarkController] pageIndexForRecentDocumentAtPath:[[[self document] 
fileURL] path]];
         if (pageIndex != NSNotFound)
             [pdfView goToPage:[[pdfView document] pageAtIndex:pageIndex]];
     }
     
-    if (windowSizeOption == 2)
+    // We can fit only after the PDF has been loaded
+    if (windowSizeOption == SKFitWindowOption)
         [self performFit:self];
     
-    [[self window] makeFirstResponder:[pdfView documentView]];
-    
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKRememberSnapshotsKey]) {
+    // Open snapshots?
+    if ([sud boolForKey:SKRememberSnapshotsKey]) {
         NSEnumerator *setupEnum = [[[SKBookmarkController 
sharedBookmarkController] snapshotsAtPath:[[[self document] fileURL] path]] 
objectEnumerator];
         NSDictionary *setup;
         if (setup = [setupEnum nextObject])
             [self showSnapshotAtPageNumber:[[setup objectForKey:@"page"] 
unsignedIntValue] forRect:NSRectFromString([setup objectForKey:@"rect"]) 
factor:[[setup objectForKey:@"page"] floatValue] display:[[setup 
objectForKey:@"hasWindow"] boolValue]];
     }
     
+    // This update toolbar item and other states
     [self handleChangedHistoryNotification:nil];
     [self handlePageChangedNotification:nil];
     [self handleScaleChangedNotification:nil];
     [self handleToolModeChangedNotification:nil];
     [self handleAnnotationModeChangedNotification:nil];
     
+    // Observe notifications and KVO
     [self registerForNotifications];
     [self registerAsObserver];
 }
@@ -1946,7 +1955,7 @@
 
 - (void)goFullScreen {
     NSScreen *screen = [[self window] screen]; // @@ screen: or should we use 
the main screen?
-    NSColor *backgroundColor = [self isPresentation] ? [NSColor blackColor] : 
[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKFullScreenBackgroundColorKey]];
+    NSColor *backgroundColor = [self isPresentation] ? [NSColor blackColor] : 
[[NSUserDefaults standardUserDefaults] 
colorForKey:SKFullScreenBackgroundColorKey];
     
     if (screen == nil) // @@ screen: can this ever happen?
         screen = [NSScreen mainScreen];
@@ -2010,7 +2019,7 @@
 }
 
 - (void)removeFullScreen {
-    [pdfView setBackgroundColor:[NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKBackgroundColorKey]]];
+    [pdfView setBackgroundColor:[[NSUserDefaults standardUserDefaults] 
colorForKey:SKBackgroundColorKey]];
     [pdfView layoutDocumentView];
     
     NSEnumerator *wcEnum = [[[self document] windowControllers] 
objectEnumerator];
@@ -2113,7 +2122,7 @@
     [scrollView setHasVerticalScroller:[[savedNormalSetup 
objectForKey:@"hasVerticalScroller"] boolValue]];
     [scrollView setAutohidesScrollers:[[savedNormalSetup 
objectForKey:@"autoHidesScrollers"] boolValue]];
     
-    NSColor *backgroundColor = [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKFullScreenBackgroundColorKey]];
+    NSColor *backgroundColor = [[NSUserDefaults standardUserDefaults] 
colorForKey:SKFullScreenBackgroundColorKey];
     [pdfView setBackgroundColor:backgroundColor];
     [fullScreenWindow setBackgroundColor:backgroundColor];
     [fullScreenWindow setLevel:NSNormalWindowLevel];
@@ -2310,11 +2319,8 @@
 - (void)addAnnotationsForSelection:(PDFSelection *)sel {
     NSArray *pages = [sel pages];
     int i, iMax = [pages count];
-    NSColor *color = nil;
-    NSData *colorData = [[NSUserDefaults standardUserDefaults] 
dataForKey:SKSearchHighlightColorKey];
+    NSColor *color = [[NSUserDefaults standardUserDefaults] 
colorForKey:SKSearchHighlightColorKey];
     
-    if (colorData != nil)
-        color = [NSUnarchiver unarchiveObjectWithData:colorData];
     if (color == nil)
         color = [NSColor redColor];
     
@@ -2931,10 +2937,10 @@
         NSString *key = [keyPath substringFromIndex:7];
         if ([key isEqualToString:SKBackgroundColorKey]) {
             if ([self isFullScreen] == NO && [self isPresentation] == NO)
-                [pdfView setBackgroundColor:[NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKBackgroundColorKey]]];
+                [pdfView setBackgroundColor:[[NSUserDefaults 
standardUserDefaults] colorForKey:SKBackgroundColorKey]];
         } else if ([key isEqualToString:SKFullScreenBackgroundColorKey]) {
             if ([self isFullScreen]) {
-                NSColor *color = [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKFullScreenBackgroundColorKey]];
+                NSColor *color = [[NSUserDefaults standardUserDefaults] 
colorForKey:SKFullScreenBackgroundColorKey];
                 if (color) {
                     [pdfView setBackgroundColor:color];
                     [fullScreenWindow setBackgroundColor:color];

Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-07-19 13:33:06 UTC (rev 2533)
+++ trunk/SKPDFAnnotationNote.m 2007-07-19 16:24:31 UTC (rev 2534)
@@ -42,6 +42,7 @@
 #import "PDFSelection_SKExtensions.h"
 #import "SKPDFView.h"
 #import "OBUtilities.h"
+#import "NSUserDefaultsController_SKExtensions.h"
 
 enum {
     SKASTextNote = 'NTxt',
@@ -563,10 +564,10 @@
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
         [self setShouldPrint:YES];
-        NSColor *color = [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKCircleNoteInteriorColorKey]];
+        NSColor *color = [[NSUserDefaults standardUserDefaults] 
colorForKey:SKCircleNoteInteriorColorKey];
         if ([color alphaComponent] > 0.0)
             [super setInteriorColor:color];
-        originalSetColor(self, @selector(setColor:), [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKCircleNoteColorKey]]);
+        originalSetColor(self, @selector(setColor:), [[NSUserDefaults 
standardUserDefaults] colorForKey:SKCircleNoteColorKey]);
         [[self border] setLineWidth:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKCircleNoteLineWidthKey]];
         [[self border] setDashPattern:[[NSUserDefaults standardUserDefaults] 
arrayForKey:SKCircleNoteDashPatternKey]];
         [[self border] setStyle:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKCircleNoteLineStyleKey]];
@@ -628,10 +629,10 @@
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
         [self setShouldPrint:YES];
-        NSColor *color = [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKSquareNoteInteriorColorKey]];
+        NSColor *color = [[NSUserDefaults standardUserDefaults] 
colorForKey:SKSquareNoteInteriorColorKey];
         if ([color alphaComponent] > 0.0)
             [super setInteriorColor:color];
-        originalSetColor(self, @selector(setColor:), [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKSquareNoteColorKey]]);
+        originalSetColor(self, @selector(setColor:), [[NSUserDefaults 
standardUserDefaults] colorForKey:SKSquareNoteColorKey]);
         [[self border] setLineWidth:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKSquareNoteLineWidthKey]];
         [[self border] setDashPattern:[[NSUserDefaults standardUserDefaults] 
arrayForKey:SKSquareNoteDashPatternKey]];
         [[self border] setStyle:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKSquareNoteLineStyleKey]];
@@ -737,7 +738,7 @@
             case kPDFMarkupTypeStrikeOut: colorKey = SKStrikeOutNoteColorKey; 
break;
         }
         if (colorKey)
-            originalSetColor(self, @selector(setColor:), [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:colorKey]]);
+            originalSetColor(self, @selector(setColor:), [[NSUserDefaults 
standardUserDefaults] colorForKey:colorKey]);
         
         NSArray *quadPoints = nil;
         if (pointStrings) {
@@ -994,7 +995,7 @@
         NSFont *font = [NSFont fontWithName:[[NSUserDefaults 
standardUserDefaults] stringForKey:SKTextNoteFontNameKey]
                                        size:[[NSUserDefaults 
standardUserDefaults] floatForKey:SKTextNoteFontSizeKey]];
         [super setFont:font];
-        originalSetColor(self, @selector(setColor:), [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKFreeTextNoteColorKey]]);
+        originalSetColor(self, @selector(setColor:), [[NSUserDefaults 
standardUserDefaults] colorForKey:SKFreeTextNoteColorKey]);
         PDFBorder *border = [[PDFBorder allocWithZone:[self zone]] init];
         [border setLineWidth:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKFreeTextNoteLineWidthKey]];
         [border setDashPattern:[[NSUserDefaults standardUserDefaults] 
arrayForKey:SKFreeTextNoteDashPatternKey]];
@@ -1091,7 +1092,7 @@
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
         [self setShouldPrint:YES];
-        originalSetColor(self, @selector(setColor:), [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKAnchoredNoteColorKey]]);
+        originalSetColor(self, @selector(setColor:), [[NSUserDefaults 
standardUserDefaults] colorForKey:SKAnchoredNoteColorKey]);
         [super setIconType:[[NSUserDefaults standardUserDefaults] 
integerForKey:SKAnchoredNoteIconTypeKey]];
         texts = [[NSArray alloc] initWithObjects:[[[SKNoteText alloc] 
initWithAnnotation:self] autorelease], nil];
         textStorage = [[NSTextStorage allocWithZone:[self zone]] init];
@@ -1277,7 +1278,7 @@
 
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
-        originalSetColor(self, @selector(setColor:), [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKLineNoteColorKey]]);
+        originalSetColor(self, @selector(setColor:), [[NSUserDefaults 
standardUserDefaults] colorForKey:SKLineNoteColorKey]);
         [super setStartLineStyle:[[NSUserDefaults standardUserDefaults] 
integerForKey:SKLineNoteStartLineStyleKey]];
         [super setEndLineStyle:[[NSUserDefaults standardUserDefaults] 
integerForKey:SKLineNoteEndLineStyleKey]];
         [super setStartPoint:NSMakePoint(0.0, 0.0)];

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2007-07-19 13:33:06 UTC (rev 2533)
+++ trunk/SKPDFView.m   2007-07-19 16:24:31 UTC (rev 2534)
@@ -350,7 +350,7 @@
         
         NSRect rect = [readingBar currentBoundsForBox:[self displayBox]];
         BOOL invert = [[NSUserDefaults standardUserDefaults] 
boolForKey:SKReadingBarInvertKey];
-        NSColor *nsColor = [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKReadingBarColorKey]];
+        NSColor *nsColor = [[NSUserDefaults standardUserDefaults] 
colorForKey:SKReadingBarColorKey];
         float color[4] = { [nsColor redComponent], [nsColor greenComponent], 
[nsColor blueComponent], [nsColor alphaComponent] };
         
         CGContextSetFillColor(context, color);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to