1 | // Aseprite |
2 | // Copyright (C) 2018-2022 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_DOC_OBSERVER_H_INCLUDED |
9 | #define APP_DOC_OBSERVER_H_INCLUDED |
10 | #pragma once |
11 | |
12 | namespace app { |
13 | class Doc; |
14 | class DocEvent; |
15 | |
16 | class DocObserver { |
17 | public: |
18 | virtual ~DocObserver() { } |
19 | |
20 | virtual void onCloseDocument(Doc* doc) { } |
21 | virtual void onFileNameChanged(Doc* doc) { } |
22 | |
23 | // General update. If an observer receives this event, it's because |
24 | // anything in the document could be changed. |
25 | virtual void onGeneralUpdate(DocEvent& ev) { } |
26 | |
27 | virtual void onColorSpaceChanged(DocEvent& ev) { } |
28 | virtual void onPixelFormatChanged(DocEvent& ev) { } |
29 | virtual void onPaletteChanged(DocEvent& ev) { } |
30 | |
31 | virtual void onAddLayer(DocEvent& ev) { } |
32 | virtual void onAddFrame(DocEvent& ev) { } |
33 | virtual void onAddCel(DocEvent& ev) { } |
34 | virtual void onAddSlice(DocEvent& ev) { } |
35 | virtual void onAddTag(DocEvent& ev) { } |
36 | |
37 | virtual void onBeforeRemoveLayer(DocEvent& ev) { } |
38 | virtual void onAfterRemoveLayer(DocEvent& ev) { } |
39 | |
40 | // Called when a frame is removed. It's called after the frame was |
41 | // removed, and the sprite's total number of frames is modified. |
42 | virtual void onRemoveFrame(DocEvent& ev) { } |
43 | virtual void onRemoveTag(DocEvent& ev) { } |
44 | virtual void onBeforeRemoveCel(DocEvent& ev) { } |
45 | virtual void onAfterRemoveCel(DocEvent& ev) { } |
46 | virtual void onRemoveSlice(DocEvent& ev) { } |
47 | |
48 | virtual void onSpriteSizeChanged(DocEvent& ev) { } |
49 | virtual void onSpriteTransparentColorChanged(DocEvent& ev) { } |
50 | virtual void onSpritePixelRatioChanged(DocEvent& ev) { } |
51 | virtual void onSpriteGridBoundsChanged(DocEvent& ev) { } |
52 | |
53 | virtual void onLayerNameChange(DocEvent& ev) { } |
54 | virtual void onLayerOpacityChange(DocEvent& ev) { } |
55 | virtual void onLayerBlendModeChange(DocEvent& ev) { } |
56 | virtual void onLayerRestacked(DocEvent& ev) { } |
57 | virtual void onLayerMergedDown(DocEvent& ev) { } |
58 | |
59 | virtual void onCelMoved(DocEvent& ev) { } |
60 | virtual void onCelCopied(DocEvent& ev) { } |
61 | virtual void onCelFrameChanged(DocEvent& ev) { } |
62 | virtual void onCelPositionChanged(DocEvent& ev) { } |
63 | virtual void onCelOpacityChange(DocEvent& ev) { } |
64 | |
65 | virtual void onUserDataChange(DocEvent& ev) { } |
66 | |
67 | virtual void onFrameDurationChanged(DocEvent& ev) { } |
68 | |
69 | virtual void onImagePixelsModified(DocEvent& ev) { } |
70 | virtual void onSpritePixelsModified(DocEvent& ev) { } |
71 | virtual void onExposeSpritePixels(DocEvent& ev) { } |
72 | |
73 | // When the number of total frames available is modified. |
74 | virtual void onTotalFramesChanged(DocEvent& ev) { } |
75 | |
76 | // The selection has changed. |
77 | virtual void onSelectionChanged(DocEvent& ev) { } |
78 | virtual void onSelectionBoundariesChanged(DocEvent& ev) { } |
79 | |
80 | // When the tag range changes |
81 | virtual void onTagChange(DocEvent& ev) { } |
82 | |
83 | // When the tag is renamed |
84 | virtual void onTagRename(DocEvent& ev) { } |
85 | |
86 | // Slices |
87 | virtual void onSliceNameChange(DocEvent& ev) { } |
88 | |
89 | // The tileset has changed. |
90 | virtual void onTilesetChanged(DocEvent& ev) { } |
91 | |
92 | }; |
93 | |
94 | } // namespace app |
95 | |
96 | #endif |
97 | |