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 mAttachedFileName = k2.mAttachedFileName;
31 // intentionally not copying event listeners
32}
33
34KeyFrame::~KeyFrame()
35{
36 for (KeyFrameEventListener* listener : mEventListeners)
37 {
38 listener->onKeyFrameDestroy(this);
39 }
40}
41
42KeyFrame& KeyFrame::operator=(const KeyFrame& k2)
43{
44 if (this == &k2)
45 {
46 return *this; // a self-assignment
47 }
48
49 mFrame = k2.mFrame;
50 mLength = k2.mLength;
51 mIsModified = k2.mIsModified;
52 mAttachedFileName = k2.mAttachedFileName;
53 // intentionally not copying event listeners
54 return *this;
55}
56
57void KeyFrame::addEventListener(KeyFrameEventListener* listener)
58{
59 auto it = std::find(mEventListeners.begin(), mEventListeners.end(), listener);
60 if (it == mEventListeners.end())
61 {
62 mEventListeners.push_back(listener);
63 }
64}
65
66void KeyFrame::removeEventListner(KeyFrameEventListener* listener)
67{
68 auto it = std::find(mEventListeners.begin(), mEventListeners.end(), listener);
69 if (it != mEventListeners.end())
70 {
71 mEventListeners.erase(it);
72 }
73}
KeyFrameEventListener
Definition: keyframe.h:71
KeyFrame
Definition: keyframe.h:30
Generated on Thu Jun 5 2025 14:06:43 for Pencil2D by doxygen 1.9.6 based on revision 4c63407997b2c03e5048716586dec6fbbb755173