Skip to content

Commit b4be0c5

Browse files
Philippe Casgrainrentzsch
authored andcommitted
Fix for ticket #3: Better end-of-talk display. We remove the CounterView when the timer has expired on the last slide.
Signed-off-by: Jonathan 'Wolf' Rentzsch <[email protected]>
1 parent 71d81c7 commit b4be0c5

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

BlitzPDFView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
@property uint16_t secondsElapsed;
1313

14+
- (void)atLastPage;
1415
- (IBAction)updateSecondsElapsed:(id)sender;
1516

1617
@end

BlitzPDFView.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,8 @@ - (void)drawPagePost:(PDFPage*)page {
163163
[counterView setNeedsDisplay: YES];
164164
}
165165

166-
- (void)dealloc
167-
{
168-
[counterView release];
166+
- (void)dealloc {
167+
[self atLastPage];
169168
[super dealloc];
170169
}
171170

@@ -175,7 +174,12 @@ - (uint16_t) secondsElapsed {
175174

176175
- (void)setSecondsElapsed:(uint16_t)secs {
177176
secondsElapsed = secs;
178-
counterView.secondsElapsed = secs;
177+
counterView.secondsElapsed = secs;
178+
}
179+
180+
- (void)atLastPage {
181+
[[counterView animator] removeFromSuperview];
182+
counterView = nil;
179183
}
180184

181185
- (IBAction)updateSecondsElapsed:(id)sender {

MyDocument.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ - (BOOL)readFromURL:(NSURL *)initWithURL ofType:(NSString *)typeName error:(NSEr
5252

5353
- (void)updateElapsedTimer:(NSTimer*)timer_ {
5454
if (self.pdfView.secondsElapsed != 0 && (self.pdfView.secondsElapsed % 15 == 0)) {
55-
[self.pdfView goToNextPage:nil];
55+
if ([self.pdfView canGoToNextPage]) {
56+
[self.pdfView goToNextPage:nil];
57+
}
58+
else {
59+
[self.pdfView atLastPage];
60+
[timer_ invalidate];
61+
}
5662
}
5763
self.pdfView.secondsElapsed += 1;
5864
[self.pdfView setNeedsDisplay:YES];

0 commit comments

Comments
 (0)