OSDN Git Service

MacGui: Fixed main window not showing updated filters settings after closing the...
authorritsuka <ritsuka@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 9 Sep 2007 14:17:03 +0000 (14:17 +0000)
committerritsuka <ritsuka@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 9 Sep 2007 14:17:03 +0000 (14:17 +0000)
HandBrake gui is updated even when the user is pressing a button or a menu.

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

macosx/Controller.mm
macosx/PictureController.h
macosx/PictureController.mm

index 0b7df1e..bf794a5 100644 (file)
@@ -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] );
index 9feae1e..81aff85 100644 (file)
@@ -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
index c274c19..f8aec43 100644 (file)
@@ -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];
 }