added internal pointer command

This commit is contained in:
itsmattkc
2018-11-24 00:24:34 +11:00
parent 20aae96110
commit 121177fd37
8 changed files with 64 additions and 3 deletions
+11
View File
@@ -0,0 +1,11 @@
#include "cubetransition.h"
#include "debug.h"
CubeTransition::CubeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
enable_coords = true;
}
void CubeTransition::process_coords(double progress, GLTextureCoords&, int data) {
glTranslatef(-progress, 0, -progress);
}
+12
View File
@@ -0,0 +1,12 @@
#ifndef CUBETRANSITION_H
#define CUBETRANSITION_H
#include "project/transition.h"
class CubeTransition : public Transition {
public:
CubeTransition(Clip* c, Clip* s, const EffectMeta* em);
void process_coords(double timecode, GLTextureCoords &, int data);
};
#endif // CUBETRANSITION_H
+4 -2
View File
@@ -87,7 +87,8 @@ SOURCES += \
project/effect.cpp \
project/transition.cpp \
project/effectrow.cpp \
project/effectfield.cpp
project/effectfield.cpp \
effects/internal/cubetransition.cpp
HEADERS += \
mainwindow.h \
@@ -154,7 +155,8 @@ HEADERS += \
project/effect.h \
project/transition.h \
project/effectrow.h \
project/effectfield.h
project/effectfield.h \
effects/internal/cubetransition.h
FORMS += \
mainwindow.ui \
+4
View File
@@ -135,6 +135,10 @@ void load_internal_effects() {
em.internal = TRANSITION_INTERNAL_CROSSDISSOLVE;
video_effects.append(em);
em.name = "Cube";
em.internal = TRANSITION_INTERNAL_CUBE;
video_effects.append(em);
em.name = "Linear Fade";
em.internal = TRANSITION_INTERNAL_LINEARFADE;
audio_effects.append(em);
+2
View File
@@ -9,6 +9,7 @@
#include "effects/internal/linearfadetransition.h"
#include "effects/internal/exponentialfadetransition.h"
#include "effects/internal/logarithmicfadetransition.h"
#include "effects/internal/cubetransition.h"
#include <QMessageBox>
@@ -40,6 +41,7 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, s, em);
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, s, em);
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, s, em);
case TRANSITION_INTERNAL_CUBE: return new CubeTransition(c, s, em);
}
} else {
dout << "[ERROR] Invalid transition data";
+2 -1
View File
@@ -11,7 +11,8 @@
#define TRANSITION_INTERNAL_LINEARFADE 1
#define TRANSITION_INTERNAL_EXPONENTIALFADE 2
#define TRANSITION_INTERNAL_LOGARITHMICFADE 3
#define TRANSITION_INTERNAL_COUNT 4
#define TRANSITION_INTERNAL_CUBE 4
#define TRANSITION_INTERNAL_COUNT 5
int create_transition(Clip* c, Clip* s, const EffectMeta* em);
+17
View File
@@ -1260,3 +1260,20 @@ void RenameClipCommand::redo() {
clips.at(i)->name = new_name;
}
}
SetPointer::SetPointer(void **pointer, void *data) :
p(pointer),
new_data(data),
old_changed(mainWindow->isWindowModified())
{}
void SetPointer::undo() {
*p = old_data;
mainWindow->setWindowModified(old_changed);
}
void SetPointer::redo() {
old_data = *p;
*p = new_data;
mainWindow->setWindowModified(true);
}
+12
View File
@@ -582,4 +582,16 @@ private:
bool old_project_changed;
};
class SetPointer : public QUndoCommand {
public:
SetPointer(void** pointer, void* data);
void undo();
void redo();
private:
bool old_changed;
void** p;
void* new_data;
void* old_data;
};
#endif // UNDO_H