OSDN Git Service

MacGui: Disable preview hud controls during new source scans.
authordynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 5 Aug 2010 16:45:00 +0000 (16:45 +0000)
committerdynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 5 Aug 2010 16:45:00 +0000 (16:45 +0000)
- Fixes a crash where trying to get a preview image when a new source is being loaded will cause a crash
- Mirrors enableUI in the  main window.

git-svn-id: svn://localhost/HandBrake/trunk@3471 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m
macosx/HBPreviewController.h
macosx/HBPreviewController.m
macosx/PictureController.h
macosx/PictureController.m

index 5bba38c..86674ad 100644 (file)
@@ -594,19 +594,23 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
         
     }
     
-       if (b) {
+       if (b) 
+    {
         
         /* if we're enabling the interface, check if the audio mixdown controls need to be enabled or not */
         /* these will have been enabled by the mass control enablement above anyway, so we're sense-checking it here */
         [self setEnabledStateOfAudioMixdownControls:nil];
         /* we also call calculatePictureSizing here to sense check if we already have vfr selected */
         [self calculatePictureSizing:nil];
-        
-       } else {
+        /* Also enable the preview window hud controls */
+        [fPictureController enablePreviewHudControls];
+    }
+    else 
+    {
         
                [fPresetsOutlineView setEnabled: NO];
-        
-       }
+        [fPictureController disablePreviewHudControls];
+    }
     
     [self videoMatrixChanged:nil];
     [fAdvancedOptions enableUI:b];
index 3d26e69..1394a97 100644 (file)
@@ -97,6 +97,9 @@
 - (IBAction)goWindowedScreen:(id)sender;
 
 /* HUD overlay */
+- (void) enableHudControls;
+- (void) disableHudControls;
+
 - (void) startHudTimer;
 - (void) stopHudTimer;
 
index 10b239d..7fa8a84 100644 (file)
 }
 
 #pragma mark Hud Control Overlay
+/* enableHudControls and disableHudControls are used to sync enableUI
+ * in HBController so that during a scan we do not attempt to access source
+ * images, etc. which can cause a crash. In general this ui behavior will mirror
+ * the main window ui's enableUI method and in fact is called from there */
+- (void) enableHudControls
+{
+    [fPictureSlider setEnabled:YES];
+    [fScaleToScreenToggleButton setEnabled:YES];
+    [fCreatePreviewMovieButton setEnabled:YES];
+    [fGoToStillPreviewButton setEnabled:YES];
+    [fHBController writeToActivityLog: "Preview: Enabling HUD Controls"];
+}
+
+- (void) disableHudControls
+{
+    [fPictureSlider setEnabled:NO];
+    [fScaleToScreenToggleButton setEnabled:NO];
+    [fCreatePreviewMovieButton setEnabled:NO];
+    [fGoToStillPreviewButton setEnabled:NO];
+    [fHBController writeToActivityLog: "Preview: Disabling HUD Controls"];
+}
+
 - (void) mouseMoved:(NSEvent *)theEvent
 {
     [super mouseMoved:theEvent];
index 96ea118..56dbe5f 100644 (file)
 - (IBAction) resizeInspectorForTab: (id)sender;
 - (IBAction) showPreviewWindow: (id)sender;
 
+- (void) enablePreviewHudControls;
+- (void) disablePreviewHudControls;
 
 - (IBAction) adjustSizingDisplay: (id) sender;
 
index 4cc3933..7817410 100644 (file)
     [fPreviewController showWindow:sender];
 }
 
+- (void) enablePreviewHudControls
+{
+    [fPreviewController enableHudControls];
+}
 
+- (void) disablePreviewHudControls
+{
+    [fPreviewController disableHudControls];
+}
 
 - (void) setToWindowedMode
 {