00001 /* === S Y N F I G ========================================================= */ 00021 /* ========================================================================= */ 00022 00023 /* === S T A R T =========================================================== */ 00024 00025 #ifndef __SYNFIG_KEYFRAME_H 00026 #define __SYNFIG_KEYFRAME_H 00027 00028 /* === H E A D E R S ======================================================= */ 00029 00030 #include <ETL/handle> 00031 #include <vector> 00032 #include "string.h" 00033 #include "time.h" 00034 #include "uniqueid.h" 00035 #include "guid.h" 00036 00037 /* === M A C R O S ========================================================= */ 00038 00039 /* === T Y P E D E F S ===================================================== */ 00040 00041 /* === C L A S S E S & S T R U C T S ======================================= */ 00042 00043 namespace synfig { 00044 00046 class Keyframe : public UniqueID 00047 { 00048 public: 00049 00050 Time time_; 00051 String desc_; 00052 GUID guid_; 00053 00054 public: 00055 00056 Keyframe(); 00057 00058 Keyframe(const Time &time); 00059 00060 ~Keyframe(); 00061 00062 void set_time(Time x) { time_=x; } 00063 00064 Time get_time()const { return time_; } 00065 00066 void set_description(String x) { desc_=x; } 00067 00068 String get_description()const { return desc_; } 00069 00070 const GUID& get_guid()const { return guid_; } 00071 void set_guid(const GUID& x) { guid_=x; } 00072 00073 using UniqueID::operator<; 00074 using UniqueID::operator==; 00075 using UniqueID::operator!=; 00076 using UniqueID::operator=; 00077 00078 bool operator<(const Keyframe &rhs)const { return time_<rhs.time_; } 00079 bool operator<(const Time &rhs)const { return time_<rhs; } 00080 00081 // bool operator==(const Keyframe &rhs)const { return id_==rhs.id_; } 00082 bool operator==(const Time &rhs)const { return time_==rhs; } 00083 00084 // bool operator!=(const Keyframe &rhs)const { return id_!=rhs.id_; } 00085 bool operator!=(const Time &rhs)const { return time_!=rhs; } 00086 }; // END of class Keyframe 00087 00088 class KeyframeList : public std::vector<Keyframe> 00089 { 00090 00091 public: 00092 00093 iterator add(const Keyframe &x); 00094 00095 void erase(const UniqueID &x); 00096 00097 iterator find(const UniqueID &x); 00098 00099 const_iterator find(const UniqueID &x)const; 00100 00102 iterator find(const Time &x); 00103 00105 iterator find_next(const Time &x); 00106 00108 iterator find_prev(const Time &x); 00109 00110 const_iterator find(const Time &x)const; 00111 const_iterator find_next(const Time &x)const; 00112 const_iterator find_prev(const Time &x)const; 00113 00114 void find_prev_next(const Time& time, Time &prev, Time &next)const; 00115 00116 void insert_time(const Time& location, const Time& delta); 00117 00118 void dump()const; 00119 void sync(); 00120 }; 00121 00122 //typedef std::list<Keyframe> KeyframeList; 00123 00124 }; // END of namespace synfig 00125 00126 /* === E N D =============================================================== */ 00127 00128 #endif