OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / macosx / Controller.m
index 0b2ca93..8c0df13 100644 (file)
@@ -2320,10 +2320,11 @@ fWorkingCount = 0;
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
+    [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PictureModulus"];
     /* if we are custom anamorphic, store the exact storage, par and display dims */
     if (fTitle->job->anamorphic.mode == 3)
     {
-        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.modulus] forKey:@"PicturePARModulus"];
+        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PicturePARModulus"];
         
         [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PicturePARStorageWidth"];
         [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PicturePARStorageHeight"];
@@ -2759,8 +2760,10 @@ fWorkingCount = 0;
         [self writeToActivityLog: "applyQueueSettingsToMainWindow: queue item found"];
     }
     /* Set title number and chapters */
-    /* since the queue only scans a single title, we really don't need to pick a title */
-    [fSrcTitlePopUp selectItemAtIndex: [[queueToApply objectForKey:@"TitleNumber"] intValue] - 1];
+    /* since the queue only scans a single title, its already been selected in showNewScan
+       so do not try to reset it here. However if we do decide to do full source scans on
+       a queue edit rescan, we would need it. So leaving in for now but commenting out. */
+    //[fSrcTitlePopUp selectItemAtIndex: [[queueToApply objectForKey:@"TitleNumber"] intValue] - 1];
     
     [fSrcChapterStartPopUp selectItemAtIndex: [[queueToApply objectForKey:@"ChapterStart"] intValue] - 1];
     [fSrcChapterEndPopUp selectItemAtIndex: [[queueToApply objectForKey:@"ChapterEnd"] intValue] - 1];
@@ -2954,6 +2957,7 @@ fWorkingCount = 0;
         
     }
     
+    job->modulus = [[queueToApply objectForKey:@"PictureModulus"]  intValue];
     
     /* we check to make sure the presets width/height does not exceed the sources width/height */
     if (fTitle->width < [[queueToApply objectForKey:@"PictureWidth"]  intValue] || fTitle->height < [[queueToApply objectForKey:@"PictureHeight"]  intValue])
@@ -2980,7 +2984,7 @@ fWorkingCount = 0;
         }
     }
     job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"]  intValue];
-    
+    job->modulus = [[queueToApply objectForKey:@"PictureModulus"]  intValue];
     
     [self writeToActivityLog: "applyQueueSettingsToMainWindow: picture sizing set up"];
     
@@ -3080,7 +3084,6 @@ fWorkingCount = 0;
     
     /* we call SetTitle: in fPictureController so we get an instant update in the Picture Settings window */
     [fPictureController SetTitle:fTitle];
-    [fPictureController SetTitle:fTitle];
     [self calculatePictureSizing:nil];
     
     [self writeToActivityLog: "applyQueueSettingsToMainWindow: picture filters set up"];
@@ -3113,8 +3116,8 @@ fWorkingCount = 0;
     //applyQueueToScan = NO;
     
     /* Not that source is loaded and settings applied, delete the queue item from the queue */
-    //[self writeToActivityLog: "applyQueueSettingsToMainWindow: deleting queue item:%d",fqueueEditRescanItemNum];
-    //[self removeQueueFileItem:fqueueEditRescanItemNum];
+    [self writeToActivityLog: "applyQueueSettingsToMainWindow: deleting queue item:%d",fqueueEditRescanItemNum];
+    [self removeQueueFileItem:fqueueEditRescanItemNum];
 }
 
 
@@ -3722,13 +3725,14 @@ bool one_burned = FALSE;
     
     job->keep_ratio = [[queueToApply objectForKey:@"PictureKeepRatio"]  intValue];
     job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"]  intValue];
+    job->modulus = [[queueToApply objectForKey:@"PictureModulus"] intValue];
     if ([[queueToApply objectForKey:@"PicturePAR"]  intValue] == 3)
     {
         /* insert our custom values here for capuj */
         job->width = [[queueToApply objectForKey:@"PicturePARStorageWidth"]  intValue];
         job->height = [[queueToApply objectForKey:@"PicturePARStorageHeight"]  intValue];
         
-        job->anamorphic.modulus = [[queueToApply objectForKey:@"PicturePARModulus"] intValue];
+        job->modulus = [[queueToApply objectForKey:@"PicturePARModulus"] intValue];
         
         job->anamorphic.par_width = [[queueToApply objectForKey:@"PicturePARPixelWidth"]  intValue];
         job->anamorphic.par_height = [[queueToApply objectForKey:@"PicturePARPixelHeight"]  intValue];
@@ -4461,19 +4465,17 @@ bool one_burned = FALSE;
     hb_title_t * title = (hb_title_t*)
         hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] );
 
