///////////////////////////////////////////////////////////////////////////////
//
// File: ToolsAVP_Entity_CameraVolume.h
//
// Created by Martin G.Harris (7/9/2006)
// 
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __TOOLS_AVP_ENTITY_CAMERA_VOLUME_H__
#define __TOOLS_AVP_ENTITY_CAMERA_VOLUME_H__


#ifdef ASURA_USE_CAMERA_VOLUME

// Includes
#include "Entity/CameraVolume/Tools_Entity_CameraVolume.h"

// Forward declarations
class Asura_Dialog;
class AVP_CameraVolumeData;

//////////////////////////////////////
// ToolsAVP_Entity_CameraVolume //
//////////////////////////////////////
class ToolsAVP_Entity_CameraVolume : public Tools_Entity_CameraVolume
{
	typedef Tools_Entity_CameraVolume PARENT;

public:
	ToolsAVP_Entity_CameraVolume(Asura_Entity* pxEntity);
	virtual ~ToolsAVP_Entity_CameraVolume();

	virtual void OnSelection();
	virtual void OnDeselection();

	virtual void Render();
	virtual void Update();
	virtual void UpdateWhileSelected();

	virtual void AddOverlayControls(Asura_Overlay* pxNewOverlay, Asura_Vector_2& xOffset);
	virtual void PrintInfo(float& fX,float& fY);

	void UpdateDialogues();

	static void Create();
	static void Create(Asura_Entity* pxEntity);

	static void _EditStaticCameraPosition()
	{
		if (s_pxThisCameraVolume) s_pxThisCameraVolume->EditStaticCameraPosition();
	}

	static void _EditCameraRail()
	{
		if (s_pxThisCameraVolume) s_pxThisCameraVolume->EditCameraRail();
	}

	static void _EditPlayerRail()
	{
		if (s_pxThisCameraVolume) s_pxThisCameraVolume->EditPlayerRail();
	}

protected:
	// The object has been moved by the specified distance, displace the camera properties.
	virtual void DisplaceProperties(const Asura_Vector_3& xMove);

	void EditStaticCameraPosition();
	void EditCameraRail();
	void EditPlayerRail();

	// Helper functions
	void EditPosition(  u_int& uPositionEditObjectID,
						Asura_Vector_3* pxPosition,
						const char* pszName,
						const char* pszMessage );

	void EditRail(  int& iLineEditObjectID,
				    Asura_Vector_3* pxStartPos,
					Asura_Vector_3* pxEndPos,
					const char* pszName,
					const char* pszStartMessage,
					const char* pszEndMessage,
					u_int uColour );

	// Copy properties from the client entity back to the tools entity.
	void CopyPropertiesToToolsEntity();
	
	// Return pointer to the client properties (or null).
	AVP_CameraVolumeData* GetClientProperty();

	// Member data
	Asura_Dialog* m_pxDialog_TimeToReset;
	Asura_Dialog* m_pxDialog_FOV;
	Asura_Dialog* m_pxDialog_Target;
	Asura_Dialog* m_pxDialog_Rotation;
	Asura_Dialog* m_pxDialog_Elevation;
	Asura_Dialog* m_pxDialog_Distance;
	Asura_Dialog* m_pxDialog_UsePlayerRail;
	Asura_Dialog* m_pxDialog_EditStaticCam;
	Asura_Dialog* m_pxDialog_EditCameraRail;
	Asura_Dialog* m_pxDialog_EditPlayerRail;

	// IDs for static camera position edit object, and line edit objects.
	u_int m_uStaticCameraPositionID;
	int m_iCameraRailID;
	int m_iPlayerRailID;

	// Static data
	static ToolsAVP_Entity_CameraVolume* s_pxThisCameraVolume;
};

#endif //ASURA_USE_CAMERA_VOLUME

#endif //__TOOLS_AVP_ENTITY_CAMERA_VOLUME_H__

