| 1 | // Aseprite |
| 2 | // Copyright (C) 2019 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2018 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_SET_MASK_H_INCLUDED |
| 9 | #define APP_CMD_SET_MASK_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "app/cmd.h" |
| 13 | #include "app/cmd/with_document.h" |
| 14 | |
| 15 | #include <memory> |
| 16 | #include <sstream> |
| 17 | |
| 18 | namespace doc { |
| 19 | class Mask; |
| 20 | } |
| 21 | |
| 22 | namespace app { |
| 23 | namespace cmd { |
| 24 | using namespace doc; |
| 25 | |
| 26 | class SetMask : public Cmd |
| 27 | , public WithDocument { |
| 28 | public: |
| 29 | SetMask(Doc* doc, const Mask* newMask); |
| 30 | |
| 31 | // Used to change the new mask used in the onRedo() |
| 32 | void setNewMask(const Mask* newMask); |
| 33 | |
| 34 | protected: |
| 35 | void onExecute() override; |
| 36 | void onUndo() override; |
| 37 | size_t onMemSize() const override; |
| 38 | |
| 39 | private: |
| 40 | void setMask(const Mask* mask); |
| 41 | |
| 42 | std::unique_ptr<Mask> m_oldMask; |
| 43 | std::unique_ptr<Mask> m_newMask; |
| 44 | }; |
| 45 | |
| 46 | } // namespace cmd |
| 47 | } // namespace app |
| 48 | |
| 49 | #endif |
| 50 | |