/*
 =======================================================================================
  Name        : podialog.h
 
  Author      : vincent lhullier            Date :26/08/97
 
  Description : header file for dialog boxes used by po editor
 =======================================================================================
  Modification -> Author :                  Date :
  Description :
 =======================================================================================
 */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef __PODIALOG_HPP__
#define __PODIALOG_HPP__
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#ifndef __AFXEXT_H__
#include <afxext.h>
#endif

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#include "ACP_base.h"
#include "GLI.h"
#include "PO_Res.h"
//#include "PRJ.h"

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

class FRMBase;
class POInterface;
class EditorPO;

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/*
 =======================================================================================
 =======================================================================================
	CPOVseModif
 =======================================================================================
 =======================================================================================
 */
class CPOVseModif : public CPA_Modif
{
  private:
	EditorPO					*m_p_oPO;
	GEO_tdxHandleToVisualSet	m_hVisualSet;
	ACP_tdxIndex				m_xNbModifs;
	ACP_tdxIndex				*m_d_xIndex;
	MTH_tdxReal					*m_d_xDiff;

  public:

	/* ==> creation */
	CPOVseModif( EditorPO *_p_oPO, GEO_tdxHandleToVisualSet _hVSE, ACP_tdxIndex _xNbModifs );
	~CPOVseModif(void);

	/* ==> actions */
	BOOL Do(void);
	BOOL Undo(void);

	/* ==> functions */
	void m_fn_vSetDiff( ACP_tdxIndex _xLod, MTH_tdxReal _xDiff );

};


/*
 =======================================================================================
 =======================================================================================
	CPODlgVse Formview class
 ======================================================================================= 
 =======================================================================================
 */
class CPODlgVse : public CFormView
{
  protected:	
	POInterface						*m_p_oParentDLL;

	EditorPO						*m_p_oPO;

	GEO_tdxHandleToVisualSet		m_hVisualSet;
	PCS_tdxHandleToPhysicalCollSet	m_hCollSet;

	ACP_tdxIndex					m_xNbLods;
	MTH_tdxReal						m_a_xTresholds[10];
	ACP_tdxHandleOfObject			m_a_xGeometrics[10];
	ACP_tdxIndex					m_xCurrentLod;
	ACP_tdxIndex					m_xSwapLod;


  public:
	CPODlgVse();					// protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CPODlgVse)
	
	void			m_fn_vShowVisualSet( GEO_tdxHandleToVisualSet hVisualSet );
	void			m_fn_vInitVisualSetData( GEO_tdxHandleToVisualSet hVisualSet );
	void			m_fn_vShowCurrentLod( void );
	void			m_fn_vShowCollideSet( PCS_tdxHandleToPhysicalCollSet hCollSet );
	void			m_fn_vChangeTreshold( ACP_tdxIndex _xIndex, MTH_tdxReal _xValue);
	ACP_tdxIndex	m_fn_xGetClickedLodIndex( void );
	void			m_fn_vSwapLOD( ACP_tdxIndex _xLod, BOOL _bRestore, BOOL _bRedraw );

	void			fn_vUpdateInfo(EditorPO *_p_oPO);
    void			fn_vSetParentDLL(POInterface *_p_oParentDLL) { m_p_oParentDLL = _p_oParentDLL ; }
	
	//{{AFX_DATA(CPODlgVse)
	enum { IDD = IDD_DIALOG_PHYSICALOBJECT };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA


  // Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPODlgVse)
	public:
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	//}}AFX_VIRTUAL

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

	// Generated message map functions
	//{{AFX_MSG(CPODlgVse)
	afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDIS);
	afx_msg void OnDeltaposSpinCurrentlod(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnKillfocusEditCurrentlod();
	afx_msg void OnDeltaposSpinFrom(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDeltaposSpinTo(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnKillfocusEditFrom();
	afx_msg void OnKillfocusEditTo();
	afx_msg void OnButtonApply();
	afx_msg void OnButtonTreshold();
	afx_msg void OnDoubleclickedButtonTreshold();
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/*
 =======================================================================================
 =======================================================================================
	CPODlgList Form view class
 =======================================================================================
 =======================================================================================
 */
class CPODlgList : public CFormView
{
  private:
	POInterface			*m_p_oParentDLL;
	HTREEITEM			m_hWorldItem;
	HTREEITEM			m_hModelItem;
	HTREEITEM			m_hObjectTable;
	HTREEITEM			m_hWithoutActor;

  public:
	CPODlgList();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CPODlgList)

	void fn_vSetParentDLL(POInterface *_p_oParentDLL) { m_p_oParentDLL = _p_oParentDLL; }

	HTREEITEM	fn_hSearchTreeChild( CTreeCtrl *_p_oTree, HTREEITEM _hParent, CString _cstrName );
	HTREEITEM	fn_hSearchTreeChild( CTreeCtrl *_p_oTree, HTREEITEM _hParent, DWORD _dwData );
	HTREEITEM	fn_hGetPOParentItem( CTreeCtrl *_p_oTree, EditorPO *_p_oPO );
	void		fn_vRefreshListContent( void );
	void		fn_vSetCurrentItem( EditorPO *_p_oPO, CPA_BaseObject *_p_oActor );

  // Form Data
  public:
	//{{AFX_DATA(CPODlgList)
	enum { IDD = IDD_DIALOGPOLIST };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

  // Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPODlgList)
	public:
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	//}}AFX_VIRTUAL

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

	// Generated message map functions
	//{{AFX_MSG(CPODlgList)
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnSelchangedTreePos(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#endif __PODIALOG_H__
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
