Revision: 2773
http://skim-app.svn.sourceforge.net/skim-app/?rev=2773&view=rev
Author: hofman
Date: 2007-08-29 09:47:30 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Set PDFDocument when reading from a bundle. Also make sure the PDFData,
PDFDocument and notes dictionaries are set to nil before loading.
Modified Paths:
--------------
trunk/SKDocument.m
Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m 2007-08-29 16:23:04 UTC (rev 2772)
+++ trunk/SKDocument.m 2007-08-29 16:47:30 UTC (rev 2773)
@@ -452,6 +452,10 @@
PDFDocument *pdfDoc = nil;
NSError *error = nil;
+ [self setPDFData:nil];
+ [self setPDFDoc:nil];
+ [self setNoteDicts:nil];
+
if ([docType isEqualToString:SKPostScriptDocumentType]) {
SKPSProgressController *progressController = [[[SKPSProgressController
alloc] init] autorelease];
data = [progressController PDFDataWithPostScriptData:data];
@@ -481,6 +485,10 @@
PDFDocument *pdfDoc = nil;
NSError *error = nil;
+ [self setPDFData:nil];
+ [self setPDFDoc:nil];
+ [self setNoteDicts:nil];
+
if ([docType isEqualToString:SKPDFDocumentType]) {
if ((data = [[NSData alloc] initWithContentsOfURL:absoluteURL
options:NSUncachedRead error:&error]) &&
(pdfDoc = [[PDFDocument alloc] initWithURL:absoluteURL])) {
@@ -524,25 +532,31 @@
NSArray *noteArray = nil;
NSFileWrapper *fw;
- if ((fw = [fileWrappers objectForKey:WRAPPER_PDF_FILENAME]) && [fw
isRegularFile])
+ if ((fw = [fileWrappers objectForKey:WRAPPER_PDF_FILENAME]) && [fw
isRegularFile]) {
data = [[fw regularFileContents] retain];
- if ((fw = [fileWrappers objectForKey:WRAPPER_SKIM_FILENAME]) && [fw
isRegularFile] &&
- (noteArray = [NSKeyedUnarchiver unarchiveObjectWithData:[fw
regularFileContents]]))
- [self setNoteDicts:noteArray];
+ pdfDoc = [[PDFDocument alloc] initWithURL:[NSURL
fileURLWithPath:[[absoluteURL path] stringByAppendingPathComponent:[fw
filename]]]];
+ }
+ if ((fw = [fileWrappers objectForKey:WRAPPER_SKIM_FILENAME]) && [fw
isRegularFile]) {
+ if (noteArray = [NSKeyedUnarchiver unarchiveObjectWithData:[fw
regularFileContents]])
+ [self setNoteDicts:noteArray];
+ }
if (data == nil || noteArray == nil) {
NSArray *fws = [fileWrappers allValues];
NSArray *extensions = [fws
valueForKeyPath:@"filename.pathExtension.lowercaseString"];
unsigned int index;
if (data == nil) {
index = [extensions indexOfObject:@"pdf"];
- if ((index != NSNotFound) && (fw = [fws objectAtIndex:index])
&& [fw isRegularFile])
+ if ((index != NSNotFound) && (fw = [fws objectAtIndex:index])
&& [fw isRegularFile]) {
data = [[fw regularFileContents] retain];
+ pdfDoc = [[PDFDocument alloc] initWithURL:[NSURL
fileURLWithPath:[[absoluteURL path] stringByAppendingPathComponent:[fw
filename]]]];
+ }
}
if (noteArray == nil) {
index = [extensions indexOfObject:@"skim"];
- if ((index != NSNotFound) && (fw = [fws objectAtIndex:index])
&& [fw isRegularFile] &&
- (noteArray = [NSKeyedUnarchiver
unarchiveObjectWithData:[fw regularFileContents]]))
- [self setNoteDicts:noteArray];
+ if ((index != NSNotFound) && (fw = [fws objectAtIndex:index])
&& [fw isRegularFile]) {
+ if (noteArray = [NSKeyedUnarchiver
unarchiveObjectWithData:[fw regularFileContents]])
+ [self setNoteDicts:noteArray];
+ }
}
}
[fileWrapper release];
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: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit