1 // Aseprite
2 // Copyright (C) 2001-2016  David Capello
3 //
4 // This program is distributed under the terms of
5 // the End-User License Agreement for Aseprite.
6 
7 #ifndef APP_CMD_ADD_CEL_H_INCLUDED
8 #define APP_CMD_ADD_CEL_H_INCLUDED
9 #pragma once
10 
11 #include "app/cmd.h"
12 #include "app/cmd/with_cel.h"
13 #include "app/cmd/with_layer.h"
14 
15 #include <sstream>
16 
17 namespace doc {
18   class Cel;
19   class Layer;
20 }
21 
22 namespace app {
23 namespace cmd {
24   using namespace doc;
25 
26   class AddCel : public Cmd
27                , public WithLayer
28                , public WithCel {
29   public:
30     AddCel(Layer* layer, Cel* cel);
31 
32   protected:
33     void onExecute() override;
34     void onUndo() override;
35     void onRedo() override;
onMemSize()36     size_t onMemSize() const override {
37       return sizeof(*this) + m_size;
38     }
39 
40   private:
41     void addCel(Layer* layer, Cel* cel);
42     void removeCel(Layer* layer, Cel* cel);
43 
44     size_t m_size;
45     std::stringstream m_stream;
46   };
47 
48 } // namespace cmd
49 } // namespace app
50 
51 #endif
52