2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
2013-08-22 12:18:14 +02:00
|
|
|
// Copyright (C) 2002-2013 Werner Schweer
|
2012-05-26 14:26:10 +02:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __UNDO_H__
|
|
|
|
#define __UNDO_H__
|
|
|
|
|
|
|
|
/**
|
|
|
|
\file
|
|
|
|
Definition of undo-releated classes and structs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "spatium.h"
|
|
|
|
#include "mscore.h"
|
|
|
|
#include "sig.h"
|
|
|
|
#include "tempo.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "style.h"
|
|
|
|
#include "key.h"
|
|
|
|
#include "select.h"
|
|
|
|
#include "instrument.h"
|
2013-04-02 20:46:07 +02:00
|
|
|
#include "synthesizer/midipatch.h"
|
2012-05-26 14:26:10 +02:00
|
|
|
#include "pitchvalue.h"
|
|
|
|
#include "timesig.h"
|
2012-11-19 10:08:15 +01:00
|
|
|
#include "noteevent.h"
|
2013-04-02 20:46:07 +02:00
|
|
|
#include "synthesizerstate.h"
|
2013-06-28 17:46:24 +02:00
|
|
|
#include "bracket.h"
|
2014-04-30 10:08:38 +02:00
|
|
|
#include "stafftype.h"
|
2014-05-08 17:59:24 +02:00
|
|
|
#include "cleflist.h"
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class ElementList;
|
|
|
|
class Element;
|
|
|
|
class Instrument;
|
|
|
|
class System;
|
|
|
|
class Measure;
|
|
|
|
class Segment;
|
|
|
|
class Staff;
|
|
|
|
class Part;
|
|
|
|
class Volta;
|
|
|
|
class Score;
|
|
|
|
class Note;
|
|
|
|
class Chord;
|
|
|
|
class ChordRest;
|
|
|
|
class Harmony;
|
|
|
|
class SlurTie;
|
|
|
|
struct MStaff;
|
|
|
|
class MeasureBase;
|
|
|
|
class Dynamic;
|
|
|
|
class Selection;
|
|
|
|
class Text;
|
|
|
|
struct Channel;
|
|
|
|
class PageFormat;
|
|
|
|
class TextStyle;
|
|
|
|
class Tuplet;
|
|
|
|
class KeySig;
|
|
|
|
class TimeSig;
|
|
|
|
class Clef;
|
|
|
|
class Image;
|
|
|
|
class Hairpin;
|
|
|
|
class Bend;
|
|
|
|
class TremoloBar;
|
|
|
|
class NoteEvent;
|
|
|
|
class SlurSegment;
|
|
|
|
class InstrumentChange;
|
|
|
|
class Box;
|
|
|
|
class Accidental;
|
|
|
|
class Spanner;
|
2012-10-14 19:48:36 +02:00
|
|
|
class BarLine;
|
2013-09-05 16:37:49 +02:00
|
|
|
enum class ClefType : signed char;
|
2014-03-28 16:29:55 +01:00
|
|
|
enum class PlayEventType : char;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-03-03 17:24:28 +01:00
|
|
|
// #define DEBUG_UNDO
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
#ifdef DEBUG_UNDO
|
|
|
|
#define UNDO_NAME(a) virtual const char* name() const { return a; }
|
|
|
|
#else
|
|
|
|
#define UNDO_NAME(a)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// UndoCommand
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class UndoCommand {
|
|
|
|
QList<UndoCommand*> childList;
|
|
|
|
|
2012-11-19 10:08:15 +01:00
|
|
|
protected:
|
|
|
|
virtual void flip() {}
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
virtual ~UndoCommand();
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
|
|
|
void appendChild(UndoCommand* cmd) { childList.append(cmd); }
|
|
|
|
UndoCommand* removeChild() { return childList.takeLast(); }
|
|
|
|
int childCount() const { return childList.size(); }
|
|
|
|
void unwind();
|
|
|
|
#ifdef DEBUG_UNDO
|
|
|
|
virtual const char* name() const { return "UndoCommand"; }
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// UndoStack
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class UndoStack {
|
|
|
|
UndoCommand* curCmd;
|
|
|
|
QList<UndoCommand*> list;
|
|
|
|
int curIdx;
|
|
|
|
int cleanIdx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
UndoStack();
|
|
|
|
~UndoStack();
|
|
|
|
|
|
|
|
bool active() const { return curCmd != 0; }
|
|
|
|
void beginMacro();
|
|
|
|
void endMacro(bool rollback);
|
2013-02-26 15:50:36 +01:00
|
|
|
void push(UndoCommand*); // push & execute
|
|
|
|
void push1(UndoCommand*);
|
2012-05-26 14:26:10 +02:00
|
|
|
void pop();
|
|
|
|
void setClean();
|
|
|
|
bool canUndo() const { return curIdx > 0; }
|
|
|
|
bool canRedo() const { return curIdx < list.size(); }
|
|
|
|
bool isClean() const { return cleanIdx == curIdx; }
|
|
|
|
UndoCommand* current() const { return curCmd; }
|
|
|
|
void undo();
|
|
|
|
void redo();
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// SaveState
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class SaveState : public UndoCommand {
|
|
|
|
InputState undoInputState;
|
|
|
|
InputState redoInputState;
|
|
|
|
Selection undoSelection;
|
|
|
|
Selection redoSelection;
|
|
|
|
Score* score;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SaveState(Score*);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("SaveState")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// InsertPart
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InsertPart : public UndoCommand {
|
|
|
|
Part* part;
|
|
|
|
int idx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
InsertPart(Part* p, int i);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("InsertPart")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemovePart
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemovePart : public UndoCommand {
|
|
|
|
Part* part;
|
|
|
|
int idx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemovePart(Part*, int idx);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("RemovePart")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// InsertStaff
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InsertStaff : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
int idx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
InsertStaff(Staff*, int idx);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("InsertStaff")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemoveStaff
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemoveStaff : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
int idx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoveStaff(Staff*, int idx);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("RemoveStaff")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// InsertMStaff
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InsertMStaff : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
MStaff* mstaff;
|
|
|
|
int idx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
InsertMStaff(Measure*, MStaff*, int);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("InsertMStaff")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemoveMStaff
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemoveMStaff : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
MStaff* mstaff;
|
|
|
|
int idx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoveMStaff(Measure*, MStaff*, int);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("RemoveMStaff")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// InsertMeasure
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InsertMeasure : public UndoCommand {
|
|
|
|
MeasureBase* measure;
|
|
|
|
MeasureBase* pos;
|
|
|
|
|
|
|
|
public:
|
|
|
|
InsertMeasure(MeasureBase* nm, MeasureBase* p) : measure(nm), pos(p) {}
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("InsertMeasure")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// InsertStaves
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InsertStaves : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
int a;
|
|
|
|
int b;
|
|
|
|
|
|
|
|
public:
|
|
|
|
InsertStaves(Measure*, int, int);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("InsertStaves")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemoveStaves
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemoveStaves : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
int a;
|
|
|
|
int b;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoveStaves(Measure*, int, int);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("RemoveStaves")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// SortStaves
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class SortStaves : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
QList<int> list;
|
|
|
|
QList<int> rlist;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SortStaves(Score*, QList<int>);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("SortStaves")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangePitch
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangePitch : public UndoCommand {
|
|
|
|
Note* note;
|
|
|
|
int pitch;
|
2014-04-09 09:40:25 +02:00
|
|
|
int tpc1;
|
|
|
|
int tpc2;
|
2012-05-26 14:26:10 +02:00
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-04-09 09:40:25 +02:00
|
|
|
ChangePitch(Note* note, int pitch, int tpc1, int tpc2);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangePitch")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeKeySig
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeKeySig : public UndoCommand {
|
|
|
|
KeySig* keysig;
|
|
|
|
KeySigEvent ks;
|
|
|
|
bool showCourtesy;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-03-31 13:59:48 +02:00
|
|
|
ChangeKeySig(KeySig*, KeySigEvent newKeySig, bool sc /*, bool sn*/);
|
|
|
|
UNDO_NAME("ChangeKeySig")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeMeasureLen
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeMeasureLen : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
Fraction len;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeMeasureLen(Measure*, Fraction);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeMeasureLen")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeElement
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeElement : public UndoCommand {
|
|
|
|
Element* oldElement;
|
|
|
|
Element* newElement;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeElement(Element* oldElement, Element* newElement);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeElement")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeVoltaEnding
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeVoltaEnding : public UndoCommand {
|
|
|
|
Volta* volta;
|
|
|
|
QList<int> list;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeVoltaEnding(Volta*, const QList<int>&);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeVoltaEnding")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeVoltaText
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeVoltaText : public UndoCommand {
|
|
|
|
Volta* volta;
|
|
|
|
QString text;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeVoltaText(Volta*, const QString&);
|
|
|
|
UNDO_NAME("ChangeVoltaText");
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeChordRestSize
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeChordRestSize : public UndoCommand {
|
|
|
|
ChordRest* cr;
|
|
|
|
bool small;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeChordRestSize(ChordRest*, bool small);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeChordRestSize")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeChordNoStem
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeChordNoStem : public UndoCommand {
|
|
|
|
Chord* chord;
|
|
|
|
bool noStem;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeChordNoStem(Chord*, bool noStem);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeChordNoStem")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeEndBarLineType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeEndBarLineType : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
BarLineType subtype;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeEndBarLineType(Measure*, BarLineType subtype);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeEndBarLineType")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeBarLineSpan
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeBarLineSpan : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
int span;
|
2012-10-14 00:35:11 +02:00
|
|
|
int spanFrom;
|
|
|
|
int spanTo;
|
2012-05-26 14:26:10 +02:00
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2012-10-14 00:35:11 +02:00
|
|
|
ChangeBarLineSpan(Staff*, int span, int spanFrom, int spanTo);
|
|
|
|
UNDO_NAME("ChangeBarLineSpan")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2012-10-14 19:48:36 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeSingleBarLineSpan
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeSingleBarLineSpan : public UndoCommand {
|
|
|
|
BarLine* barLine;
|
|
|
|
int span;
|
|
|
|
int spanFrom;
|
|
|
|
int spanTo;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeSingleBarLineSpan(BarLine* barLine, int span, int spanFrom, int spanTo);
|
|
|
|
UNDO_NAME("ChangeSingleBarLineSpan")
|
|
|
|
};
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeSlurOffsets
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeSlurOffsets : public UndoCommand {
|
|
|
|
SlurSegment* slur;
|
|
|
|
QPointF off[4];
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeSlurOffsets(SlurSegment* s, const QPointF& o1, const QPointF& o2,
|
|
|
|
const QPointF& o3, const QPointF& o4) : slur(s) {
|
|
|
|
off[0] = o1;
|
|
|
|
off[1] = o2;
|
|
|
|
off[2] = o3;
|
|
|
|
off[3] = o4;
|
|
|
|
}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeSlurOffsets")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// SigInsertTime
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class SigInsertTime : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
int tick;
|
|
|
|
int len;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
SigInsertTime(Score*, int tick, int len);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("SigInsertTime")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TransposeHarmony
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class TransposeHarmony : public UndoCommand {
|
|
|
|
Harmony* harmony;
|
|
|
|
int rootTpc, baseTpc;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
TransposeHarmony(Harmony*, int rootTpc, int baseTpc);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("TransposeHarmony")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ExchangeVoice
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ExchangeVoice : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
int val1, val2;
|
|
|
|
int staff1, staff2;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ExchangeVoice(Measure*, int val1, int val2, int staff1, int staff2);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ExchangeVoice")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeInstrumentShort
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeInstrumentShort : public UndoCommand {
|
|
|
|
Part* part;
|
|
|
|
int tick;
|
2014-02-11 14:27:44 +01:00
|
|
|
QList<StaffName> text;
|
2012-05-26 14:26:10 +02:00
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-02-11 14:27:44 +01:00
|
|
|
ChangeInstrumentShort(int, Part*, QList<StaffName>);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeInstrumentShort")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeInstrumentLong
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeInstrumentLong : public UndoCommand {
|
|
|
|
Part* part;
|
|
|
|
int tick;
|
2014-02-11 14:27:44 +01:00
|
|
|
QList<StaffName> text;
|
2012-05-26 14:26:10 +02:00
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-02-11 14:27:44 +01:00
|
|
|
const QList<StaffName>& longNames() const;
|
|
|
|
ChangeInstrumentLong(int, Part*, QList<StaffName>);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeInstrumentLong")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeChordRestLen
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeChordRestLen : public UndoCommand {
|
|
|
|
ChordRest* cr;
|
|
|
|
TDuration d;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeChordRestLen(ChordRest*, const TDuration& d);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeChordRestLen")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2014-02-11 17:42:22 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeChordRestDuration
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeChordRestDuration : public UndoCommand {
|
|
|
|
ChordRest* cr;
|
|
|
|
Fraction f;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeChordRestDuration(ChordRest*, const Fraction& f);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeChordRestDuration")
|
2014-02-11 17:42:22 +01:00
|
|
|
};
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// MoveElement
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class MoveElement : public UndoCommand {
|
|
|
|
Element* element;
|
|
|
|
QPointF offset;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
MoveElement(Element*, const QPointF&);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("MoveElement")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeBracketSpan
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeBracketSpan : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
int column;
|
|
|
|
int span;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeBracketSpan(Staff*, int column, int span);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeBracketSpan")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// AddElement
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class AddElement : public UndoCommand {
|
|
|
|
Element* element;
|
|
|
|
|
2014-04-15 17:01:41 +02:00
|
|
|
void endUndoRedo(bool) const;
|
2014-04-15 14:18:56 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
AddElement(Element*);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
|
|
|
#ifdef DEBUG_UNDO
|
|
|
|
virtual const char* name() const;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemoveElement
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemoveElement : public UndoCommand {
|
|
|
|
Element* element;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoveElement(Element*);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
|
|
|
#ifdef DEBUG_UNDO
|
|
|
|
virtual const char* name() const;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeConcertPitch
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeConcertPitch : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
bool val;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeConcertPitch(Score* s, bool val);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeConcertPitch")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// EditText
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class EditText : public UndoCommand {
|
|
|
|
Text* text;
|
|
|
|
QString oldText;
|
|
|
|
int undoLevel;
|
|
|
|
|
|
|
|
void undoRedo();
|
|
|
|
|
|
|
|
public:
|
|
|
|
EditText(Text* t, const QString& ot, int l) : text(t), oldText(ot), undoLevel(l) {}
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("EditText")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangePatch
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangePatch : public UndoCommand {
|
|
|
|
Channel* channel;
|
|
|
|
MidiPatch patch;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangePatch(Channel* c, const MidiPatch* pt)
|
|
|
|
: channel(c), patch(*pt) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangePitch")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangePageFormat
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangePageFormat : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
PageFormat* pf;
|
|
|
|
qreal spatium;
|
|
|
|
int pageOffset;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangePageFormat(Score*, PageFormat*, qreal sp, int po);
|
|
|
|
~ChangePageFormat();
|
|
|
|
virtual void undo() { flip(); }
|
|
|
|
virtual void redo() { flip(); }
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangePageFormat")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeStaff
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeStaff : public UndoCommand {
|
2013-04-20 01:32:28 +02:00
|
|
|
Staff* staff;
|
|
|
|
bool small;
|
|
|
|
bool invisible;
|
|
|
|
qreal userDist;
|
2013-10-26 13:47:05 +02:00
|
|
|
QColor color;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-04-30 10:08:38 +02:00
|
|
|
ChangeStaff(Staff*, bool small, bool invisible, qreal userDist, QColor _color);
|
2013-10-26 13:47:05 +02:00
|
|
|
UNDO_NAME("ChangeStaff")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2014-04-30 10:08:38 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeStaffType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeStaffType : public UndoCommand {
|
2014-05-27 01:47:30 +02:00
|
|
|
ClefTypeList initialClef;
|
|
|
|
Staff* staff;
|
|
|
|
StaffType staffType;
|
2014-04-30 10:08:38 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeStaffType(Staff* s, const StaffType& t) : staff(s), staffType(t) {}
|
2014-05-27 01:47:30 +02:00
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-04-30 10:08:38 +02:00
|
|
|
UNDO_NAME("ChangeStaffType")
|
|
|
|
};
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangePart
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangePart : public UndoCommand {
|
|
|
|
Part* part;
|
|
|
|
Instrument instrument;
|
|
|
|
QString partName;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangePart(Part*, const Instrument&, const QString& name);
|
|
|
|
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangePart")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2012-08-01 22:15:58 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangePartProperty
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangePartProperty : public UndoCommand {
|
|
|
|
Part* part;
|
|
|
|
int id;
|
|
|
|
QVariant property;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangePartProperty(Part* e, int i, const QVariant& v)
|
|
|
|
: part(e), id(i), property(v) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangePartProperty")
|
2012-08-01 22:15:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeTextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeTextStyle : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
TextStyle style;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeTextStyle(Score*, const TextStyle& style);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeTextStyle")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// AddTextStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class AddTextStyle : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
TextStyle style;
|
|
|
|
|
|
|
|
public:
|
|
|
|
AddTextStyle(Score* s, const TextStyle& st) : score(s), style(st) {}
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("AddTextStyle")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeStretch
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeStretch : public UndoCommand {
|
|
|
|
Measure* measure;
|
|
|
|
qreal stretch;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeStretch(Measure*, qreal);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeStretch")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeStyle
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeStyle : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
MStyle style;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeStyle(Score*, const MStyle&);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeStyle")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-09-28 11:24:00 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeStyleVal
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeStyleVal : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
StyleIdx idx;
|
|
|
|
QVariant value;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeStyleVal(Score* s, StyleIdx i, const QVariant& v) : score(s), idx(i), value(v) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeStyleVal")
|
2013-09-28 11:24:00 +02:00
|
|
|
};
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeChordStaffMove
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeChordStaffMove : public UndoCommand {
|
|
|
|
Chord* chord;
|
|
|
|
int staffMove;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeChordStaffMove(Chord*, int);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeChordStaffMove")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeVelocity
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeVelocity : public UndoCommand {
|
|
|
|
Note* note;
|
2014-05-07 18:09:01 +02:00
|
|
|
ValueType veloType;
|
2012-05-26 14:26:10 +02:00
|
|
|
int veloOffset;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-05-07 18:09:01 +02:00
|
|
|
ChangeVelocity(Note*, ValueType, int);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeVelocity")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeMStaffProperties
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeMStaffProperties : public UndoCommand {
|
|
|
|
MStaff* mstaff;
|
|
|
|
bool visible;
|
|
|
|
bool slashStyle;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeMStaffProperties(MStaff*, bool visible, bool slashStyle);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeMStaffProperties")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeTimesig
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeTimesig : public UndoCommand {
|
|
|
|
TimeSig* timesig;
|
|
|
|
bool showCourtesy;
|
2012-06-28 15:12:17 +02:00
|
|
|
Fraction sig;
|
|
|
|
Fraction stretch;
|
2012-05-26 14:26:10 +02:00
|
|
|
TimeSigType subtype;
|
2012-10-11 00:03:23 +02:00
|
|
|
QString numeratorString;
|
|
|
|
QString denominatorString;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2012-06-28 09:28:13 +02:00
|
|
|
ChangeTimesig(TimeSig* _timesig, bool sc, const Fraction&,
|
2012-10-11 00:03:23 +02:00
|
|
|
const Fraction&, QString, QString, TimeSigType subtype);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeTimesig")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemoveMeasures
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemoveMeasures : public UndoCommand {
|
|
|
|
Measure* fm;
|
|
|
|
Measure* lm;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoveMeasures(Measure*, Measure*);
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("RemoveMeasures")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// InsertMeasures
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InsertMeasures : public UndoCommand {
|
|
|
|
Measure* fm;
|
|
|
|
Measure* lm;
|
|
|
|
|
|
|
|
public:
|
|
|
|
InsertMeasures(Measure* m1, Measure* m2) : fm(m1), lm(m2) {}
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("InsertMeasures")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeImage
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeImage : public UndoCommand {
|
|
|
|
Image* image;
|
|
|
|
bool lockAspectRatio;
|
|
|
|
bool autoScale;
|
|
|
|
int z;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeImage(Image* i, bool l, bool a, int _z)
|
|
|
|
: image(i), lockAspectRatio(l), autoScale(a), z(_z) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeImage")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeHairpin
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeHairpin : public UndoCommand {
|
|
|
|
Hairpin* hairpin;
|
|
|
|
int veloChange;
|
2012-10-31 10:15:45 +01:00
|
|
|
Element::DynamicRange dynRange;
|
2012-05-26 14:26:10 +02:00
|
|
|
bool diagonal;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2012-10-31 10:15:45 +01:00
|
|
|
ChangeHairpin(Hairpin* h, int c, Element::DynamicRange t, bool dg)
|
|
|
|
: hairpin(h), veloChange(c), dynRange(t), diagonal(dg) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeHairpin")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeDuration
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeDuration : public UndoCommand {
|
|
|
|
ChordRest* cr;
|
|
|
|
Fraction d;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeDuration(ChordRest* _cr, Fraction _d) : cr(_cr), d(_d) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeDuration")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// AddExcerpt
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class AddExcerpt : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
|
|
|
|
public:
|
|
|
|
AddExcerpt(Score* s) : score(s) {}
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("AddExcerpt")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemoveExcerpt
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemoveExcerpt : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoveExcerpt(Score* s) : score(s) {}
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("RemoveExcerpt")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeBend
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeBend : public UndoCommand {
|
|
|
|
Bend* bend;
|
|
|
|
QList<PitchValue> points;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeBend(Bend* b, QList<PitchValue> p) : bend(b), points(p) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeBend")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeTremoloBar
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeTremoloBar : public UndoCommand {
|
|
|
|
TremoloBar* bend;
|
|
|
|
QList<PitchValue> points;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeTremoloBar(TremoloBar* b, QList<PitchValue> p) : bend(b), points(p) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeTremoloBar")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeNoteEvents
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeNoteEvents : public UndoCommand {
|
|
|
|
Chord* chord;
|
|
|
|
QList<NoteEvent*> events;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeNoteEvents(Chord* n, const QList<NoteEvent*>& l) : chord(n), events(l) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeNoteEvents")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeInstrument
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeInstrument : public UndoCommand {
|
|
|
|
InstrumentChange* is;
|
|
|
|
Instrument instrument;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeInstrument(InstrumentChange* _is, const Instrument& i) : is(_is), instrument(i) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeInstrument")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2012-09-20 11:35:34 +02:00
|
|
|
extern void updateNoteLines(Segment*, int track);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeBoxProperties
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeBoxProperties : public UndoCommand {
|
|
|
|
Box* _box;
|
|
|
|
|
|
|
|
qreal _marginLeft, _marginTop, _marginRight, _marginBottom;
|
|
|
|
Spatium _height, _width;
|
|
|
|
qreal _topGap, _bottomGap;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeBoxProperties(Box *, qreal, qreal, qreal, qreal,
|
|
|
|
Spatium, Spatium,
|
|
|
|
qreal, qreal);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeBoxProperties")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// SwapCR
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class SwapCR : public UndoCommand {
|
|
|
|
ChordRest* cr1;
|
|
|
|
ChordRest* cr2;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
SwapCR(ChordRest* a, ChordRest* b) : cr1(a), cr2(b) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("SwapCR")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeClefType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeClefType : public UndoCommand {
|
|
|
|
Clef* clef;
|
|
|
|
ClefType concertClef;
|
|
|
|
ClefType transposingClef;
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeClefType(Clef*, ClefType cl, ClefType tc);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeClef")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// MoveStaff
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class MoveStaff : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
Part* part;
|
|
|
|
int rstaff;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
MoveStaff(Staff* s, Part* p, int idx) : staff(s), part(p), rstaff(idx) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("MoveStaff")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeDurationType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeDurationType : public UndoCommand {
|
|
|
|
ChordRest* cr;
|
|
|
|
TDuration t;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeDurationType(ChordRest* _cr, TDuration _t)
|
|
|
|
: cr(_cr), t(_t) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeDurationType")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeStaffUserDist
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeStaffUserDist : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
qreal dist;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeStaffUserDist(Staff* s, qreal d)
|
|
|
|
: staff(s), dist(d) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeStaffUserDist")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeProperty
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeProperty : public UndoCommand {
|
|
|
|
Element* element;
|
|
|
|
P_ID id;
|
|
|
|
QVariant property;
|
2013-08-07 13:20:44 +02:00
|
|
|
PropertyStyle propertyStyle;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2013-08-07 13:20:44 +02:00
|
|
|
ChangeProperty(Element* e, P_ID i, const QVariant& v, PropertyStyle ps = PropertyStyle::NOSTYLE)
|
|
|
|
: element(e), id(i), property(v), propertyStyle(ps) {}
|
2012-09-05 11:49:48 +02:00
|
|
|
P_ID getId() const { return id; }
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeProperty")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeMetaText
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeMetaText : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
QString id;
|
|
|
|
QString text;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeMetaText(Score* s, const QString& i, const QString& t) : score(s), id(i), text(t) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeMetaText")
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2012-11-19 10:08:15 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeEventList
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeEventList : public UndoCommand {
|
2012-11-20 20:51:18 +01:00
|
|
|
Chord* chord;
|
|
|
|
QList<NoteEventList> events;
|
2014-03-28 16:29:55 +01:00
|
|
|
PlayEventType eventListType;
|
2012-11-19 10:08:15 +01:00
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-03-28 16:29:55 +01:00
|
|
|
ChangeEventList(Chord* c, const QList<NoteEventList> l);
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeEventList")
|
2012-11-19 10:08:15 +01:00
|
|
|
};
|
|
|
|
|
2013-04-02 20:46:07 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeSynthesizerState
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeSynthesizerState : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
SynthesizerState state;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeSynthesizerState(Score* s, const SynthesizerState& st) : score(s), state(st) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeSynthesizerState")
|
2013-04-02 20:46:07 +02:00
|
|
|
};
|
|
|
|
|
2013-06-28 17:46:24 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// RemoveBracket
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class RemoveBracket : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
int level;
|
|
|
|
BracketType type;
|
|
|
|
int span;
|
|
|
|
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
|
|
|
|
|
|
|
public:
|
|
|
|
RemoveBracket(Staff* s, int l, BracketType t, int sp) : staff(s), level(l), type(t), span(sp) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("RemoveBracket")
|
2013-06-28 17:46:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// AddBracket
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class AddBracket : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
int level;
|
|
|
|
BracketType type;
|
|
|
|
int span;
|
|
|
|
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
|
|
|
|
|
|
|
public:
|
|
|
|
AddBracket(Staff* s, int l, BracketType t, int sp) : staff(s), level(l), type(t), span(sp) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("AddBracket")
|
2013-06-28 17:46:24 +02:00
|
|
|
};
|
|
|
|
|
2013-08-22 12:18:14 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeSpannerElements
|
|
|
|
//---------------------------------------------------------
|
2013-06-28 17:46:24 +02:00
|
|
|
|
2013-08-22 12:18:14 +02:00
|
|
|
class ChangeSpannerElements : public UndoCommand {
|
|
|
|
Spanner* spanner;
|
|
|
|
Element* startElement;
|
|
|
|
Element* endElement;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeSpannerElements(Spanner* s, Element* se, Element* ee)
|
|
|
|
: spanner(s), startElement(se), endElement(ee) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeSpannerElements")
|
2013-08-22 12:18:14 +02:00
|
|
|
};
|
2013-05-13 18:49:17 +02:00
|
|
|
|
2013-10-22 12:05:31 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeParent
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeParent : public UndoCommand {
|
|
|
|
Element* element;
|
|
|
|
Element* parent;
|
|
|
|
int staffIdx;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeParent(Element* e, Element* p, int si) : element(e), parent(p), staffIdx(si) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeParent")
|
2013-10-22 12:05:31 +02:00
|
|
|
};
|
|
|
|
|
2013-10-30 14:21:08 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeMMRest
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeMMRest : public UndoCommand {
|
|
|
|
Measure* m;
|
|
|
|
Measure* mmrest;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChangeMMRest(Measure* _m, Measure* _mmr) : m(_m), mmrest(_mmr) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("ChangeMMRest")
|
2013-10-30 14:21:08 +01:00
|
|
|
};
|
|
|
|
|
2013-12-28 16:58:06 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// InsertTime
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InsertTime : public UndoCommand {
|
|
|
|
Score* score;
|
|
|
|
int tick;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
void redo();
|
|
|
|
void undo();
|
|
|
|
|
|
|
|
public:
|
2014-03-27 14:50:01 +01:00
|
|
|
InsertTime(Score* _score, int _tick, int _len)
|
|
|
|
: score(_score), tick(_tick), len(_len) {}
|
2014-05-16 13:48:03 +02:00
|
|
|
UNDO_NAME("InsertTime")
|
2013-12-28 16:58:06 +01:00
|
|
|
};
|
|
|
|
|
2014-03-27 14:50:01 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ChangeNoteEvent
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ChangeNoteEvent : public UndoCommand {
|
|
|
|
Note* note;
|
2014-03-28 16:29:55 +01:00
|
|
|
NoteEvent* oldEvent;
|
2014-03-27 14:50:01 +01:00
|
|
|
NoteEvent newEvent;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
2014-03-28 16:29:55 +01:00
|
|
|
ChangeNoteEvent(Note* n, NoteEvent* oe, const NoteEvent& ne)
|
2014-03-27 14:50:01 +01:00
|
|
|
: note(n), oldEvent(oe), newEvent(ne) {}
|
|
|
|
};
|
|
|
|
|
2014-05-08 17:59:24 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// SetClefType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class SetClefType : public UndoCommand {
|
|
|
|
Staff* staff;
|
|
|
|
int tick;
|
|
|
|
ClefTypeList ctl;
|
|
|
|
|
|
|
|
void flip();
|
|
|
|
|
|
|
|
public:
|
|
|
|
SetClefType(Staff* st, int t, const ClefTypeList& l) : staff(st), tick(t), ctl(l) {}
|
|
|
|
};
|
2014-03-27 14:50:01 +01:00
|
|
|
|
2014-05-21 20:08:37 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// Unlink
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Unlink : public UndoCommand {
|
|
|
|
Element* e;
|
|
|
|
Element* le = 0;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Unlink(Element* _e) : e(_e) {}
|
|
|
|
virtual void undo();
|
|
|
|
virtual void redo();
|
|
|
|
};
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
} // namespace Ms
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|