Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • structure
keyframe.cpp
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17
18#include "keyframe.h"
19
20
21KeyFrame::KeyFrame()
22{
23}
24
25KeyFrame::KeyFrame(const KeyFrame& k2)
26{
27 mFrame = k2.mFrame;
28 mLength = k2.mLength;
29 mIsModified = k2.mIsModified;
30 mIsSelected = k2.mIsSelected;
31 mAttachedFileName = k2.mAttachedFileName;
32 // intentionally not copying event listeners
33}
34
35KeyFrame::~KeyFrame()
36{
37 for (KeyFrameEventListener* listener : mEventListeners)
38 {
39 listener->onKeyFrameDestroy(this);
40 }
41}
42
43KeyFrame& KeyFrame::operator=(const KeyFrame& k2)
44{
45 if (this == &k2)
46 {
47 return *this; // a self-assignment
48 }
49
50 mFrame = k2.mFrame;
51 mLength = k2.mLength;
52 mIsModified = k2.mIsModified;
53 mIsSelected = k2.mIsSelected;
54 mAttachedFileName = k2.mAttachedFileName;
55 // intentionally not copying event listeners
56 return *this;
57}
58
59void KeyFrame::addEventListener(KeyFrameEventListener* listener)
60{
61 auto it = std::find(mEventListeners.begin(), mEventListeners.end(), listener);
62 if (it == mEventListeners.end())
63 {
64 mEventListeners.push_back(listener);
65 }
66}
67
68void KeyFrame::removeEventListner(KeyFrameEventListener* listener)
69{
70 auto it = std::find(mEventListeners.begin(), mEventListeners.end(), listener);
71 if (it != mEventListeners.end())
72 {
73 mEventListeners.erase(it);
74 }
75}
KeyFrameEventListener
Definition: keyframe.h:75
KeyFrame
Definition: keyframe.h:30
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39