From: dynaflash Date: Mon, 26 Feb 2007 20:50:48 +0000 (+0000) Subject: MacGui: Presets X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb8f5f9df439c93eacfaf1aa05c6178cb5388df5;p=handbrake MacGui: Presets - 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 --- diff --git a/macosx/Controller.h b/macosx/Controller.h index 828f22619..8d920d104 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -120,10 +120,11 @@ 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; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 21f25be4b..05e896e97 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -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]]; } diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 616b66041..2b248aded 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -78,6 +78,7 @@ fPicturePanel = NSPanel; fPresetDrawer = NSDrawer; fPresetNewName = NSTextField; + fPresetNewPicSettingsApply = NSButton; fPresetSelectedDisplay = NSTextField; fPresetsAdd = NSButton; fPresetsDelete = NSButton; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index 1b37e00d8..64beae6c9 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -7,7 +7,7 @@ IBEditorPositions 1843 - 341 286 220 592 0 0 1440 878 + 610 276 220 592 0 0 1440 878 29 102 834 300 44 0 0 1440 878 diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index adee5d9d3..7bfb8416d 100644 Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