diff --git a/macosx/English.lproj/HBPictureViewController.xib b/macosx/English.lproj/HBPictureViewController.xib index d7a4296476b2..a833a08cc656 100644 --- a/macosx/English.lproj/HBPictureViewController.xib +++ b/macosx/English.lproj/HBPictureViewController.xib @@ -1,9 +1,9 @@ - + - + @@ -27,6 +27,7 @@ + @@ -41,8 +42,7 @@ NSNegateBoolean - - + @@ -157,6 +157,7 @@ Custom allows for manual settings. + @@ -171,8 +172,7 @@ Custom allows for manual settings. NSNegateBoolean - - + @@ -214,6 +214,7 @@ Custom allows for manual settings. + @@ -228,8 +229,7 @@ Custom allows for manual settings. NSNegateBoolean - - + @@ -708,7 +708,7 @@ HQDN3D default: y-spatial=3:cb-spatial=2:cr-spatial=2:y-temporal=2:cb-temporal=3 - + @@ -979,7 +979,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec - + @@ -999,6 +999,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec + @@ -1013,8 +1014,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec NSNegateBoolean - - + diff --git a/macosx/English.lproj/PictureSettings.xib b/macosx/English.lproj/PictureSettings.xib index 2165431e59fb..6cc1caf51432 100644 --- a/macosx/English.lproj/PictureSettings.xib +++ b/macosx/English.lproj/PictureSettings.xib @@ -1,10 +1,11 @@ - + - - + + + @@ -32,7 +33,7 @@ - + @@ -55,7 +56,7 @@ - + @@ -71,7 +72,7 @@ - + @@ -95,7 +96,7 @@ - + @@ -119,7 +120,7 @@ - + @@ -135,7 +136,7 @@ - + @@ -154,7 +155,7 @@ - + @@ -181,7 +182,7 @@ - + @@ -202,7 +203,7 @@ - + @@ -210,7 +211,7 @@ - + @@ -219,7 +220,7 @@ - + @@ -247,7 +248,7 @@ - + @@ -256,7 +257,7 @@ - + @@ -265,7 +266,7 @@ - + @@ -295,7 +296,7 @@ - + @@ -343,13 +344,13 @@ + NSNegateBoolean - - + @@ -359,13 +360,13 @@ + NSNegateBoolean - - + @@ -398,7 +399,7 @@ - + @@ -420,7 +421,7 @@ - + @@ -449,16 +450,16 @@ + NSNegateBoolean - - + - + @@ -487,16 +488,16 @@ + NSNegateBoolean - - + - + @@ -505,7 +506,7 @@ - + diff --git a/macosx/HBPicture+UIAdditions.h b/macosx/HBPicture+UIAdditions.h index 0d191db45dfc..3e1fa2f608ec 100644 --- a/macosx/HBPicture+UIAdditions.h +++ b/macosx/HBPicture+UIAdditions.h @@ -19,8 +19,10 @@ @property (nonatomic, readonly) int maxWidth; @property (nonatomic, readonly) int maxHeight; -@property (nonatomic, readonly) int maxVerticalCrop; -@property (nonatomic, readonly) int maxHorizontalCrop; +@property (nonatomic, readonly) int maxTopCrop; +@property (nonatomic, readonly) int maxBottomCrop; +@property (nonatomic, readonly) int maxLeftCrop; +@property (nonatomic, readonly) int maxRightCrop; @property (nonatomic, readonly, getter=isKeepDisplayAspectEditable) BOOL keepDisplayAspectEditable; @property (nonatomic, readonly, getter=isCustomAnamorphicEnabled) BOOL customAnamorphicEnabled; diff --git a/macosx/HBPicture+UIAdditions.m b/macosx/HBPicture+UIAdditions.m index 265d1c1ad310..a3a996942e86 100644 --- a/macosx/HBPicture+UIAdditions.m +++ b/macosx/HBPicture+UIAdditions.m @@ -13,8 +13,10 @@ @implementation HBPicture (UIAdditions) @dynamic maxHeight; @dynamic maxWidth; -@dynamic maxHorizontalCrop; -@dynamic maxVerticalCrop; +@dynamic maxTopCrop; +@dynamic maxBottomCrop; +@dynamic maxLeftCrop; +@dynamic maxRightCrop; #pragma mark - Editable state diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index 97b1631aade0..5578245e4d77 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -269,52 +269,36 @@ - (void)setCropRight:(int)cropRight - (BOOL)validateCropTop:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateVCrop:ioValue]; + [self validateCrop:ioValue max:self.maxTopCrop]; return YES; } - (BOOL)validateCropBottom:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateVCrop:ioValue]; + [self validateCrop:ioValue max:self.maxBottomCrop]; return YES; } - (BOOL)validateCropLeft:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateHCrop:ioValue]; + [self validateCrop:ioValue max:self.maxLeftCrop]; return YES; } - (BOOL)validateCropRight:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateHCrop:ioValue]; + [self validateCrop:ioValue max:self.maxRightCrop]; return YES; } -- (void)validateHCrop:(NSNumber **)ioValue +- (void)validateCrop:(NSNumber **)ioValue max:(int)maxCrop { if (nil != *ioValue) { int value = [*ioValue intValue]; - if (value >= self.maxHorizontalCrop) + if (value >= maxCrop) { - *ioValue = @(self.maxHorizontalCrop); - } - else if (value < 0) - { - *ioValue = @0; - } - } -} - -- (void)validateVCrop:(NSNumber **)ioValue -{ - if (nil != *ioValue) - { - int value = [*ioValue intValue]; - if (value >= self.maxVerticalCrop) - { - *ioValue = @(self.maxVerticalCrop); + *ioValue = @(maxCrop); } else if (value < 0) { @@ -414,14 +398,44 @@ - (int)maxHeight return self.sourceHeight - self.cropTop - self.cropBottom; } -- (int)maxVerticalCrop ++ (NSSet *)keyPathsForValuesAffectingMaxTopCrop +{ + return [NSSet setWithObjects:@"cropBottom", nil]; +} + +- (int)maxTopCrop +{ + return self.sourceHeight - self.cropBottom - 32; +} + ++ (NSSet *)keyPathsForValuesAffectingMaxBottomCrop +{ + return [NSSet setWithObjects:@"cropTop", nil]; +} + +- (int)maxBottomCrop +{ + return self.sourceHeight - self.cropTop - 32; +} + ++ (NSSet *)keyPathsForValuesAffectingMaxLeftCrop +{ + return [NSSet setWithObjects:@"cropRight", nil]; +} + +- (int)maxLeftCrop +{ + return self.sourceWidth - self.cropRight - 32; +} + ++ (NSSet *)keyPathsForValuesAffectingMaxRightCrop { - return self.sourceHeight / 2 - 2; + return [NSSet setWithObjects:@"cropLeft", nil]; } -- (int)maxHorizontalCrop +- (int)maxRightCrop { - return self.sourceWidth / 2 - 2; + return self.sourceWidth - self.cropLeft - 32; } - (int)sourceDisplayWidth