summaryrefslogtreecommitdiff
path: root/muse2/muse/undo.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-05-22 13:24:13 +0000
committerFlorian Jung <flo@windfisch.org>2011-05-22 13:24:13 +0000
commit1701c520500b9198c1aaca29e7bdcd891cb0e971 (patch)
tree33c78a9e7b1aeb82e334dca9c2d319efe80610d3 /muse2/muse/undo.cpp
parentde003aced9a2aa2141258ac97701e438220740f0 (diff)
changed Song::undoOp(foo) to Song::addUndo(UndoOp(foo)).
changed all these undoOps into a UndoOp-constructor. should not have affected muse's behaviour. should not introduce bugs or fix stuff.
Diffstat (limited to 'muse2/muse/undo.cpp')
-rw-r--r--muse2/muse/undo.cpp163
1 files changed, 72 insertions, 91 deletions
diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp
index a31b8e7a..ea9ea8d6 100644
--- a/muse2/muse/undo.cpp
+++ b/muse2/muse/undo.cpp
@@ -200,6 +200,16 @@ void Song::endUndo(int flags)
undoMode = false;
}
+
+void Song::applyOperationGroup(Undo& group)
+ {
+ //this is a HACK! but it works :)
+ redoList->push_back(group);
+ redo();
+ }
+
+
+
//---------------------------------------------------------
// doUndo2
// real time part
@@ -688,134 +698,105 @@ void Song::doRedo2()
}
}
-void Song::undoOp(UndoOp::UndoType type, int a, int b, int c)
+UndoOp::UndoOp(UndoType type_, int a_, int b_, int c_)
{
- UndoOp i;
- i.type = type;
- i.a = a;
- i.b = b;
- i.c = c;
- addUndo(i);
+ type = type_;
+ a = a_;
+ b = b_;
+ c = c_;
}
-//void Song::undoOp(UndoOp::UndoType type, Track* oldTrack, Track* newTrack)
-void Song::undoOp(UndoOp::UndoType type, int n, Track* oldTrack, Track* newTrack)
+UndoOp::UndoOp(UndoType type_, int n, Track* oldTrack, Track* newTrack)
{
- UndoOp i;
- i.type = type;
- i.trackno = n;
- i.oTrack = oldTrack;
- i.nTrack = newTrack;
- // Added by Tim. p3.3.6
- //printf("Song::undoOp ModifyTrack oTrack %p %s nTrack %p %s\n", i.oTrack, i.oTrack->name().toLatin1().constData(), i.nTrack, i.nTrack->name().toLatin1().constData());
-
- addUndo(i);
+ type = type_;
+ trackno = n;
+ oTrack = oldTrack;
+ nTrack = newTrack;
}
-void Song::undoOp(UndoOp::UndoType type, int n, Track* track)
+UndoOp::UndoOp(UndoType type_, int n, Track* track)
{
- UndoOp i;
- i.type = type;
- i.trackno = n;
- i.oTrack = track;
- if (type == UndoOp::AddTrack)
- updateFlags |= SC_TRACK_INSERTED;
- addUndo(i);
+ type = type_;
+ trackno = n;
+ oTrack = track;
}
-void Song::undoOp(UndoOp::UndoType type, Part* part)
+UndoOp::UndoOp(UndoType type_, Part* part)
{
- UndoOp i;
- i.type = type;
- i.oPart = part;
- addUndo(i);
+ type = type_;
+ oPart = part;
}
-//void Song::undoOp(UndoOp::UndoType type, Event& oev, Event& nev, Part* part)
-void Song::undoOp(UndoOp::UndoType type, Event& oev, Event& nev, Part* part, bool doCtrls, bool doClones)
+UndoOp::UndoOp(UndoType type_, Event& oev, Event& nev, Part* part_, bool doCtrls_, bool doClones_)
{
- UndoOp i;
- i.type = type;
- i.nEvent = nev;
- i.oEvent = oev;
- i.part = part;
- i.doCtrls = doCtrls;
- i.doClones = doClones;
- addUndo(i);
+ type = type_;
+ nEvent = nev;
+ oEvent = oev;
+ part = part_;
+ doCtrls = doCtrls_;
+ doClones = doClones_;
}
-void Song::undoOp(UndoOp::UndoType type, Event& nev, Part* part, bool doCtrls, bool doClones)
+UndoOp::UndoOp(UndoType type_, Event& nev, Part* part_, bool doCtrls_, bool doClones_)
{
- UndoOp i;
- i.type = type;
- i.nEvent = nev;
- i.part = part;
- i.doCtrls = doCtrls;
- i.doClones = doClones;
- addUndo(i);
+ type = type_;
+ nEvent = nev;
+ part = part_;
+ doCtrls = doCtrls_;
+ doClones = doClones_;
}
-//void Song::undoOp(UndoOp::UndoType type, Part* oPart, Part* nPart)
-void Song::undoOp(UndoOp::UndoType type, Part* oPart, Part* nPart, bool doCtrls, bool doClones)
+UndoOp::UndoOp(UndoType type_, Part* oPart_, Part* nPart_, bool doCtrls_, bool doClones_)
{
- UndoOp i;
- i.type = type;
- i.oPart = nPart;
- i.nPart = oPart;
- i.doCtrls = doCtrls;
- i.doClones = doClones;
- addUndo(i);
+ type = type_;
+ oPart = nPart_;
+ nPart = oPart_;
+ doCtrls = doCtrls_;
+ doClones = doClones_;
}
-void Song::undoOp(UndoOp::UndoType type, int c, int ctrl, int ov, int nv)
+UndoOp::UndoOp(UndoType type_, int c, int ctrl_, int ov, int nv)
{
- UndoOp i;
- i.type = type;
- i.channel = c;
- i.ctrl = ctrl;
- i.oVal = ov;
- i.nVal = nv;
- addUndo(i);
+ type = type_;
+ channel = c;
+ ctrl = ctrl_;
+ oVal = ov;
+ nVal = nv;
}
-void Song::undoOp(UndoOp::UndoType type, SigEvent* oevent, SigEvent* nevent)
+UndoOp::UndoOp(UndoType type_, SigEvent* oevent, SigEvent* nevent)
{
- UndoOp i;
- i.type = type;
- i.oSignature = oevent;
- i.nSignature = nevent;
- addUndo(i);
+ type = type_;
+ oSignature = oevent;
+ nSignature = nevent;
}
-
-void Song::undoOp(UndoOp::UndoType type, const char* changedFile, const char* changeData, int startframe, int endframe)
+UndoOp::UndoOp(UndoType type_, Marker* copyMarker_, Marker* realMarker_)
{
- UndoOp i;
- i.type = type;
- i.filename = changedFile;
- i.tmpwavfile = changeData;
- i.startframe = startframe;
- i.endframe = endframe;
- addUndo(i);
- temporaryWavFiles.push_back(QString(changeData));
-
- //printf("Adding ModifyClip undo-operation: origfile=%s tmpfile=%s sf=%d ef=%d\n", changedFile, changeData, startframe, endframe);
+ type = type_;
+ realMarker = realMarker_;
+ copyMarker = copyMarker_;
}
-void Song::undoOp(UndoOp::UndoType type, Marker* copyMarker, Marker* realMarker)
+UndoOp::UndoOp(UndoType type_, const char* changedFile, const char* changeData, int startframe_, int endframe_)
{
- UndoOp i;
- i.type = type;
- i.realMarker = realMarker;
- i.copyMarker = copyMarker;
+ type = type_;
+ filename = changedFile;
+ tmpwavfile = changeData;
+ startframe = startframe_;
+ endframe = endframe_;
+ }
- addUndo(i);
+void Song::undoOp(UndoOp::UndoType type, const char* changedFile, const char* changeData, int startframe, int endframe)
+ {
+ addUndo(UndoOp(type,changedFile,changeData,startframe,endframe));
+ temporaryWavFiles.push_back(QString(changeData));
}
//---------------------------------------------------------
// addUndo
//---------------------------------------------------------
-void Song::addUndo(UndoOp& i)
+void Song::addUndo(UndoOp i)
{
if (!undoMode) {
printf("internal error: undoOp without startUndo()\n");