diff options
author | Damiano Galassi <[email protected]> | 2016-05-24 10:51:26 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2016-05-24 10:51:26 +0200 |
commit | b015c304d1d72ae7e43e0eae25048136069f03ad (patch) | |
tree | 4a1c2fd312f2ffeae8b71c4ed8b63877ee910fd5 /macosx/HBPicture.m | |
parent | c0393485103ded582169ce383f411450ab8e016d (diff) |
MacGui: split HBPicture KVO dependencies.
Diffstat (limited to 'macosx/HBPicture.m')
-rw-r--r-- | macosx/HBPicture.m | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index 6760bf1e1..c0f7db15a 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -393,11 +393,21 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; #pragma mark - Max sizes ++ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxWidth +{ + return [NSSet setWithObjects:@"cropTop", @"cropBottom", @"cropLeft", @"cropRight", nil]; +} + - (int)maxWidth { return self.sourceWidth - self.cropRight - self.cropLeft; } ++ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxHeight +{ + return [NSSet setWithObjects:@"cropTop", @"cropBottom", @"cropLeft", @"cropRight", nil]; +} + - (int)maxHeight { return self.sourceHeight - self.cropTop - self.cropBottom; @@ -418,38 +428,6 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; return (int) (self.sourceWidth * self.sourceParNum / (double)self.sourceParDen); } -+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key -{ - NSSet *retval = nil; - - // Tell KVO to reload the editable state. - if ([key isEqualToString:@"keepDisplayAspectEditable"] || - [key isEqualToString:@"heightEditable"] || - [key isEqualToString:@"widthEditable"] || - [key isEqualToString:@"customAnamorphicEnabled"]) - { - retval = [NSSet setWithObjects:@"anamorphicMode", nil]; - } - - else if ([key isEqualToString:@"maxWidth"] || - [key isEqualToString:@"maxHeight"]) - { - retval = [NSSet setWithObjects:@"cropTop", @"cropBottom", @"cropLeft", @"cropRight", nil]; - } - - else if ([key isEqualToString:@"info"] || [key isEqualToString:@"summary"]) - { - retval = [NSSet setWithObjects:@"parWidth", @"parHeight", @"displayWidth", @"width", @"height",@"anamorphicMode", @"cropTop", @"cropBottom", @"cropLeft", @"cropRight", nil]; - } - - else - { - retval = [NSSet set]; - } - - return retval; -} - - (void)setNilValueForKey:(NSString *)key { if ([key isEqualToString:@"width"] || [key isEqualToString:@"height"]) |