File indexing completed on 2024-12-22 04:10:01

0001 /*
0002  *  SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
0003  *  SPDX-FileCopyrightText: 2007 Sven Langkamp <sven.langkamp@gmail.com>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef KIS_IMAGE_LAYER_ADD_COMMAND_H_
0009 #define KIS_IMAGE_LAYER_ADD_COMMAND_H_
0010 
0011 #include <kritaimage_export.h>
0012 
0013 #include "kis_types.h"
0014 #include "kis_image_command.h"
0015 
0016 
0017 /// The command for adding a layer
0018 class KRITAIMAGE_EXPORT KisImageLayerAddCommand : public KisImageCommand
0019 {
0020 
0021 public:
0022     /**
0023      * Constructor
0024      * @param image The image the command will be working on.
0025      * @param layer The layer to add
0026      * @param parent The parent node
0027      * @param aboveThis The node above this
0028      * @param doRedoUpdates Whether to make the redo updates
0029      * @param doUndoUpdates Whether to make the undo updates
0030      */
0031     KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, KisNodeSP aboveThis, bool doRedoUpdates = true, bool doUndoUpdates = true);
0032     KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index, bool doRedoUpdates = true, bool doUndoUpdates = true);
0033 
0034     void redo() override;
0035     void undo() override;
0036 
0037 private:
0038     KisNodeSP m_layer;
0039     KisNodeSP m_parent;
0040     KisNodeSP m_aboveThis;
0041     quint32 m_index;
0042     bool m_doRedoUpdates;
0043     bool m_doUndoUpdates;
0044 };
0045 #endif