From 22ad6f6931e51738146c0e01b169d0c65bee312d Mon Sep 17 00:00:00 2001 From: dynaflash Date: Tue, 27 Jan 2009 17:47:35 +0000 Subject: MacGui: remember window postion and open/close state of the Picture Filter and Picture sizing inspectors and restore them at the next launch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2101 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.mm | 31 +++++++++++++++++++------------ macosx/English.lproj/PictureFilters.xib | 20 ++++++++++---------- macosx/English.lproj/PictureSettings.xib | 10 +++++----- macosx/HBFilterController.mm | 11 +++++++++-- macosx/HBPreviewController.mm | 16 +++++++++++++--- macosx/PictureController.mm | 7 ++++++- 6 files changed, 62 insertions(+), 33 deletions(-) (limited to 'macosx') diff --git a/macosx/Controller.mm b/macosx/Controller.mm index dfa73ed4b..116cf457c 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1539,18 +1539,25 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It SuccessfulScan = YES; [self enableUI: YES]; - /* if its the initial successful scan after awakeFromNib */ - if (currentSuccessfulScanCount == 1) - { - [self selectDefaultPreset:nil]; - /* initially set deinterlace to 0, will be overridden reset by the default preset anyway */ - //[fPictureController setDeinterlace:0]; - - /* lets set Denoise to index 0 or "None" since this is the first scan */ - //[fPictureController setDenoise:0]; - - [fPictureFilterController setInitialPictureFilters]; - } + /* if its the initial successful scan after awakeFromNib */ + if (currentSuccessfulScanCount == 1) + { + [self selectDefaultPreset:nil]; + + [fPictureFilterController setInitialPictureFilters]; + + // Open preview window now if it was visible when HB was closed + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PreviewWindowIsOpen"]) + [self showPreviewWindow:nil]; + + // Open picture sizing window now if it was visible when HB was closed + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PictureSizeWindowIsOpen"]) + [self showPicturePanel:nil]; + + // Open filters window now if it was visible when HB was closed + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PictureFiltersWindowIsOpen"]) + [self showFiltersPanel:nil]; + } } diff --git a/macosx/English.lproj/PictureFilters.xib b/macosx/English.lproj/PictureFilters.xib index 1e961a16e..20e831ce4 100644 --- a/macosx/English.lproj/PictureFilters.xib +++ b/macosx/English.lproj/PictureFilters.xib @@ -28,7 +28,7 @@ 8215 2 - {{1211, 475}, {345, 400}} + {{1211, 502}, {266, 373}} 1886913536 Picture Filters NSPanel @@ -39,7 +39,7 @@ {230, 250} - 256 + 274 YES @@ -458,7 +458,7 @@ - {{62, 48}, {232, 303}} + {{17, 22}, {232, 303}} {0, 0} @@ -489,7 +489,7 @@ 268 - {{119, 372}, {57, 16}} + {{19, 345}, {57, 16}} YES @@ -523,7 +523,7 @@ 268 - {{229, 372}, {88, 16}} + {{159, 345}, {88, 16}} YES @@ -535,7 +535,7 @@ 7.019608e-01 1.000000e+00 - + YES @@ -555,7 +555,7 @@ - {345, 400} + {266, 373} {{0, 0}, {1440, 878}} @@ -755,9 +755,9 @@ YES + - @@ -1150,10 +1150,10 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{654, 453}, {345, 400}} + {{654, 483}, {266, 373}} com.apple.InterfaceBuilder.CocoaPlugin - {{654, 453}, {345, 400}} + {{654, 483}, {266, 373}} {{221, 276}, {533, 580}} diff --git a/macosx/English.lproj/PictureSettings.xib b/macosx/English.lproj/PictureSettings.xib index 1d0ecf334..34e8c0011 100644 --- a/macosx/English.lproj/PictureSettings.xib +++ b/macosx/English.lproj/PictureSettings.xib @@ -873,7 +873,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA 268 - {{156, 490}, {57, 16}} + {{19, 491}, {57, 16}} YES @@ -907,7 +907,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA 268 - {{18, 490}, {84, 16}} + {{118, 491}, {84, 16}} YES @@ -919,7 +919,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA 7.019608e-01 1.000000e+00 - + YES @@ -1846,10 +1846,10 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA com.apple.InterfaceBuilder.CocoaPlugin - {{563, 338}, {229, 518}} + {{423, 339}, {229, 518}} com.apple.InterfaceBuilder.CocoaPlugin - {{563, 338}, {229, 518}} + {{423, 339}, {229, 518}} {{221, 276}, {533, 580}} diff --git a/macosx/HBFilterController.mm b/macosx/HBFilterController.mm index c5ec6836f..29759de64 100644 --- a/macosx/HBFilterController.mm +++ b/macosx/HBFilterController.mm @@ -45,6 +45,7 @@ else { [self showWindow:sender]; + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PictureFiltersWindowIsOpen"]; if ([fPreviewController fullScreen] == YES) { [self setToFullScreenMode]; @@ -83,21 +84,27 @@ - (void)setHBController: (HBController *)controller { + fHBController = controller; - //[fPreviewController setHBController: controller]; } - (void)awakeFromNib { [fFilterWindow setDelegate:self]; + + if( ![[self window] setFrameUsingName:@"PictureFilters"] ) + [[self window] center]; + [self setWindowFrameAutosaveName:@"PictureFilters"]; + [[self window] setExcludedFromWindowsMenu:YES]; + [self setInitialPictureFilters]; } - (void)windowWillClose:(NSNotification *)aNotification { - +[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PictureFiltersWindowIsOpen"]; } - (BOOL)windowShouldClose:(id)fPictureWindow diff --git a/macosx/HBPreviewController.mm b/macosx/HBPreviewController.mm index 8d78b945b..a74282c50 100644 --- a/macosx/HBPreviewController.mm +++ b/macosx/HBPreviewController.mm @@ -49,6 +49,8 @@ - (IBAction) showPreviewWindow: (id)sender { [self showWindow:sender]; + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PreviewWindowIsOpen"]; + /* lets set the preview window to accept mouse moved events */ [fPreviewWindow setAcceptsMouseMovedEvents:YES]; hudTimerSeconds = 0; @@ -64,6 +66,11 @@ - (void)awakeFromNib { [fPreviewWindow setDelegate:self]; + if( ![[self window] setFrameUsingName:@"Preview"] ) + [[self window] center]; + [self setWindowFrameAutosaveName:@"Preview"]; + [[self window] setExcludedFromWindowsMenu:YES]; + /* lets set the preview window to accept mouse moved events */ [fPreviewWindow setAcceptsMouseMovedEvents:YES]; //[self pictureSliderChanged:nil]; @@ -118,6 +125,7 @@ return YES; isFullScreen = NO; hudTimerSeconds = 0; + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PreviewWindowIsOpen"]; } - (BOOL)windowShouldClose:(id)fPictureWindow @@ -187,10 +195,10 @@ return YES; - (void) SetTitle: (hb_title_t *) title { hb_job_t * job = title->job; - + fTitle = title; -fPicture = 0; -MaxOutputWidth = title->width - job->crop[2] - job->crop[3]; + fPicture = 0; + MaxOutputWidth = title->width - job->crop[2] - job->crop[3]; MaxOutputHeight = title->height - job->crop[0] - job->crop[1]; [self SettingsChanged: nil]; } @@ -329,11 +337,13 @@ MaxOutputWidth = title->width - job->crop[2] - job->crop[3]; else { [self showWindow:sender]; + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PreviewWindowIsOpen"]; [fPreviewWindow setAcceptsMouseMovedEvents:YES]; isFullScreen = NO; scaleToScreen = NO; hudTimerSeconds = 0; [self startHudTimer]; + } } diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index 1ffb3ae48..4965f76f8 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -44,6 +44,7 @@ else { [self showWindow:sender]; + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PictureSizeWindowIsOpen"]; if ([fPreviewController fullScreen] == YES) { [self setToFullScreenMode]; @@ -92,12 +93,16 @@ - (void)awakeFromNib { [fPictureWindow setDelegate:self]; + if( ![[self window] setFrameUsingName:@"PictureSizing"] ) + [[self window] center]; + [self setWindowFrameAutosaveName:@"PictureSizing"]; + [[self window] setExcludedFromWindowsMenu:YES]; } - (void)windowWillClose:(NSNotification *)aNotification { - +[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PictureSizeWindowIsOpen"]; } - (BOOL)windowShouldClose:(id)fPictureWindow -- cgit v1.2.3