From 602aaa6938ade134a9d388f86cecfe0e1d8e7b01 Mon Sep 17 00:00:00 2001 From: Chris Moeller <kode54@gmail.com> Date: Fri, 11 Oct 2013 03:39:57 -0700 Subject: [PATCH] Enter Full Screen menu item and separator are now hidden until the main window wakes and detects toggleFullScreen selector --- Application/AppController.h | 3 +++ Application/AppController.m | 7 ++----- English.lproj/MainMenu.xib | 10 ++++++---- Window/MainWindow.h | 3 ++- Window/MainWindow.m | 11 +++++++---- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Application/AppController.h b/Application/AppController.h index 16b0b779a..71ca54099 100644 --- a/Application/AppController.h +++ b/Application/AppController.h @@ -99,4 +99,7 @@ OSStatus handleHotKey(EventHandlerCallRef nextHandler,EventRef theEvent,void *us - (void)nodeExpanded:(NSNotification*)notification; - (void)nodeCollapsed:(NSNotification*)notification; +- (void)windowDidEnterFullScreen:(NSNotification *)notification; +- (void)windowDidExitFullScreen:(NSNotification *)notification; + @end diff --git a/Application/AppController.m b/Application/AppController.m index a226edd81..8652195f9 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -275,9 +275,6 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ [playbackController seek:[NSNumber numberWithDouble:[[NSUserDefaults standardUserDefaults] floatForKey:@"lastTrackPosition"]]]; } - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enterFullscreen) name:NSWindowDidEnterFullScreenNotification object:mainWindow]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitFullscreen) name:NSWindowDidExitFullScreenNotification object:mainWindow]; - // We need file tree view to restore its state here // so attempt to access file tree view controller's root view // to force it to read nib and create file tree view for us @@ -584,7 +581,7 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ } } -- (void)enterFullscreen +- (void)windowDidEnterFullScreen:(NSNotification *)notification { NSLog(@"Entering fullscreen"); if (nil == nowPlaying) @@ -611,7 +608,7 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ } } -- (void)exitFullscreen +- (void)windowDidExitFullScreen:(NSNotification *)notification { NSLog(@"Exiting fullscreen"); if (nowPlaying) diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 154348499..6df6d2fde 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -82,7 +82,7 @@ <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/> </tableHeaderCell> - <imageCell key="dataCell" controlSize="small" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="9E1EC36B-776F-41F6-84BA-3BCF9937C65D" id="1801"> + <imageCell key="dataCell" controlSize="small" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="AE428D9F-3521-44E5-A3BF-1E9BBDE889D6" id="1801"> <font key="font" metaFont="system"/> </imageCell> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> @@ -552,6 +552,8 @@ </binding> <outlet property="delegate" destination="226" id="481"/> <outlet property="initialFirstResponder" destination="207" id="720"/> + <outlet property="itemLionFullscreenToggle" destination="6FK-oo-X6Z" id="AFZ-tU-eoC"/> + <outlet property="itemLionSeparator" destination="LXf-6h-S7b" id="1Bl-jw-Bhi"/> <outlet property="otherWindow" destination="2234" id="2304"/> </connections> </window> @@ -924,8 +926,8 @@ <action selector="decreaseFontSize:" target="226" id="1872"/> </connections> </menuItem> - <menuItem isSeparatorItem="YES" id="LXf-6h-S7b"/> - <menuItem title="Enter Full Screen" keyEquivalent="f" id="6FK-oo-X6Z" userLabel="Menu Item - Enter Full Screen"> + <menuItem isSeparatorItem="YES" hidden="YES" id="LXf-6h-S7b"/> + <menuItem title="Enter Full Screen" hidden="YES" keyEquivalent="f" id="6FK-oo-X6Z" userLabel="Menu Item - Enter Full Screen"> <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/> <connections> <action selector="toggleFullScreen:" target="-1" id="UCw-gd-iiw"/> @@ -1651,7 +1653,7 @@ Gw <customObject id="2434" customClass="FeedbackController"/> </objects> <resources> - <image name="9E1EC36B-776F-41F6-84BA-3BCF9937C65D" width="17" height="17"> + <image name="AE428D9F-3521-44E5-A3BF-1E9BBDE889D6" width="17" height="17"> <mutableData key="keyedArchiveRepresentation"> YnBsaXN0MDDUAQIDBAUGRkdYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK8QDwcI ExQZHh8qKyw0NzpAQ1UkbnVsbNUJCgsMDQ4PEBESVk5TU2l6ZVYkY2xhc3NcTlNJbWFnZUZsYWdzVk5T diff --git a/Window/MainWindow.h b/Window/MainWindow.h index d5e94c28f..8568c867a 100644 --- a/Window/MainWindow.h +++ b/Window/MainWindow.h @@ -10,7 +10,8 @@ #import "DualWindow.h" @interface MainWindow : DualWindow { - + IBOutlet NSMenuItem * itemLionSeparator; + IBOutlet NSMenuItem * itemLionFullscreenToggle; } @end diff --git a/Window/MainWindow.m b/Window/MainWindow.m index 16fd36b86..e9f6e3cff 100644 --- a/Window/MainWindow.m +++ b/Window/MainWindow.m @@ -19,7 +19,7 @@ [self setExcludedFromWindowsMenu:YES]; [self setContentBorderThickness:24.0 forEdge:NSMinYEdge]; [self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; - } + } return self; } @@ -30,10 +30,13 @@ [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:[self hiddenDefaultsKey]]]; } + if ([self respondsToSelector:@selector(toggleFullScreen:)]) + { + [itemLionSeparator setHidden:NO]; + [itemLionFullscreenToggle setHidden:NO]; + } + [super awakeFromNib]; } - - - @end