]> granicus.if.org Git - handbrake/commitdiff
MacGui: Presets
authordynaflash <dynaflashtech@gmail.com>
Mon, 26 Feb 2007 20:50:48 +0000 (20:50 +0000)
committerdynaflash <dynaflashtech@gmail.com>
Mon, 26 Feb 2007 20:50:48 +0000 (20:50 +0000)
- Initial implementation of Picture Settings into User Presets
- Added Checkbox on the new user preset panel so user may indicate whether or not to include the current Picture Settings in the preset.

git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.8.0_beta2_5.1@409 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.h
macosx/Controller.mm
macosx/English.lproj/MainMenu.nib/classes.nib
macosx/English.lproj/MainMenu.nib/info.nib
macosx/English.lproj/MainMenu.nib/keyedobjects.nib

index 828f2261945af11865f57274adc600899373ed00..8d920d1041fbcaca19f28048affef0e4c817b81a 100644 (file)
     IBOutlet NSButton            * fPauseButton;
     IBOutlet NSButton            * fRipButton;
 
-       /* User Preset variables here*/
+       /* User Preset variables here fPresetNewPicSettingsApply*/
        
        IBOutlet NSDrawer            * fPresetDrawer;
        IBOutlet NSTextField         * fPresetNewName;
+       IBOutlet NSButton            * fPresetNewPicSettingsApply;
        IBOutlet NSTextField         * fPresetSelectedDisplay;
        
        NSString * AppSupportDirectory;
index 21f25be4b24d8e986b5be4f0bd1b553c36489e4b..05e896e9762630b2cacc1849a49e8e8eae0fb05f 100644 (file)
@@ -1461,6 +1461,8 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
     NSMutableDictionary *preset = [[NSMutableDictionary alloc] init];
        /* Get the New Preset Name from the field in the AddPresetPanel */
     [preset setObject:[fPresetNewName stringValue] forKey:@"PresetName"];
+       /*Get the whether or not to apply pic settings in the AddPresetPanel*/
+       [preset setObject:[NSNumber numberWithInt:[fPresetNewPicSettingsApply state]] forKey:@"UsesPictureSettings"];
        /* File Format */
     [preset setObject:[fDstFormatPopUp titleOfSelectedItem] forKey:@"FileFormat"];
        /* Codecs */
@@ -1480,6 +1482,21 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
        /* 2 Pass Encoding */
        [preset setObject:[NSNumber numberWithInt:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"];
        
+       /*Picture Settings*/
+       hb_job_t * job = fTitle->job;
+       /* Basic Picture Settings */
+       [preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
+       [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->deinterlace] forKey:@"PictureDeinterlace"];
+       [preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+       /* Set crop settings here */
+       /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */
+       [preset setObject:[NSNumber numberWithInt:job->crop[0]] forKey:@"PictureTopCrop"];
+    [preset setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"];
+       [preset setObject:[NSNumber numberWithInt:job->crop[2]] forKey:@"PictureLeftCrop"];
+       [preset setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"];
+       
        /*Audio*/
        /* Audio Language One*/
        [preset setObject:[fAudLang1PopUp titleOfSelectedItem] forKey:@"AudioLang1"];
@@ -1510,7 +1527,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
         return;
     /* Alert user before deleting preset */
        /* Comment out for now, tie to user pref eventually */
-    NSBeep();
+    //NSBeep();
     status = NSRunAlertPanel(@"Warning!", @"Are you sure that you want to delete the selected preset?", @"OK", @"Cancel", nil);
     
     if ( status == NSAlertDefaultReturn ) {
@@ -1551,12 +1568,9 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
        [fVidQualityMatrix selectCellAtRow:[[chosenPreset objectForKey:@"VideoQualityType"] intValue] column:0];
        
        [fVidTargetSizeField setStringValue: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoTargetSize"]]];
-       //[preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
        [fVidBitrateField setStringValue: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoAvgBitrate"]]];
-              //[preset setObject:[fVidBitrateField stringValue] forKey:@"VideoAvgBitrate"];
-       // TO DO: NEED TO SET THE QUALITY SLIDER WITH FLOAT VALUE, I THINK
+       
        [fVidQualitySlider setFloatValue: [[chosenPreset valueForKey:@"VideoQualitySlider"] floatValue]];
-                         //[preset setObject:[NSNumber numberWithInt:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"];
        [self VideoMatrixChanged: sender];
        
        /* Video framerate */
@@ -1564,10 +1578,10 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
        
        /* GrayScale */
        [fVidGrayscaleCheck setState:[[chosenPreset objectForKey:@"VideoGrayScale"] intValue]];
-       //[preset setObject:[NSNumber numberWithInt:[fVidGrayscaleCheck state]] forKey:@"VideoGrayScale"];
+
        /* 2 Pass Encoding */
        [fVidTwoPassCheck setState:[[chosenPreset objectForKey:@"VideoTwoPass"] intValue]];
-       //[preset setObject:[NSNumber numberWithInt:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"];
+    
        
        /*Audio*/
        /* Audio Language One*/
@@ -1582,6 +1596,26 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
        /*Subtitles*/
        [fSubPopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"Subtitles"]]];
        
+       /* Picture Settings */
+       /* Look to see if we apply these here in objectForKey:@"UsesPictureSettings"] */
+       if ([[chosenPreset objectForKey:@"UsesPictureSettings"]  intValue] == 1)
+       {
+               hb_job_t * job = fTitle->job;
+               job->width = [[chosenPreset objectForKey:@"PictureWidth"]  intValue];
+               job->height = [[chosenPreset objectForKey:@"PictureHeight"]  intValue];
+               job->keep_ratio = [[chosenPreset objectForKey:@"PictureKeepRatio"]  intValue];
+               if (job->keep_ratio == 1)
+               {
+                       hb_fix_aspect( job, HB_KEEP_WIDTH );
+               }
+               job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"]  intValue];
+               job->crop[0] = [[chosenPreset objectForKey:@"PictureTopCrop"]  intValue];
+               job->crop[1] = [[chosenPreset objectForKey:@"PictureBottomCrop"]  intValue];
+               job->crop[2] = [[chosenPreset objectForKey:@"PictureLeftCrop"]  intValue];
+               job->crop[3] = [[chosenPreset objectForKey:@"PictureRightCrop"]  intValue];
+               [self CalculatePictureSizing: sender]; 
+       }
+       
        // Deselect the currently selected table //
        //[tableView deselectRow:[tableView selectedRow]];
 }
index 616b6604142f0fdbc0351b4f69f327d7c8c7fba9..2b248aded156df16fe7682c60bd365485e203fce 100644 (file)
@@ -78,6 +78,7 @@
                 fPicturePanel = NSPanel; 
                 fPresetDrawer = NSDrawer; 
                 fPresetNewName = NSTextField; 
+                fPresetNewPicSettingsApply = NSButton; 
                 fPresetSelectedDisplay = NSTextField; 
                 fPresetsAdd = NSButton; 
                 fPresetsDelete = NSButton; 
index 1b37e00d8ef591147bfa531c59e20beb1683c90e..64beae6c96e41aea6800ab3222f262bfe50d0506 100644 (file)
@@ -7,7 +7,7 @@
        <key>IBEditorPositions</key>
        <dict>
                <key>1843</key>
-               <string>341 286 220 592 0 0 1440 878 </string>
+               <string>610 276 220 592 0 0 1440 878 </string>
                <key>29</key>
                <string>102 834 300 44 0 0 1440 878 </string>
        </dict>
index adee5d9d349ea58fbea5a0c3509c6fc88c96b8a1..7bfb8416d8e6e60a76756974f83ca0881141e39c 100644 (file)
Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