Revision: 5824
http://skim-app.svn.sourceforge.net/skim-app/?rev=5824&view=rev
Author: hofman
Date: 2009-09-28 11:03:33 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
open remotegoto action url in previously undocumented delegate method rather
than overriding performAction
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
trunk/SKPDFView.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2009-09-28 11:00:02 UTC (rev 5823)
+++ trunk/SKMainWindowController_UI.m 2009-09-28 11:03:33 UTC (rev 5824)
@@ -1127,6 +1127,28 @@
#pragma mark SKPDFView delegate protocol
+- (void)PDFViewOpenPDF:(PDFView *)sender
forRemoteGoToAction:(PDFActionRemoteGoTo *)action {
+ NSURL *fileURL = [action URL];
+ NSError *error = nil;
+ NSDocumentController *sdc = [NSDocumentController
sharedDocumentController];
+ id document = nil;
+ if ([sdc documentClassForType:[sdc typeForContentsOfURL:fileURL
error:&error]] == [SKMainDocument class]) {
+ if (document = [sdc openDocumentWithContentsOfURL:fileURL display:YES
error:&error]) {
+ NSUInteger pageIndex = [action pageIndex];
+ if (pageIndex < [[document pdfDocument] pageCount]) {
+ PDFPage *page = [[document pdfDocument] pageAtIndex:pageIndex];
+ PDFDestination *dest = [[[PDFDestination alloc]
initWithPage:page atPoint:[action point]] autorelease];
+ [[document pdfView] goToDestination:dest];
+ }
+ } else if (error) {
+ [NSApp presentError:error];
+ }
+ } else if (fileURL) {
+ // fall back to just opening the file and ignore the destination
+ [[NSWorkspace sharedWorkspace] openURL:fileURL];
+ }
+}
+
- (void)PDFView:(PDFView *)sender editAnnotation:(PDFAnnotation *)annotation {
[self showNote:annotation];
}
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2009-09-28 11:00:02 UTC (rev 5823)
+++ trunk/SKPDFView.m 2009-09-28 11:03:33 UTC (rev 5824)
@@ -1604,34 +1604,6 @@
[[NSSpellChecker sharedSpellChecker] ignoreWord:[[sender selectedCell]
stringValue] inSpellDocumentWithTag:spellingTag];
}
-// we cannot use PDFAction and subclasses, because those are Leopard only
-- (void)performAction:(id)action {
- // PDFView does not handle the PDFActionRemoteGoTo, so we do it
- if ([action isKindOfClass:[PDFActionRemoteGoTo class]]) {
- NSURL *fileURL = [action URL];
- NSError *error = nil;
- NSDocumentController *sdc = [NSDocumentController
sharedDocumentController];
- id document = nil;
- if ([sdc documentClassForType:[sdc typeForContentsOfURL:fileURL
error:&error]] == [SKMainDocument class]) {
- if (document = [sdc openDocumentWithContentsOfURL:fileURL
display:YES error:&error]) {
- NSUInteger pageIndex = [action pageIndex];
- if (pageIndex < [[document pdfDocument] pageCount]) {
- PDFPage *page = [[document pdfDocument]
pageAtIndex:pageIndex];
- PDFDestination *dest = [[[PDFDestination alloc]
initWithPage:page atPoint:[action point]] autorelease];
- [[document pdfView] goToDestination:dest];
- }
- } else if (error) {
- [NSApp presentError:error];
- }
- } else if (fileURL) {
- // fall back to just opening the file and ignore the destination
- [[NSWorkspace sharedWorkspace] openURL:fileURL];
- }
- } else {
- [super performAction:action];
- }
-}
-
#pragma mark Tracking mousemoved fix
- (void)resetBoundsTrackingRect {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit