]> granicus.if.org Git - handbrake/commitdiff
MacGui: Enhanced Picture Settings in Presets (esp. cropping)
authordynaflash <dynaflashtech@gmail.com>
Tue, 31 Jul 2007 14:52:37 +0000 (14:52 +0000)
committerdynaflash <dynaflashtech@gmail.com>
Tue, 31 Jul 2007 14:52:37 +0000 (14:52 +0000)
When creating a preset, three choices exist for picture settings:
- None: Preset has no effect on any picture settings
- Current: Preset will apply whatever picture settings were in effect at the time the preset was created (including deinterlace, par and *cropping)
- Source Maximum (post scan): Preset will apply the maximum picture settings for each source and auto crop (basically the same picture settings that were in effect right after the source scan and nothing was modified with auto cropping enabled) Anamorphic and Deinterlace will be set according to general preferences
- * Note on cropping with Current set for preset: If cropping was set to "Auto" at the time the preset was created, the preset will then use the sources auto crop values. If, however the cropping was set to "Custom" at the time the preset was created the preset will apply the custom cropping values to each source from when the preset was created.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@765 b64f7644-9d1e-0410-96f1-a4d463321fa5

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

index 24a2011c4086b9dcf3e4b3a9ed1e6a40c9efaba6..fc5260f02900b57b36bec0993bbad2ac196ce446 100644 (file)
     /* Picture variables */
        int                        PicOrigOutputWidth;
        int                        PicOrigOutputHeight;
-       
+       int                        AutoCropTop;
+       int                        AutoCropBottom;
+       int                        AutoCropLeft;
+       int                        AutoCropRight;
     /* Subtitles box */
     IBOutlet NSTextField         * fSubField;
     IBOutlet NSPopUpButton       * fSubPopUp;
index b48dd7a903ab134a9c32421c526af8d825b76953..30b126aae88c35cc1e7dc09270606e62b95fce44 100644 (file)
@@ -38,7 +38,6 @@ static int FormatSettings[4][10] =
 /* We setup the toolbar values here */
 static NSString*       MyDocToolbarIdentifier          = @"My Document Toolbar Identifier";
 static NSString*       ToggleDrawerIdentifier  = @"Toggle Drawer Item Identifier";
-//static NSString*       ToggleDrawerIdentifier  = @"Toggle Presets Item Identifier";
 static NSString*       StartEncodingIdentifier         = @"Start Encoding Item Identifier";
 static NSString*       PauseEncodingIdentifier         = @"Pause Encoding Item Identifier";
 static NSString*       ShowQueueIdentifier     = @"Show Queue Item Identifier";
@@ -132,9 +131,11 @@ static NSString*       ChooseSourceIdentifier   = @"Choose Source Item Identifie
     [fWindow center];
 
     [self TranslateStrings];
-    currentScanCount = 0;
+    /* Initialize currentScanCount so HB can use it to
+          evaluate successive scans */
+       currentScanCount = 0;
 
-/* Init User Presets .plist */
+    /* Init User Presets .plist */
        /* We declare the default NSFileManager into fileManager */
        NSFileManager * fileManager = [NSFileManager defaultManager];
        //presetPrefs = [[NSUserDefaults standardUserDefaults] retain];
@@ -992,12 +993,11 @@ list = hb_get_titles( fHandle );
                /* We set the auto crop in the main window to value "1" just as in PictureController,
                        as it does not seem to be taken from any job-> variable */
                [fPicSettingAutoCrop setStringValue: [NSString stringWithFormat:
-                       @"%d", 1]];
+                       @"%d", 0]];
                
                [self TitlePopUpChanged: NULL];
                [self EnableUI: YES];
-               //[fPauseButton setEnabled: NO];
-               //[fRipButton   setEnabled: YES];
+               
                startButtonEnabled = YES;
                stopOrStart = NO;
                AddToQueueButtonEnabled = YES;
