basic undo support added

This commit is contained in:
itsmattkc
2018-06-07 20:40:56 -07:00
parent 6130d0d91e
commit 544c77828a
8 changed files with 80 additions and 4 deletions
+27
View File
@@ -5,6 +5,7 @@
#include <QDebug>
Sequence::Sequence() {
undo_pointer = -1;
}
Sequence::~Sequence() {
@@ -120,3 +121,29 @@ void Sequence::split_at_playhead(long frame) {
}
}
}
void Sequence::undo_add_current() {
undo_pointer++;
undo_stack.resize(undo_pointer);
undo_stack.append(clips);
qDebug() << "a pointer:" << undo_pointer << undo_stack.size();
}
void Sequence::undo() {
if (undo_pointer > 0) {
undo_pointer--;
clips = undo_stack[undo_pointer];
} else {
qDebug() << "[INFO] No more undos";
}
qDebug() << "u pointer:" << undo_pointer << undo_stack.size();
}
void Sequence::redo() {
if (undo_pointer == undo_stack.size() - 1) {
qDebug() << "[INFO] No more redos";
} else {
undo_pointer++;
clips = undo_stack[undo_pointer];
}
qDebug() << "r pointer:" << undo_pointer << undo_stack.size();
}