diff options
author | ritsuka <[email protected]> | 2014-12-23 10:23:59 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-23 10:23:59 +0000 |
commit | a66b692e29674de9c444fd54f0493d03b4900abc (patch) | |
tree | 1356eec981d0542ad6ca9087794e7cc52a09c664 /macosx/HBPicture+UIAdditions.m | |
parent | ee10e1fdb417c7f1047406522379c85c47143bfd (diff) |
MacGui: move the UI helper methods to new categories. Implement NSCoding in more classes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6643 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBPicture+UIAdditions.m')
-rw-r--r-- | macosx/HBPicture+UIAdditions.m | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/macosx/HBPicture+UIAdditions.m b/macosx/HBPicture+UIAdditions.m new file mode 100644 index 000000000..04a4a5afd --- /dev/null +++ b/macosx/HBPicture+UIAdditions.m @@ -0,0 +1,89 @@ +/* HBPicture+UIAdditions.m $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import "HBPicture+UIAdditions.h" +#import "HBTitle.h" +#include "hb.h" + +@implementation HBPicture (UIAdditions) + +@dynamic maxHeight; +@dynamic maxWidth; + +@dynamic maxHorizontalCrop; +@dynamic maxVerticalCrop; + +@dynamic keepDisplayAspectEditable; + +#pragma mark - Editable state + +- (BOOL)isWidthEditable +{ + return (self.anamorphicMode != HB_ANAMORPHIC_STRICT) ? YES : NO; +} + +- (BOOL)isHeightEditable +{ + return (self.anamorphicMode != HB_ANAMORPHIC_STRICT) ? YES : NO; +} + +- (BOOL)isKeepDisplayAspectEditable +{ + if (self.anamorphicMode == HB_ANAMORPHIC_STRICT || + self.anamorphicMode == HB_ANAMORPHIC_LOOSE) + { + return NO; + } + else + { + return YES; + } +} + +- (BOOL)isCustomAnamorphicEnabled +{ + return self.anamorphicMode == HB_ANAMORPHIC_CUSTOM; +} + +- (NSString *)info +{ + if (!self.title) + { + return @""; + } + + NSString *sizeInfo; + hb_title_t *title = self.title.hb_title; + + if (self.anamorphicMode == HB_ANAMORPHIC_STRICT) // Original PAR Implementation + { + sizeInfo = [NSString stringWithFormat: + @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d Strict", + title->geometry.width, title->geometry.height, self.width, self.height, self.displayWidth, self.height]; + } + else if (self.anamorphicMode == HB_ANAMORPHIC_LOOSE) // Loose Anamorphic + { + sizeInfo = [NSString stringWithFormat: + @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d Loose", + title->geometry.width, title->geometry.height, self.width, self.height, self.displayWidth, self.height]; + } + else if (self.anamorphicMode == HB_ANAMORPHIC_CUSTOM) // Custom Anamorphic + { + sizeInfo = [NSString stringWithFormat: + @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d Custom", + title->geometry.width, title->geometry.height, self.width, self.height, self.displayWidth, self.height]; + } + else // No Anamorphic + { + sizeInfo = [NSString stringWithFormat: + @"Source: %dx%d, Output: %dx%d", + title->geometry.width, title->geometry.height, self.width, self.height]; + } + + return sizeInfo; +} + +@end |