/*
 *=============================================================================
 *
 *  Filename:			AnimView.h
 *  Version:            1.0
 *  Date:				11/03/97
 *  Author:             Vincent Lhullier
 *
 *  Description:		view box to display list of animations
 *						and control to display animation
 *
 *===========================================================================
 */

#ifndef __ANIMVIEW2_H__
#define __ANIMVIEW2_H__

/*---------------------------------------------------------------------------*/
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
#include "T3D_res.h"
/*---------------------------------------------------------------------------*/

#define D_State_Define
#define D_ObjsTbls_Define
#define D_ZdxStuff_StructureDefine
//#include "DNM.h"
#include "incGAM.h"
#undef D_ZdxStuff_StructureDefine
#undef D_ObjsTbls_Define
#undef D_State_Define

class CPA_Animation;
class CPA_Action;
class CPA_Family;
class Tool3D_World;
/*
 *=============================================================================
 * CAnimationView form view
 *=============================================================================
 */
class CAnimationView : public CFormView
{
  protected:
	DECLARE_DYNCREATE(CAnimationView)

  private:
	BOOL				bInitialUpdate;
	BOOL				m_bActionPlay;		//Mircea Dunka 12.10.98
	UINT				m_uiNumberOfAnimations;
	UINT				m_uiTotalNumberOfFrames;
    CPA_EditorBase      *m_p_oT3DInterf;
    Tool3D_World        *m_p_oTool3DWorld;
    CPA_Animation       *m_p_oCurrentAnim;
	CPA_Action			*m_p_oCurrentAction;//Mircea Dunka 6.10.98
    CPA_Family          *m_p_oFamily;

//Stefan Dumitrean 28-05-98
	CFormView           *m_p_oFamilySelDialog;
//End Stefan Dumitrean 28-05-98

    unsigned short      m_uwInitFrame;

	CBitmap				m_oBitmapPlay;
	CBitmap				m_oBitmapStop;
	CBitmap				m_oBitmapReverse;
	CBitmap				m_oBitmapForward;
	CBitmap				m_oBitmapRewind;

    BOOL                m_bAllAnims;
	BOOL				m_bAllActions;
  public:
	UINT				m_uiPlayTimer;
	UINT				m_uiElapseTime;
	BOOL				m_bPlay;
	BOOL				m_bReverse;

  // Form Data
  public:
	enum { IDD = IDD_DIALOG_ANIM };

	CAnimationView();
	~CAnimationView();

    void mfn_vSetEditor(CPA_EditorBase *_p_oEditor )            { m_p_oT3DInterf = _p_oEditor; }
    void mfn_vSetWorld( Tool3D_World *_p_oWorld )               { m_p_oTool3DWorld = _p_oWorld; }

//Stefan Dumitrean 28-05-98
	void mfn_vSetFamilySelDialog( CFormView * _p_oDialogList )    { m_p_oFamilySelDialog = _p_oDialogList; }
//End Stefan Dumitrean 28-05-98

    void mfn_vInitDialog( CPA_Family *_p_oCurrentFamily, CPA_Animation *_p_oAnimation = NULL, unsigned short _uwFrame = 0);

	void m_fn_vStopAnim();
  // Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAnimationView)
	public:
	virtual void OnInitialUpdate();
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

  private:
      void fn_vBeginAnim( unsigned short _uwFrame = 0);
      void fn_vShowFrame(unsigned short _uwFrame);
	  void m_fn_vEnableControl( BOOL _bEnable );
      void fn_vFillAnimList();
      void mfn_vFillActionList();

  protected:
    #ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
    #endif

	// Generated message map functions
	//{{AFX_MSG(CAnimationView)
	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnSelchangeListAnims();
	afx_msg void OnSelchangeListActions();	//Mircea Dunka 6.10.98
	afx_msg void OnButtonLoad();
	afx_msg void OnButtonPlay();
	afx_msg void OnButtonReinit();
	afx_msg void OnButtonAction();			//Mircea Dunka 8.10.98
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    afx_msg void OnButtonAnim();
	afx_msg void OnButtonStop();
	afx_msg void OnButtonForward();
	afx_msg void OnButtonReverse();
	afx_msg void OnButtonRewind();
	afx_msg void OnDblclkListAnims();
	afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
	afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDIS);
	afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
	afx_msg void OnButtonHelp();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#endif /*__ANIMVIEW2_H__*/