-    /* If we are a stream type, grok the output file name from title->name upon title change */
-    if (title->type == HB_STREAM_TYPE)
+    /* If we are a stream type and a batch scan, grok the output file name from title->name upon title change */
+    if (title->type == HB_STREAM_TYPE && hb_list_count( list ) > 1 )
     {
         /* we set the default name according to the new title->name */
         [fDstFile2Field setStringValue: [NSString stringWithFormat:
                                          @"%@/%@.%@", [[fDstFile2Field stringValue] stringByDeletingLastPathComponent],
                                          [NSString stringWithUTF8String: title->name],
                                          [[fDstFile2Field stringValue] pathExtension]]];
-        /* If we have more than one title and are stream then we have a batch, change the source to read out the parent folder also */
-        if ( hb_list_count( list ) > 1 )
-        {                                  
-            [fSrcDVD2Field setStringValue:[NSString stringWithFormat:@"%@/%@", browsedSourceDisplayName,[NSString stringWithUTF8String: title->name]]];
-        }
+        
+        /* Change the source to read out the parent folder also */
+        [fSrcDVD2Field setStringValue:[NSString stringWithFormat:@"%@/%@", browsedSourceDisplayName,[NSString stringWithUTF8String: title->name]]];
     }
     
     /* For point a to point b pts encoding, set the start and end fields to 0 and the title duration in seconds respectively */
@@ -5040,20 +5042,15 @@ the user is using "Custom" settings by determining the sender*/
     
     float sliderRfInverse = ([fVidQualitySlider maxValue] - [fVidQualitySlider floatValue]) + [fVidQualitySlider minValue];
     /* If the encoder is theora, use the float, otherwise use the inverse float*/
-    float sliderRfToPercent;
+    //float sliderRfToPercent;
     if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA)
     {
-        [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", [fVidQualitySlider floatValue]]];
-        sliderRfToPercent = [fVidQualityRFField floatValue] / ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]);   
+        [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", [fVidQualitySlider floatValue]]];   
     }
     else
     {
         [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", sliderRfInverse]];
-        sliderRfToPercent = ( ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue])  - ([fVidQualityRFField floatValue] - [fVidQualitySlider minValue])) / ([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]);
     }
-    [fVidConstantCell setTitle: [NSString stringWithFormat:
-                                 NSLocalizedString( @"Constant quality: %.2f %%", @"" ), 100 * sliderRfToPercent]];
-    
     [self customSettingUsed: sender];
 }
 
@@ -5203,8 +5200,14 @@ the user is using "Custom" settings by determining the sender*/
         fTitle->job->keep_ratio = 0;
        }
     
-    [fPictureSizeField setStringValue: [NSString stringWithFormat:@"Picture Size: %@", [fPictureController getPictureSizeInfoString]]];
-    
+    if (fTitle->job->anamorphic.mode != 1) // we are not strict so show the modulus
+       {
+        [fPictureSizeField setStringValue: [NSString stringWithFormat:@"Picture Size: %@, Modulus: %d", [fPictureController getPictureSizeInfoString], fTitle->job->modulus]];
+    }
+    else
+    {
+        [fPictureSizeField setStringValue: [NSString stringWithFormat:@"Picture Size: %@", [fPictureController getPictureSizeInfoString]]];
+    }
     NSString *picCropping;
     /* Set the display field for crop as per boolean */
        if (![fPictureController autoCrop])
@@ -6837,17 +6840,25 @@ return YES;
                 
                 [self audioTrackPopUpChanged: audiocodecPopUp];
                 [mixdownPopUp selectItemWithTitle:[tempObject objectForKey:@"AudioMixdown"]];
-                /* check to see if the selections was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
+                [self audioTrackMixdownChanged: mixdownPopUp];
+                /* check to see if the selection was available, if not, rerun audioTrackPopUpChanged using the codec to just set the default
                  * mixdown*/
                 if  ([mixdownPopUp selectedItem] == nil)
                 {
                     [self audioTrackPopUpChanged: audiocodecPopUp];
+                    [self writeToActivityLog: "presetSelected mixdown not selected, rerun audioTrackPopUpChanged"];
                 }
                 [sampleratePopUp selectItemWithTitle:[tempObject objectForKey:@"AudioSamplerate"]];
                 /* We set the presets bitrate if it is *not* an AC3 track since that uses the input bitrate */
                 if (![[tempObject objectForKey:@"AudioEncoder"] isEqualToString:@"AC3 Passthru"])
                 {
                     [bitratePopUp selectItemWithTitle:[tempObject objectForKey:@"AudioBitrate"]];
+                    /* check to see if the bitrate selection was available, if not, rerun audioTrackMixdownChanged using the mixdown to just set the
+                     *default mixdown bitrate*/
+                    if ([bitratePopUp selectedItem] == nil)
+                    {
+                        [self audioTrackMixdownChanged: mixdownPopUp];
+                    }
                 }
                 [drcSlider setFloatValue:[[tempObject objectForKey:@"AudioTrackDRCSlider"] floatValue]];
                 [self audioDRCSliderChanged: drcSlider];
@@ -7094,7 +7105,16 @@ return YES;
                 
             }
             
-            
+            /* Set modulus */
+            if ([chosenPreset objectForKey:@"PictureModulus"])
+            {
+                job->modulus = [[chosenPreset objectForKey:@"PictureModulus"]  intValue];
+            }
+            else
+            {
+                job->modulus = 16;
+            }
+             
             /* Check to see if the objectForKey:@"UsesPictureSettings is 2 which is "Use Max for the source */
             if ([[chosenPreset objectForKey:@"UsesPictureSettings"]  intValue] == 2 || [[chosenPreset objectForKey:@"UsesMaxPictureSettings"]  intValue] == 1)
             {
@@ -7469,6 +7489,7 @@ return YES;
         [preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
         [preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
         [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
+        [preset setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PictureModulus"];
         
         /* Set crop settings here */
         [preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"];