| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2018 Rerrah |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
*/ |
| 5 |
|
| 6 |
#include "insert_step_command.hpp" |
| 7 |
#include "pattern_command_utils.hpp" |
| 8 |
|
| 9 |
InsertStepCommand::InsertStepCommand( |
| 10 |
std::weak_ptr<Module> mod, int songNum, int trackNum, int orderNum, int stepNum) |
| 11 |
: AbstractCommand(CommandId::InsertStep), |
| 12 |
mod_(mod), |
| 13 |
song_(songNum), |
| 14 |
track_(trackNum), |
| 15 |
order_(orderNum), |
| 16 |
step_(stepNum) |
| 17 |
{ |
| 18 |
} |
| 19 |
|
| 20 |
bool InsertStepCommand::redo() |
| 21 |
{ |
| 22 |
command_utils::getPattern(mod_, song_, track_, order_).insertStep(step_); |
| 23 |
return true; |
| 24 |
} |
| 25 |
|
| 26 |
bool InsertStepCommand::undo() |
| 27 |
{ |
| 28 |
command_utils::getPattern(mod_, song_, track_, order_).deletePreviousStep(step_ + 1); |
| 29 |
return true; |
| 30 |
} |