Revision: 3603 http://skim-app.svn.sourceforge.net/skim-app/?rev=3603&view=rev Author: hofman Date: 2008-04-03 04:36:12 -0700 (Thu, 03 Apr 2008)
Log Message: ----------- Implement Leopard-only performAction: to open the remote goto action, which is not handled by PDFKit. Let PDFKit handle tool tips for those links. Modified Paths: -------------- trunk/PDFAnnotation_SKExtensions.m trunk/SKPDFView.m Modified: trunk/PDFAnnotation_SKExtensions.m =================================================================== --- trunk/PDFAnnotation_SKExtensions.m 2008-04-02 23:40:55 UTC (rev 3602) +++ trunk/PDFAnnotation_SKExtensions.m 2008-04-03 11:36:12 UTC (rev 3603) @@ -529,7 +529,8 @@ @implementation PDFAnnotationLink (SKExtensions) // override these Leopard methods to avoid showing the standard tool tips over our own -- (NSString *)toolTip { return nil; } -- (NSString *)toolTipNoLabel { return nil; } +- (NSString *)toolTip { + return ([self URL] || [self destination]) ? nil : [super toolTip]; +} @end Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2008-04-02 23:40:55 UTC (rev 3602) +++ trunk/SKPDFView.m 2008-04-03 11:36:12 UTC (rev 3603) @@ -1422,6 +1422,31 @@ [[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:NSClassFromString(@"PDFActionRemoteGoTo")]) { + NSURL *fileURL = [action URL]; + NSError *error = nil; + NSDocumentController *sdc = [NSDocumentController sharedDocumentController]; + id document = nil; + if ([sdc documentClassForType:[sdc typeForContentsOfURL:fileURL error:&error]] == [SKDocument class]) { + if (document = [sdc openDocumentWithContentsOfURL:fileURL display:YES error:&error]) { + PDFPage *page = [[document pdfDocument] pageAtIndex:[action 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 if ([[SKPDFView superclass] instancesRespondToSelector:_cmd]) { + [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. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit