/*
* FX Tool Timeline Properties
* @version 3-09-05
* @author Joseph 'Pcjoe' Florencio
*/


#ifndef FXTOOLTIMELINE_H
#define FXTOOLTIMELINE_H

#include<VGUI_Panel.h>
#include<VGUI_TablePanel.h>
#include<VGUI_HeaderPanel.h>
#include<VGUI_TextGrid.h>
#include<VGUI_Label.h>
#include<VGUI_Slider.h>
#include "fxscript/fxsys.h"
#include "vgui_botmenu.h"
#include "vgui_fxtoolpanel.h"

/*
* Base Timeline Property Panel
*/
class CFXBaseTimeProp : public CFXPanel
{
public:
	// Constructor
	CFXBaseTimeProp(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Configure for New
	virtual void configNew( float flTime );

	// Make Accept and Cancel buttons
	// Note - Starts from getTall() and extends content panel
	virtual void makeFinishButtons( void );

	// Get Panel Name Prefix
	virtual std::string getPrefixName( void )
	{	if(isCreatePanel())
		{	return std::string("Create");
		}
		return std::string("Edit");
	}

	// Add Timed Event
	virtual void addTimedEvent( float flTime, CTimedEvent *pEvent );

	// Complete Entry ( calls Apply Settings )
	virtual void completeEntry( void );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent ) { return NULL; }

	// Cancel Settings
	virtual void cancelSettings( void ) { }

	// Update
	virtual void Update( void ) { }

	// Disable
	virtual void Disable( void ) { }

	// Make Check Box
	CCheckButton2 *makeCheckBox( std::string strTitle, int y );

	// Make Label
	Label *makeLabel( std::string strTitle, int y );

	// Make Slider
	Slider2 *makeSlider( int iStartY, int iStartRange, int iEndRange );

	// Make Text Entry
	CBotTextEntry *makeTextEntry( int iStartY );

	// Get Text from Text Entry
	std::string getText( CBotTextEntry *pEntry );

	// Get Text from Text Entry (float)
	float getTextFloat( CBotTextEntry *pEntry );

	// Padding
	virtual int getPadding( void ) { return 5; }

	/*
	* Accessors
	*/
	// Accept button
	void setAcceptButton( CommandButton *pAccept ) { m_pAccept = pAccept; }
	CommandButton *getAcceptButton( void ) { return m_pAccept; }

	// Cancel Button
	void setCancelButton( CommandButton *pCancel ) { m_pCancel = pCancel; }
	CommandButton *getCancelButton( void ) { return m_pCancel; }

	// Delete Button
	void setDeleteButton( CommandButton *pDelete ) { m_pDelete = pDelete; }
	CommandButton *getDeleteButton( void ) { return m_pDelete; }

	// Time start Text
	void setTimeStartText( CBotTextEntry *pText ) { m_pTimeStart = pText; }
	CBotTextEntry *getTimeStartText( void ) { return m_pTimeStart; }

	// If this is a create panel ( if not, must be an edit panel )
	void setCreatePanel( bool create ) { m_bCreatePanel = create; }
	bool isCreatePanel( void ) { return m_bCreatePanel; }

	// Timeline ID ( used to add new events )
	void setTimelineID( int id ) { m_iTimelineID = id; }
	int getTimelineID( void ) { return m_iTimelineID; }

	// Object ID
	void setObjectID( int id ) { m_iObjectID = id; }
	int getObjectID( void ) { return m_iObjectID; }

	// EDIT: Edit Iterator
	void setEditEvent( std::map<float,CTimedEvent*>::iterator iterEdit ) { m_iterEdit = iterEdit; }
	std::map<float,CTimedEvent*>::iterator getEditEvent( void ) { return m_iterEdit; }

	// CREATE: Create Time
	void setCreateTime( float flTime ) { m_flCreateTime = flTime; }
	float getCreateTime( void ) { return m_flCreateTime; }
protected:
	CommandButton	*m_pAccept;
	CommandButton	*m_pCancel;
	CommandButton	*m_pDelete;
	CBotTextEntry	*m_pTimeStart;
	bool			m_bCreatePanel;
	int				m_iTimelineID;
	int				m_iObjectID;
	std::map<float,CTimedEvent*>::iterator m_iterEdit;
	float			m_flCreateTime;
};

/*
* Position
*/
class CFXTimeProp_Position_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Position_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	// Update
	virtual void Update( void );

	// Cancel Settings
	virtual void cancelSettings( void );

	// Get Selected Path
	CPathManager *getSelectedPath( void );

	/*
	* Accessors
	*/
	// Velocity
	void setVelocityText( CBotTextEntry *pText ) { m_pVelocity = pText; }
	CBotTextEntry *getVelocityText( void ) { return m_pVelocity; }

	// Distance
	void setDistanceSlider( Slider2 *pSlider ) { m_pDistance = pSlider; }
	Slider2 *getDistanceSlider( void ) { return m_pDistance; }

	// Loop
	void setLoopCheck( CCheckButton2 *pLoop ) { m_pLoop = pLoop; }
	CCheckButton2 *getLoopCheck( void ) { return m_pLoop; }

	// Interpolate
	void setInterpCheck( CCheckButton2 *pInterp ) { m_pInterp = pInterp; }
	CCheckButton2 *getInterpCheck( void ) { return m_pInterp; }

	// Old Distance
	void setOldDistance( float flDist ) { m_flOldDistance = flDist; }
	float getOldDistance( void ) { return m_flOldDistance; }

private:
	CBotTextEntry	*m_pVelocity;
	Slider2			*m_pDistance;
	CCheckButton2	*m_pLoop;
	CCheckButton2	*m_pInterp;
	float			m_flOldDistance;
};

/*
* Rotation
*/
class CFXTimeProp_Rotation_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Rotation_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);
	
	// Disable
	virtual void Disable( void );

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	// Update
	virtual void Update( void );

	// Cancel Settings
	virtual void cancelSettings( void );

	/*
	* Accessors
	*/
	// Added Yaw Slider
	void setAddedYawSlider( Slider2 *pSlider ) { m_pAddedYaw = pSlider; }
	Slider2 *getAddedYawSlider( void ) { return m_pAddedYaw; }

	// Added Pitch Slider
	void setAddedPitchSlider( Slider2 *pSlider ) { m_pAddedPitch = pSlider; }
	Slider2 *getAddedPitchSlider( void ) { return m_pAddedPitch; }

	// Added Roll Slider
	void setAddedRollSlider( Slider2 *pSlider ) { m_pAddedRoll = pSlider; }
	Slider2 *getAddedRollSlider( void ) { return m_pAddedRoll; }

	// Original Yaw Slider
	void setOriginalYawSlider( Slider2 *pSlider ) { m_pOriginalYaw = pSlider; }
	Slider2 *getOriginalYawSlider( void ) { return m_pOriginalYaw; }

	// Original Pitch Slider
	void setOriginalPitchSlider( Slider2 *pSlider ) { m_pOriginalPitch = pSlider; }
	Slider2 *getOriginalPitchSlider( void ) { return m_pOriginalPitch; }

	// Original Roll Slider
	void setOriginalRollSlider( Slider2 *pSlider ) { m_pOriginalRoll = pSlider; }
	Slider2 *getOriginalRollSlider( void ) { return m_pOriginalRoll; }

	// Interpolate
	void setInterpCheck( CCheckButton2 *pInterp ) { m_pInterp = pInterp; }
	CCheckButton2 *getInterpCheck( void ) { return m_pInterp; }

	// Get Old Rotation
	CQuaternion getOldRotation( void ) { return m_qOldRotation; }
	void setOldRotation( CQuaternion quat ) { m_qOldRotation = quat; }

private:
	Slider2			*m_pAddedYaw;
	Slider2			*m_pAddedPitch;
	Slider2			*m_pAddedRoll;
	Slider2			*m_pOriginalYaw;
	Slider2			*m_pOriginalPitch;
	Slider2			*m_pOriginalRoll;
	CCheckButton2	*m_pInterp;
	CQuaternion		m_qOldRotation;
};

/*
* Alpha
*/
class CFXTimeProp_Alpha_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Alpha_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Alpha
	void setAlphaSlider( Slider2 *pSlider ) { m_pAlpha = pSlider; }
	Slider2 *getAlphaSlider( void ) { return m_pAlpha; }

	// Interpolate
	void setInterpCheck( CCheckButton2 *pInterp ) { m_pInterp = pInterp; }
	CCheckButton2 *getInterpCheck( void ) { return m_pInterp; }

private:
	Slider2			*m_pAlpha;
	CCheckButton2	*m_pInterp;
};

/*
* Color
*/
class CFXTimeProp_Color_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Color_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	// Update
	virtual void Update( void );

	/*
	* Accessors
	*/
	// R Slider
	void setRSlider( Slider2 *pSlider ) { m_pR = pSlider; }
	Slider2 *getRSlider( void ) { return m_pR; }

	// G Slider
	void setGSlider( Slider2 *pSlider ) { m_pG = pSlider; }
	Slider2 *getGSlider( void ) { return m_pG; }

	// B Slider
	void setBSlider( Slider2 *pSlider ) { m_pB = pSlider; }
	Slider2 *getBSlider( void ) { return m_pB; }

	// Preview Label
	void setPreviewLabel( Label *pLabel ) { m_pPreview = pLabel; }
	Label *getPreviewLabel( void ) { return m_pPreview; }

	// Interpolate
	void setInterpCheck( CCheckButton2 *pInterp ) { m_pInterp = pInterp; }
	CCheckButton2 *getInterpCheck( void ) { return m_pInterp; }

