From: jbrjake Date: Tue, 22 May 2007 16:42:46 +0000 (+0000) Subject: MacGui: adds deblocking widgets for the x264 advanced options tab. God this one was... X-Git-Tag: 0.9.0~242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f30f74413fa0f5aaafb01f804d4ff4ce6fc789e3;p=handbrake MacGui: adds deblocking widgets for the x264 advanced options tab. God this one was a pain. Haven't decided yet whether to include a boolean to turn deblocking on and off. Not sure where I'd stick it right now, at least. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@593 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/macosx/Controller.h b/macosx/Controller.h index 89755bdb2..b3bc8bd20 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -170,6 +170,9 @@ IBOutlet NSPopUpButton * fX264optBiMEPopUp; IBOutlet NSTextField * fX264optDirectPredLabel; IBOutlet NSPopUpButton * fX264optDirectPredPopUp; + IBOutlet NSTextField * fX264optDeblockLabel; + IBOutlet NSPopUpButton * fX264optAlphaDeblockPopUp; + IBOutlet NSPopUpButton * fX264optBetaDeblockPopUp; /* User Preset variables here fPresetNewPicSettingsApply*/ diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 952514a46..5c9b5ca02 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -656,7 +656,8 @@ return registrationDictionary; fX264optMotionEstLabel,fX264optMotionEstPopUp,fX264optMERangeLabel,fX264optMERangePopUp, fX264optWeightBLabel,fX264optWeightBPopUp,fX264optBRDOLabel,fX264optBRDOPopUp, fX264optBPyramidLabel,fX264optBPyramidPopUp,fX264optBiMELabel,fX264optBiMEPopUp, - fX264optDirectPredLabel,fX264optDirectPredPopUp}; + fX264optDirectPredLabel,fX264optDirectPredPopUp,fX264optDeblockLabel, + fX264optAlphaDeblockPopUp,fX264optBetaDeblockPopUp}; for( unsigned i = 0; i < sizeof( controls ) / sizeof( NSControl * ); i++ ) @@ -2056,6 +2057,22 @@ the user is using "Custom" settings by determining the sender*/ [fX264optDirectPredPopUp addItemWithTitle:@"Temporal"]; [fX264optDirectPredPopUp addItemWithTitle:@"Automatic"]; + /*Alpha Deblock*/ + [fX264optAlphaDeblockPopUp removeAllItems]; + [fX264optAlphaDeblockPopUp addItemWithTitle:@"Default (0)"]; + for (i=-6; i<7;i++) + { + [fX264optAlphaDeblockPopUp addItemWithTitle:[NSString stringWithFormat:@"%d",i]]; + } + + /*Beta Deblock*/ + [fX264optBetaDeblockPopUp removeAllItems]; + [fX264optBetaDeblockPopUp addItemWithTitle:@"Default (0)"]; + for (i=-6; i<7;i++) + { + [fX264optBetaDeblockPopUp addItemWithTitle:[NSString stringWithFormat:@"%d",i]]; + } + /* Standardize the option string */ [self X264AdvancedOptionsStandardizeOptString: NULL]; /* Set Current GUI Settings based on newly standardized string */ @@ -2183,6 +2200,12 @@ the user is using "Custom" settings by determining the sender*/ cleanOptNameString = @"direct"; } + /*Deblocking*/ + if ([cleanOptNameString isEqualToString:@"filter"]) + { + cleanOptNameString = @"deblock"; + } + return cleanOptNameString; } @@ -2309,7 +2332,42 @@ the user is using "Custom" settings by determining the sender*/ else if ([optValue isEqualToString:@"auto"]) [fX264optDirectPredPopUp selectItemAtIndex:4]; } - + /*Deblocking NSPopUpButtons*/ + if ([optName isEqualToString:@"deblock"]) + { + NSString * alphaDeblock = @""; + NSString * betaDeblock = @""; + + NSRange splitDeblock = [optValue rangeOfString:@","]; + alphaDeblock = [optValue substringToIndex:splitDeblock.location]; + betaDeblock = [optValue substringFromIndex:splitDeblock.location + 1]; + + if ([alphaDeblock isEqualToString:@"0"] && [betaDeblock isEqualToString:@"0"]) + { + [fX264optAlphaDeblockPopUp selectItemAtIndex:0]; + [fX264optBetaDeblockPopUp selectItemAtIndex:0]; + } + else + { + if (![alphaDeblock isEqualToString:@"0"]) + { + [fX264optAlphaDeblockPopUp selectItemAtIndex:[alphaDeblock intValue]+7]; + } + else + { + [fX264optAlphaDeblockPopUp selectItemAtIndex:7]; + } + + if (![betaDeblock isEqualToString:@"0"]) + { + [fX264optBetaDeblockPopUp selectItemAtIndex:[betaDeblock intValue]+7]; + } + else + { + [fX264optBetaDeblockPopUp selectItemAtIndex:7]; + } + } + } } } } @@ -2376,6 +2434,14 @@ the user is using "Custom" settings by determining the sender*/ { optNameToChange = @"direct"; } + if (sender == fX264optAlphaDeblockPopUp) + { + optNameToChange = @"deblock"; + } + if (sender == fX264optBetaDeblockPopUp) + { + optNameToChange = @"deblock"; + } /* Set widgets depending on the opt string in field */ NSString * thisOpt; // The separated option such as "bframes=3" @@ -2427,7 +2493,18 @@ the user is using "Custom" settings by determining the sender*/ "Unspecified" is set.*/ if ([optName isEqualToString:optNameToChange]) { - if ([sender indexOfSelectedItem] == 0) // means that "unspecified" is chosen, lets then remove it from the string + if ([optNameToChange isEqualToString:@"deblock"]) + { + if ((([fX264optAlphaDeblockPopUp indexOfSelectedItem] == 0) || ([fX264optAlphaDeblockPopUp indexOfSelectedItem] == 7)) && (([fX264optBetaDeblockPopUp indexOfSelectedItem] == 0) || ([fX264optBetaDeblockPopUp indexOfSelectedItem] == 7))) + { + thisOpt = @""; + } + else + { + thisOpt = [NSString stringWithFormat:@"%@=%d,%d",optName, ([fX264optAlphaDeblockPopUp indexOfSelectedItem] != 0) ? [fX264optAlphaDeblockPopUp indexOfSelectedItem]-7 : 0,([fX264optBetaDeblockPopUp indexOfSelectedItem] != 0) ? [fX264optBetaDeblockPopUp indexOfSelectedItem]-7 : 0]; + } + } + else if (([sender indexOfSelectedItem] == 0) && (sender != fX264optAlphaDeblockPopUp) && (sender != fX264optBetaDeblockPopUp) ) // means that "unspecified" is chosen, lets then remove it from the string { thisOpt = @""; } @@ -2479,7 +2556,6 @@ the user is using "Custom" settings by determining the sender*/ break; } } - else if ([optNameToChange isEqualToString:@"merange"]) { thisOpt = [NSString stringWithFormat:@"%@=%d",optName,[sender indexOfSelectedItem]+3]; @@ -2578,6 +2654,10 @@ the user is using "Custom" settings by determining the sender*/ [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@=%@", [NSString stringWithFormat:optNameToChange],[NSString stringWithFormat:@"%d",[sender indexOfSelectedItem]+3]]]; } + else if ([optNameToChange isEqualToString:@"deblock"]) + { + [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@=%@", [NSString stringWithFormat:optNameToChange],[NSString stringWithFormat:@"%d,%d", ([fX264optAlphaDeblockPopUp indexOfSelectedItem] != 0) ? [fX264optAlphaDeblockPopUp indexOfSelectedItem]-7 : 0, ([fX264optBetaDeblockPopUp indexOfSelectedItem] != 0) ? [fX264optBetaDeblockPopUp indexOfSelectedItem]-7 : 0]]]; + } else { [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@=%@", @@ -2656,6 +2736,11 @@ the user is using "Custom" settings by determining the sender*/ [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@:%@=%@",[NSString stringWithFormat:[fDisplayX264Options stringValue]], [NSString stringWithFormat:optNameToChange],[NSString stringWithFormat:@"%d",[sender indexOfSelectedItem]+3]]]; } + else if ([optNameToChange isEqualToString:@"deblock"]) + { + [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@:%@=%@", [NSString stringWithFormat:[fDisplayX264Options stringValue]], [NSString stringWithFormat:optNameToChange], [NSString stringWithFormat:@"%d,%d", ([fX264optAlphaDeblockPopUp indexOfSelectedItem] != 0) ? [fX264optAlphaDeblockPopUp indexOfSelectedItem]-7 : 0, ([fX264optBetaDeblockPopUp indexOfSelectedItem] != 0) ? [fX264optBetaDeblockPopUp indexOfSelectedItem]-7 : 0]]]; + } + else { [fDisplayX264Options setStringValue:[NSString stringWithFormat:@"%@:%@=%@",[NSString stringWithFormat:[fDisplayX264Options stringValue]], diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 6569a8d02..adcb1df54 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -141,14 +141,17 @@ fVidTargetSizeField = NSTextField; fVidTwoPassCheck = NSButton; fWindow = NSWindow; + fX264optAlphaDeblockPopUp = NSPopUpButton; fX264optBPyramidLabel = NSTextField; fX264optBPyramidPopUp = NSPopUpButton; fX264optBRDOLabel = NSTextField; fX264optBRDOPopUp = NSPopUpButton; + fX264optBetaDeblockPopUp = NSPopUpButton; fX264optBframesLabel = NSTextField; fX264optBframesPopUp = NSPopUpButton; fX264optBiMELabel = NSTextField; fX264optBiMEPopUp = NSPopUpButton; + fX264optDeblockLabel = NSTextField; fX264optDirectPredLabel = NSTextField; fX264optDirectPredPopUp = NSPopUpButton; fX264optMERangeLabel = NSTextField; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index 974d94096..7439f3223 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -9,7 +9,7 @@ 1843 863 409 220 592 0 0 1920 1058 29 - 281 404 365 44 0 0 1280 778 + 478 558 365 44 0 0 1920 1058 IBFramework Version 446.1 @@ -19,12 +19,11 @@ IBOpenObjects - 1438 29 21 IBSystem Version - 8P2137 + 8L127 IBUserGuides 21 diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index d49208592..e232c6ca8 100644 Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