]> granicus.if.org Git - handbrake/commitdiff
MacGui: Add auto crop value to main window
authordynaflash <dynaflashtech@gmail.com>
Fri, 6 Jul 2007 15:32:34 +0000 (15:32 +0000)
committerdynaflash <dynaflashtech@gmail.com>
Fri, 6 Jul 2007 15:32:34 +0000 (15:32 +0000)
- shows if you are using Auto or Custom cropping in the Video tab of the main window.
- Prepares controller.mm to better use custom/auto cropping values particularly with presets.
- Required since auto crop is not currently stored in a title or job variable, and proper use of cropping for presets requires the preset to know what cropping to actually use.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@651 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
macosx/PictureController.h
macosx/PictureController.mm

index 695fa98f68a28658f86b03a8638e3e0a37a2030d..bd098577489ec8b4c9a525bb5b4a33783ce3deca 100644 (file)
@@ -76,7 +76,7 @@
     IBOutlet NSButton            * fVidTwoPassCheck;
     IBOutlet NSButton            * fVidTurboPassCheck;
        
-       /* Picture Settings box */
+       /* Picture Settings box fPicSettingAutoCropDsply*/
        IBOutlet NSTextField         * fPicLabelSettings;
        IBOutlet NSTextField         * fPicLabelSrc;
        IBOutlet NSTextField         * fPicLabelOutp;
@@ -94,6 +94,8 @@
        IBOutlet NSTextField         * fPicSettingDeinterlace;
        IBOutlet NSTextField         * fPicSettingARkeepDsply;
        IBOutlet NSTextField         * fPicSettingPARDsply;
+       IBOutlet NSTextField         * fPicSettingAutoCrop;
+       IBOutlet NSTextField         * fPicSettingAutoCropDsply;
        IBOutlet NSTextField         * fPicSettingDeinterlaceDsply;
        IBOutlet NSTextField         * fPicLabelAnamorphic;
        IBOutlet NSTextField         * fPicLabelPAROutp;
index 8a64f4a0ac914246c72ddcdf7a694215defae929..12035d7e621553972b2c29852212e9798ab36f00 100644 (file)
@@ -480,8 +480,12 @@ return registrationDictionary;
             // Select the longuest title
                        [fSrcTitlePopUp selectItemAtIndex: indxpri];
             /* We set the Settings Display to "Default" here
-                       until we get default presets implemented */
+                               until we get default presets implemented */
                        [fPresetSelectedDisplay setStringValue: @"Default"];
+                       /* 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]];
                        
             [self TitlePopUpChanged: NULL];
             [self EnableUI: YES];
@@ -1919,29 +1923,39 @@ return registrationDictionary;
                
        /* Set ON/Off values for the deinterlace/keep aspect ratio according to boolean */      
        if (fTitle->job->keep_ratio > 0)
-               {
+       {
                [fPicSettingARkeepDsply setStringValue: @"On"];
-        }
-               else
-               {
+       }
+       else
+       {
                [fPicSettingARkeepDsply setStringValue: @"Off"];
-               }       
+       }       
        if (fTitle->job->deinterlace > 0)
-               {
+       {
                [fPicSettingDeinterlaceDsply setStringValue: @"On"];
-        }
-               else
-               {
+       }
+       else
+       {
                [fPicSettingDeinterlaceDsply setStringValue: @"Off"];
-               }
+       }
        if (fTitle->job->pixel_ratio > 0)
