]> granicus.if.org Git - graphviz/commitdiff
Allow relative URL in Graphviz.app
authorYutaka Tsutano <yutaka@tsutano.com>
Fri, 25 Mar 2016 13:03:59 +0000 (08:03 -0500)
committerYutaka Tsutano <yutaka@tsutano.com>
Fri, 25 Mar 2016 13:03:59 +0000 (08:03 -0500)
macosx/GVWindowController.h
macosx/GVWindowController.m

index 5a1b7c297167038fd4ff1fe7432e0eedc5bff7c8..d6491f29f39bda698e0edf2ee6716374cc4f1dbb 100644 (file)
@@ -34,6 +34,8 @@
 
 - (IBAction)printGraphDocument:(id)sender;
 
+- (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)URL;
+
 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem;
 
 - (void)dealloc;
index 502204e862b1260762506a50b3750addd0c1bdf7..43b3be6bde0fa961fc1fdbf8ac45b0592ff85b51 100644 (file)
@@ -43,6 +43,8 @@
        NSWindow *window = [self window];
        if (![window isZoomed])
                [window zoom:self];
+
+       [documentView setDelegate:self];
 }
 
 - (void)graphDocumentDidChange:(NSNotification*)notification
        [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 <NSValidatedUserInterfaceItem>)anItem
 {
        /* validate toolbar or menu items */