forked from rentzsch/Blitz
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBlitzPDFView.m
68 lines (55 loc) · 1.36 KB
/
BlitzPDFView.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
#import "BlitzPDFView.h"
@implementation BlitzPDFView
@dynamic secondsElapsed;
- (void)drawPagePost:(PDFPage*)page {
}
- (void)dealloc {
[counterView release];
[super dealloc];
}
- (NSTimeInterval) secondsElapsed {
return secondsElapsed;
}
- (void)setSecondsElapsed:(NSTimeInterval)secs {
secondsElapsed = secs;
counterView.secondsElapsed = secs;
[counterView setNeedsDisplay:YES];
}
- (BOOL)running;
{
return ([counterView superview] == self);
}
- (void)setRunning:(BOOL)running;
{
BOOL wasRunning = ![counterView isHidden];
if (running == wasRunning)
return;
if (running) {
[[counterView animator] setHidden:NO];
[counterView setNeedsDisplay: YES];
} else {
[[counterView animator] setHidden:YES];
}
}
- (IBAction)updateSecondsElapsed:(id)sender {
self.secondsElapsed = [sender doubleValue];
[self setNeedsDisplay:YES];
}
- (NSUInteger)pageIndex;
{
if (!self.document)
return NSNotFound;
return [self.document indexForPage:self.currentPage];
}
- (void)setPageIndex:(NSUInteger)pageIndex;
{
NSUInteger pageCount = [self.document pageCount];
PDFPage *page = nil;
if (pageCount > 0) {
if (pageIndex >= pageCount)
pageIndex = pageCount - 1;
page = [self.document pageAtIndex:pageIndex];
}
[self goToPage:page];
}
@end