From 1f9ef72bcfea75bcac48d7de51a60d3529489aac Mon Sep 17 00:00:00 2001 From: Philippe Casgrain Date: Sat, 11 Jul 2009 21:42:25 -0400 Subject: [PATCH] Fix for ticket #1: Full-screen display --- MyDocument.h | 1 + MyDocument.m | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/MyDocument.h b/MyDocument.h index 02b8bc5..4beb36b 100644 --- a/MyDocument.h +++ b/MyDocument.h @@ -8,6 +8,7 @@ IBOutlet BlitzPDFView *pdfView; @private PDFDocument *pdfDocument; @private NSTimer *timer; + @private BOOL isInFullScreenMode; } @property (retain, nonatomic) IBOutlet BlitzPDFView *pdfView; diff --git a/MyDocument.m b/MyDocument.m index d60c280..98f1e7f 100644 --- a/MyDocument.m +++ b/MyDocument.m @@ -4,10 +4,22 @@ @interface MyDocument () @property (retain, nonatomic) PDFDocument *pdfDocument; @property (retain, nonatomic) NSTimer *timer; +@property (nonatomic) BOOL isInFullScreenMode; @end @implementation MyDocument -@synthesize pdfDocument, pdfView, timer; +@synthesize pdfView, pdfDocument, timer, isInFullScreenMode; + +- (void)toggleFullScreenMode { + if (self.isInFullScreenMode) { + [self.pdfView exitFullScreenModeWithOptions: nil]; + self.isInFullScreenMode = NO; + } + else { + NSWindow *window = [[[self windowControllers] objectAtIndex:0 ] window]; + self.isInFullScreenMode = [self.pdfView enterFullScreenMode: window.screen withOptions: nil]; + } +} - (void)windowControllerDidLoadNib:(NSWindowController*)controller_ { [super windowControllerDidLoadNib:controller_]; @@ -23,6 +35,8 @@ - (void)windowControllerDidLoadNib:(NSWindowController*)controller_ { selector:@selector(updateElapsedTimer:) userInfo:nil repeats:YES] retain]; + self.isInFullScreenMode = NO; + [self toggleFullScreenMode]; } - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError {