summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {