00001 //------------------------------------------------------------------------- 00002 // 00003 // File: KeyC.h 00004 // Desc: Keyframe class. 00005 // Author: memon <memon@inside.org> 00006 // 00007 //------------------------------------------------------------------------- 00008 // Copyright (c) 2000-2002 Moppi Productions. All Rights Reserved. 00009 // This file is part of Moppi Demopaja SDK. For conditions of 00010 // distribution and use, see the accompanying license.txt file. 00011 // http://moppi.inside.org/demopaja/ 00012 //------------------------------------------------------------------------- 00013 00014 #ifndef __DEMOPAJA_KEYC_H__ 00015 #define __DEMOPAJA_KEYC_H__ 00016 00017 00018 #include "DataBlockI.h" 00019 #include "EditableI.h" 00020 #include "UndoC.h" 00021 #include "PajaTypes.h" 00022 #include <vector> 00023 #include "FileIO.h" 00024 #include "FileHandleC.h" 00025 00026 namespace Composition { 00027 00029 00032 const PajaTypes::uint32 KEY_MAXCHANNELS = 4; 00033 00035 enum KeyFlagsE { 00036 KEY_NOFLAGS = 0, 00037 KEY_SELECTED = 0x0001, 00038 KEY_LINEAR = 0x0002, 00039 KEY_SMOOTH = 0x0004, 00040 KEY_HOLD = 0x0008, 00041 KEY_FILE = 0x0010, 00042 }; 00043 00044 00046 00054 class KeyC : public Edit::EditableI 00055 { 00056 public: 00058 static KeyC* create_new(); 00060 virtual Edit::DataBlockI* create(); 00062 virtual Edit::DataBlockI* create( Edit::EditableI* pOriginal ); 00064 virtual void copy( Edit::EditableI* pEditable ); 00066 virtual void restore( Edit::EditableI* pEditable ); 00067 00069 virtual PajaTypes::int32 get_time(); 00071 virtual void set_time( PajaTypes::int32 i32Time ); 00072 00074 00078 virtual void set_flags( PajaTypes::int32 i32Flags ); 00080 virtual void add_flags( PajaTypes::int32 i32Flags ); 00082 virtual void del_flags( PajaTypes::int32 i32Flags ); 00084 virtual void toggle_flags( PajaTypes::int32 i32Flags ); 00086 virtual PajaTypes::int32 get_flags(); 00087 00089 virtual PajaTypes::uint32 save( FileIO::SaveC* pSave ); 00091 virtual PajaTypes::uint32 load( FileIO::LoadC* pLoad ); 00092 00093 protected: 00095 KeyC(); 00097 KeyC( PajaTypes::int32 i32Time ); 00099 KeyC( Edit::EditableI* pOriginal ); 00101 virtual ~KeyC(); 00102 00103 PajaTypes::int32 m_i32Flags; 00104 PajaTypes::int32 m_i32Time; 00105 }; 00106 00107 00109 00115 class FloatKeyC : public KeyC 00116 { 00117 public: 00119 static FloatKeyC* create_new(); 00121 static FloatKeyC* create_new( PajaTypes::int32 i32NumChannels ); 00123 virtual Edit::DataBlockI* create(); 00125 virtual Edit::DataBlockI* create( Edit::EditableI* pOriginal ); 00127 virtual void copy( Edit::EditableI* pEditable ); 00129 virtual void restore( Edit::EditableI* pEditable ); 00130 00132 virtual PajaTypes::float32 get_ease_in(); 00134 virtual PajaTypes::float32 get_ease_out(); 00136 virtual PajaTypes::float32 get_tens(); 00138 virtual PajaTypes::float32 get_cont(); 00140 virtual PajaTypes::float32 get_bias(); 00142 virtual void set_ease_in( PajaTypes::float32 ); 00144 virtual void set_ease_out( PajaTypes::float32 ); 00146 virtual void set_tens( PajaTypes::float32 ); 00148 virtual void set_cont( PajaTypes::float32 ); 00150 virtual void set_bias( PajaTypes::float32 ); 00151 00153 00161 virtual void get_value( PajaTypes::float32* pValues ); 00163 00173 virtual void set_value( const PajaTypes::float32* pValues ); 00174 00177 virtual void get_in_tan( PajaTypes::float32* pValues ); 00180 virtual void set_in_tan( const PajaTypes::float32* pValues ); 00181 00184 virtual void get_out_tan( PajaTypes::float32* pValues ); 00187 virtual void set_out_tan( const PajaTypes::float32* pValues ); 00188 00190 virtual PajaTypes::uint32 save( FileIO::SaveC* pSave ); 00192 virtual PajaTypes::uint32 load( FileIO::LoadC* pLoad ); 00193 00194 protected: 00196 FloatKeyC(); 00198 FloatKeyC( PajaTypes::int32 i32Time ); 00200 FloatKeyC( Edit::EditableI* pOriginal ); 00202 virtual ~FloatKeyC(); 00203 00204 PajaTypes::float32* m_pValues; 00205 PajaTypes::int32 m_i32NumChannels; 00206 PajaTypes::float32 m_f32EaseIn, m_f32EaseOut; 00207 PajaTypes::float32 m_f32Tens, m_f32Cont, m_f32Bias; 00208 }; 00209 00210 00212 00230 class FileKeyC : public KeyC 00231 { 00232 public: 00234 static FileKeyC* create_new(); 00237 virtual Edit::DataBlockI* create(); 00239 virtual Edit::DataBlockI* create( Edit::EditableI* pOriginal ); 00241 virtual void copy( Edit::EditableI* pEditable ); 00243 virtual void restore( Edit::EditableI* pEditable ); 00244 00246 virtual void set_file_handle( Import::FileHandleC* pHandle ); 00248 virtual Import::FileHandleC* get_file_handle(); 00249 00251 virtual void set_time_scale( PajaTypes::float32 f32Scale ); 00253 virtual PajaTypes::float32 get_time_scale() const; 00254 00256 virtual void set_time_offset( PajaTypes::int32 i32Offset ); 00258 virtual PajaTypes::int32 get_time_offset() const; 00259 00260 00262 virtual PajaTypes::uint32 save( FileIO::SaveC* pSave ); 00264 virtual PajaTypes::uint32 load( FileIO::LoadC* pLoad ); 00265 00266 protected: 00268 FileKeyC(); 00270 FileKeyC( PajaTypes::int32 i32Time ); 00272 FileKeyC( Edit::EditableI* pOriginal ); 00274 virtual ~FileKeyC(); 00275 00276 PajaTypes::int32 m_i32TimeOffset; 00277 PajaTypes::float32 m_f32TimeScale; 00278 Import::FileHandleC* m_pFileHandle; 00279 }; 00280 00281 00282 }; // namespace Parameter 00283 00284 #endif // __KEYC_H__