Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TSPECTRUMPARAM_H
Toshihiro Shimizu 890ddd
#define TSPECTRUMPARAM_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tspectrum.h"
Toshihiro Shimizu 890ddd
#include "tparamset.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TPARAM_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//    Forward declaration
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TParamSet;
Toshihiro Shimizu 890ddd
class TSpectrumParamImp;
Toshihiro Shimizu 890ddd
class TPixelParamP;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
class TSpectrumParam;
Toshihiro Shimizu 890ddd
template class DVAPI TPersistDeclarationT<tspectrumparam>;</tspectrumparam>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TSpectrumParam : public TParam
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	PERSIST_DECLARATION(TSpectrumParam)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TSpectrumParamImp *m_imp;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TSpectrumParam();
Toshihiro Shimizu 890ddd
	TSpectrumParam(int keyCount, TSpectrum::ColorKey keys[]);
Toshihiro Shimizu 890ddd
	TSpectrumParam(const TSpectrumParam &);
Toshihiro Shimizu 890ddd
	~TSpectrumParam();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParam *clone() const { return new TSpectrumParam(*this); }
Toshihiro Shimizu 890ddd
	void copy(TParam *src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void addObserver(TParamObserver *);
Toshihiro Shimizu 890ddd
	void removeObserver(TParamObserver *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TSpectrum getValue(double frame) const;
Toshihiro Shimizu 890ddd
	TSpectrum64 getValue64(double frame) const;
Toshihiro Shimizu 890ddd
	void setValue(double frame, const TSpectrum &value, bool undoing = false);
Toshihiro Shimizu 890ddd
	void setDefaultValue(const TSpectrum &value);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getKeyCount() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDoubleParamP getPosition(int index) const;
Toshihiro Shimizu 890ddd
	TPixelParamP getColor(int index) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setValue(double frame, int index, double s, const TPixel32 &color, bool undoing = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void insertKey(int index, double s, const TPixel32 &color);
Toshihiro Shimizu 890ddd
	void addKey(double s, const TPixel32 &color);
Toshihiro Shimizu 890ddd
	void removeKey(int index);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isAnimatable() const { return true; }
Toshihiro Shimizu 890ddd
	bool isKeyframe(double frame) const;
Toshihiro Shimizu 890ddd
	void deleteKeyframe(double frame);
Toshihiro Shimizu 890ddd
	void clearKeyframes();
Toshihiro Shimizu 890ddd
	void assignKeyframe(
Toshihiro Shimizu 890ddd
		double frame,
Toshihiro Shimizu 890ddd
		const TSmartPointerT<tparam> &src, double srcFrame,</tparam>
Toshihiro Shimizu 890ddd
		bool changedOnly = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
	void saveData(TOStream &os);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void enableDragging(bool on);
Toshihiro Shimizu 890ddd
	void enableNotification(bool on);
Toshihiro Shimizu 890ddd
	bool isNotificationEnabled() const;
Toshihiro Shimizu 890ddd
	void enableMatte(bool on);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isMatteEnabled() const;
Toshihiro Shimizu 890ddd
	string getValueAlias(double frame, int precision);
Toshihiro Shimizu 890ddd
	bool hasKeyframes() const;
Toshihiro Shimizu 890ddd
	void getKeyframes(std::set<double> &frames) const;</double>
Toshihiro Shimizu 890ddd
	int getNextKeyframe(double frame) const;
Toshihiro Shimizu 890ddd
	int getPrevKeyframe(double frame) const;
Toshihiro Shimizu 890ddd
	double keyframeIndexToFrame(int index) const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<tspectrumparam>;</tspectrumparam>
Toshihiro Shimizu 890ddd
template class DVAPI TDerivedSmartPointerT<tspectrumparam, tparam="">;</tspectrumparam,>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TSpectrumParamP : public TDerivedSmartPointerT<tspectrumparam, tparam=""></tspectrumparam,>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TSpectrumParamP() {}
Toshihiro Shimizu 890ddd
	TSpectrumParamP(int keyCount, TSpectrum::ColorKey keys[])
Toshihiro Shimizu 890ddd
		: TDerivedSmartPointerT<tspectrumparam, tparam="">(new TSpectrumParam(keyCount, keys)) {}</tspectrumparam,>
Toshihiro Shimizu 890ddd
	TSpectrumParamP(TSpectrumParam *p) : TDerivedSmartPointerT<tspectrumparam, tparam="">(p) {}</tspectrumparam,>
Toshihiro Shimizu 890ddd
	TSpectrumParamP(const TParamP &p) : TDerivedSmartPointerT<tspectrumparam, tparam="">(p) {}</tspectrumparam,>
Toshihiro Shimizu 890ddd
	operator TParamP() const { return TParamP(m_pointer); }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI TIStream &operator>>(TIStream &in, TSpectrumParamP &p);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif