From: dynaflash Date: Thu, 5 Aug 2010 16:45:00 +0000 (+0000) Subject: MacGui: Disable preview hud controls during new source scans. X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=ae1ecc6cfd44ad5447e1136366e6179b3d138aa9;p=handbrake-jp%2Fhandbrake-jp-git.git MacGui: Disable preview hud controls during new source scans. - 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 --- diff --git a/macosx/Controller.m b/macosx/Controller.m index 5bba38c5..86674ade 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -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]; diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h index 3d26e692..1394a973 100644 --- a/macosx/HBPreviewController.h +++ b/macosx/HBPreviewController.h @@ -97,6 +97,9 @@ - (IBAction)goWindowedScreen:(id)sender; /* HUD overlay */ +- (void) enableHudControls; +- (void) disableHudControls; + - (void) startHudTimer; - (void) stopHudTimer; diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 10b239d5..7fa8a844 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -487,6 +487,28 @@ } #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]; diff --git a/macosx/PictureController.h b/macosx/PictureController.h index 96ea118a..56dbe5f2 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -170,6 +170,8 @@ - (IBAction) resizeInspectorForTab: (id)sender; - (IBAction) showPreviewWindow: (id)sender; +- (void) enablePreviewHudControls; +- (void) disablePreviewHudControls; - (IBAction) adjustSizingDisplay: (id) sender; diff --git a/macosx/PictureController.m b/macosx/PictureController.m index 4cc39331..78174102 100644 --- a/macosx/PictureController.m +++ b/macosx/PictureController.m @@ -395,7 +395,15 @@ [fPreviewController showWindow:sender]; } +- (void) enablePreviewHudControls +{ + [fPreviewController enableHudControls]; +} +- (void) disablePreviewHudControls +{ + [fPreviewController disableHudControls]; +} - (void) setToWindowedMode {