Revision: 7411
http://skim-app.svn.sourceforge.net/skim-app/?rev=7411&view=rev
Author: hofman
Date: 2011-08-01 09:54:42 +0000 (Mon, 01 Aug 2011)
Log Message:
-----------
don't attempt converting notes when there are no convertible annotations to
avoid unnecessary unlocking
Modified Paths:
--------------
trunk/SKMainDocument.m
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2011-08-01 09:50:10 UTC (rev 7410)
+++ trunk/SKMainDocument.m 2011-08-01 09:54:42 UTC (rev 7411)
@@ -1065,8 +1065,21 @@
[self convertNotesUsingPDFDocument:[pdfDocWithoutNotes autorelease]];
}
+- (BOOL)hasConvertibleAnnotations {
+ PDFDocument *pdfDoc = [self pdfDocument];
+ NSInteger i, count = [pdfDoc pageCount];
+ for (i = 0; i < count; i++) {
+ for (PDFAnnotation *annotation in [[pdfDoc pageAtIndex:i]
annotations]) {
+ if ([annotation isSkimNote] == NO && [annotation
isConvertibleAnnotation])
+ return YES;
+ }
+ }
+ return NO;
+}
+
- (IBAction)convertNotes:(id)sender {
- if ([[self fileType] isEqualToString:SKPDFDocumentType] == NO && [[self
fileType] isEqualToString:SKPDFBundleDocumentType] == NO) {
+ if (([[self fileType] isEqualToString:SKPDFDocumentType] == NO && [[self
fileType] isEqualToString:SKPDFBundleDocumentType] == NO) ||
+ [self hasConvertibleAnnotations] == NO) {
NSBeep();
return;
}
@@ -1951,10 +1964,10 @@
}
- (void)handleConvertNotesScriptCommand:(NSScriptCommand *)command {
- if ([[self fileType] isEqualToString:SKPDFDocumentType] || [[self
fileType] isEqualToString:SKPDFBundleDocumentType])
+ if ([[self fileType] isEqualToString:SKPDFDocumentType] == NO && [[self
fileType] isEqualToString:SKPDFBundleDocumentType] == NO)
+ [command setScriptErrorNumber:NSArgumentsWrongScriptError];
+ else if ([self hasConvertibleAnnotations])
[self convertNotesSheetDidEnd:nil returnCode:NSAlertDefaultReturn
contextInfo:NULL];
- else
- [command setScriptErrorNumber:NSArgumentsWrongScriptError];
}
- (void)handleReadNotesScriptCommand:(NSScriptCommand *)command {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit