/****************************************************************************************

		ModelerView.h

		Copyright (c)1990 - 1999 MetaCreations. All rights reserved.

		Author:	Jerome Bignon
		Date:	05/18/99

		Revision History

		when		who			what & why
		==========	==========	======================================================
		06/11/99	Jerome		Added animation and saving
		05/18/99	Jerome		Creation

*****************************************************************************************/

#ifndef __ModelerVIEW__
#define __ModelerVIEW__  

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "BasicMCFCOMImplementations.h"
#include "Modeler.h"
#include "MCPoint.h"
#include "ModelerDef.h"
#include "IModelerView.h"

// Define the ModelerView CLSID ( see the ModelerTreeDef.h file to get R_CLSID_ModelerView value )
extern const MCGUID CLSID_ModelerView;

class Modeler;

struct DrawTreePrivData
{
	IMCGraphicContext*	fGC;
	int32				fNumView;
	real				fZoom;
};

TMCPoint TreePoint3Dto2D( TVector3 *v , int16 numView, real zoom );

// VIEW Object definition : 
// VIEW Object :

class ModelerView : public TBasicPart,
					   public IModelerView	
{

	public :
		
		ModelerView();
		virtual MCCOMErr 	MCCOMAPI QueryInterface	(const MCIID &riid, void** ppvObj);
 		virtual uint32		MCCOMAPI AddRef();
		STANDARD_RELEASE;
 
		virtual void MCCOMAPI	SelfDraw(IMCGraphicContext* graphicContext, const TMCRect& inZone);
	  
		virtual	Modeler*	MCCOMAPI	GetModelerNoAddRef	();
		virtual	void		MCCOMAPI	SetModeler			(Modeler* TheModeler);
		virtual	void		MCCOMAPI	SetBackgroundColor	(const TMCRGBColor& rgbcolor);
		virtual boolean		MCCOMAPI	SelfKeyDown			(TMCPlatformEvent* event);
		TMFEventResult		MCCOMAPI	SelfMouseDown		(const TMCPoint& inWhere, const TMCPlatformEvent& inEvent);

		virtual void		MCCOMAPI	SetViewSide( int16 ViewNumber );
		virtual real		MCCOMAPI	GetZoom()				{ return fZoom; };
		virtual int16		MCCOMAPI	GetViewSide()			{ return ViewSide; };
		virtual void		MCCOMAPI	SetZoomPlus()			{ fZoom += fZoom/5; };
		virtual void		MCCOMAPI	SetZoomMinus()			{ fZoom -= fZoom/5; };
		virtual void		MCCOMAPI	SetZoom11()				{ fZoom = 25.0f; };
		virtual void		MCCOMAPI	SetCursorID(MFCursorID inID)	{ fCursorID = inID; };


protected:

		Modeler*			fTreeModeler;
		TMCPoint			fCameraPos;
		int16				ViewSide;
		MFCursorID			fCursorID;
		real				fZoom;
		TMCRGBColor			fbackgroundColor;
};

#endif // __VIEW__