summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp2
-rw-r--r--muse2/muse/functions.cpp1
-rw-r--r--muse2/muse/midiedit/dcanvas.cpp4
-rw-r--r--muse2/muse/midiedit/prcanvas.cpp4
-rw-r--r--muse2/muse/miditransform.cpp20
-rw-r--r--muse2/muse/seqmsg.cpp2
-rw-r--r--muse2/muse/song.cpp68
-rw-r--r--muse2/muse/song.h20
-rw-r--r--muse2/muse/structure.cpp4
-rw-r--r--muse2/muse/undo.cpp163
-rw-r--r--muse2/muse/undo.h13
11 files changed, 143 insertions, 158 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index daaf2d28..ed52cc03 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -2775,7 +2775,7 @@ void PartCanvas::movePartsTotheRight(unsigned int startTicks, int length)
Marker *oldMarker = new Marker();
*oldMarker = *m;
m->setTick(m->tick()+length);
- song->undoOp(UndoOp::ModifyMarker,oldMarker, m);
+ song->addUndo(UndoOp(UndoOp::ModifyMarker,oldMarker, m));
}
}
}
diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp
index 3c6bbc89..5498c6d1 100644
--- a/muse2/muse/functions.cpp
+++ b/muse2/muse/functions.cpp
@@ -357,6 +357,7 @@ void quantize_notes(const set<Part*>& parts, int range, int raster, int strength
newEvent.setTick(begin_tick - part->tick());
newEvent.setLenTick(len);
// Indicate no undo, and do not do port controller values and clone parts.
+ //audio->msgChangeEvent(event, newEvent, part, false, false, false);
audio->msgChangeEvent(event, newEvent, part, false, false, false);
}
}
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp
index eea29b46..fa7da753 100644
--- a/muse2/muse/midiedit/dcanvas.cpp
+++ b/muse2/muse/midiedit/dcanvas.cpp
@@ -1292,8 +1292,8 @@ void DrumCanvas::modifySelected(NoteInfo::ValType type, int delta)
}
song->changeEvent(event, newEvent, part);
// Indicate do not do port controller values and clone parts.
- //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
- song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false);
+ //song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part));
+ song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false));
}
song->endUndo(SC_EVENT_MODIFIED);
audio->msgIdle(false);
diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp
index 84cac135..e59e8beb 100644
--- a/muse2/muse/midiedit/prcanvas.cpp
+++ b/muse2/muse/midiedit/prcanvas.cpp
@@ -1536,8 +1536,8 @@ void PianoCanvas::modifySelected(NoteInfo::ValType type, int delta)
}
song->changeEvent(event, newEvent, part);
// Indicate do not do port controller values and clone parts.
- //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
- song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false);
+ //song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part));
+ song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false));
}
song->endUndo(SC_EVENT_MODIFIED);
audio->msgIdle(false);
diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp
index 1c73b7c2..9e9c87c0 100644
--- a/muse2/muse/miditransform.cpp
+++ b/muse2/muse/miditransform.cpp
@@ -662,14 +662,14 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part,
// Indicate do clone parts.
addPortCtrlEvents(newEvent, part, true);
// Indicate do port controller values and clone parts.
- //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
- song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true);
+ //song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part));
+ song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true));
song->addUpdateFlags(SC_EVENT_MODIFIED);
break;
case Insert:
// Indicate do port controller values and clone parts.
- //song->undoOp(UndoOp::AddEvent, dummy, newEvent, part);
- song->undoOp(UndoOp::AddEvent, dummy, newEvent, part, true, true);
+ //song->addUndo(UndoOp(UndoOp::AddEvent, dummy, newEvent, part));
+ song->addUndo(UndoOp(UndoOp::AddEvent, dummy, newEvent, part, true, true));
song->addEvent(newEvent, part);
// Indicate do clone parts.
addPortCtrlEvents(newEvent, part, true);
@@ -677,8 +677,8 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part,
break;
case Extract:
// Indicate do port controller values and clone parts.
- //song->undoOp(UndoOp::DeleteEvent, dummy, event, part);
- song->undoOp(UndoOp::DeleteEvent, dummy, event, part, true, true);
+ //song->addUndo(UndoOp(UndoOp::DeleteEvent, dummy, event, part));
+ song->addUndo(UndoOp(UndoOp::DeleteEvent, dummy, event, part, true, true));
// Indicate do clone parts.
removePortCtrlEvents(event, part, true);
song->deleteEvent(event, part);
@@ -713,8 +713,8 @@ void MidiTransformerDialog::processEvent(Event& event, MidiPart* part, MidiPart*
// Indicate do clone parts.
addPortCtrlEvents(newEvent, part, true);
// Indicate do port controller values and clone parts.
- //song->undoOp(UndoOp::ModifyEvent, newEvent, event, part);
- song->undoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true);
+ //song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part));
+ song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true));
song->addUpdateFlags(SC_EVENT_MODIFIED);
}
}
@@ -723,8 +723,8 @@ void MidiTransformerDialog::processEvent(Event& event, MidiPart* part, MidiPart*
{
Event ev;
// Indicate do port controller values and clone parts.
- //song->undoOp(UndoOp::DeleteEvent, ev, event, part, true, true);
- song->undoOp(UndoOp::DeleteEvent, ev, event, part, true, true);
+ //song->addUndo(UndoOp(UndoOp::DeleteEvent, ev, event, part, true, true));
+ song->addUndo(UndoOp(UndoOp::DeleteEvent, ev, event, part, true, true));
// Indicate do clone parts.
removePortCtrlEvents(event, part, true);
song->deleteEvent(event, part);
diff --git a/muse2/muse/seqmsg.cpp b/muse2/muse/seqmsg.cpp
index 950015b2..3fb91293 100644
--- a/muse2/muse/seqmsg.cpp
+++ b/muse2/muse/seqmsg.cpp
@@ -751,7 +751,7 @@ void Song::msgInsertTrack(Track* track, int idx, bool doUndoFlag)
msg.ival = idx;
if (doUndoFlag) {
song->startUndo();
- undoOp(UndoOp::AddTrack, idx, track);
+ addUndo(UndoOp(UndoOp::AddTrack, idx, track));
}
audio->sendMsg(&msg);
if (doUndoFlag)
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
index 1c451f55..f781b8f0 100644
--- a/muse2/muse/song.cpp
+++ b/muse2/muse/song.cpp
@@ -350,7 +350,7 @@ Track* Song::addTrack(int t)
void Song::cmdRemoveTrack(Track* track)
{
int idx = _tracks.index(track);
- undoOp(UndoOp::DeleteTrack, idx, track);
+ addUndo(UndoOp(UndoOp::DeleteTrack, idx, track));
removeTrack2(track);
updateFlags |= SC_TRACK_REMOVED;
}
@@ -395,8 +395,8 @@ void Song::changeTrack(Track* oldTrack, Track* newTrack)
oldTrack->setSelected(false); //??
int idx = _tracks.index(newTrack);
- //undoOp(UndoOp::ModifyTrack, oldTrack, newTrack);
- undoOp(UndoOp::ModifyTrack, idx, oldTrack, newTrack);
+ //addUndo(UndoOp(UndoOp::ModifyTrack, oldTrack, newTrack));
+ addUndo(UndoOp(UndoOp::ModifyTrack, idx, oldTrack, newTrack));
updateFlags |= SC_TRACK_MODIFIED;
}
@@ -863,7 +863,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
// Now add all of the new part's port controller values. Indicate do not do clone parts.
addPortCtrlEvents(newPart, false);
// Create an undo op. Indicate do port controller values but not clone parts.
- undoOp(UndoOp::ModifyPart, part, newPart, true, false);
+ addUndo(UndoOp(UndoOp::ModifyPart, part, newPart, true, false));
updateFlags |= SC_PART_MODIFIED;
if (_recMode == REC_REPLACE)
@@ -874,7 +874,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
{
Event event = i->second;
// Create an undo op. Indicate do port controller values and clone parts.
- undoOp(UndoOp::DeleteEvent, event, newPart, true, true);
+ addUndo(UndoOp(UndoOp::DeleteEvent, event, newPart, true, true));
// Remove the event from the new part's port controller values, and do all clone parts.
removePortCtrlEvents(event, newPart, true);
}
@@ -886,7 +886,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
event.setTick(event.tick() - partTick);
Event e;
// Create an undo op. Indicate do port controller values and clone parts.
- undoOp(UndoOp::AddEvent, e, event, newPart, true, true);
+ addUndo(UndoOp(UndoOp::AddEvent, e, event, newPart, true, true));
if(newPart->events()->find(event) == newPart->events()->end())
newPart->events()->add(event);
@@ -906,8 +906,8 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
{
Event event = i->second;
// Create an undo op. Indicate do port controller values and clone parts.
- //undoOp(UndoOp::DeleteEvent, event, part);
- undoOp(UndoOp::DeleteEvent, event, part, true, true);
+ //addUndo(UndoOp(UndoOp::DeleteEvent, event, part));
+ addUndo(UndoOp(UndoOp::DeleteEvent, event, part, true, true));
//if (event.type() == Controller) {
// MidiTrack* track = (MidiTrack*)part->track();
@@ -938,8 +938,8 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
event.setTick(tick);
Event e;
// Create an undo op. Indicate do port controller values and clone parts.
- //undoOp(UndoOp::AddEvent, e, event, newPart);
- undoOp(UndoOp::AddEvent, e, event, newPart, true, true);
+ //addUndo(UndoOp(UndoOp::AddEvent, e, event, newPart));
+ addUndo(UndoOp(UndoOp::AddEvent, e, event, newPart, true, true));
// addEvent also adds port controller values. So does msgChangePart, below. Let msgChangePart handle them.
//addEvent(event, (MidiPart*)newPart);
@@ -965,9 +965,9 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
//printf("Song::cmdAddRecordedEvents after changePart part:%p events:%p refs:%d Arefs:%d newPart:%p events:%p refs:%d Arefs:%d\n", part, part->events(), part->events()->refCount(), part->events()->arefCount(), newPart, newPart->events(), newPart->events()->refCount(), newPart->events()->arefCount());
- //undoOp(UndoOp::ModifyPart, part, newPart);
+ //addUndo(UndoOp(UndoOp::ModifyPart, part, newPart));
// Create an undo op. Indicate do not do port controller values and clone parts.
- undoOp(UndoOp::ModifyPart, part, newPart, false, false);
+ addUndo(UndoOp(UndoOp::ModifyPart, part, newPart, false, false));
// Removed by T356.
//part->events()->incARef(-1);
@@ -985,8 +985,8 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
for (iEvent i = si; i != ei; ++i) {
Event event = i->second;
// Create an undo op. Indicate that controller values and clone parts were handled.
- //undoOp(UndoOp::DeleteEvent, event, part);
- undoOp(UndoOp::DeleteEvent, event, part, true, true);
+ //addUndo(UndoOp(UndoOp::DeleteEvent, event, part));
+ addUndo(UndoOp(UndoOp::DeleteEvent, event, part, true, true));
/*
if (event.type() == Controller) {
MidiTrack* track = (MidiTrack*)part->track();
@@ -1007,8 +1007,8 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
event.setTick(tick);
// Create an undo op. Indicate that controller values and clone parts were handled.
- //undoOp(UndoOp::AddEvent, event, part);
- undoOp(UndoOp::AddEvent, event, part, true, true);
+ //addUndo(UndoOp(UndoOp::AddEvent, event, part));
+ addUndo(UndoOp(UndoOp::AddEvent, event, part, true, true));
//addEvent(event, part);
if(part->events()->find(event) == part->events()->end())
@@ -1286,7 +1286,7 @@ void Song::setStopPlay(bool f)
void Song::swapTracks(int i1, int i2)
{
- undoOp(UndoOp::SwapTrack, i1, i2);
+ addUndo(UndoOp(UndoOp::SwapTrack, i1, i2));
Track* track = _tracks[i1];
_tracks[i1] = _tracks[i2];
_tracks[i2] = track;
@@ -1906,8 +1906,8 @@ void Song::processMsg(AudioMsg* msg)
updateFlags = SC_EVENT_INSERTED;
if (addEvent(msg->ev1, (MidiPart*)msg->p2)) {
Event ev;
- //undoOp(UndoOp::AddEvent, ev, msg->ev1, (Part*)msg->p2);
- undoOp(UndoOp::AddEvent, ev, msg->ev1, (Part*)msg->p2, msg->a, msg->b);
+ //addUndo(UndoOp(UndoOp::AddEvent, ev, msg->ev1, (Part*)msg->p2));
+ addUndo(UndoOp(UndoOp::AddEvent, ev, msg->ev1, (Part*)msg->p2, msg->a, msg->b));
}
else
updateFlags = 0;
@@ -1921,8 +1921,8 @@ void Song::processMsg(AudioMsg* msg)
if(msg->a)
removePortCtrlEvents(event, part, msg->b);
Event e;
- //undoOp(UndoOp::DeleteEvent, e, event, (Part*)part);
- undoOp(UndoOp::DeleteEvent, e, event, (Part*)part, msg->a, msg->b);
+ //addUndo(UndoOp(UndoOp::DeleteEvent, e, event, (Part*)part));
+ addUndo(UndoOp(UndoOp::DeleteEvent, e, event, (Part*)part, msg->a, msg->b));
deleteEvent(event, part);
updateFlags = SC_EVENT_REMOVED;
}
@@ -1933,21 +1933,21 @@ void Song::processMsg(AudioMsg* msg)
changeEvent(msg->ev1, msg->ev2, (MidiPart*)msg->p3);
if(msg->a)
addPortCtrlEvents(msg->ev2, (Part*)msg->p3, msg->b);
- //undoOp(UndoOp::ModifyEvent, msg->ev2, msg->ev1, (Part*)msg->p3);
- undoOp(UndoOp::ModifyEvent, msg->ev2, msg->ev1, (Part*)msg->p3, msg->a, msg->b);
+ //addUndo(UndoOp(UndoOp::ModifyEvent, msg->ev2, msg->ev1, (Part*)msg->p3));
+ addUndo(UndoOp(UndoOp::ModifyEvent, msg->ev2, msg->ev1, (Part*)msg->p3, msg->a, msg->b));
updateFlags = SC_EVENT_MODIFIED;
break;
case SEQM_ADD_TEMPO:
//printf("processMsg (SEQM_ADD_TEMPO) UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b);
- undoOp(UndoOp::AddTempo, msg->a, msg->b);
+ addUndo(UndoOp(UndoOp::AddTempo, msg->a, msg->b));
tempomap.addTempo(msg->a, msg->b);
updateFlags = SC_TEMPO;
break;
case SEQM_SET_TEMPO:
//printf("processMsg (SEQM_SET_TEMPO) UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b);
- undoOp(UndoOp::AddTempo, msg->a, msg->b);
+ addUndo(UndoOp(UndoOp::AddTempo, msg->a, msg->b));
tempomap.setTempo(msg->a, msg->b);
updateFlags = SC_TEMPO;
break;
@@ -1958,31 +1958,31 @@ void Song::processMsg(AudioMsg* msg)
case SEQM_REMOVE_TEMPO:
//printf("processMsg (SEQM_REMOVE_TEMPO) UndoOp::DeleteTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b);
- undoOp(UndoOp::DeleteTempo, msg->a, msg->b);
+ addUndo(UndoOp(UndoOp::DeleteTempo, msg->a, msg->b));
tempomap.delTempo(msg->a);
updateFlags = SC_TEMPO;
break;
case SEQM_ADD_SIG:
- undoOp(UndoOp::AddSig, msg->a, msg->b, msg->c);
+ addUndo(UndoOp(UndoOp::AddSig, msg->a, msg->b, msg->c));
AL::sigmap.add(msg->a, AL::TimeSignature(msg->b, msg->c));
updateFlags = SC_SIG;
break;
case SEQM_REMOVE_SIG:
- undoOp(UndoOp::DeleteSig, msg->a, msg->b, msg->c);
+ addUndo(UndoOp(UndoOp::DeleteSig, msg->a, msg->b, msg->c));
AL::sigmap.del(msg->a);
updateFlags = SC_SIG;
break;
case SEQM_ADD_KEY:
- undoOp(UndoOp::AddKey, msg->a, msg->b);
+ addUndo(UndoOp(UndoOp::AddKey, msg->a, msg->b));
keymap.addKey(msg->a, (key_enum) msg->b);
updateFlags = SC_KEY;
break;
case SEQM_REMOVE_KEY:
- undoOp(UndoOp::DeleteKey, msg->a, msg->b);
+ addUndo(UndoOp(UndoOp::DeleteKey, msg->a, msg->b));
keymap.delKey(msg->a);
updateFlags = SC_KEY;
break;
@@ -2000,7 +2000,7 @@ void Song::processMsg(AudioMsg* msg)
void Song::cmdAddPart(Part* part)
{
addPart(part);
- undoOp(UndoOp::AddPart, part);
+ addUndo(UndoOp(UndoOp::AddPart, part));
updateFlags = SC_PART_INSERTED;
}
@@ -2011,7 +2011,7 @@ void Song::cmdAddPart(Part* part)
void Song::cmdRemovePart(Part* part)
{
removePart(part);
- undoOp(UndoOp::DeletePart, part);
+ addUndo(UndoOp(UndoOp::DeletePart, part));
part->events()->incARef(-1);
//part->unchainClone();
unchainClone(part);
@@ -2032,8 +2032,8 @@ void Song::cmdChangePart(Part* oldPart, Part* newPart, bool doCtrls, bool doClon
changePart(oldPart, newPart);
- //undoOp(UndoOp::ModifyPart, oldPart, newPart);
- undoOp(UndoOp::ModifyPart, oldPart, newPart, doCtrls, doClones);
+ //addUndo(UndoOp(UndoOp::ModifyPart, oldPart, newPart));
+ addUndo(UndoOp(UndoOp::ModifyPart, oldPart, newPart, doCtrls, doClones));
// Changed by T356. Do not decrement ref count if the new part is a clone of the old part, since the event list
// will still be active.
diff --git a/muse2/muse/song.h b/muse2/muse/song.h
index e1378480..cb9d0f9d 100644
--- a/muse2/muse/song.h
+++ b/muse2/muse/song.h
@@ -147,6 +147,8 @@ class Song : public QObject {
Song(const char* name = 0);
~Song();
+ void applyOperationGroup(Undo& group);
+
void putEvent(int pv);
void endMsgCmd();
void processMsg(AudioMsg* msg);
@@ -316,21 +318,9 @@ class Song : public QObject {
void startUndo();
void endUndo(int);
- //void undoOp(UndoOp::UndoType, Track* oTrack, Track* nTrack);
- void undoOp(UndoOp::UndoType, int n, Track* oTrack, Track* nTrack);
- void undoOp(UndoOp::UndoType, int, Track*);
- void undoOp(UndoOp::UndoType, int, int, int = 0);
- void undoOp(UndoOp::UndoType, Part*);
- //void undoOp(UndoOp::UndoType, Event& nevent, Part*);
- void undoOp(UndoOp::UndoType, Event& nevent, Part*, bool doCtrls, bool doClones);
- //void undoOp(UndoOp::UndoType, Event& oevent, Event& nevent, Part*);
- void undoOp(UndoOp::UndoType, Event& oevent, Event& nevent, Part*, bool doCtrls, bool doClones);
- void undoOp(UndoOp::UndoType, SigEvent* oevent, SigEvent* nevent);
- void undoOp(UndoOp::UndoType, int channel, int ctrl, int oval, int nval);
- //void undoOp(UndoOp::UndoType, Part* oPart, Part* nPart);
- void undoOp(UndoOp::UndoType, Part* oPart, Part* nPart, bool doCtrls, bool doClones);
+
void undoOp(UndoOp::UndoType type, const char* changedFile, const char* changeData, int startframe, int endframe);
- void undoOp(UndoOp::UndoType type, Marker* copyMarker, Marker* realMarker);
+
bool doUndo1();
void doUndo2();
void doUndo3();
@@ -338,7 +328,7 @@ class Song : public QObject {
void doRedo2();
void doRedo3();
- void addUndo(UndoOp& i);
+ void addUndo(UndoOp i);
//-----------------------------------------
// Configuration
diff --git a/muse2/muse/structure.cpp b/muse2/muse/structure.cpp
index f0a4308a..27246315 100644
--- a/muse2/muse/structure.cpp
+++ b/muse2/muse/structure.cpp
@@ -99,12 +99,12 @@ void MusE::adjustGlobalLists(int startPos, int diff)
Marker *oldMarker = new Marker();
*oldMarker = *m;
markerlist->remove(m);
- song->undoOp(UndoOp::ModifyMarker,oldMarker, 0);
+ song->addUndo(UndoOp(UndoOp::ModifyMarker,oldMarker, 0));
} else {
Marker *oldMarker = new Marker();
*oldMarker = *m;
m->setTick(tick + diff);
- song->undoOp(UndoOp::ModifyMarker,oldMarker, m);
+ song->addUndo(UndoOp(UndoOp::ModifyMarker,oldMarker, m));
}
}
}
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");
diff --git a/muse2/muse/undo.h b/muse2/muse/undo.h
index eb5600ef..b048b9e6 100644
--- a/muse2/muse/undo.h
+++ b/muse2/muse/undo.h
@@ -83,8 +83,21 @@ struct UndoOp {
Event nEvent;
bool doCtrls;
bool doClones;
+
const char* typeName();
void dump();
+
+ UndoOp(UndoType type, int a, int b, int c=0);
+ UndoOp(UndoType type, int n, Track* oldTrack, Track* newTrack);
+ UndoOp(UndoType type, int n, Track* track);
+ UndoOp(UndoType type, Part* part);
+ UndoOp(UndoType type, Event& oev, Event& nev, Part* part, bool doCtrls, bool doClones);
+ UndoOp(UndoType type, Event& nev, Part* part, bool doCtrls, bool doClones);
+ UndoOp(UndoType type, Part* oPart, Part* nPart, bool doCtrls, bool doClones);
+ UndoOp(UndoType type, int c, int ctrl, int ov, int nv);
+ UndoOp(UndoType type, SigEvent* oevent, SigEvent* nevent);
+ UndoOp(UndoType type, const char* changedFile, const char* changeData, int startframe, int endframe);
+ UndoOp(UndoType type, Marker* copyMarker, Marker* realMarker);
};
class Undo : public std::list<UndoOp> {