fixed issue with undo overhaul

This commit is contained in:
itsmattkc
2018-09-18 21:06:56 +10:00
parent 0cc394f977
commit 1793c7837c
3 changed files with 26 additions and 2 deletions
+23
View File
@@ -81,13 +81,36 @@ DeleteClipAction::~DeleteClipAction() {
}
void DeleteClipAction::undo() {
// restore ref to clip
seq->clips[index] = ref;
ref = NULL;
// restore links to this clip
for (int i=linkClipIndex.size()-1;i>=0;i--) {
seq->clips.at(linkClipIndex.at(i))->linked.insert(linkLinkIndex.at(i), index);
}
}
void DeleteClipAction::redo() {
// remove ref to clip
ref = seq->clips.at(index);
seq->clips[index] = NULL;
// delete link to this clip
linkClipIndex.clear();
linkLinkIndex.clear();
for (int i=0;i<seq->clips.size();i++) {
Clip* c = seq->clips.at(i);
if (c != NULL) {
for (int j=0;j<c->linked.size();j++) {
if (c->linked.at(j) == index) {
linkClipIndex.append(i);
linkLinkIndex.append(j);
c->linked.removeAt(j);
}
}
}
}
}
ChangeSequenceAction::ChangeSequenceAction(Sequence* s) :
+3
View File
@@ -62,6 +62,9 @@ private:
Sequence* seq;
Clip* ref;
int index;
QVector<int> linkClipIndex;
QVector<int> linkLinkIndex;
};
class ChangeSequenceAction : public QUndoCommand {
-2
View File
@@ -33,8 +33,6 @@ void KeyframeView::paintEvent(QPaintEvent*) {
rowY.clear();
rows.clear();
if (panel_effect_controls->selected_clips.size() > 0) {
long effects_in = LONG_MAX;
long effects_out = 0;