Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef KEYFRAMENAVIGATOR_INCLUDED
Toshihiro Shimizu 890ddd
#define KEYFRAMENAVIGATOR_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include "tfxutil.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonz/tstageobject.h"
Toshihiro Shimizu 890ddd
#include "toonz/tframehandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tobjecthandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/txsheethandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tpalettehandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tfxhandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tcolumnfx.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <qtoolbar></qtoolbar>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_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
class TStyleSelection;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// KeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI KeyframeNavigator : public QToolBar
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QAction *m_actPreviewKey;
Toshihiro Shimizu 890ddd
	QAction *m_actKeyNo;
Toshihiro Shimizu 890ddd
	QAction *m_actKeyPartial;
Toshihiro Shimizu 890ddd
	QAction *m_actKeyTotal;
Toshihiro Shimizu 890ddd
	QAction *m_actNextKey;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFrameHandle *m_frameHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	KeyframeNavigator(QWidget *parent = 0, TFrameHandle *frameHandle = 0);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getCurrentFrame() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (!m_frameHandle)
Toshihiro Shimizu 890ddd
			return -1;
Toshihiro Shimizu 890ddd
		return m_frameHandle->getFrameIndex();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
	void setCurrentFrame(int frame)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_frameHandle->setFrameIndex(frame);
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setFrameHandle(TFrameHandle *frameHandle)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_frameHandle = frameHandle;
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void update();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
	void toggleKeyAct()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		toggle();
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void toggleNextKeyAct()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		goNext();
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void togglePrevKeyAct()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		goPrev();
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	virtual bool hasNext() const = 0;
Toshihiro Shimizu 890ddd
	virtual bool hasPrev() const = 0;
Toshihiro Shimizu 890ddd
	virtual bool hasKeyframes() const = 0;
Toshihiro Shimizu 890ddd
	virtual bool isKeyframe() const = 0;
Toshihiro Shimizu 890ddd
	virtual bool isFullKeyframe() const = 0;
Toshihiro Shimizu 890ddd
	virtual void toggle() = 0;
Toshihiro Shimizu 890ddd
	virtual void goNext() = 0;
Toshihiro Shimizu 890ddd
	virtual void goPrev() = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void showEvent(QShowEvent *);
Toshihiro Shimizu 890ddd
	void hideEvent(QHideEvent *);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// ViewerKeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI ViewerKeyframeNavigator : public KeyframeNavigator
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TObjectHandle *m_objectHandle;
Toshihiro Shimizu 890ddd
	TXsheetHandle *m_xsheetHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ViewerKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
Toshihiro Shimizu 890ddd
		: KeyframeNavigator(parent, frameHandle), m_objectHandle(0), m_xsheetHandle(0)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TObjectHandle *getObjectHandle() const { return m_objectHandle; }
Toshihiro Shimizu 890ddd
	TXsheetHandle *getXsheetHandle() const { return m_xsheetHandle; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
	void setObjectHandle(TObjectHandle *objectHandle)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_objectHandle = objectHandle;
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void setXsheetHandle(TXsheetHandle *xsheetHandle)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_xsheetHandle = xsheetHandle;
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	TStageObject *getStageObject() const;
Toshihiro Shimizu 890ddd
	bool hasNext() const;
Toshihiro Shimizu 890ddd
	bool hasPrev() const;
Toshihiro Shimizu 890ddd
	bool hasKeyframes() const;
Toshihiro Shimizu 890ddd
	bool isKeyframe() const;
Toshihiro Shimizu 890ddd
	bool isFullKeyframe() const;
Toshihiro Shimizu 890ddd
	void toggle();
Toshihiro Shimizu 890ddd
	void goNext();
Toshihiro Shimizu 890ddd
	void goPrev();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void showEvent(QShowEvent *);
Toshihiro Shimizu 890ddd
	void hideEvent(QHideEvent *);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// PaletteKeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI PaletteKeyframeNavigator : public KeyframeNavigator
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPaletteHandle *m_paletteHandle;
Toshihiro Shimizu 890ddd
	TStyleSelection *m_selection;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	PaletteKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
Toshihiro Shimizu 890ddd
		: KeyframeNavigator(parent, frameHandle), m_paletteHandle(0), m_selection(0)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setSelection(TStyleSelection *selection) { m_selection = selection; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPalette *getPalette() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (!m_paletteHandle)
Toshihiro Shimizu 890ddd
			return 0;
Toshihiro Shimizu 890ddd
		return m_paletteHandle->getPalette();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	int getStyleIndex() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (!m_paletteHandle)
Toshihiro Shimizu 890ddd
			return 0;
Toshihiro Shimizu 890ddd
		return m_paletteHandle->getStyleIndex();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
	void setPaletteHandle(TPaletteHandle *paletteHandle)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_paletteHandle = paletteHandle;
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	bool hasNext() const;
Toshihiro Shimizu 890ddd
	bool hasPrev() const;
Toshihiro Shimizu 890ddd
	bool hasKeyframes() const;
Toshihiro Shimizu 890ddd
	bool isKeyframe() const;
Toshihiro Shimizu 890ddd
	bool isFullKeyframe() const { return isKeyframe(); }
Toshihiro Shimizu 890ddd
	void toggle();
Toshihiro Shimizu 890ddd
	void goNext();
Toshihiro Shimizu 890ddd
	void goPrev();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void showEvent(QShowEvent *);
Toshihiro Shimizu 890ddd
	void hideEvent(QHideEvent *);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// FxKeyframeNavigator
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI FxKeyframeNavigator : public KeyframeNavigator
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFxHandle *m_fxHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	FxKeyframeNavigator(QWidget *parent, TFrameHandle *frameHandle = 0)
Toshihiro Shimizu 890ddd
		: KeyframeNavigator(parent, frameHandle), m_fxHandle(0)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFx *getFx() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (!m_fxHandle)
Toshihiro Shimizu 890ddd
			return 0;
Toshihiro Shimizu 890ddd
		TFx *fx = m_fxHandle->getFx();
Toshihiro Shimizu 890ddd
		if (TZeraryColumnFx *zfx = dynamic_cast<tzerarycolumnfx *="">(fx))</tzerarycolumnfx>
Toshihiro Shimizu 890ddd
			fx = zfx->getZeraryFx();
Toshihiro Shimizu 890ddd
		return fx;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFxHandle *getFxHandle() const { return m_fxHandle; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
	void setFxHandle(TFxHandle *fxHandle)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_fxHandle = fxHandle;
Toshihiro Shimizu 890ddd
		update();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	bool hasNext() const;
Toshihiro Shimizu 890ddd
	bool hasPrev() const;
Toshihiro Shimizu 890ddd
	bool hasKeyframes() const;
Toshihiro Shimizu 890ddd
	bool isKeyframe() const;
Toshihiro Shimizu 890ddd
	bool isFullKeyframe() const;
Toshihiro Shimizu 890ddd
	void toggle();
Toshihiro Shimizu 890ddd
	void goNext();
Toshihiro Shimizu 890ddd
	void goPrev();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void showEvent(QShowEvent *);
Toshihiro Shimizu 890ddd
	void hideEvent(QHideEvent *);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif