forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocument_event.h
More file actions
84 lines (70 loc) · 2.19 KB
/
document_event.h
File metadata and controls
84 lines (70 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Aseprite Document Library
// Copyright (c) 2001-2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef DOC_DOCUMENT_EVENT_H_INCLUDED
#define DOC_DOCUMENT_EVENT_H_INCLUDED
#pragma once
#include "gfx/region.h"
#include "doc/frame.h"
namespace doc {
class Cel;
class Image;
class Layer;
class LayerImage;
class Sprite;
}
namespace doc {
class Document;
using namespace doc;
class DocumentEvent {
public:
DocumentEvent(Document* document)
: m_document(document)
, m_sprite(NULL)
, m_layer(NULL)
, m_cel(NULL)
, m_image(NULL)
, m_imageIndex(-1)
, m_frame(0)
, m_targetLayer(NULL)
, m_targetFrame(0) {
}
// Source of the event.
Document* document() const { return m_document; }
Sprite* sprite() const { return m_sprite; }
Layer* layer() const { return m_layer; }
Cel* cel() const { return m_cel; }
Image* image() const { return m_image; }
int imageIndex() const { return m_imageIndex; }
frame_t frame() const { return m_frame; }
const gfx::Region& region() const { return m_region; }
void sprite(Sprite* sprite) { m_sprite = sprite; }
void layer(Layer* layer) { m_layer = layer; }
void cel(Cel* cel) { m_cel = cel; }
void image(Image* image) { m_image = image; }
void imageIndex(int imageIndex) { m_imageIndex = imageIndex; }
void frame(frame_t frame) { m_frame = frame; }
void region(const gfx::Region& rgn) { m_region = rgn; }
// Destination of the operation.
Layer* targetLayer() const { return m_targetLayer; }
frame_t targetFrame() const { return m_targetFrame; }
void targetLayer(Layer* layer) { m_targetLayer = layer; }
void targetFrame(frame_t frame) { m_targetFrame = frame; }
private:
Document* m_document;
Sprite* m_sprite;
Layer* m_layer;
Cel* m_cel;
Image* m_image;
int m_imageIndex;
frame_t m_frame;
gfx::Region m_region;
// For copy/move commands, the m_layer/m_frame are source of the
// operation, and these are the destination of the operation.
Layer* m_targetLayer;
frame_t m_targetFrame;
};
} // namespace app
#endif