diff options
author | Damiano Galassi <[email protected]> | 2015-10-22 16:22:46 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2015-10-22 16:22:46 +0200 |
commit | d49d34b76ba5ee2e417479e2098b687453c2962a (patch) | |
tree | cb83a729a4d3e392b98eea8fd7905ebcffbfe1f1 /macosx/HBAudioTrackPreset.m | |
parent | 618bfd0bb81b4d70e640e49835da19177d7b2650 (diff) |
MacGui: partial undo/redo support in the defaults sheets.
Diffstat (limited to 'macosx/HBAudioTrackPreset.m')
-rw-r--r-- | macosx/HBAudioTrackPreset.m | 61 |
1 files changed, 56 insertions, 5 deletions
diff --git a/macosx/HBAudioTrackPreset.m b/macosx/HBAudioTrackPreset.m index fc73fe333..56c6f65e0 100644 --- a/macosx/HBAudioTrackPreset.m +++ b/macosx/HBAudioTrackPreset.m @@ -54,22 +54,55 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; - (void)setEncoder:(int)encoder { + if (encoder != _encoder) + { + [[self.undo prepareWithInvocationTarget:self] setEncoder:_encoder]; + } _encoder = encoder; - [self validateMixdown]; - [self validateSamplerate]; - [self validateBitrate]; + + if (!(self.undo.isUndoing || self.undo.isRedoing)) + { + [self validateMixdown]; + [self validateSamplerate]; + [self validateBitrate]; + } } - (void)setMixdown:(int)mixdown { + if (mixdown != _mixdown) + { + [[self.undo prepareWithInvocationTarget:self] setMixdown:_mixdown]; + } _mixdown = mixdown; - [self validateBitrate]; + + if (!(self.undo.isUndoing || self.undo.isRedoing)) + { + [self validateBitrate]; + } } - (void)setSampleRate:(int)sampleRate { + if (sampleRate != _sampleRate) + { + [[self.undo prepareWithInvocationTarget:self] setSampleRate:_sampleRate]; + } _sampleRate = sampleRate; - [self validateBitrate]; + + if (!(self.undo.isUndoing || self.undo.isRedoing)) + { + [self validateBitrate]; + } +} + +- (void)setBitRate:(int)bitRate +{ + if (bitRate != _bitRate) + { + [[self.undo prepareWithInvocationTarget:self] setBitRate:_bitRate]; + } + _bitRate = bitRate; } #pragma mark - @@ -153,6 +186,15 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; return retval; } +- (void)setGain:(double)gain +{ + if (gain != _gain) + { + [[self.undo prepareWithInvocationTarget:self] setGain:_gain]; + } + _gain = gain; +} + // Because we have indicated that the binding for the gain validates immediately we can implement the // key value binding method to ensure the gain stays in our accepted range. - (BOOL)validateGain:(id *)ioValue error:(NSError * __autoreleasing *)outError @@ -174,6 +216,15 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; return retval; } +- (void)setDrc:(double)drc +{ + if (drc != _drc) + { + [[self.undo prepareWithInvocationTarget:self] setDrc:_drc]; + } + _drc = drc; +} + #pragma mark - Options - (NSArray *)encoders |