private:
	Slider2			*m_pR;
	Slider2			*m_pG;
	Slider2			*m_pB;
	Label			*m_pPreview;
	CCheckButton2	*m_pInterp;
};

/*
* Size
*/
class CFXTimeProp_Size_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Size_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Size
	void setSizeText( CBotTextEntry *pText ) { m_pSize = pText; }
	CBotTextEntry *getSizeText( void ) { return m_pSize; }

	// Interpolate
	void setInterpCheck( CCheckButton2 *pInterp ) { m_pInterp = pInterp; }
	CCheckButton2 *getInterpCheck( void ) { return m_pInterp; }

private:
	CBotTextEntry	*m_pSize;
	CCheckButton2	*m_pInterp;
};

/*
* Framerate Multiplier
*/
class CFXTimeProp_FrameMulti_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_FrameMulti_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// FrameMulti
	void setFrameMultiText( CBotTextEntry *pText ) { m_pFrameMulti = pText; }
	CBotTextEntry *getFrameMultiText( void ) { return m_pFrameMulti; }
private:
	CBotTextEntry	*m_pFrameMulti;
};

/*
* Bodypart
*/
class CFXTimeProp_BodyPart_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_BodyPart_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Body Part
	void setBodyPartText( CBotTextEntry *pText ) { m_pBodyPart = pText; }
	CBotTextEntry *getBodyPartText( void ) { return m_pBodyPart; }
private:
	CBotTextEntry	*m_pBodyPart;
};

/*
* Model Blur
*/
class CFXTimeProp_ModelBlur_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_ModelBlur_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Interpolate
	void setBlurCheck( CCheckButton2 *pBlur ) { m_pBlur = pBlur; }
	CCheckButton2 *getBlurCheck( void ) { return m_pBlur; }
private:
	CCheckButton2	*m_pBlur;
};

/*
* Sequence
*/
class CFXTimeProp_Sequence_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Sequence_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Sequence Text
	void setSequenceText( CBotTextEntry *pText ) { m_pSequence = pText; }
	CBotTextEntry *getSequenceText( void ) { return m_pSequence; }

	// Loop
	void setLoopCheck( CCheckButton2 *pLoop ) { m_pLoop = pLoop; }
	CCheckButton2 *getLoopCheck( void ) { return m_pLoop; }

private:
	CBotTextEntry	*m_pSequence;
	CCheckButton2	*m_pLoop;
};

/*
* Sound
*/
class CFXTimeProp_Sound_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Sound_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Sound Text
	void setSoundText( CBotTextEntry *pText ) { m_pSound = pText; }
	CBotTextEntry *getSoundText( void ) { return m_pSound; }

	// Channel Text
	void setChannelText( CBotTextEntry *pText ) { m_pChannel = pText; }
	CBotTextEntry *getChannelText( void ) { return m_pChannel; }

private:
	CBotTextEntry	*m_pSound;
	CBotTextEntry	*m_pChannel;
};

/*
* Sound Stream
*/
class CFXTimeProp_SoundStream_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_SoundStream_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Sound Text
	void setSoundStreamText( CBotTextEntry *pText ) { m_pSoundStream = pText; }
	CBotTextEntry *getSoundStreamText( void ) { return m_pSoundStream; }
private:
	CBotTextEntry	*m_pSoundStream;
};

/*
* Volume
*/
class CFXTimeProp_Volume_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_Volume_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Volume
	void setVolumeSlider( Slider2 *pSlider ) { m_pVolume = pSlider; }
	Slider2 *getVolumeSlider( void ) { return m_pVolume; }

	// Interpolate
	void setInterpCheck( CCheckButton2 *pInterp ) { m_pInterp = pInterp; }
	CCheckButton2 *getInterpCheck( void ) { return m_pInterp; }

private:
	Slider2			*m_pVolume;
	CCheckButton2	*m_pInterp;
};

/*
* Radial Blur
*/
class CFXTimeProp_RadialBlur_VGUI : public CFXBaseTimeProp
{
public:
	// Constructor
	CFXTimeProp_RadialBlur_VGUI(std::string strTitle, int x,int y, bool bCreatePanel, int iTimelineID);

	// Configure for Edit
	virtual void configEdit( std::map<float,CTimedEvent*>::iterator iterEdit );

	// Apply Settings ( to edit or new )
	virtual CTimedEvent *applySettings( CTimedEvent *pEvent );

	/*
	* Accessors
	*/
	// Radial Blur
	void setRadialBlurSlider( Slider2 *pSlider ) { m_pRadialBlur = pSlider; }
	Slider2 *getRadialBlurSlider( void ) { return m_pRadialBlur; }

	// Interpolate
	void setInterpCheck( CCheckButton2 *pInterp ) { m_pInterp = pInterp; }
	CCheckButton2 *getInterpCheck( void ) { return m_pInterp; }

private:
	Slider2			*m_pRadialBlur;
	CCheckButton2	*m_pInterp;
};


#endif