Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TTONECURVEPARAM_H
Toshihiro Shimizu 890ddd
#define TTONECURVEPARAM_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "tparamset.h"
Toshihiro Shimizu 890ddd
#include "tstroke.h"
Toshihiro Shimizu 890ddd
#include "tnotanimatableparam.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <qlist></qlist>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
#pragma warning(disable : 4251)
Toshihiro Shimizu 890ddd
#endif
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
class DVAPI TToneCurveParam : public TParam
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	PERSIST_DECLARATION(TToneCurveParam)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParamSetP m_rgbaParamSet;
Toshihiro Shimizu 890ddd
	TParamSetP m_rgbParamSet;
Toshihiro Shimizu 890ddd
	TParamSetP m_rParamSet;
Toshihiro Shimizu 890ddd
	TParamSetP m_gParamSet;
Toshihiro Shimizu 890ddd
	TParamSetP m_bParamSet;
Toshihiro Shimizu 890ddd
	TParamSetP m_aParamSet;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TBoolParamP m_isLinear;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	enum ToneChannel {
Toshihiro Shimizu 890ddd
		RGBA = 0,
Toshihiro Shimizu 890ddd
		RGB,
Toshihiro Shimizu 890ddd
		Red,
Toshihiro Shimizu 890ddd
		Green,
Toshihiro Shimizu 890ddd
		Blue,
Toshihiro Shimizu 890ddd
		Alpha
Toshihiro Shimizu 890ddd
	} m_toneChannel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TToneCurveParam();
Toshihiro Shimizu 890ddd
	TToneCurveParam(const TToneCurveParam &src);
Toshihiro Shimizu 890ddd
	~TToneCurveParam() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParamSetP getParamSet(ToneChannel channel) const;
Toshihiro Shimizu 890ddd
	TParamSetP getCurrentParamSet() const;
Toshihiro Shimizu 890ddd
	TBoolParamP getIsLinearParam() const { return m_isLinear; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setCurrentChannel(ToneChannel channel);
Toshihiro Shimizu 890ddd
	ToneChannel getCurrentChannel() const { return m_toneChannel; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TParam *clone() const { return new TToneCurveParam(*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
	QList<tpointd> getValue(double frame) const;</tpointd>
Toshihiro Shimizu 890ddd
	void setValue(double frame, const QList<tpointd> &value, bool undoing = false);</tpointd>
Toshihiro Shimizu 890ddd
	void setDefaultValue(const QList<tpointd> &value);</tpointd>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isLinear() const;
Toshihiro Shimizu 890ddd
	void setIsLinear(bool isLinear);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void addValue(double frame, const QList<tpointd> &value, int index);</tpointd>
Toshihiro Shimizu 890ddd
	void removeValue(double frame, int index);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//  virtual void enableNotification(bool on) {}
Toshihiro Shimizu 890ddd
	//  virtual bool isNotificationEnabled() const { return true;}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	string getValueAlias(double frame, int precision);
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(double frame, const TSmartPointerT<tparam> &src,</tparam>
Toshihiro Shimizu 890ddd
						double srcFrame, bool changedOnly = false);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void getKeyframes(std::set<double> &frames) const;</double>
Toshihiro Shimizu 890ddd
	bool hasKeyframes() const;
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
	void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
	void saveData(TOStream &os);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<ttonecurveparam>;</ttonecurveparam>
Toshihiro Shimizu 890ddd
template class DVAPI TDerivedSmartPointerT<ttonecurveparam, tparam="">;</ttonecurveparam,>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TToneCurveParamP : public TDerivedSmartPointerT<ttonecurveparam, tparam=""></ttonecurveparam,>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TToneCurveParamP() {}
Toshihiro Shimizu 890ddd
	TToneCurveParamP(TToneCurveParam *p) : TDerivedSmartPointerT<ttonecurveparam, tparam="">(p) {}</ttonecurveparam,>
Toshihiro Shimizu 890ddd
	TToneCurveParamP(const TParamP &p) : TDerivedSmartPointerT<ttonecurveparam, tparam="">(p) {}</ttonecurveparam,>
Toshihiro Shimizu 890ddd
	operator TParamP() const { return TParamP(m_pointer); }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif