summaryrefslogtreecommitdiff
path: root/muse2/muse/undo.h
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/undo.h')
-rw-r--r--muse2/muse/undo.h71
1 files changed, 44 insertions, 27 deletions
diff --git a/muse2/muse/undo.h b/muse2/muse/undo.h
index 2f582d8e..f83ce491 100644
--- a/muse2/muse/undo.h
+++ b/muse2/muse/undo.h
@@ -46,8 +46,9 @@ extern std::list<QString> temporaryWavFiles; //!< Used for storing all tmp-files
struct UndoOp {
enum UndoType {
AddTrack, DeleteTrack,
- AddPart, DeletePart, ModifyPart,
- AddEvent, DeleteEvent, ModifyEvent,
+ AddPart, DeletePart, ModifyPartTick, ModifyPartLength, ModifyPartLengthFrames, /* FINDMICH FIXME frames are to be deprecated */ ModifyPartName, SelectPart,
+ MovePartToTrack,
+ AddEvent, DeleteEvent, ModifyEvent, SelectEvent,
AddTempo, DeleteTempo,
AddSig, DeleteSig,
AddKey, DeleteKey,
@@ -67,15 +68,9 @@ struct UndoOp {
int c;
};
struct {
- Track* track;
- int trackno;
- };
- struct {
- Part* oPart;
- Part* nPart;
- };
- struct {
- Part* part; // this part is only relevant for EVENT operations, NOT for part ops!
+ const Part* part;
+ unsigned old_partlen_or_tick; // FIXME FINDMICHJETZT XTicks!!
+ unsigned new_partlen_or_tick;
};
struct {
int channel;
@@ -90,50 +85,72 @@ struct UndoOp {
const char* tmpwavfile; //!< The file with the changed data
};
struct {
- Marker* realMarker;
+ Marker* realMarker;
Marker* copyMarker;
};
struct {
- Track* _renamedTrack;
- char* _oldName;
- char* _newName;
- };
- struct {
- Track* _propertyTrack;
+ const Track* _propertyTrack;
int _oldPropValue;
int _newPropValue;
};
};
+
+ char* _oldName;
+ char* _newName;
Event oEvent;
Event nEvent;
+ bool selected;
+ bool selected_old;
bool doCtrls;
bool doClones;
+ const Track* track;
+ const Track* oldTrack;
+ int trackno;
const char* typeName();
void dump();
UndoOp();
UndoOp(UndoType type, int a, int b, int c=0);
- 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, int n, const Track* track);
+ UndoOp(UndoType type, const Part* part, unsigned old_len_or_tick=-1, unsigned new_len_or_tick=-1, bool doCtrls=false, bool doClones=false); // FIXME these bools are UNUSED!!. XTICKS!
+ UndoOp(UndoType type, const Part* part, const char* old_name, const char* new_name);
+ UndoOp(UndoType type, const Part* part, bool selected, bool selected_old);
+ UndoOp(UndoType type, const Part* part, const Track* nTrack, const Track* oTrack);
+ UndoOp(UndoType type, const Event& nev, const Event& oev, const Part* part, bool doCtrls, bool doClones);
+ UndoOp(UndoType type, const Event& nev, const Part* part, bool doCtrls, bool doClones);
+ UndoOp(UndoType type, const Event& nev, bool selected, bool selected_old);
UndoOp(UndoType type, const char* changedFile, const char* changeData, int startframe, int endframe);
UndoOp(UndoType type, Marker* copyMarker, Marker* realMarker);
- UndoOp(UndoType type, Track* track, const char* old_name, const char* new_name);
- UndoOp(UndoType type, Track* track, int old_chan, int new_chan);
- UndoOp(UndoType type);
+ UndoOp(UndoType type, const Track* track, const char* old_name, const char* new_name);
+ UndoOp(UndoType type, const Track* track, int old_chan, int new_chan);
};
class Undo : public std::list<UndoOp> {
public:
+ Undo() : std::list<UndoOp>() { combobreaker=false; }
+ Undo(const Undo& other) : std::list<UndoOp>(other) { this->combobreaker=other.combobreaker; }
+ Undo& operator=(const Undo& other) { std::list<UndoOp>::operator=(other); this->combobreaker=other.combobreaker; return *this;}
+
bool empty() const;
+
+
+ /** if set, forbid merging (below).
+ * Defaults to false */
+ bool combobreaker;
+
+ /** is possible, merges itself and other by appending
+ * all contents of other at this->end().
+ * returns true if merged, false otherwise.
+ * in case of success, the caller has to ensure that
+ * other is deleted from the UndoList. */
+ bool merge_combo(const Undo& other);
};
typedef Undo::iterator iUndoOp;
typedef Undo::reverse_iterator riUndoOp;
+typedef Undo::const_iterator ciUndoOp;
+typedef Undo::const_reverse_iterator criUndoOp;
class UndoList : public std::list<Undo> {
protected: