diff options
author | dynaflash <[email protected]> | 2010-02-19 19:53:52 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2010-02-19 19:53:52 +0000 |
commit | 2543a7aed801cbfdc43d85f4a5ddce37960387c3 (patch) | |
tree | 4be74a39d2a8462682a22e5be39f6656745cd331 | |
parent | 766233a0d5cd7181ce3a20aeb631b3cd863fe686 (diff) |
MacGui: Removie Full Screen preview mode as its largely redundant when we have 100 percent full screen scaling in windowed mode. Removes a lot of code that is really not needed.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3125 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/English.lproj/PicturePreview.xib | 92 | ||||
-rw-r--r-- | macosx/HBPreviewController.h | 8 | ||||
-rw-r--r-- | macosx/HBPreviewController.m | 207 | ||||
-rw-r--r-- | macosx/PictureController.h | 4 | ||||
-rw-r--r-- | macosx/PictureController.m | 27 |
5 files changed, 28 insertions, 310 deletions
diff --git a/macosx/English.lproj/PicturePreview.xib b/macosx/English.lproj/PicturePreview.xib index a27fd608d..906930dd5 100644 --- a/macosx/English.lproj/PicturePreview.xib +++ b/macosx/English.lproj/PicturePreview.xib @@ -21,7 +21,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="252"/> + <integer value="257"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -173,39 +173,6 @@ <int key="NSPeriodicInterval">25</int> </object> </object> - <object class="NSButton" id="537831590"> - <reference key="NSNextResponder" ref="385854969"/> - <int key="NSvFlags">289</int> - <string key="NSFrame">{{253, 7}, {69, 25}}</string> - <reference key="NSSuperview" ref="385854969"/> - <object class="NSArray" key="NSViewContentFilters"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="CIColorMonochrome"> - <object class="CIColor" key="CI_inputColor"> - <float key="red">0.70196080207824707</float> - <float key="green">0.70196080207824707</float> - <float key="blue">0.70196080207824707</float> - <float key="alpha">1</float> - </object> - <integer value="1" key="CI_inputIntensity"/> - <bool key="CIEnabled">YES</bool> - </object> - </object> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="29238952"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134479872</int> - <string key="NSContents">Full Screen</string> - <reference key="NSSupport" ref="22"/> - <reference key="NSControlView" ref="537831590"/> - <int key="NSButtonFlags">-2038284033</int> - <int key="NSButtonFlags2">163</int> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - </object> <object class="NSButton" id="141370142"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">289</int> @@ -242,7 +209,7 @@ <object class="NSButton" id="81685190"> <reference key="NSNextResponder" ref="385854969"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{327, 7}, {34, 25}}</string> + <string key="NSFrame">{{259, 7}, {86, 25}}</string> <reference key="NSSuperview" ref="385854969"/> <object class="NSArray" key="NSViewContentFilters"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -261,7 +228,7 @@ <object class="NSButtonCell" key="NSCell" id="847033897"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134479872</int> - <string key="NSContents"><-></string> + <string key="NSContents">Scale To Screen</string> <reference key="NSSupport" ref="22"/> <reference key="NSControlView" ref="81685190"/> <int key="NSButtonFlags">-2038284033</int> @@ -819,22 +786,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">fFullScreenToggleButton</string> - <reference key="source" ref="355312334"/> - <reference key="destination" ref="537831590"/> - </object> - <int key="connectionID">267</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">toggleScreenMode:</string> - <reference key="source" ref="355312334"/> - <reference key="destination" ref="537831590"/> - </object> - <int key="connectionID">270</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">fPictureSettingsToggleButton</string> <reference key="source" ref="355312334"/> <reference key="destination" ref="141370142"/> @@ -970,12 +921,11 @@ <reference ref="628196212"/> <reference ref="798240356"/> <reference ref="396925210"/> - <reference ref="537831590"/> <reference ref="141370142"/> <reference ref="245200984"/> - <reference ref="81685190"/> <reference ref="66510867"/> <reference ref="598619000"/> + <reference ref="81685190"/> </object> <reference key="parent" ref="289177107"/> </object> @@ -1094,20 +1044,6 @@ <reference key="parent" ref="569473100"/> </object> <object class="IBObjectRecord"> - <int key="objectID">265</int> - <reference key="object" ref="537831590"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="29238952"/> - </object> - <reference key="parent" ref="92351498"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">266</int> - <reference key="object" ref="29238952"/> - <reference key="parent" ref="537831590"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">271</int> <reference key="object" ref="141370142"/> <object class="NSMutableArray" key="children"> @@ -1218,12 +1154,6 @@ <string>257.IBPluginDependency</string> <string>261.IBPluginDependency</string> <string>262.IBPluginDependency</string> - <string>265.IBPluginDependency</string> - <string>265.IBViewIntegration.shadowBlurRadius</string> - <string>265.IBViewIntegration.shadowColor</string> - <string>265.IBViewIntegration.shadowOffsetHeight</string> - <string>265.IBViewIntegration.shadowOffsetWidth</string> - <string>266.IBPluginDependency</string> <string>271.IBPluginDependency</string> <string>271.IBViewIntegration.shadowBlurRadius</string> <string>271.IBViewIntegration.shadowColor</string> @@ -1316,20 +1246,14 @@ <integer value="0"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <integer value="0"/> - <reference ref="864448722"/> - <integer value="0"/> - <integer value="0"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{411, 496}, {480, 360}}</string> + <string>{{261, 473}, {480, 360}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> - <string>{{411, 496}, {480, 360}}</string> + <string>{{261, 473}, {480, 360}}</string> <integer value="1"/> <string>{{221, 276}, {533, 580}}</string> <boolean value="NO"/> @@ -1393,7 +1317,6 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>SettingsChanged:</string> <string>createMoviePreview:</string> - <string>goFullScreen:</string> <string>goWindowedScreen:</string> <string>pictureSliderChanged:</string> <string>previewDurationPopUpChanged:</string> @@ -1401,7 +1324,6 @@ <string>showPictureSettings:</string> <string>showPreviewWindow:</string> <string>toggleScaleToScreen:</string> - <string>toggleScreenMode:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1410,12 +1332,10 @@ <string>id</string> <string>id</string> <string>id</string> - <string>id</string> <string>NSString</string> <string>id</string> <string>id</string> <string>id</string> - <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h index df5cf2b1c..38c86c99d 100644 --- a/macosx/HBPreviewController.h +++ b/macosx/HBPreviewController.h @@ -49,10 +49,8 @@ int hudTimerSeconds; /* Full Screen Mode Toggle */ - IBOutlet NSButton * fFullScreenToggleButton; IBOutlet NSButton * fScaleToScreenToggleButton; IBOutlet NSButton * fPictureSettingsToggleButton; - BOOL isFullScreen; BOOL scaleToScreen; /* Movie Previews */ IBOutlet NSButton * fCreatePreviewMovieButton; @@ -80,12 +78,8 @@ - (IBAction)showPictureSettings:(id)sender; - (NSString*) pictureSizeInfoString; -/* Full Screen */ -- (IBAction)toggleScreenMode:(id)sender; - (IBAction)toggleScaleToScreen:(id)sender; -- (BOOL)fullScreen; -- (IBAction)goFullScreen:(id)sender; -- (IBAction)goWindowedScreen:(id)sender; + /* HUD overlay */ - (void) startHudTimer; diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index a391b8dd0..cc0e73826 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -83,7 +83,6 @@ //[self pictureSliderChanged:nil]; [self startReceivingLibhbNotifications]; - isFullScreen = NO; hudTimerSeconds = 0; /* we set the progress indicator to not use threaded animation * as it causes a conflict with the qtmovieview's controllerbar @@ -134,7 +133,6 @@ [fMovieView setHidden:YES]; [fMovieView setMovie:nil]; - isFullScreen = NO; hudTimerSeconds = 0; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PreviewWindowIsOpen"]; } @@ -389,7 +387,6 @@ [self showWindow:sender]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PreviewWindowIsOpen"]; [fPreviewWindow setAcceptsMouseMovedEvents:YES]; - isFullScreen = NO; scaleToScreen = NO; [self pictureSliderChanged:nil]; } @@ -459,19 +456,7 @@ } } -#pragma mark Fullscreen Mode -- (IBAction)toggleScreenMode:(id)sender -{ - if (!isFullScreen) - { - [self goFullScreen:nil]; - } - else - { - [self goWindowedScreen:nil]; - } -} - (IBAction)toggleScaleToScreen:(id)sender { @@ -480,117 +465,19 @@ scaleToScreen = NO; /* make sure we are set to a still preview */ [self pictureSliderChanged:nil]; - [fScaleToScreenToggleButton setTitle:@"<->"]; + [fScaleToScreenToggleButton setTitle:@"Scale To Screen"]; } else { scaleToScreen = YES; /* make sure we are set to a still preview */ [self pictureSliderChanged:nil]; - [fScaleToScreenToggleButton setTitle:@">-<"]; + [fScaleToScreenToggleButton setTitle:@"Actual Scale"]; } } -- (BOOL)fullScreen -{ - return isFullScreen; -} -- (IBAction)goFullScreen:(id)sender -{ - // Get the screen information. - NSScreen* mainScreen = [fPreviewWindow screen]; - NSDictionary* screenInfo = [mainScreen deviceDescription]; - NSNumber* screenID = [screenInfo objectForKey:@"NSScreenNumber"]; - // Capture the screen. - CGDirectDisplayID displayID = (CGDirectDisplayID)[screenID longValue]; - CGDisplayErr err = CGDisplayCapture(displayID); - - if (err == CGDisplayNoErr) - { - - /* make sure we are set to a still preview and not scaled to screen */ - scaleToScreen = NO; - [self pictureSliderChanged:nil]; - - // Create the full-screen window. - //NSRect winRect = [mainScreen frame]; - //fPictureViewArea - NSRect winRect = [fPictureViewArea frame]; - - fFullScreenWindow = [[NSWindow alloc] initWithContentRect:winRect - styleMask:NSBorderlessWindowMask - backing:NSBackingStoreBuffered - defer:NO - screen:mainScreen]; - - // Establish the window attributes. - [fFullScreenWindow setReleasedWhenClosed:NO]; - [fFullScreenWindow setDisplaysWhenScreenProfileChanges:YES]; - [fFullScreenWindow setDelegate:self]; - - /* insert a view into the new window */ - [fFullScreenWindow setContentView:fPictureViewArea]; - [fPictureViewArea setNeedsDisplay:YES]; - - /* Better to center the window using the screen's frame - * and the windows origin. Note that we should take into - * account the auto sizing and alignment that occurs in - * setViewSize each time the preview changes. - * Note: by using [fFullScreenWindow screen] (instead of - * [NSScreen mainScreen]) in referencing the screen - * coordinates, the full screen window will show up on - * whichever display was being used in windowed mode - * on multi-display systems - */ - - NSSize screenSize = [[fFullScreenWindow screen] frame].size; - NSSize windowSize = [fFullScreenWindow frame].size; - NSPoint windowOrigin = [fFullScreenWindow frame].origin; - - /* Adjust our origin y (vertical) based on the screen height */ - windowOrigin.y += (screenSize.height - windowSize.height) / 2.0; - windowOrigin.x += (screenSize.width - windowSize.width) / 2.0; - - [fFullScreenWindow setFrameOrigin:windowOrigin]; - - /* lets kill the timer for now */ - [self stopReceivingLibhbNotifications]; - - /* We need to retain the fPreviewWindow */ - [fPreviewWindow retain]; - - [self setWindow:fFullScreenWindow]; - - // The window has to be above the level of the shield window. - int32_t shieldLevel = CGShieldingWindowLevel(); - - [fFullScreenWindow setLevel:shieldLevel]; - - // Show the window. - [fFullScreenWindow makeKeyAndOrderFront:self]; - - - /* Change the name of fFullScreenToggleButton appropriately */ - [fFullScreenToggleButton setTitle: @"Windowed"]; - - /* Lets fire the timer back up for the hud controls, etc. */ - [self startReceivingLibhbNotifications]; - - isFullScreen = YES; - [fScaleToScreenToggleButton setHidden:NO]; - - /* make sure we are set to a still preview */ - [self pictureSliderChanged:nil]; - - [fFullScreenWindow setAcceptsMouseMovedEvents:YES]; - - - hudTimerSeconds = 0; - [self startHudTimer]; - } -} // Title-less windows normally don't receive key presses, override this - (BOOL)canBecomeKeyWindow @@ -606,58 +493,7 @@ } -- (IBAction)goWindowedScreen:(id)sender -{ - - /* Get the screen info to release the display but don't actually do - * it until the windowed screen is setup. - */ - scaleToScreen = NO; - [self pictureSliderChanged:nil]; - [fScaleToScreenToggleButton setTitle:@"<->"]; - - NSScreen* mainScreen = [NSScreen mainScreen]; - NSDictionary* screenInfo = [mainScreen deviceDescription]; - NSNumber* screenID = [screenInfo objectForKey:@"NSScreenNumber"]; - CGDirectDisplayID displayID = (CGDirectDisplayID)[screenID longValue]; - - [fFullScreenWindow dealloc]; - [fFullScreenWindow release]; - - - [fPreviewWindow setContentView:fPictureViewArea]; - [fPictureViewArea setNeedsDisplay:YES]; - [self setWindow:fPreviewWindow]; - - // Show the window. - [fPreviewWindow makeKeyAndOrderFront:self]; - - /* Set the window back to regular level */ - [fPreviewWindow setLevel:NSNormalWindowLevel]; - - /* Set the isFullScreen flag back to NO */ - isFullScreen = NO; - scaleToScreen = NO; - /* make sure we are set to a still preview */ - [self pictureSliderChanged:nil]; - [self showPreviewWindow:nil]; - - /* Change the name of fFullScreenToggleButton appropriately */ - [fFullScreenToggleButton setTitle: @"Full Screen"]; - // [fScaleToScreenToggleButton setHidden:YES]; - /* set the picture settings pallete back to normal level */ - [fHBController picturePanelWindowed]; - - /* Release the display now that the we are back in windowed mode */ - CGDisplayRelease(displayID); - - [fPreviewWindow setAcceptsMouseMovedEvents:YES]; - //[fFullScreenWindow setAcceptsMouseMovedEvents:NO]; - - hudTimerSeconds = 0; - [self startHudTimer]; - -} + #pragma mark Still Preview Image Processing @@ -994,9 +830,10 @@ * we retain the gray cropping border we have already established * with the still previews */ - + /* Load the new movie into fMovieView */ - if (path) { + if (path) + { QTMovie * aMovie; NSError *outError; NSURL *movieUrl = [NSURL fileURLWithPath:path]; @@ -1008,20 +845,23 @@ [NSNumber numberWithBool:NO], @"QTMovieOpenAsyncOKAttribute", QTMovieApertureModeClean, QTMovieApertureModeAttribute, nil]; - + aMovie = [[[QTMovie alloc] initWithAttributes:movieAttributes error:&outError] autorelease]; - - if (!aMovie) { + + if (!aMovie) + { NSLog(@"Unable to open movie"); } - else { + else + { NSRect movieBounds; /* we get some size information from the preview movie */ NSSize movieSize= [[aMovie attributeForKey:QTMovieNaturalSizeAttribute] sizeValue]; movieBounds = [fMovieView movieBounds]; movieBounds.size.height = movieSize.height; - if ([fMovieView isControllerVisible]) { + if ([fMovieView isControllerVisible]) + { CGFloat controllerBarHeight = [fMovieView controllerBarHeight]; if ( controllerBarHeight != 0 ) //Check if QTKit return a real value or not. movieBounds.size.height += controllerBarHeight; @@ -1185,8 +1025,6 @@ // Now resize the whole panel by those same deltas, but don't exceed the min NSRect frame = [[self window] frame]; - NSSize screenSize = [[[self window] screen] frame].size; - //NSSize maxSize = [[self window] maxSize]; NSSize maxSize = [[[self window] screen] visibleFrame].size; NSSize minSize = [[self window] minSize]; @@ -1220,22 +1058,7 @@ if( frame.size.width != [[self window] frame].size.width ) frame.origin.x -= (deltaX / 2.0); - if (isFullScreen) - { - if( frame.size.height != [[self window] frame].size.height ) - { - frame.origin.y -= (deltaY / 2.0); - } - else - { - if( frame.size.height != [[self window] frame].size.height ) - frame.origin.y -= deltaY; - } - [[self window] setFrame:frame display:YES animate:NO]; - } - else - { /* Since upon launch we can open up the preview window if it was open * the last time we quit (and at the size it was) we want to make * sure that upon resize we do not have the window off the screen @@ -1267,7 +1090,7 @@ } [[self window] setFrame:frame display:YES animate:YES]; - } + } diff --git a/macosx/PictureController.h b/macosx/PictureController.h index 4a1dd6172..fc8172f06 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -169,7 +169,7 @@ - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem; - (IBAction) resizeInspectorForTab: (id)sender; - (IBAction) showPreviewWindow: (id)sender; -- (BOOL) previewFullScreenMode; + - (IBAction) previewGoWindowed: (id)sender; - (IBAction) adjustSizingDisplay: (id) sender; @@ -187,7 +187,7 @@ - (IBAction) storageLinkChanged: (id) sender; - (IBAction) parLinkChanged: (id) sender; - (IBAction) displayLinkChanged: (id) sender; -- (void) setToFullScreenMode; + - (void) setToWindowedMode; /* Filter Actions */ diff --git a/macosx/PictureController.m b/macosx/PictureController.m index 19b3c0acf..5f916d8be 100644 --- a/macosx/PictureController.m +++ b/macosx/PictureController.m @@ -36,14 +36,8 @@ //------------------------------------------------------------------------------------ - (IBAction) showPictureWindow: (id)sender { - if ([fPreviewController fullScreen] == YES) - { - [self showWindow:sender]; - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PictureSizeWindowIsOpen"]; - [self setToFullScreenMode]; - } - else - { + + if ([[self window] isVisible]) { [[self window] close]; @@ -54,15 +48,12 @@ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PictureSizeWindowIsOpen"]; [self setToWindowedMode]; } - } + [self adjustFilterDisplay:nil]; [self adjustSizingDisplay:nil]; } -- (BOOL) previewFullScreenMode -{ - return [fPreviewController fullScreen]; -} + /* this method is used to detect clicking on a tab in fSizeFilterView */ - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem @@ -409,16 +400,6 @@ - -- (void) setToFullScreenMode -{ - int32_t shieldLevel = CGShieldingWindowLevel(); - - [fPictureWindow setLevel:shieldLevel + 1]; - // Show the window. - [fPictureWindow makeKeyAndOrderFront:self]; -} - - (void) setToWindowedMode { /* Set the window back to Floating Window mode |