-               {
+       {
                [fPicSettingPARDsply setStringValue: @"On"];
-        }
-               else
-               {
+       }
+       else
+       {
                [fPicSettingPARDsply setStringValue: @"Off"];
-               }       
+       }
+       /* Set the display field for crop as per boolean */
+       if ([[fPicSettingAutoCrop stringValue] isEqualToString: @"0"])
+       {
+           [fPicSettingAutoCropDsply setStringValue: @"Custom"];
+       }
+       else
+       {
+               [fPicSettingAutoCropDsply setStringValue: @"Auto"];
+       }       
+       
        /* below will trigger the preset, if selected, to be
        changed to "Custom". Lets comment out for now until
        we figure out a way to determine if the picture values
@@ -2980,6 +2994,8 @@ 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:job->crop[0]] forKey:@"PictureTopCrop"];
     [preset setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"];
        [preset setObject:[NSNumber numberWithInt:job->crop[2]] forKey:@"PictureLeftCrop"];
@@ -3040,6 +3056,7 @@ the user is using "Custom" settings by determining the sender*/
        /* Basic Picture Settings */
        /* Use Max Picture settings for whatever the dvd is.*/
        [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"];
+       [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"];
        [preset setObject:[NSNumber numberWithInt:320] forKey:@"PictureWidth"];
        [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"];
        [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"];
@@ -3469,10 +3486,25 @@ 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)
+                               {
+                               [fPicSettingAutoCrop setStringValue: [NSString stringWithFormat:
+                               @"%d", 1]];
+                               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 */
+                               {
+                               [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];
+                               }
                        }
                        [self CalculatePictureSizing: NULL]; 
                }
index e0a6c8585511bb91d4370b14e1d30bba790fd796..15620d1ece4ab0908e81626c5408d7aac1718e84 100644 (file)
@@ -88,6 +88,8 @@
                 fPicLabelSrcX = NSTextField; 
                 fPicSettingARkeep = NSTextField; 
                 fPicSettingARkeepDsply = NSTextField; 
+                fPicSettingAutoCrop = NSTextField; 
+                fPicSettingAutoCropDsply = NSTextField; 
                 fPicSettingDeinterlace = NSTextField; 
                 fPicSettingDeinterlaceDsply = NSTextField; 
                 fPicSettingHeight = NSTextField; 
             CLASS = PictureController; 
             LANGUAGE = ObjC; 
             OUTLETS = {
+                fAutoCropMainWindow = NSTextField; 
                 fCropBottomField = NSTextField; 
                 fCropBottomStepper = NSStepper; 
                 fCropLeftField = NSTextField; 
index d207af74b0b71c9984f6806557c8023db6500b5e..79e22dcbb7602b35154520ae09ed1fe1e81bbdd6 100644 (file)
@@ -19,9 +19,9 @@
        </array>
        <key>IBOpenObjects</key>
        <array>
-               <integer>1162</integer>
-               <integer>1867</integer>
                <integer>29</integer>
+               <integer>21</integer>
+               <integer>1162</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8R2218</string>
index 708eaf53603fa479d9b3a4d7e2ebee88cdd4ef43..30456fee3fb5933cb314a69da0bb573e70ba6215 100644 (file)
Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ
index 46b8b3d98e53f446da12cddf4c823b3705bc5eaf..973a0e2ffa7a3e37e52e1de33b64ead8e968bec5 100644 (file)
     IBOutlet NSButton        * fNextButton;
     IBOutlet NSTextField     * fInfoField;
        
+       
+       
        int                        MaxOutputWidth;
        int                        MaxOutputHeight;
+       
+       /* widgets in main window */
+       IBOutlet NSTextField     * fAutoCropMainWindow;
 
 }
 
index 96d0a2e81ffca8b0865a24c37b0907fd24b3f7f5..902c71c130f5777c76b913a9c0e82a47f5003cdc 100644 (file)
@@ -87,7 +87,14 @@ static int GetAlignedSize( int size )
     [fCropRightStepper  setMaxValue: title->width/2-2];
     [fDeinterlaceCheck  setState:    job->deinterlace ? NSOnState : NSOffState];
        [fPARCheck  setState:    job->pixel_ratio ? NSOnState : NSOffState];
-
+       if ([fAutoCropMainWindow  intValue] == 0)
+       {
+       [fCropMatrix  selectCellAtRow: 1 column:0];
+       }
+       else
+       {
+       [fCropMatrix  selectCellAtRow: 0 column:0];
+       }
     MaxOutputWidth = job->width;
        MaxOutputHeight = job->height;
     fPicture = 0;
@@ -214,6 +221,7 @@ static int GetAlignedSize( int size )
     [fCropBottomStepper setEnabled: !autocrop];
     [fCropLeftStepper   setEnabled: !autocrop];
     [fCropRightStepper  setEnabled: !autocrop];
+       [fAutoCropMainWindow  setStringValue: [NSString stringWithFormat:@"%d",autocrop]];
     if( autocrop )
     {
         memcpy( job->crop, fTitle->crop, 4 * sizeof( int ) );