1 /* 2 * Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __KIS_MACRO_BASED_UNDO_STORE_H 20 #define __KIS_MACRO_BASED_UNDO_STORE_H 21 22 #include <QScopedPointer> 23 #include "kis_undo_store.h" 24 25 class KisSavedMacroCommand; 26 27 28 /** 29 * This undo store is supposed to be stacked with a KisPostExecutionUndoAdapter. 30 * 31 * That chain looks like: 32 * KisPostExecutionUndoAdapter -> 33 * KisMacroBasedUndoStore -> 34 * KisSavedMacroCommand; 35 * 36 * So the store calls redo() on every command that is added via 37 * addCommand(); 38 */ 39 class KisMacroBasedUndoStore : public KisUndoStore 40 { 41 public: 42 KisMacroBasedUndoStore(KisSavedMacroCommand *command); 43 ~KisMacroBasedUndoStore() override; 44 45 const KUndo2Command* presentCommand() override; 46 void undoLastCommand() override; 47 void addCommand(KUndo2Command *cmd) override; 48 void beginMacro(const KUndo2MagicString& macroName) override; 49 void endMacro() override; 50 void purgeRedoState() override; 51 52 private: 53 struct Private; 54 const QScopedPointer<Private> m_d; 55 }; 56 57 #endif /* __KIS_MACRO_BASED_UNDO_STORE_H */ 58