summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2009-01-12 18:49:16 +0000
committerdynaflash <[email protected]>2009-01-12 18:49:16 +0000
commit64fedd100c8b801ccba9d4a1b2bf1df7110d4198 (patch)
treed7401e0c2e47bdf0f2a975d1bc536666b3a14895 /macosx
parent6ee1d1ee7d0be13cd5a842a656b6209a680f202b (diff)
MacGui: Preview Window
- Add a 20 second no mouse movement delay then fade out the hud overlay controls so that the controls are not always visible as long as the cursor is inside the preview area. - Note: the 20 seconds might make a nice setting in preferences. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2078 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBPreviewController.h14
-rw-r--r--macosx/HBPreviewController.mm114
2 files changed, 108 insertions, 20 deletions
diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h
index 21e262bc2..16dd75e48 100644
--- a/macosx/HBPreviewController.h
+++ b/macosx/HBPreviewController.h
@@ -37,12 +37,16 @@
BOOL isEncoding;
- int MaxOutputWidth;
- int MaxOutputHeight;
+ int MaxOutputWidth;
+ int MaxOutputHeight;
int output_width, output_height, output_par_width, output_par_height;
int display_width;
-
+
+ /* Hud Control Overlay */
+ NSTimer * fHudTimer;
+ int hudTimerSeconds;
+
/* Full Screen Mode Toggle */
IBOutlet NSButton * fFullScreenToggleButton;
IBOutlet NSButton * fPictureSettingsToggleButton;
@@ -77,6 +81,10 @@
- (IBAction)goFullScreen:(id)sender;
- (IBAction)goWindowedScreen:(id)sender;
+/* HUD overlay */
+- (void) startHudTimer;
+- (void) stopHudTimer;
+
/* Movie Previews */
- (void) startReceivingLibhbNotifications;
- (void) stopReceivingLibhbNotifications;
diff --git a/macosx/HBPreviewController.mm b/macosx/HBPreviewController.mm
index d2d5dae97..575a2c6ec 100644
--- a/macosx/HBPreviewController.mm
+++ b/macosx/HBPreviewController.mm
@@ -46,38 +46,111 @@
- (void) mouseMoved:(NSEvent *)theEvent
{
[super mouseMoved:theEvent];
-
- [self showHideHudControls];
+
+ if (isEncoding == NO)
+ {
+ if (hudTimerSeconds == 0)
+ {
+ hudTimerSeconds ++;
+ [self startHudTimer];
+ }
+
+ if (hudTimerSeconds > 20)
+ {
+
+
+ [self stopHudTimer];
+ [self showHideHudControls];
+ }
+
+ }
}
+- (void) startHudTimer
+{
+ if (!fHudTimer)
+ {
+ fHudTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(hudTimerFired:) userInfo:nil repeats:YES];
+ [fHudTimer retain];
+ }
+}
+
+- (void) stopHudTimer
+{
+ if (fHudTimer)
+ {
+ [fHudTimer invalidate];
+ [fHudTimer release];
+ fHudTimer = nil;
+ hudTimerSeconds = 0;
+ }
+}
+
+- (void) hudTimerFired: (NSTimer*)theTimer
+{
+ hudTimerSeconds ++;
+ [self showHideHudControls];
+
+}
- (void) showHideHudControls
{
/* Test for mouse location to show/hide hud controls */
NSPoint mouseLoc;
- NSRect targetFrame;
+ NSRect targetFrame;
+ NSRect controlBoxFrame;
+ targetFrame = [fPictureViewArea frame];
+ controlBoxFrame = [fPictureControlBox frame];
+
if (isFullScreen)
{
- mouseLoc = [fFullScreenWindow mouseLocationOutsideOfEventStream];
+ mouseLoc = [fFullScreenWindow mouseLocationOutsideOfEventStream];
}
else
{
- mouseLoc = [fPreviewWindow mouseLocationOutsideOfEventStream];
+ mouseLoc = [fPreviewWindow mouseLocationOutsideOfEventStream];
}
- targetFrame = [fPictureViewArea frame];
- /* If we are not encoding a preview, we show/hide the hud controls */
- if (isEncoding == NO)
+
+ /* if the pointer is inside the picture view areas but not
+ * in the controlbox, check the hudTimerSeconds to see if
+ * its in the allowable time span
+ */
+ if ( hudTimerSeconds > 0 && hudTimerSeconds < 20)
{
- if (NSPointInRect (mouseLoc, targetFrame))
- {
- /* Mouse is over the preview area so show hud controls */
- [[fPictureControlBox animator] setHidden: NO];
- }
- else
+ if (NSPointInRect (mouseLoc, controlBoxFrame))
+ {
+ /* Mouse is over the preview area so show hud controls so just
+ * reset the timer to keep the control box visible
+ */
+ //[fPictureControlBox setHidden: NO];
+ hudTimerSeconds = 1;
+ return;
+ }
+
+ /* Else, if we are not encoding a preview, we show/hide the hud controls */
+ if (isEncoding == NO)
{
- [[fPictureControlBox animator] setHidden: YES];
+ /* Re-verify we are within the target frame */
+ if (NSPointInRect (mouseLoc, targetFrame))
+ {
+ /* Mouse is over the preview area so show hud controls */
+ [[fPictureControlBox animator] setHidden: NO];
+ /* increment our timer by one */
+ hudTimerSeconds ++;
+ }
+ else
+ {
+ [[fPictureControlBox animator] setHidden: YES];
+ [self stopHudTimer];
+ }
}
+
}
+ else
+ {
+ [[fPictureControlBox animator] setHidden: YES];
+ }
+
}
@@ -108,6 +181,7 @@
[self startReceivingLibhbNotifications];
isFullScreen = NO;
+ hudTimerSeconds = 0;
/* Setup our layers for core animation */
[fPictureViewArea setWantsLayer:YES];
@@ -115,7 +189,6 @@
[fMovieView setWantsLayer:YES];
- [fEncodingControlBox setWantsLayer:YES];
[fCancelPreviewMovieButton setWantsLayer:YES];
[fMovieCreationProgressIndicator setWantsLayer:YES];
@@ -124,6 +197,9 @@
[fFullScreenToggleButton setWantsLayer:YES];
[fPictureSettingsToggleButton setWantsLayer:YES];
[fCreatePreviewMovieButton setWantsLayer:YES];
+
+ [fEncodingControlBox setWantsLayer:YES];
+
[fShowPreviewMovieButton setWantsLayer:YES];
@@ -151,7 +227,7 @@ return YES;
}
isFullScreen = NO;
-
+ hudTimerSeconds = 0;
}
- (BOOL)windowShouldClose:(id)fPictureWindow
@@ -171,6 +247,9 @@ return YES;
[fLibhbTimer invalidate];
[fLibhbTimer release];
+ [fHudTimer invalidate];
+ [fHudTimer release];
+
[fPicturePreviews release];
[fFullScreenWindow release];
@@ -346,6 +425,7 @@ MaxOutputWidth = title->width - job->crop[2] - job->crop[3];
[self SetTitle:title];
[self showWindow:sender];
isFullScreen = NO;
+ hudTimerSeconds = 0;
}