1// Aseprite
2// Copyright (C) 2019 Igara Studio S.A.
3// Copyright (C) 2017 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_CMD_ADD_SLICE_H_INCLUDED
9#define APP_CMD_ADD_SLICE_H_INCLUDED
10#pragma once
11
12#include "app/cmd.h"
13#include "app/cmd/with_slice.h"
14#include "app/cmd/with_sprite.h"
15
16#include <sstream>
17
18namespace app {
19namespace cmd {
20 using namespace doc;
21
22 class AddSlice : public Cmd
23 , public WithSprite
24 , public WithSlice {
25 public:
26 AddSlice(Sprite* sprite, Slice* slice);
27
28 protected:
29 void onExecute() override;
30 void onUndo() override;
31 void onRedo() override;
32 size_t onMemSize() const override {
33 return sizeof(*this) + m_size;
34 }
35
36 private:
37 void addSlice(Sprite* sprite, Slice* slice);
38 void removeSlice(Sprite* sprite, Slice* slice);
39
40 size_t m_size;
41 std::stringstream m_stream;
42 };
43
44} // namespace cmd
45} // namespace app
46
47#endif
48