Debian Codegraph @

BambooTracker/command/instrument/clone_instrument_command.cpp

raw
1 /*
2 * SPDX-FileCopyrightText: 2018 Rerrah
3 * SPDX-License-Identifier: MIT
4 */
5
6 #include "clone_instrument_command.hpp"
7
8 cloneInstrumentCommand::cloneInstrumentCommand(std::weak_ptr<InstrumentsManager> manager,
9 int num, int refNum)
10 : AbstractCommand(CommandId::CloneInstrument),
11 manager_(manager),
12 cloneInstNum_(num),
13 refInstNum_(refNum)
14 {
15 }
16
17 bool cloneInstrumentCommand::redo()
18 {
19 manager_.lock()->cloneInstrument(cloneInstNum_, refInstNum_);
20 return true;
21 }
22
23 bool cloneInstrumentCommand::undo()
24 {
25 manager_.lock()->removeInstrument(cloneInstNum_);
26 return true;
27 }