diff options
author | dynaflash <[email protected]> | 2008-12-15 15:11:49 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2008-12-15 15:11:49 +0000 |
commit | 45e2e58bed396259f939f7482d6e7eec31b1a351 (patch) | |
tree | 1be6427f405edcd0c85830c6c39fe14bb3b32c2a /macosx/PictureController.mm | |
parent | 0137a81794777bc60e5dd34ea1af2b8336971a9d (diff) |
MacGui: Picture window now uses a subclass of HBController to access the main controller.
- fixed issue where preview movie keeps playing even if the picture window is closed
- Removed deprecated -ClosePanel method since we now use the windows native close button.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2033 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/PictureController.mm')
-rw-r--r-- | macosx/PictureController.mm | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index 08d5c3e8e..8d61f562e 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -5,6 +5,7 @@ It may be used under the terms of the GNU General Public License. */ #import "PictureController.h" +#import "Controller.h" @interface PictureController (Private) @@ -17,7 +18,7 @@ @implementation PictureController -- (id)initWithDelegate:(id)del +- (id)init { if (self = [super initWithWindowNibName:@"PictureSettings"]) { @@ -31,8 +32,7 @@ // go away. [self window]; - delegate = del; - fPicturePreviews = [[NSMutableDictionary dictionaryWithCapacity: HB_NUM_HBLIB_PICTURES] retain]; + fPicturePreviews = [[NSMutableDictionary dictionaryWithCapacity: HB_NUM_HBLIB_PICTURES] retain]; /* Init libhb with check for updates libhb style set to "0" so its ignored and lets sparkle take care of it */ int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; fPreviewLibhb = hb_init(loggingLevel, 0); @@ -40,6 +40,40 @@ return self; } +//------------------------------------------------------------------------------------ +// Displays and brings the picture window to the front +//------------------------------------------------------------------------------------ +- (IBAction) showPictureWindow: (id)sender +{ + [self showWindow:sender]; +} + +- (void)setHBController: (HBController *)controller +{ + fHBController = controller; +} + +- (void)awakeFromNib +{ + [fPictureWindow setDelegate:self]; +} + + +- (void)windowWillClose:(NSNotification *)aNotification +{ + /* Upon Closing the picture window, we make sure we clean up any + * preview movie that might be playing + */ + play_movie = NO; + hb_stop( fPreviewLibhb ); + [self pictureSliderChanged:nil]; +} + +- (BOOL)windowShouldClose:(id)fPictureWindow +{ + return YES; +} + - (void) dealloc { hb_stop(fPreviewLibhb); @@ -478,8 +512,7 @@ are maintained across different sources */ if (sender != nil) { - if ([delegate respondsToSelector:@selector(pictureSettingsDidChange)]) - [delegate pictureSettingsDidChange]; + [fHBController pictureSettingsDidChange]; } } @@ -505,6 +538,8 @@ are maintained across different sources */ #pragma mark Movie Preview - (IBAction) createMoviePreview: (id) sender { + + /* Lets make sure the still picture previews are showing in case * there is currently a movie showing */ [self pictureSliderChanged:nil]; @@ -526,18 +561,18 @@ are maintained across different sources */ return; } + /* we use controller.mm's prepareJobForPreview to go ahead and set all of our settings * however, we want to use a temporary destination field of course * so that we do not put our temp preview in the users chosen * directory */ hb_job_t * job = fTitle->job; + /* We run our current setting through prepeareJob in Controller.mm * just as if it were a regular encode */ - if ([delegate respondsToSelector:@selector(prepareJobForPreview)]) - { - [delegate prepareJobForPreview]; - } + + [fHBController prepareJobForPreview]; /* Destination file. We set this to our preview directory * changing the extension appropriately.*/ @@ -813,15 +848,6 @@ are maintained across different sources */ #pragma mark - -- (IBAction) ClosePanel: (id) sender -{ - if ([delegate respondsToSelector:@selector(pictureSettingsDidChange)]) - [delegate pictureSettingsDidChange]; - - [NSApp endSheet:[self window]]; - [[self window] orderOut:self]; -} - - (BOOL) autoCrop { return autoCrop; |