18#ifndef UNDOREDOMANAGER_H
19#define UNDOREDOMANAGER_H
21#include "basemanager.h"
25#include "preferencesdef.h"
42using SAVESTATE_ID = int;
45enum class UndoRedoRecordType {
59 const qreal rotationAngle,
66 this->rotationAngle = rotationAngle;
67 this->scaleX = scaleX;
68 this->scaleY = scaleY;
69 this->translation = translation;
70 this->anchor = anchor;
74 qreal rotationAngle = 0.0;
87 this->offset = offset;
88 this->positions = positions;
108 UndoRedoRecordType recordType = UndoRedoRecordType::INVALID;
110 int currentFrameIndex = 0;
111 Layer::LAYER_TYPE layerType = Layer::UNDEFINED;
112 std::unique_ptr<KeyFrame> keyframe;
126 bool init()
override;
135 void record(SAVESTATE_ID SaveStateId,
const QString& description);
144 SAVESTATE_ID
createState(UndoRedoRecordType recordType);
156 void updateUndoAction(
QAction* undoAction);
157 void updateRedoAction(
QAction* redoAction);
166 void legacyBackup(
const QString& undoText);
167 bool legacyBackup(
int backupLayer,
int backupFrame,
const QString& undoText);
179 void restoreLegacyKey();
181 void rememberLastModifiedFrame(
int layerNumber,
int frameNumber);
183 void onSettingChanged(SETTING setting);
186 void didUpdateUndoStack();
198 void initCommonKeyFrameState(
UndoSaveState* undoSaveState)
const;
203 void clearSaveStates();
213 int mLegacyBackupIndex = -1;
217 int mLegacyLastModifiedLayer = -1;
218 int mLegacyLastModifiedFrame = -1;
220 SAVESTATE_ID mSaveStateId = 1;
222 bool mNewBackupSystemEnabled =
false;
bool hasUnsavedChanges() const
Checks whether there are unsaved changes.
void sanitizeLegacyBackupElementsAfterLayerDeletion(int layerIndex)
Restores integrity of the backup elements after a layer has been deleted.
void addUserState(SAVESTATE_ID SaveStateId, const UserSaveState &userState)
Adds userState to the saveState found at SaveStateId If no record is found matching the id,...
void record(SAVESTATE_ID SaveStateId, const QString &description)
Records the given save state.
SAVESTATE_ID createState(UndoRedoRecordType recordType)
Prepares and returns an save state with common data.
void clearStack()
Clears the undo stack.
QObject * parent() const const
This is the main undo/redo state structure which is meant to populate whatever states that needs to b...
Use this struct to store user related data that will later be added to the backup This struct is mean...