@@ -1651,10 +1651,15 @@ list = hb_get_titles( fHandle );
                                                         @"%d", fTitle->width]];
        [fPicSrcHeight setStringValue: [NSString stringWithFormat:
                                                         @"%d", fTitle->height]];
+                                                        
        /* We get the originial output picture width and height and put them
        in variables for use with some presets later on */
        PicOrigOutputWidth = job->width;
        PicOrigOutputHeight = job->height;
+       AutoCropTop = job->crop[0];
+       AutoCropBottom = job->crop[1];
+       AutoCropLeft = job->crop[2];
+       AutoCropRight = job->crop[3];
        /* we test getting the max output value for pic sizing here to be used later*/
        [fPicSettingWidth setStringValue: [NSString stringWithFormat:
                @"%d", PicOrigOutputWidth]];
@@ -3584,7 +3589,7 @@ the user is using "Custom" settings by determining the sender*/
        [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:[[fPictureController fCropMatrix] selectedRow]] forKey:@"PictureAutoCrop"];
+       [preset setObject:[NSNumber numberWithInt:[fPicSettingAutoCrop intValue]] forKey:@"PictureAutoCrop"];
 
        [preset setObject:[NSNumber numberWithInt:job->crop[0]] forKey:@"PictureTopCrop"];
     [preset setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"];
@@ -4693,24 +4698,31 @@ the user is using "Custom" settings by determining the sender*/
                                        hb_fix_aspect( job, HB_KEEP_WIDTH );
                                }
                                job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"]  intValue];
-                               /* AutoCrop is in preset, then use the autocrop settings for each dvd */
-                               if ([[chosenPreset objectForKey:@"PictureAutoCrop"]  intValue] == 1)
+                               job->deinterlace = [[chosenPreset objectForKey:@"PictureDeinterlace"]  intValue];
+                               /* If Cropping is set to custom, then recall all four crop values from
+                                  when the preset was created and apply them */
+                               if ([[chosenPreset objectForKey:@"PictureAutoCrop"]  intValue] == 0)
                                {
                                [fPicSettingAutoCrop setStringValue: [NSString stringWithFormat:
-                               @"%d", 1]];
+                               @"%d", 0]];
+                               
+                               /* Here we use the custom crop values saved at the time the preset was saved */
                                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];
+                               
                                }
-                               else /* if custom crop has been saved in preset, use the saved custom cropping regardless of the source */
+                               else /* if auto crop has been saved in preset, set to auto and use post scan auto crop */
                                {
                                [fPicSettingAutoCrop setStringValue: [NSString stringWithFormat:
-                               @"%d", 0]];
-                               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];
+                               @"%d", 1]];
+                               /* Here we use the auto crop values determined right after scan */
+                job->crop[0] = AutoCropTop;
+                               job->crop[1] = AutoCropBottom;
+                               job->crop[2] = AutoCropLeft;
+                               job->crop[3] = AutoCropRight;
+                               
                                }
                        }
                        [self CalculatePictureSizing: NULL]; 
index 30d7fae3ca618def1c4a26ec12c7365f22e7fe85..fb664a5755a281258aa723e44eeebce04ab3bd86 100644 (file)
@@ -90,6 +90,15 @@ static int GetAlignedSize( int size )
        if ([fAutoCropMainWindow  intValue] == 0)
        {
        [fCropMatrix  selectCellAtRow: 1 column:0];
+       /* If auto, lets set the crop steppers according to current job->crop values */
+       [fCropTopStepper    setIntValue: job->crop[0]];
+    [fCropTopField      setIntValue: job->crop[0]];
+    [fCropBottomStepper setIntValue: job->crop[1]];
+    [fCropBottomField   setIntValue: job->crop[1]];
+    [fCropLeftStepper   setIntValue: job->crop[2]];
+    [fCropLeftField     setIntValue: job->crop[2]];
+    [fCropRightStepper  setIntValue: job->crop[3]];
+    [fCropRightField    setIntValue: job->crop[3]];
        }
        else
        {