Debian Codegraph @

BambooTracker/command/pattern/erase_effect_value_in_step_command.cpp

raw
1 /*
2 * SPDX-FileCopyrightText: 2018 Rerrah
3 * SPDX-License-Identifier: MIT
4 */
5
6 #include "erase_effect_value_in_step_command.hpp"
7 #include "pattern_command_utils.hpp"
8
9 EraseEffectValueInStepCommand::EraseEffectValueInStepCommand(
10 std::weak_ptr<Module> mod, int songNum, int trackNum, int orderNum, int stepNum, int n)
11 : AbstractCommand(CommandId::EraseEffectValueInStep),
12 mod_(mod),
13 song_(songNum),
14 track_(trackNum),
15 order_(orderNum),
16 step_(stepNum),
17 n_(n)
18 {
19 prevVal_ = command_utils::getStep(mod, songNum, trackNum, orderNum, stepNum).getEffectValue(n);
20 }
21
22 bool EraseEffectValueInStepCommand::redo()
23 {
24 command_utils::getStep(mod_, song_, track_, order_, step_).clearEffectValue(n_);
25 return true;
26 }
27
28 bool EraseEffectValueInStepCommand::undo()
29 {
30 command_utils::getStep(mod_, song_, track_, order_, step_).setEffectValue(n_, prevVal_);
31 return true;
32 }