File indexing completed on 2024-05-12 15:58:37

0001 /*
0002  *  SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_POST_EXECUTION_UNDO_ADAPTER_H
0008 #define __KIS_POST_EXECUTION_UNDO_ADAPTER_H
0009 
0010 #include <kritaimage_export.h>
0011 #include "kis_types.h"
0012 
0013 class KUndo2MagicString;
0014 class KisUndoStore;
0015 class KisSavedMacroCommand;
0016 class KisStrokesFacade;
0017 
0018 
0019 /**
0020  * KisPostExecutionUndoAdapter -- used by the strokes. It doesn't
0021  * call redo() when you add a command. It is assumed, that you have
0022  * already executed the command yourself and now just notify
0023  * the system about it. Warning: it doesn't inherit KisUndoAdapter
0024  * because it doesn't fit the contract of this class. And, more
0025  * important, KisTransaction should work differently with this class.
0026  */
0027 class KRITAIMAGE_EXPORT KisPostExecutionUndoAdapter
0028 {
0029 public:
0030     KisPostExecutionUndoAdapter(KisUndoStore *undoStore, KisStrokesFacade *strokesFacade);
0031 
0032     void addCommand(KUndo2CommandSP command);
0033 
0034     KisSavedMacroCommand* createMacro(const KUndo2MagicString& macroName);
0035     void addMacro(KisSavedMacroCommand *macro);
0036 
0037     void setUndoStore(KisUndoStore *undoStore);
0038     KisStrokesFacade* strokesFacade() const;
0039 
0040 private:
0041     KisUndoStore *m_undoStore;
0042     KisStrokesFacade *m_strokesFacade;
0043 };
0044 
0045 #endif /* __KIS_POST_EXECUTION_UNDO_ADAPTER_H */