1 /* 2 * Copyright (c) 2011 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_UNDO_STORES_H 20 #define __KIS_UNDO_STORES_H 21 22 #include "kis_undo_store.h" 23 24 class KUndo2Stack; 25 class KUndo2MagicString; 26 27 28 /** 29 * KisSurrogateUndoAdapter -- saves commands directly to the 30 * internal stack. Used for wrapping around legacy code into 31 * a single command. 32 */ 33 class KRITACOMMAND_EXPORT KisSurrogateUndoStore : public KisUndoStore 34 { 35 public: 36 KisSurrogateUndoStore(); 37 ~KisSurrogateUndoStore() override; 38 39 const KUndo2Command* presentCommand() override; 40 void undoLastCommand() override; 41 void addCommand(KUndo2Command *cmd) override; 42 void beginMacro(const KUndo2MagicString& macroName) override; 43 void endMacro() override; 44 45 void undo(); 46 void redo(); 47 48 void undoAll(); 49 void redoAll(); 50 51 void purgeRedoState() override; 52 53 void clear(); 54 55 private: 56 KUndo2Stack *m_undoStack; 57 }; 58 59 /** 60 * @brief The KisDumbUndoStore class doesn't actually save commands, 61 * so you cannot undo or redo! 62 */ 63 class KRITACOMMAND_EXPORT KisDumbUndoStore : public KisUndoStore 64 { 65 public: 66 const KUndo2Command* presentCommand() override; 67 void undoLastCommand() override; 68 void addCommand(KUndo2Command *cmd) override; 69 void beginMacro(const KUndo2MagicString& macroName) override; 70 void endMacro() override; 71 void purgeRedoState() override; 72 }; 73 74 #endif /* __KIS_UNDO_STORES_H */ 75