Debian Codegraph @

BambooTracker/command/pattern/erase_instrument_in_step_command.cpp

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