Revision: 3700
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3700&view=rev
Author:   hofman
Date:     2008-04-10 11:12:54 -0700 (Thu, 10 Apr 2008)

Log Message:
-----------
Add more global strings.

Modified Paths:
--------------
    trunk/NSArray_SKExtensions.m
    trunk/SKAnnotationTypeImageCell.h
    trunk/SKAnnotationTypeImageCell.m
    trunk/SKBookmark.m
    trunk/SKBookmarkController.m
    trunk/SKMainWindowController.m
    trunk/SKSnapshotWindowController.h
    trunk/SKSnapshotWindowController.m

Modified: trunk/NSArray_SKExtensions.m
===================================================================
--- trunk/NSArray_SKExtensions.m        2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/NSArray_SKExtensions.m        2008-04-10 18:12:54 UTC (rev 3700)
@@ -39,35 +39,36 @@
 #import "NSArray_SKExtensions.h"
 #import "NSValue_SKExtensions.h"
 #import "NSString_SKExtensions.h"
+#import "PDFAnnotation_SKExtensions.h"
 
 @implementation NSArray (SKExtensions)
 
 - (NSArray *)arraySortedByPageIndex {
-    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"pageIndex" 
ascending:YES selector:@selector(compare:)] autorelease]]];
+    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] 
initWithKey:SKPDFAnnotationPageIndexKey ascending:YES 
selector:@selector(compare:)] autorelease]]];
 }
 
 - (NSArray *)arraySortedByBounds {
-    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"bounds" ascending:YES 
selector:@selector(boundsCompare:)] autorelease]]];
+    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationBoundsKey 
ascending:YES selector:@selector(boundsCompare:)] autorelease]]];
 }
 
 - (NSArray *)arraySortedByPageIndexAndBounds {
-    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:@"pageIndex" 
ascending:YES selector:@selector(compare:)] autorelease], [[[NSSortDescriptor 
alloc] initWithKey:@"bounds" ascending:YES selector:@selector(boundsCompare:)] 
autorelease], nil]];
+    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObjects:[[[NSSortDescriptor alloc] 
initWithKey:SKPDFAnnotationPageIndexKey ascending:YES 
selector:@selector(compare:)] autorelease], [[[NSSortDescriptor alloc] 
initWithKey:SKPDFAnnotationBoundsKey ascending:YES 
selector:@selector(boundsCompare:)] autorelease], nil]];
 }
 
 - (NSArray *)arraySortedByType {
-    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"type" ascending:YES 
selector:@selector(noteTypeCompare:)] autorelease]]];
+    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationTypeKey 
ascending:YES selector:@selector(noteTypeCompare:)] autorelease]]];
 }
 
 - (NSArray *)arraySortedByContents {
-    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"string" ascending:YES 
selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease]]];
+    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationStringKey 
ascending:YES selector:@selector(localizedCaseInsensitiveNumericCompare:)] 
autorelease]]];
 }
 
 - (NSArray *)arraySortedByTypeAndContents {
-    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:@"type" ascending:YES 
selector:@selector(noteTypeCompare:)] autorelease], [[[NSSortDescriptor alloc] 
initWithKey:@"string" ascending:YES 
selector:@selector(caseInsensitiveCompare:)] autorelease], nil]];
+    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationTypeKey 
ascending:YES selector:@selector(noteTypeCompare:)] autorelease], 
[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationStringKey ascending:YES 
selector:@selector(caseInsensitiveCompare:)] autorelease], nil]];
 }
 
 - (NSArray *)arraySortedByTypeAndPageIndex {
-    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:@"type" ascending:YES 
selector:@selector(noteTypeCompare:)] autorelease], [[[NSSortDescriptor alloc] 
initWithKey:@"pageIndex" ascending:YES selector:@selector(compare:)] 
autorelease], nil]];
+    return [self sortedArrayUsingDescriptors:[NSArray 
arrayWithObjects:[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationTypeKey 
ascending:YES selector:@selector(noteTypeCompare:)] autorelease], 
[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationPageIndexKey 
ascending:YES selector:@selector(compare:)] autorelease], nil]];
 }
 
 @end

Modified: trunk/SKAnnotationTypeImageCell.h
===================================================================
--- trunk/SKAnnotationTypeImageCell.h   2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/SKAnnotationTypeImageCell.h   2008-04-10 18:12:54 UTC (rev 3700)
@@ -38,6 +38,8 @@
 
 #import <Cocoa/Cocoa.h>
 
