| 1 | // Aseprite | 
|---|
| 2 | // Copyright (C) 2019  Igara Studio S.A. | 
|---|
| 3 | // | 
|---|
| 4 | // This program is distributed under the terms of | 
|---|
| 5 | // the End-User License Agreement for Aseprite. | 
|---|
| 6 |  | 
|---|
| 7 | #ifndef APP_CMD_SET_GRID_BOUNDS_H_INCLUDED | 
|---|
| 8 | #define APP_CMD_SET_GRID_BOUNDS_H_INCLUDED | 
|---|
| 9 | #pragma once | 
|---|
| 10 |  | 
|---|
| 11 | #include "app/cmd.h" | 
|---|
| 12 | #include "app/cmd/with_sprite.h" | 
|---|
| 13 | #include "gfx/rect.h" | 
|---|
| 14 |  | 
|---|
| 15 | namespace doc { | 
|---|
| 16 | class Sprite; | 
|---|
| 17 | } | 
|---|
| 18 |  | 
|---|
| 19 | namespace app { | 
|---|
| 20 | namespace cmd { | 
|---|
| 21 |  | 
|---|
| 22 | class SetGridBounds : public Cmd | 
|---|
| 23 | , public WithSprite { | 
|---|
| 24 | public: | 
|---|
| 25 | SetGridBounds(doc::Sprite* sprite, const gfx::Rect& bounds); | 
|---|
| 26 |  | 
|---|
| 27 | protected: | 
|---|
| 28 | void onExecute() override; | 
|---|
| 29 | void onUndo() override; | 
|---|
| 30 | void onFireNotifications() override; | 
|---|
| 31 | size_t onMemSize() const override { | 
|---|
| 32 | return sizeof(*this); | 
|---|
| 33 | } | 
|---|
| 34 |  | 
|---|
| 35 | private: | 
|---|
| 36 | void setGrid(const gfx::Rect& grid); | 
|---|
| 37 |  | 
|---|
| 38 | gfx::Rect m_oldBounds; | 
|---|
| 39 | gfx::Rect m_newBounds; | 
|---|
| 40 | }; | 
|---|
| 41 |  | 
|---|
| 42 | } // namespace cmd | 
|---|
| 43 | } // namespace app | 
|---|
| 44 |  | 
|---|
| 45 | #endif | 
|---|
| 46 |  | 
|---|