added replace function for pasting effects

This commit is contained in:
itsmattkc
2018-12-21 10:34:42 +11:00
parent c65e2557b5
commit c62d4803fb
3 changed files with 68 additions and 6 deletions
+12 -3
View File
@@ -199,10 +199,11 @@ void SetTimelineInOutCommand::redo() {
mainWindow->setWindowModified(true);
}
AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m) :
AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int insert_pos) :
clip(c),
meta(m),
ref(e),
pos(insert_pos),
done(false),
old_project_changed(mainWindow->isWindowModified())
{}
@@ -213,7 +214,11 @@ AddEffectCommand::~AddEffectCommand() {
void AddEffectCommand::undo() {
clip->effects.last()->close();
clip->effects.removeLast();
if (pos < 0) {
clip->effects.removeLast();
} else {
clip->effects.removeAt(pos);
}
done = false;
mainWindow->setWindowModified(old_project_changed);
}
@@ -222,7 +227,11 @@ void AddEffectCommand::redo() {
if (ref == NULL) {
ref = create_effect(clip, meta);
}
clip->effects.append(ref);
if (pos < 0) {
clip->effects.append(ref);
} else {
clip->effects.insert(pos, ref);
}
done = true;
mainWindow->setWindowModified(true);
}