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_MOVE_COMMAND_H_
0009 #define KIS_IMAGE_LAYER_MOVE_COMMAND_H_
0010 
0011 #include <kritaimage_export.h>
0012 
0013 #include <QSize>
0014 #include <QBitArray>
0015 #include "kis_types.h"
0016 #include "kis_image_command.h"
0017 
0018 /// The command for layer moves inside the layer stack
0019 class KRITAIMAGE_EXPORT KisImageLayerMoveCommand : public KisImageCommand
0020 {
0021 
0022 
0023 public:
0024     /**
0025      * Command for layer moves inside the layer stack
0026      *
0027      * @param image the image
0028      * @param node the moved node
0029      * @param newParent the next parent of the layer
0030      * @param newAbove the layer that will be below the layer after the move
0031      * @param doUpdates whether to do updates
0032      */
0033     KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, KisNodeSP newAbove, bool doUpdates = true);
0034     KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, quint32 index);
0035 
0036     void redo() override;
0037     void undo() override;
0038 
0039 private:
0040     KisNodeSP m_layer;
0041     KisNodeSP m_prevParent;
0042     KisNodeSP m_prevAbove;
0043     KisNodeSP m_newParent;
0044     KisNodeSP m_newAbove;
0045     quint32 m_index;
0046 
0047     bool m_useIndex;
0048     bool m_doUpdates;
0049 };
0050 
0051 #endif