diff options
Diffstat (limited to 'macosx/HBChapter.m')
-rw-r--r-- | macosx/HBChapter.m | 18 |
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; } |