+extern NSString *SKAnnotationTypeImageCellTypeKey;
+extern NSString *SKAnnotationTypeImageCellActiveKey;
 
 @interface SKAnnotationTypeImageCell : NSImageCell {
     NSString *type;

Modified: trunk/SKAnnotationTypeImageCell.m
===================================================================
--- trunk/SKAnnotationTypeImageCell.m   2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/SKAnnotationTypeImageCell.m   2008-04-10 18:12:54 UTC (rev 3700)
@@ -40,6 +40,8 @@
 #import <Quartz/Quartz.h>
 #import "SKStringConstants.h"
 
+NSString *SKAnnotationTypeImageCellTypeKey = @"type";
+NSString *SKAnnotationTypeImageCellActiveKey = @"active";
 
 @implementation SKAnnotationTypeImageCell
 
@@ -57,12 +59,12 @@
 
 - (void)setObjectValue:(id)anObject {
     if ([anObject respondsToSelector:@selector(objectForKey:)]) {
-        NSString *newType = [anObject objectForKey:@"type"];
+        NSString *newType = [anObject 
objectForKey:SKAnnotationTypeImageCellTypeKey];
         if (type != newType) {
             [type release];
             type = [newType retain];
         }
-        active = [[anObject objectForKey:@"active"] boolValue];
+        active = [[anObject objectForKey:SKAnnotationTypeImageCellActiveKey] 
boolValue];
     } else {
         [super setObjectValue:anObject];
     }

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/SKBookmark.m  2008-04-10 18:12:54 UTC (rev 3700)
@@ -49,11 +49,11 @@
 static NSString *SKBookmarkTypeFolderString = @"folder";
 static NSString *SKBookmarkTypeSeparatorString = @"separator";
 
-#define CHILDREN_KEY    @"children"
-#define LABEL_KEY       @"label"
-#define PAGE_INDEX_KEY  @"pageIndex"
-#define ALIAS_DATA_KEY  @"_BDAlias"
-#define TYPE_KEY        @"type"
+static NSString *SKBookmarkChildrenKey = @"children";
+static NSString *SKBookmarkLabelKey = @"label";
+static NSString *SKBookmarkPageIndexKey = @"pageIndex";
+static NSString *SKBookmarkAliasDataKey = @"_BDAlias";
+static NSString *SKBookmarkTypeKey = @"type";
 
 @interface SKFileBookmark : SKBookmark {
     BDAlias *alias;
@@ -124,17 +124,17 @@
 }
 
 - (id)initWithProperties:(NSDictionary *)dictionary {
-    if ([[dictionary objectForKey:TYPE_KEY] 
isEqualToString:SKBookmarkTypeFolderString]) {
-        NSEnumerator *dictEnum = [[dictionary objectForKey:CHILDREN_KEY] 
objectEnumerator];
+    if ([[dictionary objectForKey:SKBookmarkTypeKey] 
isEqualToString:SKBookmarkTypeFolderString]) {
+        NSEnumerator *dictEnum = [[dictionary 
objectForKey:SKBookmarkChildrenKey] objectEnumerator];
         NSDictionary *dict;
         NSMutableArray *newChildren = [NSMutableArray array];
         while (dict = [dictEnum nextObject])
             [newChildren addObject:[[[[self class] alloc] 
initWithProperties:dict] autorelease]];
-        return [self initFolderWithChildren:newChildren label:[dictionary 
objectForKey:LABEL_KEY]];
-    } else if ([[dictionary objectForKey:TYPE_KEY] 
isEqualToString:SKBookmarkTypeSeparatorString]) {
+        return [self initFolderWithChildren:newChildren label:[dictionary 
objectForKey:SKBookmarkLabelKey]];
+    } else if ([[dictionary objectForKey:SKBookmarkTypeKey] 
isEqualToString:SKBookmarkTypeSeparatorString]) {
         return [self initSeparator];
     } else {
-        return [self initWithAliasData:[dictionary 
objectForKey:ALIAS_DATA_KEY] pageIndex:[[dictionary 
objectForKey:PAGE_INDEX_KEY] unsignedIntValue] label:[dictionary 
objectForKey:LABEL_KEY]];
+        return [self initWithAliasData:[dictionary 
objectForKey:SKBookmarkAliasDataKey] pageIndex:[[dictionary 
objectForKey:SKBookmarkPageIndexKey] unsignedIntValue] label:[dictionary 
objectForKey:SKBookmarkLabelKey]];
     }
 }
 
@@ -235,7 +235,7 @@
 }
 
 - (NSDictionary *)properties {
-    return [NSDictionary 
dictionaryWithObjectsAndKeys:SKBookmarkTypeBookmarkString, TYPE_KEY, [self 
aliasData], ALIAS_DATA_KEY, [NSNumber numberWithUnsignedInt:pageIndex], 
PAGE_INDEX_KEY, label, LABEL_KEY, nil];
+    return [NSDictionary 
dictionaryWithObjectsAndKeys:SKBookmarkTypeBookmarkString, SKBookmarkTypeKey, 
[self aliasData], SKBookmarkAliasDataKey, [NSNumber 
numberWithUnsignedInt:pageIndex], SKBookmarkPageIndexKey, label, 
SKBookmarkLabelKey, nil];
 }
 
 - (int)bookmarkType {
@@ -337,7 +337,7 @@
 }
 
 - (NSDictionary *)properties {
-    return [NSDictionary 
dictionaryWithObjectsAndKeys:SKBookmarkTypeFolderString, TYPE_KEY, [children 
valueForKey:@"properties"], CHILDREN_KEY, label, LABEL_KEY, nil];
+    return [NSDictionary 
dictionaryWithObjectsAndKeys:SKBookmarkTypeFolderString, SKBookmarkTypeKey, 
[children valueForKey:@"properties"], SKBookmarkChildrenKey, label, 
SKBookmarkLabelKey, nil];
 }
 
 - (int)bookmarkType {
@@ -402,7 +402,7 @@
 }
 
 - (NSDictionary *)properties {
-    return [NSDictionary 
dictionaryWithObjectsAndKeys:SKBookmarkTypeSeparatorString, TYPE_KEY, nil];
+    return [NSDictionary 
dictionaryWithObjectsAndKeys:SKBookmarkTypeSeparatorString, SKBookmarkTypeKey, 
nil];
 }
 
 - (int)bookmarkType {

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/SKBookmarkController.m        2008-04-10 18:12:54 UTC (rev 3700)
@@ -63,14 +63,13 @@
 
 static NSString *SKMaximumDocumentPageHistoryCountKey = 
@"SKMaximumDocumentPageHistoryCount";
 
-#define BOOKMARKS_KEY           @"bookmarks"
-#define RECENT_DOCUMENTS_KEY    @"recentDocuments"
+static NSString *SKBookmarkControllerBookmarksKey = @"bookmarks";
+static NSString *SKBookmarkControllerRecentDocumentsKey = @"recentDocuments";
 
-#define PAGE_INDEX_KEY          @"pageIndex"
-#define PATH_KEY                @"path"
-#define ALIAS_KEY               @"alias"
-#define ALIAS_DATA_KEY          @"_BDAlias"
-#define SNAPSHOTS_KEY           @"snapshots"
+static NSString *SKRecentDocumentPageIndexKey = @"pageIndex";
+static NSString *SKRecentDocumentAliasKey = @"alias";
+static NSString *SKRecentDocumentAliasDataKey = @"_BDAlias";
+static NSString *SKRecentDocumentSnapshotsKey = @"snapshots";
 
 @implementation SKBookmarkController
 
@@ -109,8 +108,8 @@
                 NSLog(@"Error deserializing: %@", error);
                 [error release];
             } else if ([plist isKindOfClass:[NSDictionary class]]) {
-                [recentDocuments addObjectsFromArray:[plist 
objectForKey:RECENT_DOCUMENTS_KEY]];
-                NSEnumerator *dictEnum = [[plist objectForKey:BOOKMARKS_KEY] 
objectEnumerator];
+                [recentDocuments addObjectsFromArray:[plist 
objectForKey:SKBookmarkControllerRecentDocumentsKey]];
+                NSEnumerator *dictEnum = [[plist 
objectForKey:SKBookmarkControllerBookmarksKey] objectEnumerator];
                 NSDictionary *dict;
                 
                 while (dict = [dictEnum nextObject]) {
@@ -282,10 +281,10 @@
     unsigned int idx = NSNotFound, i, iMax = [recentDocuments count];
     for (i = 0; i < iMax; i++) {
         NSMutableDictionary *info = [recentDocuments objectAtIndex:i];
-        BDAlias *alias = [info valueForKey:ALIAS_KEY];
+        BDAlias *alias = [info valueForKey:SKRecentDocumentAliasKey];
         if (alias == nil) {
-            alias = [BDAlias aliasWithData:[info valueForKey:ALIAS_DATA_KEY]];
-            [info setValue:alias forKey:ALIAS_KEY];
+            alias = [BDAlias aliasWithData:[info 
valueForKey:SKRecentDocumentAliasDataKey]];
+            [info setValue:alias forKey:SKRecentDocumentAliasKey];
         }
         if ([[alias fullPathNoUI] isEqualToString:path]) {
             idx = i;
@@ -304,7 +303,7 @@
         [recentDocuments removeObjectAtIndex:idx];
     
     BDAlias *alias = [BDAlias aliasWithPath:path];
-    NSMutableDictionary *bm = [NSMutableDictionary 
dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:pageIndex], 
PAGE_INDEX_KEY, [alias aliasData], ALIAS_DATA_KEY, alias, ALIAS_KEY, [setups 
count] ? setups : nil, SNAPSHOTS_KEY, nil];
+    NSMutableDictionary *bm = [NSMutableDictionary 
dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:pageIndex], 
SKRecentDocumentPageIndexKey, [alias aliasData], SKRecentDocumentAliasDataKey, 
alias, SKRecentDocumentAliasKey, [setups count] ? setups : nil, 
SKRecentDocumentSnapshotsKey, nil];
     [recentDocuments insertObject:bm atIndex:0];
     if ([recentDocuments count] > maxRecentDocumentsCount)
         [recentDocuments removeLastObject];
@@ -314,14 +313,14 @@
     if (path == nil)
         return NSNotFound;
     unsigned int idx = [self indexOfRecentDocumentAtPath:path];
-    return idx == NSNotFound ? NSNotFound : [[[recentDocuments 
objectAtIndex:idx] objectForKey:PAGE_INDEX_KEY] unsignedIntValue];
+    return idx == NSNotFound ? NSNotFound : [[[recentDocuments 
objectAtIndex:idx] objectForKey:SKRecentDocumentPageIndexKey] unsignedIntValue];
 }
 
 - (NSArray *)snapshotsAtPath:(NSString *)path {
     if (path == nil)
         return nil;
     unsigned int idx = [self indexOfRecentDocumentAtPath:path];
-    NSArray *setups = idx == NSNotFound ? nil : [[recentDocuments 
objectAtIndex:idx] objectForKey:SNAPSHOTS_KEY];
+    NSArray *setups = idx == NSNotFound ? nil : [[recentDocuments 
objectAtIndex:idx] objectForKey:SKRecentDocumentSnapshotsKey];
     return [setups count] ? setups : nil;
 }
 
@@ -451,8 +450,8 @@
 #pragma mark Notification handlers
 
 - (void)handleApplicationWillTerminateNotification:(NSNotification 
*)notification  {
-    [recentDocuments makeObjectsPerformSelector:@selector(removeObjectForKey:) 
withObject:ALIAS_KEY];
-    NSDictionary *bookmarksDictionary = [NSDictionary 
dictionaryWithObjectsAndKeys:[bookmarks valueForKey:@"properties"], 
BOOKMARKS_KEY, recentDocuments, RECENT_DOCUMENTS_KEY, nil];
+    [recentDocuments makeObjectsPerformSelector:@selector(removeObjectForKey:) 
withObject:SKRecentDocumentAliasKey];
+    NSDictionary *bookmarksDictionary = [NSDictionary 
dictionaryWithObjectsAndKeys:[bookmarks valueForKey:@"properties"], 
SKBookmarkControllerBookmarksKey, recentDocuments, 
SKBookmarkControllerRecentDocumentsKey, nil];
     NSString *error = nil;
     NSPropertyListFormat format = NSPropertyListBinaryFormat_v1_0;
     NSData *data = [NSPropertyListSerialization 
dataFromPropertyList:bookmarksDictionary format:format errorDescription:&error];

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/SKMainWindowController.m      2008-04-10 18:12:54 UTC (rev 3700)
@@ -71,6 +71,7 @@
 #import "SKNoteOutlineView.h"
 #import "SKThumbnailTableView.h"
 #import "SKFindTableView.h"
+#import "SKAnnotationTypeImageCell.h"
 #import "NSWindowController_SKExtensions.h"
 #import "SKPDFHoverWindow.h"
 #import "PDFSelection_SKExtensions.h"
@@ -86,6 +87,7 @@
 #import "SKProgressController.h"
 #import "SKSecondaryPDFView.h"
 #import "SKSheetController.h"
+#import "SKColorSwatch.h"
 #import "OBUtilities.h"
 #import "SKApplicationController.h"
 #import "SKCFCallbacks.h"
@@ -105,6 +107,27 @@
 static NSString *SKMainWindowAutoHidesScrollersKey = @"autoHidesScrollers";
 static NSString *SKMainWindowPageIndexKey = @"pageIndex";
 
+static NSString *SKMainWindowPageLabelKey = @"pageLabel";
+static NSString *SKMainWindowPageLabelsKey = @"pageLabels";
+static NSString *SKMainWindowPageNumberKey = @"pageNumber";
+static NSString *SKMainWindowSearchResultsKey = @"searchResults";
+static NSString *SKMainWindowGroupedSearchResultsKey = @"groupedSearchResults";
+static NSString *SKMainWindowNotesKey = @"notes";
+static NSString *SKMainWindowThumbnailsKey = @"thumbnails";
+static NSString *SKMainWindowSnapshotsKey = @"snapshots";
+
+static NSString *SKMainWindowPageColumnIdentifer = @"page";
+static NSString *SKMainWindowLabelColumnIdentifer = @"label";
+static NSString *SKMainWindowNoteColumnIdentifer = @"note";
+static NSString *SKMainWindowTypeColumnIdentifer = @"type";
+static NSString *SKMainWindowRelevanceColumnIdentifer = @"relevance";
+static NSString *SKMainWindowResultsColumnIdentifer = @"results";
+
+static NSString *SKSearchResultCountKey = @"count";
+static NSString *SKSearchResultPageKey = @"page";
+static NSString *SKSearchResultResultsKey = @"results";
+static NSString *SKSearchResultMaxCountKey = @"maxCount";
+
 static float segmentedControlHeight = 23.0;
 static float segmentedControlOffset = 1.0;
 
@@ -242,7 +265,7 @@
     [self stopObservingNotes:[self notes]];
     [undoGroupOldPropertiesPerNote release];
     [undoGroupInsertedNotes release];
-    [colorSwatch unbind:@"color"];
+    [colorSwatch unbind:SKColorSwatchColorsKey];
        [[NSNotificationCenter defaultCenter] removeObserver: self];
     [self unregisterAsObserver];
     [(id)temporaryAnnotations release];
@@ -420,15 +443,15 @@
     [self resetSnapshotSizeIfNeeded];
     
     // this needs to be done before loading the PDFDocument
-    NSSortDescriptor *pageIndexSortDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:@"pageIndex" ascending:YES] autorelease];
-    NSSortDescriptor *boundsSortDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:@"bounds" ascending:YES selector:@selector(boundsCompare:)] 
autorelease];
+    NSSortDescriptor *pageIndexSortDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:SKPDFAnnotationPageIndexKey ascending:YES] autorelease];
+    NSSortDescriptor *boundsSortDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:SKPDFAnnotationBoundsKey ascending:YES 
selector:@selector(boundsCompare:)] autorelease];
     [noteArrayController setSortDescriptors:[NSArray 
arrayWithObjects:pageIndexSortDescriptor, boundsSortDescriptor, nil]];
     [snapshotArrayController setSortDescriptors:[NSArray 
arrayWithObjects:pageIndexSortDescriptor, nil]];
     [ownerController setContent:self];
     
