summaryrefslogtreecommitdiff
path: root/tikzit/src/osx
diff options
context:
space:
mode:
authorJohan Paulsson <gonz@Akita.local>2013-12-01 13:23:59 -0800
committerJohan Paulsson <gonz@Akita.local>2013-12-01 13:23:59 -0800
commit2b7726352d1d422d4284618c8762637f64ec9a68 (patch)
treea1a3194acd6aaa2054b34eaee3ef38a34977124e /tikzit/src/osx
parent2c0baccbe99f52c402d6c0f9882192477c9b5246 (diff)
osx gui: Fixed dragging of the preview pdf to all applications.
Diffstat (limited to 'tikzit/src/osx')
-rw-r--r--tikzit/src/osx/DraggablePDFView.m18
-rw-r--r--tikzit/src/osx/PreviewController.m3
2 files changed, 12 insertions, 9 deletions
diff --git a/tikzit/src/osx/DraggablePDFView.m b/tikzit/src/osx/DraggablePDFView.m
index ce57473..ce393c7 100644
--- a/tikzit/src/osx/DraggablePDFView.m
+++ b/tikzit/src/osx/DraggablePDFView.m
@@ -38,17 +38,21 @@
- (void)mouseDown:(NSEvent *)theEvent
{
- NSPasteboard *pboard;
-
NSRect pageBox = [[[self document] pageAtIndex:0] boundsForBox:kPDFDisplayBoxMediaBox];
NSRect pageRect= [self convertRect:pageBox fromPage:[[self document] pageAtIndex:0]];
- pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- [pboard declareTypes:[NSArray arrayWithObject:NSPasteboardTypePDF] owner:self];
- [pboard setData:[[self document] dataRepresentation] forType:NSPasteboardTypePDF];
+ NSArray *fileList = [NSArray arrayWithObjects:[[[self document] documentURL] path], nil];
+ NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+ [pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil];
+ [pboard setPropertyList:fileList forType:NSFilenamesPboardType];
- [self dragImage:[[NSImage alloc] initWithData:[[self document] dataRepresentation]] at:pageRect.origin offset:pageRect.size
- event:theEvent pasteboard:pboard source:self slideBack:YES];
+ [self dragImage:[[NSImage alloc] initWithData:[[self document] dataRepresentation]]
+ at:pageRect.origin
+ offset:pageRect.size
+ event:theEvent
+ pasteboard:pboard
+ source:self
+ slideBack:YES];
return;
}
diff --git a/tikzit/src/osx/PreviewController.m b/tikzit/src/osx/PreviewController.m
index 94a80a4..310c2ab 100644
--- a/tikzit/src/osx/PreviewController.m
+++ b/tikzit/src/osx/PreviewController.m
@@ -109,8 +109,7 @@ static PreviewController *preview = nil;
[errorText setString:@""];
[errorTextView setHidden:YES];
- data = [NSData dataWithContentsOfFile:pdfFile];
- PDFDocument *doc = [[PDFDocument alloc] initWithData:data];
+ PDFDocument *doc = [[PDFDocument alloc] initWithURL:[[NSURL alloc] initFileURLWithPath:pdfFile]];
// pad the PDF by a couple of pixels
if ([doc pageCount] >= 1) {