From: Yutaka Tsutano Date: Fri, 25 Mar 2016 13:03:59 +0000 (-0500) Subject: Allow relative URL in Graphviz.app X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~17^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df9892c6506cff40718f938e7bd8a8330d70bf84;p=graphviz Allow relative URL in Graphviz.app --- diff --git a/macosx/GVWindowController.h b/macosx/GVWindowController.h index 5a1b7c297..d6491f29f 100644 --- a/macosx/GVWindowController.h +++ b/macosx/GVWindowController.h @@ -34,6 +34,8 @@ - (IBAction)printGraphDocument:(id)sender; +- (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)URL; + - (BOOL)validateUserInterfaceItem:(id )anItem; - (void)dealloc; diff --git a/macosx/GVWindowController.m b/macosx/GVWindowController.m index 502204e86..43b3be6bd 100644 --- a/macosx/GVWindowController.m +++ b/macosx/GVWindowController.m @@ -43,6 +43,8 @@ NSWindow *window = [self window]; if (![window isZoomed]) [window zoom:self]; + + [documentView setDelegate:self]; } - (void)graphDocumentDidChange:(NSNotification*)notification @@ -89,6 +91,13 @@ [documentView printWithInfo:[[self document] printInfo] autoRotate:NO]; } +- (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)URL +{ + NSURL* baseURL = [[self document] fileURL]; + NSURL* targetURL = [NSURL URLWithString:[URL absoluteString] relativeToURL:baseURL]; + [[NSWorkspace sharedWorkspace] openURL:targetURL]; +} + - (BOOL)validateUserInterfaceItem:(id )anItem { /* validate toolbar or menu items */