summaryrefslogtreecommitdiffstats
path: root/macosx/HBPicture.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-22 07:55:39 +0000
committerritsuka <[email protected]>2014-12-22 07:55:39 +0000
commita052152ebb5b1844ca76ca65b1fed359307e8ad4 (patch)
treedf12b6ae8d8e02c3aa9f835d4f828bea00501607 /macosx/HBPicture.m
parent546f57a1402492f2aedeab1ca6cf9f3d3201795f (diff)
MacGui: implement NSCoding protocol in HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6638 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBPicture.m')
-rw-r--r--macosx/HBPicture.m54
1 files changed, 53 insertions, 1 deletions
diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m
index beecd8d81..63318757c 100644
--- a/macosx/HBPicture.m
+++ b/macosx/HBPicture.m
@@ -7,6 +7,8 @@
#import "HBPicture.h"
#import "HBTitle.h"
+#import "NSCodingMacro.h"
+
#include "hb.h"
NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
@@ -42,7 +44,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
self = [self init];
if (self)
{
- _title = [title retain];
+ _title = title;
_width = title.hb_title->geometry.width;
_height = title.hb_title->geometry.height;
@@ -479,6 +481,56 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
[self postChangedNotification];
}
+#pragma mark - NSCoding
+
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+ [coder encodeInt:1 forKey:@"HBPictureVersion"];
+
+ encodeInt(_width);
+ encodeInt(_height);
+
+ encodeInt(_keepDisplayAspect);
+ encodeInt(_anamorphicMode);
+ encodeInt(_modulus);
+
+ encodeInt(_displayWidth);
+ encodeInt(_parWidth);
+ encodeInt(_parHeight);
+
+ encodeBool(_autocrop);
+ encodeInt(_cropTop);
+ encodeInt(_cropBottom);
+ encodeInt(_cropLeft);
+ encodeInt(_cropRight);
+}
+
+- (id)initWithCoder:(NSCoder *)decoder
+{
+ self = [super init];
+
+ decodeInt(_width);
+ decodeInt(_height);
+
+ decodeInt(_keepDisplayAspect);
+ decodeInt(_anamorphicMode);
+ decodeInt(_modulus);
+
+ decodeInt(_displayWidth);
+ decodeInt(_parWidth);
+ decodeInt(_parHeight);
+
+ decodeBool(_autocrop);
+ decodeInt(_cropTop);
+ decodeInt(_cropBottom);
+ decodeInt(_cropLeft);
+ decodeInt(_cropRight);
+
+ return self;
+}
+
+#pragma mark - Presets/Queue
+
- (void)preparePictureForPreset:(NSMutableDictionary *)preset
{
preset[@"PictureKeepRatio"] = @(self.keepDisplayAspect);