From a2a0fb470bf50e75937c68b02f0e97a9f6cc6873 Mon Sep 17 00:00:00 2001 From: ritsuka Date: Sun, 9 Sep 2007 14:17:03 +0000 Subject: MacGui: Fixed main window not showing updated filters settings after closing the picture window. HandBrake gui is updated even when the user is pressing a button or a menu. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@940 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.mm | 31 ++++++++++++------------------- macosx/PictureController.h | 5 +++++ macosx/PictureController.mm | 13 ++++++++++++- 3 files changed, 29 insertions(+), 20 deletions(-) (limited to 'macosx') diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 0b7df1e35..bf794a5e2 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -80,7 +80,7 @@ static int hb_group_count(hb_handle_t * h) [HBPreferencesController registerUserDefaults]; fHandle = NULL; outputPanel = [[HBOutputPanelController alloc] init]; - fPictureController = [[PictureController alloc] init]; + fPictureController = [[PictureController alloc] initWithDelegate:self]; fQueueController = [[HBQueueController alloc] init]; fAdvancedOptions = [[HBAdvancedController alloc] init]; return self; @@ -104,11 +104,11 @@ static int hb_group_count(hb_handle_t * h) fChapterTitlesDelegate = [[ChapterTitles alloc] init]; [fChapterTable setDataSource:fChapterTitlesDelegate]; - /* Call UpdateUI every 2/10 sec */ + /* Call UpdateUI every 1/2 sec */ [[NSRunLoop currentRunLoop] addTimer: [NSTimer - scheduledTimerWithTimeInterval: 0.2 target: self - selector: @selector( updateUI: ) userInfo: NULL repeats: FALSE] - forMode: NSModalPanelRunLoopMode]; + scheduledTimerWithTimeInterval: 0.5 target: self + selector: @selector( updateUI: ) userInfo: NULL repeats: YES] + forMode: NSEventTrackingRunLoopMode]; if( ( build = hb_check_update( fHandle, &version ) ) > -1 ) { @@ -688,8 +688,8 @@ static int hb_group_count(hb_handle_t * h) - (void) updateUI: (NSTimer *) timer { -hb_list_t * list; -list = hb_get_titles( fHandle ); + hb_list_t * list; + list = hb_get_titles( fHandle ); /* check to see if there has been a new scan done this bypasses the constraints of HB_STATE_WORKING not allowing setting a newly scanned source */ @@ -953,11 +953,6 @@ list = hb_get_titles( fHandle ); { [fQueueStatus setStringValue: @""]; } - - [[NSRunLoop currentRunLoop] addTimer: [NSTimer - scheduledTimerWithTimeInterval: 0.5 target: self - selector: @selector( updateUI: ) userInfo: NULL repeats: FALSE] - forMode: NSModalPanelRunLoopMode]; } - (IBAction) showNewScan:(id)sender @@ -1320,7 +1315,6 @@ list = hb_get_titles( fHandle ); if( returnCode == NSOKButton ) { [fDstFile2Field setStringValue: [sheet filename]]; - } } @@ -1329,10 +1323,11 @@ list = hb_get_titles( fHandle ); hb_list_t * list = hb_get_titles( fHandle ); hb_title_t * title = (hb_title_t *) hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] ); - [fPictureController showPanelInWindow:fWindow forTitle:title]; - - [self calculatePictureSizing: sender]; +} + +- (void)pictureSettingsDidChange { + [self calculatePictureSizing: NULL]; } - (void) PrepareJob @@ -1772,7 +1767,7 @@ list = hb_get_titles( fHandle ); { hb_list_t * list = hb_get_titles( fHandle ); hb_title_t * title = (hb_title_t*) - hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] ); + hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] ); /* If Auto Naming is on. We create an output filename of dvd name - title number */ @@ -1816,7 +1811,6 @@ list = hb_get_titles( fHandle ); /* Pixel Ratio Setting */ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PixelRatio"]) { - job->pixel_ratio = 1 ; } else @@ -1903,7 +1897,6 @@ list = hb_get_titles( fHandle ); } - hb_list_t * list = hb_get_titles( fHandle ); hb_title_t * title = (hb_title_t *) hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] ); diff --git a/macosx/PictureController.h b/macosx/PictureController.h index 9feae1e25..81aff8517 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -57,7 +57,9 @@ int denoise; } fPictureFilterSettings; + id delegate; } +- (id)initWithDelegate:(id)del; - (void) SetHandle: (hb_handle_t *) handle; - (void) SetTitle: (hb_title_t *) title; @@ -80,5 +82,8 @@ - (void) showPanelInWindow: (NSWindow *) fWindow forTitle:(hb_title_t *)title; - (BOOL) loadMyNibFile; +@end +@interface NSObject (PictureControllertDelegateMethod) +- (void)pictureSettingsDidChange; @end diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index c274c196c..f8aec43ff 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -18,6 +18,15 @@ static int GetAlignedSize( int size ) @implementation PictureController +- (id)initWithDelegate:(id)del +{ + if (self = [super init]) + { + delegate = del; + } + return self; +} + - (void) SetHandle: (hb_handle_t *) handle { fHandle = handle; @@ -321,7 +330,6 @@ static int GetAlignedSize( int size ) { [self Display: HB_ANIMATE_NONE]; } - } - (IBAction) PreviousPicture: (id) sender @@ -346,6 +354,9 @@ static int GetAlignedSize( int size ) - (IBAction) ClosePanel: (id) sender { + if ([delegate respondsToSelector:@selector(pictureSettingsDidChange)]) + [delegate pictureSettingsDidChange]; + [NSApp endSheet: fPicturePanel]; [fPicturePanel orderOut: self]; } -- cgit v1.2.3