1// Aseprite
2// Copyright (C) 2001-2018 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_FRAME_H_INCLUDED
8#define APP_CMD_ADD_FRAME_H_INCLUDED
9#pragma once
10
11#include "app/cmd.h"
12#include "app/cmd/add_cel.h"
13#include "app/cmd/with_sprite.h"
14#include "doc/frame.h"
15
16#include <memory>
17
18namespace doc {
19 class Sprite;
20}
21
22namespace app {
23namespace cmd {
24 using namespace doc;
25
26 class AddFrame : public Cmd
27 , public WithSprite {
28 public:
29 AddFrame(Sprite* sprite, frame_t frame);
30
31 protected:
32 void onExecute() override;
33 void onUndo() override;
34 size_t onMemSize() const override {
35 return sizeof(*this) +
36 (m_addCel ? m_addCel->memSize() : 0);
37 }
38
39 private:
40 void moveFrames(Layer* layer, frame_t fromThis, frame_t delta);
41
42 frame_t m_newFrame;
43 std::unique_ptr<AddCel> m_addCel;
44 };
45
46} // namespace cmd
47} // namespace app
48
49#endif
50