File indexing completed on 2024-05-12 15:58:45
0001 /* 0002 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KIS_TRANSACTION_DATA_H_ 0008 #define KIS_TRANSACTION_DATA_H_ 0009 0010 #include <kundo2command.h> 0011 #include "kis_types.h" 0012 #include <kritaimage_export.h> 0013 0014 class KisTransactionWrapperFactory; 0015 0016 /** 0017 * A tile based undo command. 0018 * 0019 * Ordinary KUndo2Command subclasses store parameters and apply the action in 0020 * the redo() command, however, Krita doesn't work like this. Undo replaces 0021 * the current tiles in a paint device with the old tiles, redo replaces them 0022 * again with the new tiles without actually executing the command that changed 0023 * the image data again. 0024 */ 0025 class KRITAIMAGE_EXPORT KisTransactionData : public KUndo2Command 0026 { 0027 public: 0028 KisTransactionData(const KUndo2MagicString& name, KisPaintDeviceSP device, bool resetSelectionOutlineCache, KisTransactionWrapperFactory *interstrokeDataFactory, KUndo2Command* parent, bool suppressUpdates); 0029 ~KisTransactionData() override; 0030 0031 public: 0032 void redo() override; 0033 void undo() override; 0034 0035 virtual void endTransaction(); 0036 0037 protected: 0038 virtual void saveSelectionOutlineCache(); 0039 virtual void restoreSelectionOutlineCache(bool undo); 0040 0041 private: 0042 void init(KisPaintDeviceSP device); 0043 void startUpdates(); 0044 void possiblyNotifySelectionChanged(); 0045 void possiblyResetOutlineCache(); 0046 void possiblyFlattenSelection(KisPaintDeviceSP device); 0047 void doFlattenUndoRedo(bool undo); 0048 0049 private: 0050 class Private; 0051 Private * const m_d; 0052 }; 0053 0054 #endif /* KIS_TRANSACTION_DATA_H_ */ 0055