| 1 | // Aseprite | 
|---|
| 2 | // Copyright (C) 2017  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_SET_SLICE_NAME_H_INCLUDED | 
|---|
| 8 | #define APP_CMD_SET_SLICE_NAME_H_INCLUDED | 
|---|
| 9 | #pragma once | 
|---|
| 10 |  | 
|---|
| 11 | #include "app/cmd.h" | 
|---|
| 12 | #include "app/cmd/with_slice.h" | 
|---|
| 13 |  | 
|---|
| 14 | #include <string> | 
|---|
| 15 |  | 
|---|
| 16 | namespace app { | 
|---|
| 17 | namespace cmd { | 
|---|
| 18 | using namespace doc; | 
|---|
| 19 |  | 
|---|
| 20 | class SetSliceName : public Cmd | 
|---|
| 21 | , public WithSlice { | 
|---|
| 22 | public: | 
|---|
| 23 | SetSliceName(Slice* slice, const std::string& name); | 
|---|
| 24 |  | 
|---|
| 25 | protected: | 
|---|
| 26 | void onExecute() override; | 
|---|
| 27 | void onUndo() override; | 
|---|
| 28 | void onFireNotifications() override; | 
|---|
| 29 | size_t onMemSize() const override { | 
|---|
| 30 | return sizeof(*this) | 
|---|
| 31 | + m_oldName.size() | 
|---|
| 32 | + m_newName.size(); | 
|---|
| 33 | } | 
|---|
| 34 |  | 
|---|
| 35 | std::string m_oldName; | 
|---|
| 36 | std::string m_newName; | 
|---|
| 37 | }; | 
|---|
| 38 |  | 
|---|
| 39 | } // namespace cmd | 
|---|
| 40 | } // namespace app | 
|---|
| 41 |  | 
|---|
| 42 | #endif | 
|---|
| 43 |  | 
|---|