-    NSSortDescriptor *countDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:@"count" ascending:NO] autorelease];
+    NSSortDescriptor *countDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:SKSearchResultCountKey ascending:NO] autorelease];
     [groupedFindArrayController setSortDescriptors:[NSArray 
arrayWithObjects:countDescriptor, nil]];
-    [[[groupedFindTableView tableColumnWithIdentifier:@"relevance"] dataCell] 
setEnabled:NO];
+    [[[groupedFindTableView 
tableColumnWithIdentifier:SKMainWindowRelevanceColumnIdentifer] dataCell] 
setEnabled:NO];
         
     // NB: the next line will load the PDF document and annotations, so 
necessary setup must be finished first!
     // windowControllerDidLoadNib: is not called automatically because the 
document overrides makeWindowControllers
@@ -802,7 +825,7 @@
 }
 
 - (void)updatePageColumnWidthForTableView:(NSTableView *)tv {
-    NSTableColumn *tableColumn = [tv tableColumnWithIdentifier:@"page"];
+    NSTableColumn *tableColumn = [tv 
tableColumnWithIdentifier:SKMainWindowPageColumnIdentifer];
     id cell = [tableColumn dataCell];
     float labelWidth = 0.0;
     NSEnumerator *labelEnum = [pageLabels objectEnumerator];
@@ -823,8 +846,8 @@
     int i, count = [pdfDoc pageCount];
     
     // update page labels, also update the size of the table columns 
displaying the labels
-    [self willChangeValueForKey:@"pageLabel"];
-    [self willChangeValueForKey:@"pageLabels"];
+    [self willChangeValueForKey:SKMainWindowPageLabelKey];
+    [self willChangeValueForKey:SKMainWindowPageLabelsKey];
     [pageLabels removeAllObjects];
     for (i = 0; i < count; i++) {
         NSString *label = [[pdfDoc pageAtIndex:i] label];
@@ -832,8 +855,8 @@
             label = [NSString stringWithFormat:@"%i", i+1];
         [pageLabels addObject:label];
     }
-    [self didChangeValueForKey:@"pageLabels"];
-    [self didChangeValueForKey:@"pageLabel"];
+    [self didChangeValueForKey:SKMainWindowPageLabelsKey];
+    [self didChangeValueForKey:SKMainWindowPageLabelKey];
     
     [self updatePageColumnWidthForTableView:thumbnailTableView];
     [self updatePageColumnWidthForTableView:snapshotTableView];
@@ -904,14 +927,14 @@
             [pdfView setActiveAnnotation:nil];
             
             // these will be invalid. If needed, the document will restore them
-            [[self mutableArrayValueForKey:@"searchResults"] removeAllObjects];
-            [[self mutableArrayValueForKey:@"groupedSearchResults"] 
removeAllObjects];
-            [[self mutableArrayValueForKey:@"notes"] removeAllObjects];
-            [[self mutableArrayValueForKey:@"thumbnails"] removeAllObjects];
+            [[self mutableArrayValueForKey:SKMainWindowSearchResultsKey] 
removeAllObjects];
+            [[self 
mutableArrayValueForKey:SKMainWindowGroupedSearchResultsKey] removeAllObjects];
+            [[self mutableArrayValueForKey:SKMainWindowNotesKey] 
removeAllObjects];
+            [[self mutableArrayValueForKey:SKMainWindowThumbnailsKey] 
removeAllObjects];
             
-            snapshotDicts = [snapshots valueForKey:@"currentSetup"];
+            snapshotDicts = [snapshots valueForKey:SKSnapshotCurrentSetupKey];
             [snapshots makeObjectsPerformSelector:@selector(close)];
-            [[self mutableArrayValueForKey:@"snapshots"] removeAllObjects];
+            [[self mutableArrayValueForKey:SKMainWindowSnapshotsKey] 
removeAllObjects];
             
             [pdfOutline release];
             pdfOutline = nil;
@@ -957,11 +980,11 @@
     PDFAnnotation *annotation;
     NSDictionary *dict;
     PDFDocument *pdfDoc = [pdfView document];
-    NSMutableArray *observedNotes = [self mutableArrayValueForKey:@"notes"];
+    NSMutableArray *observedNotes = [self 
mutableArrayValueForKey:SKMainWindowNotesKey];
     
     // create new annotations from the dictionary and add them to their page 
and to the document
     while (dict = [e nextObject]) {
-        unsigned pageIndex = [[dict objectForKey:@"pageIndex"] 
unsignedIntValue];
+        unsigned pageIndex = [[dict objectForKey:SKPDFAnnotationPageIndexKey] 
unsignedIntValue];
         if (annotation = [[PDFAnnotation alloc] initWithProperties:dict]) {
             if (pageIndex == NSNotFound)
                 pageIndex = 0;
@@ -1005,7 +1028,7 @@
     }
     
     if (undoable == NO)
-        [[self mutableArrayValueForKey:@"notes"] removeAllObjects];
+        [[self mutableArrayValueForKey:SKMainWindowNotesKey] removeAllObjects];
     
     [self addAnnotationsFromDictionaries:noteDicts undoable:undoable];
 }
@@ -2822,9 +2845,9 @@
     if (findPanelFind == NO) {
         NSString *message = [NSLocalizedString(@"Searching", @"Message in 
search table header") stringByAppendingEllipsis];
         [findArrayController removeObjects:searchResults];
-        [[[findTableView tableColumnWithIdentifier:@"results"] headerCell] 
setStringValue:message];
+        [[[findTableView 
tableColumnWithIdentifier:SKMainWindowResultsColumnIdentifer] headerCell] 
setStringValue:message];
         [[findTableView headerView] setNeedsDisplay:YES];
-        [[[groupedFindTableView tableColumnWithIdentifier:@"relevance"] 
headerCell] setStringValue:message];
+        [[[groupedFindTableView 
tableColumnWithIdentifier:SKMainWindowRelevanceColumnIdentifer] headerCell] 
setStringValue:message];
         [[groupedFindTableView headerView] setNeedsDisplay:YES];
         [groupedFindArrayController removeObjects:groupedSearchResults];
         [statusBar setProgressIndicatorStyle:SKProgressIndicatorBarStyle];
@@ -2837,13 +2860,13 @@
 - (void)documentDidEndDocumentFind:(NSNotification *)note {
     if (findPanelFind == NO) {
         NSString *message = [NSString stringWithFormat:NSLocalizedString(@"%i 
Results", @"Message in search table header"), [searchResults count]];
-        [self willChangeValueForKey:@"searchResults"];
-        [self didChangeValueForKey:@"searchResults"];
-        [self willChangeValueForKey:@"groupedSearchResults"];
-        [self didChangeValueForKey:@"groupedSearchResults"];
-        [[[findTableView tableColumnWithIdentifier:@"results"] headerCell] 
setStringValue:message];
+        [self willChangeValueForKey:SKMainWindowSearchResultsKey];
+        [self didChangeValueForKey:SKMainWindowSearchResultsKey];
+        [self willChangeValueForKey:SKMainWindowGroupedSearchResultsKey];
+        [self didChangeValueForKey:SKMainWindowGroupedSearchResultsKey];
+        [[[findTableView 
tableColumnWithIdentifier:SKMainWindowResultsColumnIdentifer] headerCell] 
setStringValue:message];
         [[findTableView headerView] setNeedsDisplay:YES];
-        [[[groupedFindTableView tableColumnWithIdentifier:@"relevance"] 
headerCell] setStringValue:message];
+        [[[groupedFindTableView 
tableColumnWithIdentifier:SKMainWindowRelevanceColumnIdentifer] headerCell] 
setStringValue:message];
         [[groupedFindTableView headerView] setNeedsDisplay:YES];
         [statusBar stopAnimation:self];
         [statusBar setProgressIndicatorStyle:SKProgressIndicatorNone];
@@ -2854,10 +2877,10 @@
     NSNumber *pageIndex = [[note userInfo] 
objectForKey:@"PDFDocumentPageIndex"];
     [[statusBar progressIndicator] setDoubleValue:[pageIndex doubleValue]];
     if ([pageIndex unsignedIntValue] % 50 == 0) {
-        [self willChangeValueForKey:@"searchResults"];
-        [self didChangeValueForKey:@"searchResults"];
-        [self willChangeValueForKey:@"groupedSearchResults"];
-        [self didChangeValueForKey:@"groupedSearchResults"];
+        [self willChangeValueForKey:SKMainWindowSearchResultsKey];
+        [self didChangeValueForKey:SKMainWindowSearchResultsKey];
+        [self willChangeValueForKey:SKMainWindowGroupedSearchResultsKey];
+        [self didChangeValueForKey:SKMainWindowGroupedSearchResultsKey];
     }
 }
 
@@ -2867,20 +2890,20 @@
         
         PDFPage *page = [[instance pages] objectAtIndex:0];
         NSMutableDictionary *dict = [groupedSearchResults lastObject];
-        NSNumber *maxCount = [dict valueForKey:@"maxCount"];
-        if ([[dict valueForKey:@"page"] isEqual:page] == NO) {
-            dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:page, 
@"page", [NSMutableArray array], @"results", maxCount, @"maxCount", nil];
+        NSNumber *maxCount = [dict valueForKey:SKSearchResultMaxCountKey];
+        if ([[dict valueForKey:SKSearchResultPageKey] isEqual:page] == NO) {
+            dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:page, 
SKSearchResultPageKey, [NSMutableArray array], SKSearchResultResultsKey, 
maxCount, SKSearchResultMaxCountKey, nil];
             [groupedSearchResults addObject:dict];
         }
-        NSMutableArray *results = [dict valueForKey:@"results"];
+        NSMutableArray *results = [dict valueForKey:SKSearchResultResultsKey];
         [results addObject:instance];
-        [dict setValue:[NSNumber numberWithUnsignedInt:[results count]] 
forKey:@"count"];
+        [dict setValue:[NSNumber numberWithUnsignedInt:[results count]] 
forKey:SKSearchResultCountKey];
         
         if ([results count] > [maxCount unsignedIntValue]) {
             NSEnumerator *dictEnum = [groupedSearchResults objectEnumerator];
             maxCount = [NSNumber numberWithUnsignedInt:[results count]];
             while (dict = [dictEnum nextObject])
-                [dict setValue:maxCount forKey:@"maxCount"];
+                [dict setValue:maxCount forKey:SKSearchResultMaxCountKey];
         }
     }
 }
@@ -3174,11 +3197,11 @@
     NSImage *image = [controller thumbnailWithSize:snapshotCacheSize];
     
     [controller setThumbnail:image];
-    [[self mutableArrayValueForKey:@"snapshots"] addObject:controller];
+    [[self mutableArrayValueForKey:SKMainWindowSnapshotsKey] 
addObject:controller];
 }
 
 - (void)snapshotControllerWindowWillClose:(SKSnapshotWindowController 
*)controller {
-    [[self mutableArrayValueForKey:@"snapshots"] removeObject:controller];
+    [[self mutableArrayValueForKey:SKMainWindowSnapshotsKey] 
removeObject:controller];
 }
 
 - (void)snapshotControllerViewDidChange:(SKSnapshotWindowController 
*)controller {
@@ -3304,10 +3327,10 @@
     [thumbnailTableView setNeedsDisplay:YES];
     [outlineView setNeedsDisplay:YES];
     
-    [self willChangeValueForKey:@"pageNumber"];
-    [self willChangeValueForKey:@"pageLabel"];
-    [self didChangeValueForKey:@"pageLabel"];
-    [self didChangeValueForKey:@"pageNumber"];
+    [self willChangeValueForKey:SKMainWindowPageNumberKey];
+    [self willChangeValueForKey:SKMainWindowPageLabelKey];
+    [self didChangeValueForKey:SKMainWindowPageLabelKey];
+    [self didChangeValueForKey:SKMainWindowPageNumberKey];
     
     [previousNextPageButton setEnabled:[pdfView canGoToPreviousPage] 
forSegment:0];
     [previousNextPageButton setEnabled:[pdfView canGoToNextPage] forSegment:1];
@@ -3416,7 +3439,7 @@
     
     if (annotation) {
         updatingNoteSelection = YES;
-        [[self mutableArrayValueForKey:@"notes"] addObject:annotation];
+        [[self mutableArrayValueForKey:SKMainWindowNotesKey] 
addObject:annotation];
         [noteArrayController rearrangeObjects]; // doesn't seem to be done 
automatically
         updatingNoteSelection = NO;
     }
@@ -3450,7 +3473,7 @@
                 break;
             }
         }
-        [[self mutableArrayValueForKey:@"notes"] removeObject:annotation];
+        [[self mutableArrayValueForKey:SKMainWindowNotesKey] 
removeObject:annotation];
         [noteArrayController rearrangeObjects];
     }
     if (page) {
@@ -3842,9 +3865,9 @@
 - (id)outlineView:(NSOutlineView *)ov objectValueForTableColumn:(NSTableColumn 
*)tableColumn byItem:(id)item{
     if ([ov isEqual:outlineView]) {
         NSString *tcID = [tableColumn identifier];
-        if([tcID isEqualToString:@"label"]){
+        if([tcID isEqualToString:SKMainWindowLabelColumnIdentifer]){
             return [(PDFOutline *)item label];
-        }else if([tcID isEqualToString:@"page"]){
+        }else if([tcID isEqualToString:SKMainWindowPageColumnIdentifer]){
             return [[[(PDFOutline *)item destination] page] label];
         }else{
             [NSException raise:@"Unexpected tablecolumn identifier" format:@" 
- %@ ", tcID];
@@ -3852,11 +3875,11 @@
         }
     } else if ([ov isEqual:noteOutlineView]) {
         NSString *tcID = [tableColumn  identifier];
-        if ([tcID isEqualToString:@"note"]) {
+        if ([tcID isEqualToString:SKMainWindowNoteColumnIdentifer]) {
             return [item type] ? (id)[item string] : (id)[item text];
-        } else if([tcID isEqualToString:@"type"]) {
-            return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber 
numberWithBool:item == [pdfView activeAnnotation]], @"active", [item type], 
@"type", nil];
-        } else if([tcID isEqualToString:@"page"]) {
+        } else if([tcID isEqualToString:SKMainWindowTypeColumnIdentifer]) {
+            return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber 
numberWithBool:item == [pdfView activeAnnotation]], 
SKAnnotationTypeImageCellActiveKey, [item type], 
SKAnnotationTypeImageCellTypeKey, nil];
+        } else if([tcID isEqualToString:SKMainWindowPageColumnIdentifer]) {
             return [[item page] label];
         }
     }
@@ -3865,7 +3888,7 @@
 
 - (void)outlineView:(NSOutlineView *)ov setObjectValue:(id)object 
forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item{
     if ([ov isEqual:noteOutlineView]) {
-        if ([[tableColumn identifier] isEqualToString:@"note"]) {
+        if ([[tableColumn identifier] 
isEqualToString:SKMainWindowNoteColumnIdentifer]) {
             if ([item type] && [object isEqualToString:[item string]] == NO)
                 [item setString:object];
         }
@@ -3874,7 +3897,7 @@
 
 - (BOOL)outlineView:(NSOutlineView *)ov shouldEditTableColumn:(NSTableColumn 
*)tableColumn item:(id)item{
     if ([ov isEqual:noteOutlineView]) {
-        if ([[tableColumn identifier] isEqualToString:@"note"]) {
+        if ([[tableColumn identifier] 
isEqualToString:SKMainWindowNoteColumnIdentifer]) {
             if ([item type] == nil) {
                 if ([pdfView hideNotes] == NO) {
                     PDFAnnotation *annotation = [(SKNoteText *)item 
annotation];
@@ -3901,14 +3924,14 @@
             ascending = [[sortDescriptors lastObject] ascending];
         } else {
             NSString *tcID = [tableColumn identifier];
-            NSSortDescriptor *pageIndexSortDescriptor = [[[NSSortDescriptor 
alloc] initWithKey:@"pageIndex" ascending:ascending] autorelease];
-            NSSortDescriptor *boundsSortDescriptor = [[[NSSortDescriptor 
alloc] initWithKey:@"bounds" ascending:ascending 
selector:@selector(boundsCompare:)] autorelease];
+            NSSortDescriptor *pageIndexSortDescriptor = [[[NSSortDescriptor 
alloc] initWithKey:SKPDFAnnotationPageIndexKey ascending:ascending] 
autorelease];
+            NSSortDescriptor *boundsSortDescriptor = [[[NSSortDescriptor 
alloc] initWithKey:SKPDFAnnotationBoundsKey ascending:ascending 
selector:@selector(boundsCompare:)] autorelease];
             NSMutableArray *sds = [NSMutableArray 
arrayWithObjects:pageIndexSortDescriptor, boundsSortDescriptor, nil];
             if ([tcID isEqualToString:@"type"]) {
-                [sds insertObject:[[[NSSortDescriptor alloc] 
initWithKey:@"type" ascending:YES selector:@selector(noteTypeCompare:)] 
autorelease] atIndex:0];
+                [sds insertObject:[[[NSSortDescriptor alloc] 
initWithKey:SKPDFAnnotationTypeKey ascending:YES 
selector:@selector(noteTypeCompare:)] autorelease] atIndex:0];
             } else if ([tcID isEqualToString:@"note"]) {
-                [sds insertObject:[[[NSSortDescriptor alloc] 
initWithKey:@"string" ascending:YES 
selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease] 
atIndex:0];
-            } else if ([tcID isEqualToString:@"page"]) {
+                [sds insertObject:[[[NSSortDescriptor alloc] 
initWithKey:SKPDFAnnotationStringKey ascending:YES 
selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease] 
atIndex:0];
+            } else if ([tcID isEqualToString:SKMainWindowPageColumnIdentifer]) 
{
                 if (oldTableColumn == nil)
                     ascending = NO;
             }

Modified: trunk/SKSnapshotWindowController.h
===================================================================
--- trunk/SKSnapshotWindowController.h  2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/SKSnapshotWindowController.h  2008-04-10 18:12:54 UTC (rev 3700)
@@ -38,6 +38,7 @@
 
 #import <Cocoa/Cocoa.h>
 
+extern NSString *SKSnapshotCurrentSetupKey;
 
 @class BDSKZoomablePDFView, PDFDocument, PDFPage;
 

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2008-04-10 17:21:42 UTC (rev 3699)
+++ trunk/SKSnapshotWindowController.m  2008-04-10 18:12:54 UTC (rev 3700)
@@ -57,6 +57,8 @@
 #define HAS_WINDOW_KEY              @"hasWindow"
 #define WINDOW_FRAME_KEY            @"windowFrame"
 
+NSString *SKSnapshotCurrentSetupKey = @"currentSetup";
+
 static NSString *SKSnapshotWindowFrameAutosaveName = @"SKSnapshotWindow";
 static NSString *SKSnapshotViewChangedNotification = 
@"SKSnapshotViewChangedNotification";
 


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 the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to