forked from rentzsch/Blitz
-
Notifications
You must be signed in to change notification settings - Fork 2
/
SlidesWindowController.m
71 lines (56 loc) · 1.93 KB
/
SlidesWindowController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// SlidesWindowController.m
// Blitz
//
// Created by Timothy J. Wood on 9/20/09.
// Copyright 2009 The Omni Group. All rights reserved.
//
#import "SlidesWindowController.h"
#import "BlitzPDFView.h"
@interface SlidesWindowController (/*Private*/)
@end
@implementation SlidesWindowController
@synthesize pdfView;
- (void)windowDidLoad;
{
[super windowDidLoad];
[self.pdfView setBackgroundColor:[NSColor blackColor]];
}
- (void)setDocument:(NSDocument *)document;
{
[super setDocument:document];
if (document) {
[self window]; // make sure our nib is loaded
[self.pdfView bind:@"document" toObject:document withKeyPath:@"pdfDocument" options:nil];
[self.pdfView bind:@"secondsElapsed" toObject:document withKeyPath:@"secondsElapsed" options:nil];
[self.pdfView bind:@"pageIndex" toObject:document withKeyPath:@"pageIndex" options:nil];
[self.pdfView bind:@"running" toObject:document withKeyPath:@"running" options:nil];
} else {
[self.pdfView unbind:@"document"];
[self.pdfView unbind:@"secondsElapsed"];
[self.pdfView unbind:@"pageIndex"];
[self.pdfView unbind:@"running"];
}
}
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
- (BOOL)acceptsPreviewPanelControl:(QLPreviewPanel *)panel {
return YES;
}
- (void)beginPreviewPanelControl:(QLPreviewPanel *)panel {
previewPanel = [panel retain];
panel.delegate = self;
panel.dataSource = self;
}
- (void)endPreviewPanelControl:(QLPreviewPanel *)panel {
[previewPanel release];
previewPanel = nil;
}
- (NSInteger)numberOfPreviewItemsInPreviewPanel:(QLPreviewPanel*)panel {
return 1;
}
- (id <QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index {
return [self.document fileURL];
//return [NSURL fileURLWithPath:@"/Users/wolf/code/github/Blitz/blitz-example.pdf"];//[selectedDownloads objectAtIndex:index];
}
#endif
@end