1 /*
2  *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
3  *  Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef KIS_IMAGE_LAYER_ADD_COMMAND_H_
21 #define KIS_IMAGE_LAYER_ADD_COMMAND_H_
22 
23 #include <kritaimage_export.h>
24 
25 #include "kis_types.h"
26 #include "kis_image_command.h"
27 
28 
29 /// The command for adding a layer
30 class KRITAIMAGE_EXPORT KisImageLayerAddCommand : public KisImageCommand
31 {
32 
33 public:
34     /**
35      * Constructor
36      * @param image The image the command will be working on.
37      * @param layer The layer to add
38      * @param parent The parent node
39      * @param aboveThis The node above this
40      * @param doRedoUpdates Whether to make the redo updates
41      * @param doUndoUpdates Whether to make the undo updates
42      */
43     KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, KisNodeSP aboveThis, bool doRedoUpdates = true, bool doUndoUpdates = true);
44     KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index, bool doRedoUpdates = true, bool doUndoUpdates = true);
45 
46     void redo() override;
47     void undo() override;
48 
49 private:
50     KisNodeSP m_layer;
51     KisNodeSP m_parent;
52     KisNodeSP m_aboveThis;
53     quint32 m_index;
54     bool m_doRedoUpdates;
55     bool m_doUndoUpdates;
56 };
57 #endif
58