Revision: 4371
http://skim-app.svn.sourceforge.net/skim-app/?rev=4371&view=rev
Author: hofman
Date: 2008-08-10 16:59:54 +0000 (Sun, 10 Aug 2008)
Log Message:
-----------
Add accessors for some arrays that were accessing the ivar directly. Return
copy from -<key> accessors of array properties, as the caller (e.g. KVO) may
not expect the returned object to be mutated.
Modified Paths:
--------------
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2008-08-09 22:16:52 UTC (rev 4370)
+++ trunk/SKMainWindowController.h 2008-08-10 16:59:54 UTC (rev 4371)
@@ -373,6 +373,20 @@
- (void)insertObject:(id)obj inSnapshotsAtIndex:(unsigned)theIndex;
- (void)removeObjectFromSnapshotsAtIndex:(unsigned)theIndex;
+- (NSArray *)searchResults;
+- (void)setSearchResults:(NSArray *)newSearchResults;
+- (unsigned)countOfSearchResults;
+- (id)objectInSearchResultsAtIndex:(unsigned)theIndex;
+- (void)insertObject:(id)obj inSearchResultsAtIndex:(unsigned)theIndex;
+- (void)removeObjectFromSearchResultsAtIndex:(unsigned)theIndex;
+
+- (NSArray *)groupedSearchResults;
+- (void)setGroupedSearchResults:(NSArray *)newGroupedSearchResults;
+- (unsigned)countOfGroupedSearchResults;
+- (id)objectInGroupedSearchResultsAtIndex:(unsigned)theIndex;
+- (void)insertObject:(id)obj inGroupedSearchResultsAtIndex:(unsigned)theIndex;
+- (void)removeObjectFromGroupedSearchResultsAtIndex:(unsigned)theIndex;
+
- (NSArray *)selectedNotes;
- (unsigned int)pageNumber;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2008-08-09 22:16:52 UTC (rev 4370)
+++ trunk/SKMainWindowController.m 2008-08-10 16:59:54 UTC (rev 4371)
@@ -783,14 +783,14 @@
[pdfView setActiveAnnotation:nil];
// these will be invalid. If needed, the document will restore them
- [[self mutableArrayValueForKey:SKMainWindowSearchResultsKey]
removeAllObjects];
- [[self
mutableArrayValueForKey:SKMainWindowGroupedSearchResultsKey] removeAllObjects];
- [[self mutableArrayValueForKey:SKMainWindowNotesKey]
removeAllObjects];
+ [self setSearchResults:nil];
+ [self setGroupedSearchResults:nil];
+ [self setNotes:nil];
[[self mutableArrayValueForKey:SKMainWindowThumbnailsKey]
removeAllObjects];
snapshotDicts = [snapshots valueForKey:SKSnapshotCurrentSetupKey];
[snapshots makeObjectsPerformSelector:@selector(close)];
- [[self mutableArrayValueForKey:SKMainWindowSnapshotsKey]
removeAllObjects];
+ [self setSnapshots:nil];
[pdfOutline release];
pdfOutline = nil;
@@ -884,7 +884,7 @@
}
if (undoable == NO)
- [[self mutableArrayValueForKey:SKMainWindowNotesKey] removeAllObjects];
+ [self setNotes:nil];
[self addAnnotationsFromDictionaries:noteDicts undoable:undoable];
}
@@ -1040,7 +1040,7 @@
}
- (NSArray *)notes {
- return notes;
+ return [[notes copy] autorelease];
}
- (void)setNotes:(NSArray *)newNotes {
@@ -1164,7 +1164,7 @@
}
- (NSArray *)snapshots {
- return snapshots;
+ return [[snapshots copy] autorelease];
}
- (void)setSnapshots:(NSArray *)newSnapshots {
@@ -1216,6 +1216,54 @@
return selectedNotes;
}
+- (NSArray *)searchResults {
+ return [[searchResults copy] autorelease];
+}
+
+- (void)setSearchResults:(NSArray *)newSearchResults {
+ [searchResults setArray:newSearchResults];
+}
+
+- (unsigned)countOfSearchResults {
+ return [searchResults count];
+}
+
+- (id)objectInSearchResultsAtIndex:(unsigned)theIndex {
+ return [searchResults objectAtIndex:theIndex];
+}
+
+- (void)insertObject:(id)obj inSearchResultsAtIndex:(unsigned)theIndex {
+ [searchResults insertObject:obj atIndex:theIndex];
+}
+
+- (void)removeObjectFromSearchResultsAtIndex:(unsigned)theIndex {
+ [searchResults removeObjectAtIndex:theIndex];
+}
+
+- (NSArray *)groupedSearchResults {
+ return [[groupedSearchResults copy] autorelease];
+}
+
+- (void)setGroupedSearchResults:(NSArray *)newGroupedSearchResults {
+ [groupedSearchResults setArray:newGroupedSearchResults];
+}
+
+- (unsigned)countOfGroupedSearchResults {
+ return [groupedSearchResults count];
+}
+
+- (id)objectInGroupedSearchResultsAtIndex:(unsigned)theIndex {
+ return [groupedSearchResults objectAtIndex:theIndex];
+}
+
+- (void)insertObject:(id)obj inGroupedSearchResultsAtIndex:(unsigned)theIndex {
+ [groupedSearchResults insertObject:obj atIndex:theIndex];
+}
+
+- (void)removeObjectFromGroupedSearchResultsAtIndex:(unsigned)theIndex {
+ [groupedSearchResults removeObjectAtIndex:theIndex];
+}
+
#pragma mark Actions
- (IBAction)changeColor:(id)sender{
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 Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit