/*=========================================================================
File Name:		DIAMECA.HPP
Purpose:		Implements functions handling the mecanics characteristics
				Implements Following Classes:

				- DiaMeca
				- tdoDeleteEngineMechanicsModif
				- tdoCreateEngineMechanicsModif

Author:			Yann Le Tensorer
Date:			April/May,1997
==========================================================================*/

#ifndef __diameca_hpp
#define __diameca_hpp

/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif
/******************************************/

#include "matres.h"
#include "itf.h"
#include "gmatobj.hpp"
#include "MMatObj.hpp"

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

class tdoCopyBuffer;

/*===========================================================================
Class Name:		DiaMeca
Used for:		Main class of mecanics dialog
Author:			Yann Le Tensorer
Date:			April 1997
============================================================================*/
class DiaMeca : public CFormView
{
protected:
	DiaMeca();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(DiaMeca)

// Form Data
public:
	//{{AFX_DATA(DiaMeca)
	enum { IDD = IDD_MECA_DIALOG };
	CSliderCtrl	m_oSliderAbsorption;
	CButton	m_CheckDisableMechanics;
	double	m_Rebound;
	double	m_Slide;
	//}}AFX_DATA
	//GMT_tdxHandleToGameMaterial				m_hHandleToGameMaterial;
	DNM_tdxHandleToMecMatCharacteristics	m_hHandleToMecMatCharacteristics;
	DNM_tdxHandleToMecMatCharacteristics	m_hDefaultMechanicsMaterial;
	CComboBox *m_p_oMaterialCombo;

// Attributes
private:
	BOOL									m_bAllSelected;
	BOOL                  m_bAutoDispatch;
	BOOL m_bEditColor(GLI_tdstColor *p_stColor);
//ANNECY Shaitan DisableFunctions (16/04/98) {
	BOOL m_bCommonFile;
//ENDANNECY Shaitan DisableFunctions }

// Operations
public:
	virtual ~DiaMeca();
	tdoCopyBuffer					*m_p_oCopyBuffer;
	void m_vNotifyChangeToScripts();
	void m_fn_vShowMaterial(GMT_tdxHandleToGameMaterial _hMat);
	void m_fn_vSetMaterial(void);
	void m_fn_vEnableWindowFields(BOOL bEnable);
	// Load/Save functions
	void m_fn_vSaveDefault();
	static SCR_tde_Anl_ReturnValue fn_v_LoadMecaDefault(
                                     SCR_tdst_File_Description *_p_stFile,
                                     char *_p_szName,
                                     char *_ap_szPars[],
                                     SCR_tde_Anl_Action _eAction);
	void m_fn_vInitLoad();
	void m_fn_vLoadDefault();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(DiaMeca)
	public:
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual int OnToolHitTest( CPoint point, TOOLINFO* pTI ) const;
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(DiaMeca)
	afx_msg void OnCheckDisableMechanics();
	afx_msg void OnChangeEdits();
	afx_msg void OnButtonSetDefault();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnButtonCopyMechanicsMaterial();
	afx_msg void OnButtonRenameMechanicsMaterial();
	afx_msg void OnButtonPasteMechanicsMaterial();
	afx_msg void OnComboEditChange();
	afx_msg void OnComboSelChange();
	afx_msg void OnButtonHighlightColor();
	afx_msg void OnCheckHighlight();
	afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/*===========================================================================
Class Name:		tdoDeleteEngineMechanicsModif
Used for:		deletion of meca mini structure: DO/UNDO
Author:			Yann Le Tensorer / Benoit Germain
Date:			April 1997
============================================================================*/
class tdoDeleteEngineMechanicsModif : public CPA_Modif
{
public:
	tdoDeleteEngineMechanicsModif(
		GMT_tdxHandleToGameMaterial _MyMatHandle,
		DNM_tdxHandleToMecMatCharacteristics _hMechanicsMaterial
	);
  ~tdoDeleteEngineMechanicsModif();
	BOOL Do();
	BOOL Undo();
protected:
private:
	GMT_tdxHandleToGameMaterial m_hEditedGameMaterial;
	DNM_tdxHandleToMecMatCharacteristics m_hEditedMechanicsMaterial;
	tdoEditorGameMaterial *m_p_oEditedGameMaterial;
	tdoEditorMechanicsMaterial *m_p_oEditedMechanicsMaterial;
};

/*===========================================================================
Class Name:		tdoCreateEngineMechanicsModif
Used for:		creation of meca mini structure: DO/UNDO
Author:			Yann Le Tensorer / Benoit Germain
Date:			April 1997
============================================================================*/

class tdoCreateEngineMechanicsModif : public CPA_Modif
{
public:
	tdoCreateEngineMechanicsModif(GMT_tdxHandleToGameMaterial _MyMatHandle);
	~tdoCreateEngineMechanicsModif();
	BOOL Do();
	BOOL Undo();
protected:
private:
	GMT_tdxHandleToGameMaterial m_hEditedGameMaterial;
	DNM_tdxHandleToMecMatCharacteristics m_hMechanicsAfterDo;
	tdoDeleteEngineMechanicsModif *m_p_oDestroyModif;
};

#endif
