diff options
author | dynaflash <[email protected]> | 2007-07-31 14:52:37 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2007-07-31 14:52:37 +0000 |
commit | 4c4045f21dceb007b5bc66f997156a4ffbfb975e (patch) | |
tree | 50b50eff43cf6e3d21f5c778c407ce9ca3e46752 /macosx | |
parent | cae08384433649c989276968854bee9045b619ee (diff) |
MacGui: Enhanced Picture Settings in Presets (esp. cropping)
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
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 5 | ||||
-rw-r--r-- | macosx/Controller.mm | 44 | ||||
-rw-r--r-- | macosx/PictureController.mm | 9 |
3 files changed, 41 insertions, 17 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 24a2011c4..fc5260f02 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -107,7 +107,10 @@ /* Picture variables */ int PicOrigOutputWidth; int PicOrigOutputHeight; - + int AutoCropTop; + int AutoCropBottom; + int AutoCropLeft; + int AutoCropRight; /* Subtitles box */ IBOutlet NSTextField * fSubField; IBOutlet NSPopUpButton * fSubPopUp; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index b48dd7a90..30b126aae 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -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]; diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index 30d7fae3c..fb664a575 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -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 { |