OSDN Git Service

MacGui: Keep track of the state of the keep aspect ratio checkbox when turning on...
authordynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 19 Sep 2007 15:27:05 +0000 (15:27 +0000)
committerdynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 19 Sep 2007 15:27:05 +0000 (15:27 +0000)
- Allows for easier comparison of anamorphic vs. non anamorphic.
- Good idea jbrjake

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

macosx/PictureController.h
macosx/PictureController.mm

index 98cf3dd..4c13a06 100644 (file)
     int     MaxOutputHeight;
     BOOL    autoCrop;
     
+    /* used to track the previous state of the keep aspect
+    ratio checkbox when turning anamorphic on, so it can be
+    returned to the previous state when anamorphic is turned
+    off */
+    BOOL    keepAspectRatioPreviousState; 
+    
     struct {
         int    detelecine;
         int     deinterlace;
index a2a456e..a1441ac 100644 (file)
@@ -118,7 +118,8 @@ static int GetAlignedSize( int size )
        [fDeinterlacePopUp selectItemAtIndex: fPictureFilterSettings.deinterlace];
 
        [fPARCheck setState:(job->pixel_ratio ? NSOnState : NSOffState)];
-
+    /* We initially set the previous state of keep ar to on */
+    keepAspectRatioPreviousState = 1;
        if (!autoCrop)
        {
         [fCropMatrix  selectCellAtRow: 1 column:0];
@@ -163,6 +164,7 @@ static int GetAlignedSize( int size )
     MaxOutputWidth = job->width;
        MaxOutputHeight = job->height;
     fPicture = 0;
+
     [self SettingsChanged: nil];
 }
 
@@ -266,27 +268,36 @@ static int GetAlignedSize( int size )
             show distorted preview picture ratio */
         [fHeightStepper      setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]];
         [fHeightField        setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]];
-        
-        /* This will show wrong anamorphic height values, but
-            show proper preview picture ratio */
-        //[fHeightStepper      setIntValue: MaxOutputHeight];
-        //[fHeightField        setIntValue: MaxOutputHeight];
+
+        /* if the sender is the Anamorphic checkbox, record the state
+           of KeepAspect Ratio so it can be reset if Anamorphic is unchecked again */
+        if (sender == fPARCheck)
+        {
+        keepAspectRatioPreviousState = [fRatioCheck state];
+        }
         [fRatioCheck setState:NSOffState];
+        [fRatioCheck setEnabled: NO];
         
         [fWidthStepper setEnabled: NO];
         [fWidthField setEnabled: NO];
         [fHeightStepper setEnabled: NO];
         [fHeightField setEnabled: NO];
-        [fRatioCheck setEnabled: NO];
+        
     }
-    
-       else
+    else
        {
         [fWidthStepper setEnabled: YES];
         [fWidthField setEnabled: YES];
         [fHeightStepper setEnabled: YES];
         [fHeightField setEnabled: YES];
         [fRatioCheck setEnabled: YES];
+        /* if the sender is the Anamorphic checkbox, we return the
+           keep AR checkbox to its previous state */
+        if (sender == fPARCheck)
+        {
+        [fRatioCheck setState:keepAspectRatioPreviousState];
+        }
+        
        }
        
     job->width       = [fWidthStepper  intValue];
@@ -314,7 +325,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 ) );