Browse files

correct xcode mistakes

  • Loading branch information...
1 parent cff503d commit ee13369d4cec21c4b79b215c2a46eeca84c14d01 @seanlilmateus seanlilmateus committed Dec 5, 2011
Showing with 88 additions and 91 deletions.
  1. +88 −91 TVFrancaise/AppDelegate.rb
View
179 TVFrancaise/AppDelegate.rb
@@ -16,27 +16,25 @@ class AppDelegate
def applicationDidFinishLaunching(a_notification)
- # find actual Mac OSX Version // we should find a better way
- sv = NSDictionary.dictionaryWithContentsOfFile "/System/Library/CoreServices/SystemVersion.plist"
- osx_version_string = sv["ProductVersion"]
- if osx_version_string.to_f >= "10.6.0".to_f
- # full screen mode for Lion only
- if Object.const_defined?(:NSWindowCollectionBehaviorFullScreenPrimary)
-
- # remove fullscreen Leopard button
- @leo_fullscreen_button.removeFromSuperview
-
- window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary
- NSNotificationCenter.defaultCenter.addObserver( self,
- selector: 'will_enter_fullscreen:',
- name: NSWindowWillEnterFullScreenNotification,
- object: window)
- NSNotificationCenter.defaultCenter.addObserver( self,
- selector: 'will_exit_fullscreen:',
- name: NSWindowWillExitFullScreenNotification,
- object: window)
+ # find actual Mac OSX Version // we should find a better way
+ sv = NSDictionary.dictionaryWithContentsOfFile "/System/Library/CoreServices/SystemVersion.plist"
+ osx_version_string = sv["ProductVersion"]
+ if osx_version_string.to_f >= "10.9.0".to_f
+ # full screen mode for Lion only
+ if Object.const_defined?(:NSWindowCollectionBehaviorFullScreenPrimary)
+ # remove fullscreen Leopard button
+ @leo_fullscreen_button.removeFromSuperview
+ window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary
+ NSNotificationCenter.defaultCenter.addObserver( self,
+ selector: 'will_enter_fullscreen:',
+ name: NSWindowWillEnterFullScreenNotification,
+ object: window)
+ NSNotificationCenter.defaultCenter.addObserver( self,
+ selector: 'will_exit_fullscreen:',
+ name: NSWindowWillExitFullScreenNotification,
+ object: window)
+ end
end
- end
end
def awakeFromNib
@@ -103,98 +101,97 @@ def stream_channel(item)
end
end
- def collaps_channel
- # about to enter Lion's FS mode, collapsing the channel list panel
+ def collaps_channel
+ # about to enter Lion's FS mode, collapsing the channel list panel
@channel_panel_old_size = [split_view.subviews[0].frame[0].x,
- split_view.subviews[0].frame[0].y,
- 430, #split_view.subviews[0].frame[1].width
- split_view.subviews[0].frame[1].height]
+ split_view.subviews[0].frame[0].y,
+ 430, #split_view.subviews[0].frame[1].width
+ split_view.subviews[0].frame[1].height]
split_view.subviews[0].frame = [0, 0, 0, split_view.subviews[0].frame[1].height]
- end
+ end
def will_enter_fullscreen(notification)
- collaps_channel
+ collaps_channel
end
def will_exit_fullscreen(notification)
# resizing the channel panel
split_view.subviews[0].frame = @channel_panel_old_size if @channel_panel_old_size
end
- # Leopard fullscreen
- def toggle_fullscreen(sender)
- @leo_fullscreen_button.setNextState if sender.nil?
- @is_fullscreen ? exit_fullscreen : enter_fullscreen
- end
+ # Leopard fullscreen
+ def toggle_fullscreen(sender)
+ @leo_fullscreen_button.setNextState if sender.nil?
+ @is_fullscreen ? exit_fullscreen : enter_fullscreen
+ end
- def enter_fullscreen
- @is_fullscreen = true
- collaps_channel
+ def enter_fullscreen
+ @is_fullscreen = true
+ collaps_channel
- mFullscreenScreen = window.screen
- screenRect = mFullscreenScreen.frame
- # Create a Window to Cover the screen
- fullscreenWindow = FullScreenWindow.alloc.initWithContentRect screenRect,
- styleMask:NSBorderlessWindowMask,
- backing:NSBackingStoreBuffered,
- defer:false
-
- fullscreenWindow.backgroundColor = NSColor.blackColor
- # Create Window Controllers for fullscreen window and Control Overlay
- @mFullscreenWindowController = NSWindowController.alloc.initWithWindow fullscreenWindow
- @mFullscreenOverlayWindowController = FullScreenOverlayWindowController.alloc.init
- fullscreenWindow.addChildWindow @mFullscreenOverlayWindowController.window,
- ordered:NSWindowAbove
- #
- self.repositionOverlayWindow
+ mFullscreenScreen = window.screen
+ screenRect = mFullscreenScreen.frame
+ # Create a Window to Cover the screen
+ fullscreenWindow = FullScreenWindow.alloc.initWithContentRect screenRect,
+ styleMask:NSBorderlessWindowMask,
+ backing:NSBackingStoreBuffered,
+ defer:false
- # Move the Content into fullscreen
- @split_view.removeFromSuperviewWithoutNeedingDisplay
- fullscreenWindow.contentView.addSubview @split_view
- @mSavedMovieViewRect = @split_view.frame # remember the current rect/size
- @split_view.frame = fullscreenWindow.contentView.bounds
+ fullscreenWindow.backgroundColor = NSColor.blackColor
+ # Create Window Controllers for fullscreen window and Control Overlay
+ @mFullscreenWindowController = NSWindowController.alloc.initWithWindow fullscreenWindow
+ @mFullscreenOverlayWindowController = FullScreenOverlayWindowController.alloc.init
+ fullscreenWindow.addChildWindow @mFullscreenOverlayWindowController.window, ordered:NSWindowAbove
-
- # Bring the fullscreen and overlay windows to the front
- window.orderOut self
- @mFullscreenOverlayWindowController.showWindow self
- @mFullscreenWindowController.showWindow self
+ self.repositionOverlayWindow
- # Hide the dock and menu bar, saving previous presentation options
- @mSavedPresentationOptions = NSApp.presentationOptions
- NSApp.setPresentationOptions (NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)
- end
-
- def exit_fullscreen
- @is_fullscreen = false
-
- # player view back to the main window
- @split_view.removeFromSuperviewWithoutNeedingDisplay
- @split_view.frame = @mSavedMovieViewRect
- @window.contentView.addSubview @split_view
+ # Move the Content into fullscreen
+ @split_view.removeFromSuperviewWithoutNeedingDisplay
+ fullscreenWindow.contentView.addSubview @split_view
+ @mSavedMovieViewRect = @split_view.frame # remember the current rect/size
+ @split_view.frame = fullscreenWindow.contentView.bounds
+
- # Get rid of the fullscreen windows
- @mFullscreenWindowController.close
- @mFullscreenWindowController = nil
- @mFullscreenOverlayWindowController.close
- @mFullscreenOverlayWindowController = nil
+ # Bring the fullscreen and overlay windows to the front
+ window.orderOut self
+ @mFullscreenOverlayWindowController.showWindow self
+ @mFullscreenWindowController.showWindow self
- # Bring the main window back to the front
- window.makeKeyAndOrderFront self
+ # Hide the dock and menu bar, saving previous presentation options
+ @mSavedPresentationOptions = NSApp.presentationOptions
+ NSApp.setPresentationOptions (NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)
+ end
- # Restore previous presentation options
- NSApp.setPresentationOptions @mSavedPresentationOptions
-
- # resizing the channel panel
+ def exit_fullscreen
+ @is_fullscreen = false
+
+ # player view back to the main window
+ @split_view.removeFromSuperviewWithoutNeedingDisplay
+ @split_view.frame = @mSavedMovieViewRect
+ @window.contentView.addSubview @split_view
+
+ # Get rid of the fullscreen windows
+ @mFullscreenWindowController.close
+ @mFullscreenWindowController = nil
+ @mFullscreenOverlayWindowController.close
+ @mFullscreenOverlayWindowController = nil
+
+ # Bring the main window back to the front
+ window.makeKeyAndOrderFront self
+
+ # Restore previous presentation options
+ NSApp.setPresentationOptions @mSavedPresentationOptions
+
+ # resizing the channel panel
split_view.subviews[0].frame = @channel_panel_old_size if @channel_panel_old_size
- end
+ end
- def repositionOverlayWindow
- fullscreenRect = @mFullscreenWindowController.window.frame
- overlayWindow = @mFullscreenOverlayWindowController.window
- overlayRect = overlayWindow.frame
- overlayWindow.setFrameOrigin NSMakePoint(NSMinX(fullscreenRect) + ((0.5 * NSWidth(fullscreenRect)) - (0.5 * NSWidth(overlayRect))), 0.15 * NSHeight(fullscreenRect))
- end
+ def repositionOverlayWindow
+ fullscreenRect = @mFullscreenWindowController.window.frame
+ overlayWindow = @mFullscreenOverlayWindowController.window
+ overlayRect = overlayWindow.frame
+ overlayWindow.setFrameOrigin NSMakePoint(NSMinX(fullscreenRect) + ((0.5 * NSWidth(fullscreenRect)) - (0.5 * NSWidth(overlayRect))), 0.15 * NSHeight(fullscreenRect))
+ end
def windowWillClose(sender); exit(1); end

0 comments on commit ee13369

Please sign in to comment.