summaryrefslogtreecommitdiffstats
path: root/macosx/HBChapter.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2015-10-20 18:55:08 +0200
committerDamiano Galassi <[email protected]>2015-10-20 18:55:08 +0200
commit7f50c27989a63e87d2f17c6495d29e136ccfd837 (patch)
tree280036131fa6d7dd1a11ef84a55c4dfad3e96aca /macosx/HBChapter.m
parentc32d5236135c6be0b4987fb74de511e3332d7396 (diff)
MacGui: added undo/redo support to the video, picture, filters, chapters and range parts of HBJob.
Diffstat (limited to 'macosx/HBChapter.m')
-rw-r--r--macosx/HBChapter.m18
1 files changed, 16 insertions, 2 deletions
diff --git a/macosx/HBChapter.m b/macosx/HBChapter.m
index 46d0a7602..c5f0ab081 100644
--- a/macosx/HBChapter.m
+++ b/macosx/HBChapter.m
@@ -11,11 +11,11 @@
- (instancetype)init
{
- self = [self initWithTitle:@"No Value" duration:0];
+ self = [self initWithTitle:@"No Value" index:0 duration:0];
return self;
}
-- (instancetype)initWithTitle:(NSString *)title duration:(uint64_t)duration
+- (instancetype)initWithTitle:(NSString *)title index:(NSUInteger)idx duration:(uint64_t)duration
{
NSParameterAssert(title);
@@ -28,11 +28,23 @@
_duration = [NSString stringWithFormat:@"%02llu:%02llu:%02llu", hours, minutes, seconds];
_title = [title copy];
+ _index = idx;
}
return self;
}
+#pragma mark - Properties
+
+- (void)setTitle:(NSString *)title
+{
+ if (![title isEqualToString:_title])
+ {
+ [[self.undo prepareWithInvocationTarget:self] setTitle:_title];
+ }
+ _title = title;
+}
+
#pragma mark - NSCopying
- (instancetype)copyWithZone:(NSZone *)zone
@@ -62,6 +74,7 @@
encodeObject(_title);
encodeObject(_duration);
+ encodeInteger(_index);
}
- (instancetype)initWithCoder:(NSCoder *)decoder
@@ -72,6 +85,7 @@
{
decodeObject(_title, NSString);
decodeObject(_duration, NSString);
+ decodeInteger(_index);
return self;
}