//*****************************************************************************
//*  _zWEdit.hpp                                                              *
//*****************************************************************************
//*                                                                           *
//* This file contains the definitions of the edit windows                    *
//*                                                                           *
//*****************************************************************************
//* Author : Alexis Vaisse                                                    *
//*****************************************************************************


#ifndef __ZWEDIT_HPP
#define __ZWEDIT_HPP

#pragma once

// personal include
#include "_zRes.h"       // File created by Microsoft Developer Studio
#include "_zObject.hpp"
// class of "_modif.hpp"
class ZDx_Modif;
// class defined latter
class CZDxShapeInfoWindow;


typedef enum eDisplayType_ { eNoZone , eOn , eOff , eSelected } tdeDisplayType;


//-----------------------------------------------------------------------------
// class CDisplayControlWindow
//
// Window that controls the display of the zones
//-----------------------------------------------------------------------------
class CDisplayControlWindow : public CFormView
{
// Construction
public:
	CDisplayControlWindow(CWnd* pParent = NULL);   // standard constructor
    DECLARE_DYNCREATE (CDisplayControlWindow)

// Dialog Data
	//{{AFX_DATA(CDisplayControlWindow)
	enum { IDD = IDD_ZDD_Display_Control_Window };
	int		m_Radio_Button_All_Actors;
	int		m_Radio_Button_Current_Actor;
	//}}AFX_DATA


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

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CDisplayControlWindow)
	afx_msg void On_Radio_Buttons_All_Actors();
	afx_msg void On_Radio_Buttons_Current_Actor();
	//}}AFX_MSG
    afx_msg BOOL SetToolTipText(UINT uiControlId , NMHDR *pNMHDR, LRESULT *pResult);
	DECLARE_MESSAGE_MAP()

// Private data
private:
    CToolTipCtrl           m_ToolTipCtrl;
    ZDx_Interface        * m_pZDxInterface;

public:
    void           SetZDxInterface           (ZDx_Interface * _pZDxInterface)    { m_pZDxInterface = _pZDxInterface; }
    tdeDisplayType GetDisplayForAllActors    ();                  // Get the state of the "All actors"    radio button
    tdeDisplayType GetDisplayForCurrentActor ();                  // Get the state of the "Current actor" radio button
    void           SetDisplayForAllActors    (tdeDisplayType);    // Set the state of the "All actors"    radio button
    void           SetDisplayForCurrentActor (tdeDisplayType);    // Set the state of the "Current actor" radio button

    void           SetNameOfCurrentActor     (CString);           // Set the name of the current actor (it is showed in the window)
    void           DisplayAllActors          ();                  // Display all actors with the correct zones
};


//-----------------------------------------------------------------------------
// class CZDxInfoWindow
//
// Window that shows informations about a ZDx object
//-----------------------------------------------------------------------------
class CZDxInfoWindow : public CFormView
{
// Construction
public:
	CZDxInfoWindow(CWnd* pParent = NULL);   // standard constructor
    DECLARE_DYNCREATE (CZDxInfoWindow)

// Dialog Data
	//{{AFX_DATA(CZDxInfoWindow)
	enum { IDD = IDD_ZDD_Info_Window };
	CString	m_Edition_Zone_Name;
	CString	m_Edition_Zone_Type;
	//}}AFX_DATA


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

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CZDxInfoWindow)
	afx_msg void On_Change_Edition_Zone_Name();
	afx_msg void OnCancel();
	afx_msg void OnOK();
	afx_msg void On_Apply_Button();
	afx_msg void On_Cancel_Button();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Personal data
private:
    CPA_SuperObject      * m_pZDxSuperObject;             // Pointer to the ZDx super object
    ZDx_Object           * m_pZDxObject;                  // Pointer to the ZDx object
    ZDx_Modif            * m_pZDxModif;                   // Pointer to the ZDx modif
    BOOL                   m_bIsApplying;                 // Is TRUE when cliquing on the Apply button
    CZDxShapeInfoWindow  * m_pCZDxShapeInfoWindow;        // Pointer to the child window
    tdeZDxGeometricType    m_eTypeShapeInfoWindow;        // Type of the shape info window (sphere, box...)
    BOOL                   m_ZDxHasBeenChanged;           // Indicate if the ZDx has been changed or not

    void                   OpenShapeInfoWindow     ();
    void                   CloseShapeInfoWindow    ();
    CWnd                 * GetFirstControlOfWindow ();    // Get the first control of the window
    CWnd                 * GetLastControlOfWindow  ();    // Get the last control of the window
    BOOL                   OnTabKeyPressed         ();    // Called when the Tab key is pressed
    BOOL                   OnShiftTabKeyPressed    ();    // Called when the Tab key is pressed with shift

public:
    void SetZDxHasBeenChanged (BOOL b);

    ZDx_Object *           GetZDxObjectEdited ()      { return m_pZDxObject; }
    void                   SetZDxObjectToEdit (CPA_SuperObject *); // Give a ZDx object to edit
	void                   Apply ();                          // To simulate a clic on the Apply button
	void                   Cancel ();		                  // To simulate a clic on the Cancel button
    void                   RefreshData (BOOL RedrawNeeded);   // Called when the data need to be refreshed
                                                              // The ZDx object can be redrawed or not
    void                   RefreshModif ();                   // Create a modif for the edited ZDx object
};

//-----------------------------------------------------------------------------
// class CZDxShapeInfoWindow
// Abstract class
//-----------------------------------------------------------------------------
class CZDxShapeInfoWindow : public CDialog
{
public:
    virtual void   SetZDxShapeToEdit (ZDx_Shape *)   = 0;   // Set the ZDx shape to edit
    virtual void   RefreshData ()                    = 0;   // Called when the data need to be refreshed
    virtual CWnd * GetFirstControlOfWindow ()        = 0;   // Get the first control of the window
    virtual CWnd * GetLastControlOfWindow  ()        = 0;   // Get the last control of the window
	virtual BOOL   PreTranslateMessage (MSG * pMsg);

protected:
    void         SetZDxHasBeenChanged (BOOL);             // indicate to the parent window that the ZDx object has been changed

    void         OnOK ();
    void         OnCancel ();
};

//-----------------------------------------------------------------------------
// class CZDxSphereInfoWindow
//
// Window that shows informations about a ZDx sphere object
//-----------------------------------------------------------------------------
class CZDxSphereInfoWindow : public CZDxShapeInfoWindow
{
// Construction
public:
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
	CZDxSphereInfoWindow (CWnd * pParent , ZDx_Shape * pZDxObject , CPA_SuperObject * _pFatherSuperObject , ZDx_Interface *);
//ENDROMTEAM WorldEditor (Cristi Petrescu)

// Dialog Data
	//{{AFX_DATA(CZDxSphereInfoWindow)
	enum { IDD = IDD_ZDD_Sphere_Info_Window };
	CString	m_Edition_Zone_Center_X;
	CString	m_Edition_Zone_Center_Y;
	CString	m_Edition_Zone_Center_Z;
	CString	m_Edition_Zone_Radius;
	CSliderCtrl	m_Slider_Radius;
	//}}AFX_DATA

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CZDxSphereInfoWindow)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	// Generated message map functions
	//{{AFX_MSG(CZDxSphereInfoWindow)
	virtual BOOL OnInitDialog();
	afx_msg void On_Change_Edition_Zone_Center_X();
	afx_msg void On_Change_Edition_Zone_Center_Y();
	afx_msg void On_Change_Edition_Zone_Center_Z();
	afx_msg void On_Change_Edition_Zone_Radius();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void On_Button_Init();
    afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Personal data
private:
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
	ZDx_Shape		   * m_pZDxSphere;
    Sphere3D           * m_pSphere3D;                 // Pointer to the ZDx sphere
//ENDROMTEAM WorldEditor (Cristi Petrescu)
    MTH_tdxReal        m_FatherRadius;               // Radius of the father of the ZDx object
    MTH3D_tdstVector   m_FatherCenter;               // Center of the father of the ZDx object

    void RefreshSlider ();
    void RefreshRadiusFromSlider ();

public:
    void SetZDxShapeToEdit (ZDx_Shape *);      // Set the ZDx shape to edit
    void RefreshData ();                       // Called when the data need to be refreshed
    CWnd * GetFirstControlOfWindow ();         // Get the first control of the window
    CWnd * GetLastControlOfWindow  ();         // Get the last control of the window
};

//-----------------------------------------------------------------------------
// class CZDxBoxInfoWindow
//
// Window that shows informations about a ZDx box object
//-----------------------------------------------------------------------------
class CZDxBoxInfoWindow : public CZDxShapeInfoWindow
{
// Construction
public:
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
	CZDxBoxInfoWindow(CWnd* pParent , ZDx_Shape * pZDxObject , CPA_SuperObject * _pFatherSuperObject , ZDx_Interface *);
//ENDROMTEAM WorldEditor (Cristi Petrescu)

// Dialog Data
	//{{AFX_DATA(CZDxBoxInfoWindow)
	enum { IDD = IDD_ZDD_Box_Info_Window };
	int		m_Radio_Button;
	BOOL	m_Check_Box_Cube;
	CString	m_Edition_Zone_Center_X;
	CString	m_Edition_Zone_Center_Y;
	CString	m_Edition_Zone_Center_Z;
	CString	m_Edition_Zone_Height;
	CString	m_Edition_Zone_Length;
	CString	m_Edition_Zone_Width;
	CString	m_Edition_Zone_X_Maxi;
	CString	m_Edition_Zone_X_Mini;
	CString	m_Edition_Zone_Y_Maxi;
	CString	m_Edition_Zone_Y_Mini;
	CString	m_Edition_Zone_Z_Maxi;
	CString	m_Edition_Zone_Z_Mini;
	CSliderCtrl	m_Slider_Size;
	//}}AFX_DATA

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CZDxBoxInfoWindow)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CZDxBoxInfoWindow)
	virtual BOOL OnInitDialog();
	afx_msg void On_Radio_Button_Center();
	afx_msg void On_Radio_Button_Extrema();
	afx_msg void On_Change_Edition_Zone_X_Mini();
	afx_msg void On_Change_Edition_Zone_Y_Mini();
	afx_msg void On_Change_Edition_Zone_Z_Mini();
	afx_msg void On_Change_Edition_Zone_X_Maxi();
	afx_msg void On_Change_Edition_Zone_Y_Maxi();
	afx_msg void On_Change_Edition_Zone_Z_Maxi();
	afx_msg void On_Change_Edition_Zone_Center_X();
	afx_msg void On_Change_Edition_Zone_Center_Y();
	afx_msg void On_Change_Edition_Zone_Center_Z();
	afx_msg void On_Change_Edition_Zone_Length();
	afx_msg void On_Change_Edition_Zone_Width();
	afx_msg void On_Change_Edition_Zone_Height();
	afx_msg void On_Check_Box_Cube();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void On_Button_Init();
    afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Personal data
private:
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
    ZDx_Shape *        m_pZDxBox;                    // pointer to the ZDx box
	Box3D *          m_pBox3D;
//ENDROMTEAM WorldEditor (Cristi Petrescu)
    BOOL             m_ZDxIsACube;                 // Indicate if the ZDx box is a cube or not
    double           m_FatherAverageSize;
    MTH3D_tdstVector m_FatherMinPoint;
    MTH3D_tdstVector m_FatherMaxPoint;

    void RefreshSlider ();
    void RefreshSizeFromSlider ();

public:
    void SetZDxShapeToEdit (ZDx_Shape *);      // Set the ZDx shape to edit
    void RefreshData ();                       // Called when the data need to be refreshed
    void RefreshData (BOOL _bKeepCube);        // Idem
    CWnd * GetFirstControlOfWindow ();         // Get the first control of the window
    CWnd * GetLastControlOfWindow  ();         // Get the last control of the window
};

//-----------------------------------------------------------------------------
// class CZDxPointInfoWindow
//
// Window that shows informations about a ZDx point object
//-----------------------------------------------------------------------------
class CZDxPointInfoWindow : public CZDxShapeInfoWindow
{
// Construction
public:
	CZDxPointInfoWindow (CWnd * pParent , ZDx_Point * pZDxObject);

// Dialog Data
	//{{AFX_DATA(CZDxPointInfoWindow)
	enum { IDD = IDD_ZDD_Point_Info_Window };
	CString	m_Edition_Zone_X;
	CString	m_Edition_Zone_Y;
	CString	m_Edition_Zone_Z;
	//}}AFX_DATA

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CZDxPointInfoWindow)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

    // Generated message map functions
	//{{AFX_MSG(CZDxPointInfoWindow)
	afx_msg void On_Change_Edition_Zone_X();
	afx_msg void On_Change_Edition_Zone_Y();
	afx_msg void On_Change_Edition_Zone_Z();
	virtual BOOL OnInitDialog();
    afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Personal data
private:
    ZDx_Point * m_pZDxPoint;                   // pointer to the ZDx point
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
	Point3D   * m_pPoint3D;
//ENDROMTEAM WorldEditor (Cristi Petrescu)

public:
    void SetZDxShapeToEdit (ZDx_Shape *);      // Set the ZDx shape to edit
    void RefreshData ();                       // Called when the data need to be refreshed
    CWnd * GetFirstControlOfWindow ();         // Get the first control of the window
    CWnd * GetLastControlOfWindow  ();         // Get the last control of the window
};

//-----------------------------------------------------------------------------
// class CZDxConeInfoWindow
//
// Window that shows informations about a ZDx cone object
//-----------------------------------------------------------------------------
class CZDxConeInfoWindow : public CZDxShapeInfoWindow
{
// Construction
public:
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
	CZDxConeInfoWindow (CWnd * pParent , ZDx_Shape * pZDxObject);
//ENDROMTEAM WorldEditor (Cristi Petrescu)

    // Dialog Data
	//{{AFX_DATA(CZDxConeInfoWindow)
	enum { IDD = IDD_ZDD_Cone_Info_Window };
	CString	m_Edition_Zone_Angle;
	CString	m_Edition_Zone_Radius;
	CString	m_Edition_Zone_X_Base;
	CString	m_Edition_Zone_X_Top;
	CString	m_Edition_Zone_Y_Base;
	CString	m_Edition_Zone_Y_Top;
	CString	m_Edition_Zone_Z_Base;
	CString	m_Edition_Zone_Z_Top;
	//}}AFX_DATA

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CZDxConeInfoWindow)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

    // Generated message map functions
	//{{AFX_MSG(CZDxConeInfoWindow)
	virtual BOOL OnInitDialog();
	afx_msg void On_Change_Edition_Zone_Angle();
	afx_msg void On_Change_Edition_Zone_Radius();
	afx_msg void On_Change_Edition_Zone_X_Base();
	afx_msg void On_Change_Edition_Zone_X_Top();
	afx_msg void On_Change_Edition_Zone_Y_Base();
	afx_msg void On_Change_Edition_Zone_Y_Top();
	afx_msg void On_Change_Edition_Zone_Z_Base();
	afx_msg void On_Change_Edition_Zone_Z_Top();
    afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Personal data
private:
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
    ZDx_Shape * m_pZDxCone;                     // pointer to the ZDx cone
	Cone3D   * m_pCone3D;
//ENDROMTEAM WorldEditor (Cristi Petrescu)

public:
    void SetZDxShapeToEdit (ZDx_Shape *);      // Set the ZDx shape to edit
    void RefreshData ();                       // Called when the data need to be refreshed
    CWnd * GetFirstControlOfWindow ();         // Get the first control of the window
    CWnd * GetLastControlOfWindow  ();         // Get the last control of the window
};


#endif  // __ZWEDIT_HPP
