2454 lines
106 KiB
C++
2454 lines
106 KiB
C++
//*****************************************************************************
|
|
//* _zWEdit.cpp *
|
|
//*****************************************************************************
|
|
//* *
|
|
//* This file contains all the functions for the edit windows *
|
|
//* *
|
|
//*****************************************************************************
|
|
//* Author : Alexis Vaisse *
|
|
//*****************************************************************************
|
|
|
|
|
|
// "standard" include
|
|
#include "stdafx.h"
|
|
#include "ACP_Base.h"
|
|
#define HieFriend
|
|
#include "IncGAM.h"
|
|
#include "ITF.h"
|
|
|
|
// personal include
|
|
#include "_zRes.h" // File created by Microsoft Developer Studio
|
|
#include "_zWEdit.hpp"
|
|
#include "_zObject.hpp"
|
|
#include "_zModif.hpp"
|
|
#include "_zWList1.hpp"
|
|
#include "_zWList2.hpp"
|
|
#include "_zInterf.hpp"
|
|
|
|
#include "OAC.h" // Actor dll include
|
|
#include "IncTUT.h" // Tutorial dll include
|
|
|
|
|
|
class EdActors_EditorActorInstance;
|
|
class EdActors_EditorActorModel;
|
|
class CPA_Family;
|
|
|
|
static float s_fOldLenght = 0;
|
|
static float s_fOldWidth = 0;
|
|
static float s_fOldHeight = 0;
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
// class CDisplayControlWindow
|
|
//
|
|
// Window that controls the display of the zones
|
|
//*****************************************************************************
|
|
|
|
IMPLEMENT_DYNCREATE (CDisplayControlWindow , CFormView)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow : constructor
|
|
//-----------------------------------------------------------------------------
|
|
CDisplayControlWindow::CDisplayControlWindow(CWnd* pParent /*=NULL*/)
|
|
: CFormView(CDisplayControlWindow::IDD)
|
|
{
|
|
//{{AFX_DATA_INIT(CDisplayControlWindow)
|
|
m_Radio_Button_All_Actors = -1;
|
|
m_Radio_Button_Current_Actor = -1;
|
|
//}}AFX_DATA_INIT
|
|
|
|
m_Radio_Button_All_Actors = 2; // "Selected" button
|
|
m_Radio_Button_Current_Actor = 2; // "Selected" button
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow : general functions
|
|
//-----------------------------------------------------------------------------
|
|
void CDisplayControlWindow::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CFormView::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDisplayControlWindow)
|
|
DDX_Radio(pDX, IDC_Radio_Button_All_Actors_On, m_Radio_Button_All_Actors);
|
|
DDX_Radio(pDX, IDC_Radio_Button_Current_Actor_On, m_Radio_Button_Current_Actor);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CDisplayControlWindow, CFormView)
|
|
//{{AFX_MSG_MAP(CDisplayControlWindow)
|
|
ON_BN_CLICKED(IDC_Radio_Button_All_Actors_On, On_Radio_Buttons_All_Actors)
|
|
ON_BN_CLICKED(IDC_Radio_Button_All_Actors_Off, On_Radio_Buttons_All_Actors)
|
|
ON_BN_CLICKED(IDC_Radio_Button_All_Actors_Selected, On_Radio_Buttons_All_Actors)
|
|
ON_BN_CLICKED(IDC_Radio_Button_Current_Actor_On, On_Radio_Buttons_Current_Actor)
|
|
ON_BN_CLICKED(IDC_Radio_Button_Current_Actor_Off, On_Radio_Buttons_Current_Actor)
|
|
ON_BN_CLICKED(IDC_Radio_Button_Current_Actor_Selected, On_Radio_Buttons_Current_Actor)
|
|
//}}AFX_MSG_MAP
|
|
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, SetToolTipText)
|
|
END_MESSAGE_MAP()
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - Create
|
|
// init the window
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CDisplayControlWindow::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
|
|
{
|
|
// Call the standard create. Return TRUE if Ok
|
|
if (CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
|
|
{
|
|
// To call DoDataExchange
|
|
UpdateData (FALSE);
|
|
|
|
// Init tooltip control
|
|
m_ToolTipCtrl . Create (this , WS_VISIBLE | TTS_ALWAYSTIP);
|
|
m_ToolTipCtrl . AddTool (GetDlgItem (IDC_Radio_Button_All_Actors_On ));
|
|
m_ToolTipCtrl . AddTool (GetDlgItem (IDC_Radio_Button_All_Actors_Off ));
|
|
m_ToolTipCtrl . AddTool (GetDlgItem (IDC_Radio_Button_All_Actors_Selected ));
|
|
m_ToolTipCtrl . AddTool (GetDlgItem (IDC_Radio_Button_Current_Actor_On ));
|
|
m_ToolTipCtrl . AddTool (GetDlgItem (IDC_Radio_Button_Current_Actor_Off ));
|
|
m_ToolTipCtrl . AddTool (GetDlgItem (IDC_Radio_Button_Current_Actor_Selected));
|
|
m_ToolTipCtrl . Activate (TRUE);
|
|
EnableToolTips ();
|
|
|
|
// Register the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_All_Actors_On , "TUT_AllActorsOn" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_All_Actors_Off , "TUT_AllActorsOff" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_All_Actors_Selected , "TUT_AllActorsSelected" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_Current_Actor_On , "TUT_CurrentActorOn" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_Current_Actor_Off , "TUT_CurrentActorOff" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_Current_Actor_Selected , "TUT_CurrentActorSelected" , TUT_e_Button);
|
|
|
|
return TRUE;
|
|
}
|
|
else return FALSE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - SetToolTipText
|
|
// Set the text that will be shown in a tool tip
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CDisplayControlWindow::SetToolTipText (UINT uiControlId , NMHDR * pNMHDR , LRESULT * pResult)
|
|
{
|
|
LPTOOLTIPTEXT lpToolTipText = (LPTOOLTIPTEXT) pNMHDR;
|
|
uiControlId = ::GetDlgCtrlID ((HWND) pNMHDR -> idFrom);
|
|
|
|
switch (uiControlId)
|
|
{
|
|
case IDC_Radio_Button_All_Actors_On : lpToolTipText -> lpszText = "Show zones of other actors"; break;
|
|
case IDC_Radio_Button_All_Actors_Off : lpToolTipText -> lpszText = "Hide zones of other actors"; break;
|
|
case IDC_Radio_Button_All_Actors_Selected : lpToolTipText -> lpszText = "Show zones of selected actors"; break;
|
|
case IDC_Radio_Button_Current_Actor_On : lpToolTipText -> lpszText = "Select current actor"; break;
|
|
case IDC_Radio_Button_Current_Actor_Off : lpToolTipText -> lpszText = "Unselect current actor"; break;
|
|
case IDC_Radio_Button_Current_Actor_Selected : lpToolTipText -> lpszText = "Show selected zones of actor"; break;
|
|
default : lpToolTipText -> lpszText = ""; break;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - PreTranslateMessage
|
|
// We intercept the WM_NOTIFY message
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CDisplayControlWindow::PreTranslateMessage (MSG * pMsg)
|
|
{
|
|
switch (pMsg -> message)
|
|
{
|
|
case WM_LBUTTONDOWN :
|
|
case WM_MOUSEMOVE :
|
|
case WM_LBUTTONUP :
|
|
case WM_RBUTTONDOWN :
|
|
case WM_MBUTTONDOWN :
|
|
case WM_RBUTTONUP :
|
|
case WM_MBUTTONUP : m_ToolTipCtrl . RelayEvent (pMsg);
|
|
break;
|
|
}
|
|
|
|
return CFormView::PreTranslateMessage(pMsg);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - On_Radio_Buttons_All_Actors
|
|
// Called when one clicks on one of the 3 buttons for 'All actors'
|
|
//-----------------------------------------------------------------------------
|
|
void CDisplayControlWindow::On_Radio_Buttons_All_Actors ()
|
|
{
|
|
UpdateData (TRUE); // Update the variables from screen
|
|
|
|
m_pZDxInterface -> IWillRefreshDisplay (C_lOnButtonAllActors);
|
|
|
|
// If we were editing the bouding volume, we leave the edition
|
|
if (m_pZDxInterface -> GetList1Window () -> IsEditingBoundingVolume ())
|
|
m_pZDxInterface -> GetList1Window () -> LeaveEditionOfBoundingVolume ();
|
|
// ANNECY AV CLEAN_MEC {
|
|
/*
|
|
else
|
|
if (m_pZDxInterface -> GetList1Window () -> IsEditingTestPoint ())
|
|
m_pZDxInterface -> GetList1Window () -> LeaveEditionOfTestPoint ();
|
|
*/
|
|
// END ANNECY AV }
|
|
|
|
switch (m_Radio_Button_All_Actors)
|
|
{
|
|
case 0 : // "On" button
|
|
m_pZDxInterface -> ShowAllZDxOfAllActors (C_ucShowAllZDx , FALSE);
|
|
break;
|
|
|
|
case 1 : // "Off" button
|
|
m_pZDxInterface -> ShowAllZDxOfAllActors (C_ucHideAllZDx , FALSE);
|
|
break;
|
|
|
|
case 2 : // "Selected" button
|
|
m_pZDxInterface -> ShowAllZDxOfAllActors (C_ucShowAllZDx , TRUE);
|
|
break;
|
|
|
|
default: ASSERT (0);
|
|
}
|
|
|
|
CPA_SuperObject * pSelectedActorSuperObject = m_pZDxInterface -> GetList1Window () -> GetSelectedActorSuperObject ();
|
|
if (pSelectedActorSuperObject) m_pZDxInterface -> ShowZDxOfActor (pSelectedActorSuperObject , C_ucShowAllZDx);
|
|
|
|
m_pZDxInterface -> RefreshDisplay (C_lOnButtonAllActors);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - On_Radio_Buttons_Current_Actor
|
|
// Called when one clicks on one of the 3 buttons for 'Current actor'
|
|
//-----------------------------------------------------------------------------
|
|
void CDisplayControlWindow::On_Radio_Buttons_Current_Actor ()
|
|
{
|
|
UpdateData (TRUE); // Update the variables from screen
|
|
|
|
// Get the current actor
|
|
CPA_Actor * pSelectedActor = (CPA_Actor *) m_pZDxInterface -> GetList1Window () -> GetSelectedActor ();
|
|
if (! pSelectedActor) return;
|
|
|
|
switch (m_Radio_Button_Current_Actor)
|
|
{
|
|
case 0 : // "On" button
|
|
pSelectedActor -> SetDisplayZone (TRUE);
|
|
break;
|
|
|
|
case 1 : // "Off" button
|
|
pSelectedActor -> SetDisplayZone (FALSE);
|
|
break;
|
|
|
|
case 2 : // "Selected" button
|
|
pSelectedActor -> SetDisplayZone ((BOOL) 2);
|
|
break;
|
|
|
|
default : ASSERT (0);
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - GetDisplayForAllActors
|
|
// Get the state of the "All actors" radio button
|
|
//-----------------------------------------------------------------------------
|
|
tdeDisplayType CDisplayControlWindow::GetDisplayForAllActors ()
|
|
{
|
|
UpdateData (TRUE);
|
|
|
|
switch (m_Radio_Button_All_Actors)
|
|
{
|
|
case -1 : return eNoZone;
|
|
case 0 : return eOn;
|
|
case 1 : return eOff;
|
|
case 2 : return eSelected;
|
|
default : ASSERT (0);
|
|
return eNoZone;
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - GetDisplayForCurrentActor
|
|
// Get the state of the "Current actor" radio button
|
|
//-----------------------------------------------------------------------------
|
|
tdeDisplayType CDisplayControlWindow::GetDisplayForCurrentActor ()
|
|
{
|
|
UpdateData (TRUE);
|
|
|
|
switch (m_Radio_Button_Current_Actor)
|
|
{
|
|
case -1 : return eNoZone;
|
|
case 0 : return eOn;
|
|
case 1 : return eOff;
|
|
case 2 : return eSelected;
|
|
default : ASSERT (0);
|
|
return eNoZone;
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - SetDisplayForAllActors
|
|
// Set the state of the "All actors" radio button
|
|
//-----------------------------------------------------------------------------
|
|
void CDisplayControlWindow::SetDisplayForAllActors (tdeDisplayType _eDisplayType)
|
|
{
|
|
switch (_eDisplayType)
|
|
{
|
|
case eNoZone : m_Radio_Button_All_Actors = -1; break;
|
|
case eOn : m_Radio_Button_All_Actors = 0; break;
|
|
case eOff : m_Radio_Button_All_Actors = 1; break;
|
|
case eSelected : m_Radio_Button_All_Actors = 2; break;
|
|
default : ASSERT (0); break;
|
|
}
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
On_Radio_Buttons_All_Actors ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - SetDisplayForCurrentActor
|
|
// Set the state of the "Current actor" radio button
|
|
//-----------------------------------------------------------------------------
|
|
void CDisplayControlWindow::SetDisplayForCurrentActor (tdeDisplayType _eDisplayType)
|
|
{
|
|
switch (_eDisplayType)
|
|
{
|
|
case eNoZone : m_Radio_Button_Current_Actor = -1; break;
|
|
case eOn : m_Radio_Button_Current_Actor = 0; break;
|
|
case eOff : m_Radio_Button_Current_Actor = 1; break;
|
|
case eSelected : m_Radio_Button_Current_Actor = 2; break;
|
|
default : ASSERT (0); break;
|
|
}
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
On_Radio_Buttons_Current_Actor (); // Update the flag of the actor
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - SetNameOfCurrentActor
|
|
// Set the name of the current actor (it is showed in the window)
|
|
//-----------------------------------------------------------------------------
|
|
void CDisplayControlWindow::SetNameOfCurrentActor (CString csActorName)
|
|
{
|
|
CString csText = "Current actor";
|
|
if (! csActorName . IsEmpty ()) csText += ": " + csActorName;
|
|
GetDlgItem (IDC_Frame_Current_Actor) -> SetWindowText ((char *) (LPCTSTR) csText);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CDisplayControlWindow - DisplayAllActors
|
|
// Display all actors with the correct zones
|
|
//-----------------------------------------------------------------------------
|
|
void CDisplayControlWindow::DisplayAllActors ()
|
|
{
|
|
On_Radio_Buttons_All_Actors ();
|
|
}
|
|
|
|
|
|
//*****************************************************************************
|
|
// class CZDxInfoWindow
|
|
//
|
|
// Window that shows informations about a ZDx object
|
|
//*****************************************************************************
|
|
|
|
IMPLEMENT_DYNCREATE (CZDxInfoWindow , CFormView)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow : constructor
|
|
//-----------------------------------------------------------------------------
|
|
CZDxInfoWindow::CZDxInfoWindow(CWnd* pParent /*=NULL*/)
|
|
: CFormView(CZDxInfoWindow::IDD)
|
|
{
|
|
//{{AFX_DATA_INIT(CZDxInfoWindow)
|
|
m_Edition_Zone_Name = _T("");
|
|
//}}AFX_DATA_INIT
|
|
|
|
// Init the variables
|
|
m_pCZDxShapeInfoWindow = NULL;
|
|
m_pZDxModif = NULL;
|
|
m_pZDxObject = NULL;
|
|
m_bIsApplying = FALSE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow : general functions
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CFormView::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CZDxInfoWindow)
|
|
DDX_Text(pDX, IDC_Edition_Zone_Name, m_Edition_Zone_Name);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Type, m_Edition_Zone_Type);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CZDxInfoWindow, CFormView)
|
|
//{{AFX_MSG_MAP(CZDxInfoWindow)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Name, On_Change_Edition_Zone_Name)
|
|
ON_BN_CLICKED(IDC_Apply_Button, On_Apply_Button)
|
|
ON_BN_CLICKED(IDC_Cancel_Button, On_Cancel_Button)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - Create
|
|
// init the window
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxInfoWindow::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
|
|
{
|
|
// Call the standard create. Return TRUE if Ok
|
|
if (CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
|
|
{
|
|
// To call DoDataExchange
|
|
UpdateData (FALSE);
|
|
|
|
// Register the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Name , "TUT_ZoneName" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Apply_Button , "TUT_Apply" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Cancel_Button , "TUT_Cancel" , TUT_e_Button);
|
|
|
|
return TRUE;
|
|
}
|
|
else return FALSE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - SetZDxObjectToEdit
|
|
// set the ZDx object to edit :
|
|
// we fill the different fields in the window with the data of a ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::SetZDxObjectToEdit (CPA_SuperObject * _pZDxSuperObject)
|
|
{
|
|
// if there is already a ZDx object edited, we clic on the apply button to save the changes
|
|
if (m_pZDxObject) Apply ();
|
|
|
|
m_pZDxSuperObject = _pZDxSuperObject;
|
|
m_pZDxObject = (ZDx_Object *) (_pZDxSuperObject ? _pZDxSuperObject -> GetObject () : NULL);
|
|
|
|
// Refresh the data
|
|
RefreshData (FALSE);
|
|
// If there is a ZDx object to edit, we must have a ZDx modif
|
|
if (m_pZDxObject) RefreshModif ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - RefreshData
|
|
// this function is called when the data need to be refreshed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::RefreshData (BOOL _bRedrawNeeded)
|
|
{
|
|
// Init variables
|
|
SetZDxHasBeenChanged (FALSE);
|
|
|
|
if (m_pZDxObject) // If there is a ZDx object to edit
|
|
{
|
|
// Set the field for the name of the ZDx object
|
|
// ANNECY AV CLEAN_MEC {
|
|
GetDlgItem (IDC_Edition_Zone_Name) -> EnableWindow (TRUE /* m_pZDxObject -> GetZDxType () != eTestPoint */); // One cannot modify the name of a test point
|
|
// END ANNECY AV }
|
|
m_Edition_Zone_Name = m_pZDxObject->GetZDxName ();
|
|
|
|
// Set the field for the type of the ZDx object
|
|
switch (m_pZDxObject -> GetZDxType ())
|
|
{
|
|
case eZdd : m_Edition_Zone_Type = C_szZddName; break;
|
|
case eZde : m_Edition_Zone_Type = C_szZdeName; break;
|
|
case eZdm : m_Edition_Zone_Type = C_szZdmName; break;
|
|
case eZdr : m_Edition_Zone_Type = C_szZdrName; break;
|
|
case eBoundingVolume : m_Edition_Zone_Type = C_szBoundingVolumeName; break;
|
|
// ANNECY AV CLEAN_MEC {
|
|
// case eTestPoint : m_Edition_Zone_Type = C_szTestPointName; break;
|
|
// END ANNECY AV }
|
|
default : ASSERT (0); break;
|
|
}
|
|
|
|
// ANNECY AV CLEAN_MEC {
|
|
// if (m_pZDxObject -> GetZDxType () != eTestPoint)
|
|
// END ANNECY AV }
|
|
{
|
|
m_Edition_Zone_Type += " - ";
|
|
|
|
switch (m_pZDxObject -> GetZDxGeometricType ())
|
|
{
|
|
case eSphere : m_Edition_Zone_Type += C_szZDxSphereName; break;
|
|
case eBox : m_Edition_Zone_Type += C_szZDxBoxName; break;
|
|
case ePoint : m_Edition_Zone_Type += C_szZDxPointName; break;
|
|
case eCone : m_Edition_Zone_Type += C_szZDxConeName; break;
|
|
default: ASSERT (0); break;
|
|
}
|
|
}
|
|
UpdateData (FALSE);
|
|
|
|
// If a shape info window is already open
|
|
if (m_pCZDxShapeInfoWindow)
|
|
{
|
|
// If the new edited object has the same type
|
|
if (m_eTypeShapeInfoWindow == m_pZDxObject -> GetZDxGeometricType ())
|
|
{
|
|
// We set the shape to edit (this refreshes the data of the shape info window)
|
|
m_pCZDxShapeInfoWindow -> SetZDxShapeToEdit (m_pZDxObject -> GetZDxShape ());
|
|
}
|
|
// Else we close the shape info window and we open a new one
|
|
else
|
|
{
|
|
CloseShapeInfoWindow ();
|
|
OpenShapeInfoWindow ();
|
|
}
|
|
}
|
|
// If the shape info window is not open, we open it
|
|
else
|
|
{
|
|
OpenShapeInfoWindow ();
|
|
}
|
|
|
|
if (_bRedrawNeeded) m_pZDxObject -> RedrawZDxObject ();
|
|
}
|
|
else // if there is no ZDx object to edit
|
|
{
|
|
m_Edition_Zone_Name = "";
|
|
GetDlgItem (IDC_Edition_Zone_Name) -> EnableWindow (FALSE);
|
|
|
|
m_Edition_Zone_Type = "";
|
|
|
|
if (m_pCZDxShapeInfoWindow) CloseShapeInfoWindow ();
|
|
}
|
|
|
|
// At the beginning, buttons are disabled
|
|
// They will be enabled when a modification is done
|
|
GetDlgItem (IDC_Apply_Button) -> EnableWindow (FALSE);
|
|
GetDlgItem (IDC_Cancel_Button) -> EnableWindow (FALSE);
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - RefreshModif
|
|
// create a modif for the selected ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::RefreshModif ()
|
|
{
|
|
// We don't create a modif if there is no ZDx object
|
|
if (! m_pZDxObject) return;
|
|
|
|
if (m_pZDxModif) m_pZDxModif -> SetZDxObject (m_pZDxObject);
|
|
else m_pZDxModif = new ZDx_Modif (m_pZDxObject , "Modification ZDx");
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - SetZDxHasBeenChanged
|
|
// Indicate if the ZDx object has been changed or not
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::SetZDxHasBeenChanged (BOOL b)
|
|
{
|
|
m_ZDxHasBeenChanged = b;
|
|
|
|
// buttons are enabled only if there is a modification
|
|
GetDlgItem (IDC_Apply_Button) -> EnableWindow (b);
|
|
GetDlgItem (IDC_Cancel_Button) -> EnableWindow (b);
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - On_Change_Edition_Zone_Name
|
|
// this function is called when the user changes the name of the ZDx Object :
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::On_Change_Edition_Zone_Name ()
|
|
{
|
|
UpdateData (TRUE);
|
|
|
|
if( m_pZDxObject == NULL ) return;
|
|
|
|
CList2Window * pList2Window = ((ZDx_Interface *) m_pZDxObject -> GetEditor ()) -> GetList2Window ();
|
|
|
|
// If the name has changed, we call SetZDxName
|
|
if (m_Edition_Zone_Name != m_pZDxObject -> GetZDxName ())
|
|
{
|
|
if (m_Edition_Zone_Name != "") // The name is not empty
|
|
{
|
|
if (! m_pZDxObject -> SetZDxName ((char *) (LPCTSTR (m_Edition_Zone_Name))))
|
|
{
|
|
MessageBox ("This name already exists or contains invalid characters (space...). Please enter another name." , "Warning" , MB_OK + MB_APPLMODAL + MB_ICONSTOP);
|
|
::SetFocus (GetDlgItem (IDC_Edition_Zone_Name) -> m_hWnd);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
// Refresh the list of ZDx
|
|
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
|
|
pList2Window -> CreateBoundingVolume (pList2Window -> GetActorSuperObject () , m_pZDxObject , FALSE);
|
|
else pList2Window -> ReCreateListOfZDx (FALSE , FALSE);
|
|
}
|
|
}
|
|
else // The name is empty : we put " " as name, and we do not show any message
|
|
{
|
|
m_pZDxObject -> SetZDxName (" ");
|
|
// Refresh the list of ZDx
|
|
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
|
|
pList2Window -> CreateBoundingVolume (pList2Window -> GetActorSuperObject () , m_pZDxObject , FALSE);
|
|
else pList2Window -> ReCreateListOfZDx (FALSE , FALSE);
|
|
SetZDxHasBeenChanged (TRUE);
|
|
}
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - OpenShapeInfoWindow
|
|
// open a window with the properties of the ZDx object (radius for the sphere...)
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::OpenShapeInfoWindow ()
|
|
{
|
|
CPA_SuperObject * pFatherSuperObject = m_pZDxSuperObject -> GetSuperObjectFather ();
|
|
ZDx_Interface * pZDxInterface = (ZDx_Interface *) m_pZDxObject -> GetEditor ();
|
|
|
|
// We want the resources to be searched into the DLL and not into the program
|
|
HINSTANCE hOldInst = AfxGetResourceHandle ();
|
|
AfxSetResourceHandle (((CPA_DLLBase *) m_pZDxObject -> GetEditor ()) -> GetDLLIdentity () -> hModule);
|
|
|
|
switch (m_pZDxObject -> GetZDxGeometricType ())
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
case eSphere: // create a window to display the sphere attributes and give it a pointer to the ZDx object
|
|
m_pCZDxShapeInfoWindow = new CZDxSphereInfoWindow (this , (ZDx_Shape *) m_pZDxObject -> GetZDxShape () , pFatherSuperObject , pZDxInterface);
|
|
break;
|
|
|
|
case eBox: // create a window to display the box attributes and give it a pointer to the ZDx object
|
|
m_pCZDxShapeInfoWindow = new CZDxBoxInfoWindow (this , (ZDx_Shape *) m_pZDxObject -> GetZDxShape () , pFatherSuperObject , pZDxInterface);
|
|
break;
|
|
|
|
case ePoint: // create a window to display the point attributes and give it a pointer to the ZDx object
|
|
m_pCZDxShapeInfoWindow = new CZDxPointInfoWindow (this , (ZDx_Point *) m_pZDxObject -> GetZDxShape ());
|
|
break;
|
|
|
|
case eCone: // create a window to display the cone attributes and give it a pointer to the ZDx object
|
|
m_pCZDxShapeInfoWindow = new CZDxConeInfoWindow (this , (ZDx_Shape *) m_pZDxObject -> GetZDxShape ());
|
|
break;
|
|
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
default: ASSERT (0);
|
|
return;
|
|
}
|
|
|
|
AfxSetResourceHandle (hOldInst);
|
|
|
|
// Set the type of the shape info window
|
|
m_eTypeShapeInfoWindow = m_pZDxObject -> GetZDxGeometricType ();
|
|
|
|
// Move the shape info window to the right place
|
|
RECT Dimension; // Get the width and height of the Shape info window
|
|
m_pCZDxShapeInfoWindow -> GetWindowRect( & Dimension);
|
|
RECT AbsolutePosition; // Get the absolute position of the static
|
|
GetDlgItem (IDC_Pos_Shape_Info_Window) -> GetWindowRect (& AbsolutePosition);
|
|
RECT WindowPosition; // Get the absolute position of the window
|
|
GetWindowRect (& WindowPosition);
|
|
RECT RelativePosition; // Then we can calculate the relative position of the static within the window
|
|
RelativePosition.left = AbsolutePosition.left - WindowPosition.left;
|
|
RelativePosition.top = AbsolutePosition.top - WindowPosition.top;
|
|
// We move the Shape info window
|
|
m_pCZDxShapeInfoWindow -> MoveWindow( RelativePosition.left , RelativePosition.top ,
|
|
Dimension.right-Dimension.left , Dimension.bottom-Dimension.top);
|
|
m_pCZDxShapeInfoWindow -> ShowWindow (SW_SHOW);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - CloseShapeInfoWindow
|
|
// close the Shape info window
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::CloseShapeInfoWindow ()
|
|
{
|
|
m_pCZDxShapeInfoWindow->DestroyWindow ();
|
|
delete m_pCZDxShapeInfoWindow;
|
|
m_pCZDxShapeInfoWindow = NULL;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - On_Apply_Button
|
|
// clic on the Apply button
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::On_Apply_Button ()
|
|
{
|
|
if (m_bIsApplying || m_pZDxObject == NULL) return;
|
|
|
|
m_bIsApplying = TRUE;
|
|
|
|
if (m_ZDxHasBeenChanged)
|
|
{
|
|
m_pZDxModif -> Undo (FALSE); // we must undo the modifications (without refreshing the window)
|
|
m_pZDxObject->GetEditor()->GetInterface()->GetMultiDevice()->GetEditManager()->AskFor (m_pZDxModif);
|
|
// because the edit manager redoes them
|
|
if (! m_pZDxObject) // The Do function of the modification refreshes the display,
|
|
{ // so m_pZDxObject can now be NULL
|
|
m_bIsApplying = FALSE;
|
|
m_pZDxModif = NULL;
|
|
return;
|
|
}
|
|
m_pZDxModif = new ZDx_Modif (m_pZDxObject , "Modification ZDx"); // we create a new ZDx modif
|
|
|
|
m_ZDxHasBeenChanged = FALSE;
|
|
GetDlgItem (IDC_Apply_Button) -> EnableWindow (FALSE);
|
|
GetDlgItem (IDC_Cancel_Button) -> EnableWindow (FALSE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
m_bIsApplying = FALSE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - Apply
|
|
// this simulates a clic on the Apply button
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::Apply ()
|
|
{
|
|
On_Apply_Button ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - On_Cancel_Button
|
|
// clic on the cancel button : we cancel the changes the user did
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::On_Cancel_Button ()
|
|
{
|
|
if (m_pZDxObject == NULL) return;
|
|
|
|
if (m_ZDxHasBeenChanged)
|
|
{
|
|
m_pZDxModif -> Undo (); // we undo the modifications
|
|
m_pZDxModif -> SetZDxObject (m_pZDxObject); // and we start again
|
|
|
|
GetDlgItem (IDC_Apply_Button) -> EnableWindow (FALSE);
|
|
GetDlgItem (IDC_Cancel_Button) -> EnableWindow (FALSE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - Cancel
|
|
// this simulates a clic on the Cancel button
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxInfoWindow::Cancel ()
|
|
{
|
|
On_Cancel_Button ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - GetFirstControlOfWindow
|
|
// Get the first control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxInfoWindow::GetFirstControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Edition_Zone_Name);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - GetLastControlOfWindow
|
|
// Get the last control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxInfoWindow::GetLastControlOfWindow ()
|
|
{
|
|
if (m_ZDxHasBeenChanged) return GetDlgItem (IDC_Cancel_Button);
|
|
else return GetDlgItem (IDC_Edition_Zone_Name);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - OnTabKeyPressed
|
|
// Called when the Tab key is pressed ; return TRUE if the message is used
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxInfoWindow::OnTabKeyPressed ()
|
|
{
|
|
if (GetFocus () == GetLastControlOfWindow ())
|
|
{
|
|
m_pCZDxShapeInfoWindow -> GetFirstControlOfWindow () -> SetFocus ();
|
|
return TRUE;
|
|
}
|
|
|
|
if (GetFocus () == m_pCZDxShapeInfoWindow -> GetLastControlOfWindow ())
|
|
{
|
|
GetFirstControlOfWindow () -> SetFocus ();
|
|
return TRUE;
|
|
}
|
|
|
|
// Give the focus to the next control
|
|
GetFocus () -> GetParent () -> GetNextDlgTabItem (GetFocus () , FALSE) -> SetFocus ();
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - OnShiftTabKeyPressed
|
|
// Called when the Tab key is pressed ; return TRUE if the message is used
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxInfoWindow::OnShiftTabKeyPressed ()
|
|
{
|
|
if (GetFocus () == GetFirstControlOfWindow ())
|
|
{
|
|
m_pCZDxShapeInfoWindow -> GetLastControlOfWindow () -> SetFocus ();
|
|
return TRUE;
|
|
}
|
|
|
|
if (GetFocus () == m_pCZDxShapeInfoWindow -> GetFirstControlOfWindow ())
|
|
{
|
|
GetLastControlOfWindow () -> SetFocus ();
|
|
return TRUE;
|
|
}
|
|
|
|
// Give the focus to the previous control
|
|
GetFocus () -> GetParent () -> GetNextDlgTabItem (GetFocus () , TRUE) -> SetFocus ();
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxInfoWindow - PreTranslateMessage
|
|
// used to test the Tab key
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxInfoWindow::PreTranslateMessage (MSG * pMsg)
|
|
{
|
|
if (pMsg -> message == WM_KEYDOWN)
|
|
{
|
|
switch (pMsg -> wParam)
|
|
{
|
|
case VK_TAB:
|
|
if ((::GetKeyState (VK_CONTROL) & 0x8000) == 0x0000) // The Control key must not be pressed
|
|
{
|
|
if (::GetKeyState (VK_SHIFT) & 0x8000)
|
|
{
|
|
if (OnShiftTabKeyPressed ()) return TRUE;
|
|
}
|
|
else
|
|
{
|
|
if (OnTabKeyPressed ()) return TRUE;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case VK_RETURN: Apply ();
|
|
return TRUE;
|
|
|
|
case VK_ESCAPE: Cancel ();
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return CFormView::PreTranslateMessage (pMsg);
|
|
}
|
|
|
|
|
|
//*****************************************************************************
|
|
// class CZDxShapeInfoWindow
|
|
//
|
|
// Abstract class
|
|
//*****************************************************************************
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxShapeInfoWindow - OnOK
|
|
// clic on the Apply button of the parent window
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxShapeInfoWindow::OnOK ()
|
|
{
|
|
((CZDxInfoWindow *) GetParent ()) -> Apply ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxShapeInfoWindow - OnCancel
|
|
// clic on the Cancel button of the parent window
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxShapeInfoWindow::OnCancel ()
|
|
{
|
|
((CZDxInfoWindow *) GetParent ()) -> Cancel ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxShapeInfoWindow - SetZDxHasBeenChanged
|
|
// indicate to the parent window that the ZDx object has been changed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxShapeInfoWindow::SetZDxHasBeenChanged (BOOL b)
|
|
{
|
|
((CZDxInfoWindow *) GetParent ()) -> SetZDxHasBeenChanged (b);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxShapeInfoWindow - PreTranslateMessage
|
|
// used to test the Tab key
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxShapeInfoWindow::PreTranslateMessage (MSG * pMsg)
|
|
{
|
|
if (pMsg -> message == WM_KEYDOWN && pMsg -> wParam == VK_TAB)
|
|
{
|
|
if (GetParent () -> PreTranslateMessage (pMsg)) return TRUE;
|
|
}
|
|
|
|
return CDialog::PreTranslateMessage (pMsg);
|
|
}
|
|
|
|
//*****************************************************************************
|
|
// class CZDxSphereInfoWindow
|
|
//
|
|
// Window that shows informations about a ZDx sphere object
|
|
//*****************************************************************************
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow
|
|
// general functions
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
CZDxSphereInfoWindow::CZDxSphereInfoWindow (CWnd * _pParent , ZDx_Shape * _pObject , CPA_SuperObject * _pFatherSuperObject ,
|
|
ZDx_Interface * _pZDxInterface)
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
{
|
|
// Call the CDialog constructor
|
|
CDialog::CDialog (CZDxSphereInfoWindow::IDD, _pParent);
|
|
|
|
//{{AFX_DATA_INIT(CZDxSphereInfoWindow)
|
|
m_Edition_Zone_Center_X = _T("");
|
|
m_Edition_Zone_Center_Y = _T("");
|
|
m_Edition_Zone_Center_Z = _T("");
|
|
m_Edition_Zone_Radius = _T("");
|
|
//}}AFX_DATA_INIT
|
|
|
|
// Store the pointer to the ZDx sphere object
|
|
m_pZDxSphere = _pObject;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pSphere3D = (Sphere3D *) _pObject -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (_pFatherSuperObject)
|
|
{
|
|
m_FatherRadius = _pZDxInterface -> ComputeInitialSizeOfSphere (_pFatherSuperObject , & m_FatherCenter);
|
|
}
|
|
else
|
|
{
|
|
m_FatherRadius = (float) 1.0;
|
|
MTH3D_M_vNullVector (& m_FatherCenter);
|
|
}
|
|
|
|
// Create the window
|
|
Create (IDD_ZDD_Sphere_Info_Window , _pParent);
|
|
}
|
|
|
|
void CZDxSphereInfoWindow::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CZDxSphereInfoWindow)
|
|
DDX_Text(pDX, IDC_Edition_Zone_Center_X, m_Edition_Zone_Center_X);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Center_Y, m_Edition_Zone_Center_Y);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Center_Z, m_Edition_Zone_Center_Z);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Radius, m_Edition_Zone_Radius);
|
|
DDX_Control(pDX, IDC_Slider_Radius , m_Slider_Radius);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CZDxSphereInfoWindow, CDialog)
|
|
//{{AFX_MSG_MAP(CZDxSphereInfoWindow)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Center_X, On_Change_Edition_Zone_Center_X)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Center_Y, On_Change_Edition_Zone_Center_Y)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Center_Z, On_Change_Edition_Zone_Center_Z)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Radius, On_Change_Edition_Zone_Radius)
|
|
ON_WM_HSCROLL()
|
|
ON_BN_CLICKED(IDC_Button_Init, On_Button_Init)
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - OnInitDialog
|
|
// initialisation of the window
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxSphereInfoWindow::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
RefreshData (); // Init the variables
|
|
|
|
// Register the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Center_X , "TUT_SphereX" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Center_Y , "TUT_SphereY" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Center_Z , "TUT_SphereZ" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Radius , "TUT_Radius" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Slider_Radius , "TUT_RadiusSlider" , TUT_e_Slider);
|
|
TUT_M_vRegisterControlID (IDC_Button_Init , "TUT_SphereInit" , TUT_e_Button);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - SetZDxObjectToEdit
|
|
// set the ZDx object to edit :
|
|
// we fill the different fields in the window with the data of a ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::SetZDxShapeToEdit (ZDx_Shape * _pZDxShape)
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pZDxSphere = _pZDxShape;
|
|
m_pSphere3D = (Sphere3D *) _pZDxShape -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - On_Change_Edition_Zone_Center_X
|
|
// this function is called when the user changes the X coordinate of the center
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::On_Change_Edition_Zone_Center_X ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pSphere3D -> SetCenterX ((float) atof (m_Edition_Zone_Center_X));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxSphere -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - On_Change_Edition_Zone_Center_Y
|
|
// this function is called when the user changes the Y coordinate of the center
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::On_Change_Edition_Zone_Center_Y ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pSphere3D -> SetCenterY ((float) atof (m_Edition_Zone_Center_Y));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxSphere -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - On_Change_Edition_Zone_Center_Z
|
|
// this function is called when the user changes the Z coordinate of the center
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::On_Change_Edition_Zone_Center_Z ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pSphere3D -> SetCenterZ ((float) atof (m_Edition_Zone_Center_Z));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxSphere -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - On_Change_Edition_Zone_Radius
|
|
// this function is called when the user changes the radius of the sphere
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::On_Change_Edition_Zone_Radius ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Radius = (float) atof (m_Edition_Zone_Radius);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
if (! m_pSphere3D -> SetRadius (& Radius))
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
{ // Not a correct value : the correct value is stored in Radius. We show it
|
|
m_Edition_Zone_Radius . Format ("%.4g" , Radius);
|
|
UpdateData (FALSE);
|
|
}
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxSphere -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - RefreshSlider
|
|
// Refresh the position of the slider
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::RefreshSlider ()
|
|
{
|
|
m_Slider_Radius . SetOwner (this);
|
|
m_Slider_Radius . SetRange (0 , 150 , TRUE);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_Slider_Radius . SetPos ((long) (m_pSphere3D -> GetRadius () / m_FatherRadius * 100));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Slider_Radius . SetTicFreq (50);
|
|
|
|
UpdateData (FALSE);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - RefreshRadiusFromSlider
|
|
// Refresh the radius of the sphere when the position of the slider has changed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::RefreshRadiusFromSlider ()
|
|
{
|
|
UpdateData (TRUE);
|
|
|
|
MTH_tdxReal NewRadius = (float) (m_FatherRadius * m_Slider_Radius . GetPos () / 100.0);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pSphere3D -> SetRadius (& NewRadius);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
m_Edition_Zone_Radius . Format ("%.4g" , NewRadius);
|
|
UpdateData (FALSE);
|
|
|
|
m_pZDxSphere -> RedrawZDxObject ();
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - RefreshData
|
|
// this function is called when the data need to be refreshed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::RefreshData ()
|
|
{
|
|
// Init the variables on the screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
MTH3D_tdstVector Center = m_pSphere3D -> GetCenter ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Edition_Zone_Center_X . Format ("%.4g" , Center . xX);
|
|
m_Edition_Zone_Center_Y . Format ("%.4g" , Center . xY);
|
|
m_Edition_Zone_Center_Z . Format ("%.4g" , Center . xZ);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_Edition_Zone_Radius . Format ("%.4g" , m_pSphere3D -> GetRadius ());
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshSlider ();
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - GetFirstControlOfWindow
|
|
// Get the first control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxSphereInfoWindow::GetFirstControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Edition_Zone_Center_X);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - GetLastControlOfWindow
|
|
// Get the last control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxSphereInfoWindow::GetLastControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Edition_Zone_Radius);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - OnHScroll
|
|
// Call when the slider is changed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::OnHScroll(UINT nSBCode , UINT nPos , CScrollBar * pScrollBar)
|
|
{
|
|
if (pScrollBar == (void *) & m_Slider_Radius) RefreshRadiusFromSlider ();
|
|
else CDialog::OnHScroll (nSBCode , nPos , pScrollBar);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - On_Button_Init
|
|
// Call when the user clics on the Init button : we reinit the position and the size of the sphere
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::On_Button_Init ()
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pSphere3D -> SetRadius (& m_FatherRadius);
|
|
m_pSphere3D -> SetCenter (& m_FatherCenter);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
RefreshData ();
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxSphere -> RedrawZDxObject ();
|
|
((CZDxInfoWindow *) GetParent ()) -> Apply ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxSphereInfoWindow - OnDestroy
|
|
// Call when the window is destroy
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxSphereInfoWindow::OnDestroy ()
|
|
{
|
|
// Unregister the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Center_X);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Center_Y);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Center_Z);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Radius );
|
|
TUT_M_vUnregisterControlID (IDC_Slider_Radius );
|
|
TUT_M_vUnregisterControlID (IDC_Button_Init );
|
|
|
|
CZDxShapeInfoWindow::OnDestroy ();
|
|
}
|
|
|
|
|
|
//*****************************************************************************
|
|
// class CZDxBoxInfoWindow
|
|
//
|
|
// Window that shows informations about a ZDx box object
|
|
//*****************************************************************************
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow
|
|
// general functions
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
CZDxBoxInfoWindow::CZDxBoxInfoWindow (CWnd * _pParent , ZDx_Shape * _pObject , CPA_SuperObject * _pFatherSuperObject ,
|
|
ZDx_Interface * _pZDxInterface)
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
{
|
|
// Call the CDialog constructor
|
|
CDialog::CDialog (CZDxBoxInfoWindow::IDD, _pParent);
|
|
|
|
//{{AFX_DATA_INIT(CZDxBoxInfoWindow)
|
|
m_Radio_Button = -1;
|
|
m_Check_Box_Cube = FALSE;
|
|
m_Edition_Zone_Center_X = _T("");
|
|
m_Edition_Zone_Center_Y = _T("");
|
|
m_Edition_Zone_Center_Z = _T("");
|
|
m_Edition_Zone_Height = _T("");
|
|
m_Edition_Zone_Length = _T("");
|
|
m_Edition_Zone_Width = _T("");
|
|
m_Edition_Zone_X_Maxi = _T("");
|
|
m_Edition_Zone_X_Mini = _T("");
|
|
m_Edition_Zone_Y_Maxi = _T("");
|
|
m_Edition_Zone_Y_Mini = _T("");
|
|
m_Edition_Zone_Z_Maxi = _T("");
|
|
m_Edition_Zone_Z_Mini = _T("");
|
|
//}}AFX_DATA_INIT
|
|
|
|
// Store the pointer to the ZDx box object
|
|
m_pZDxBox = _pObject;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D = (Box3D *) _pObject -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
// Compute size of the father
|
|
if (_pFatherSuperObject)
|
|
{
|
|
_pZDxInterface -> ComputeInitialSizeOfBox (_pFatherSuperObject , & m_FatherMinPoint , & m_FatherMaxPoint);
|
|
MTH3D_tdstVector Difference;
|
|
MTH3D_M_vSubVector (& Difference , & m_FatherMaxPoint , & m_FatherMinPoint);
|
|
m_FatherAverageSize = (MTH3D_M_xGetXofVector (& Difference) + MTH3D_M_xGetYofVector (& Difference) +
|
|
MTH3D_M_xGetZofVector (& Difference)) / 3.0;
|
|
}
|
|
else m_FatherAverageSize = 1.0;
|
|
|
|
// Create the window
|
|
Create (IDD_ZDD_Box_Info_Window , _pParent);
|
|
}
|
|
|
|
void CZDxBoxInfoWindow::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CZDxBoxInfoWindow)
|
|
DDX_Radio(pDX, IDC_Radio_Button_Center, m_Radio_Button);
|
|
DDX_Check(pDX, IDC_Check_Box_Cube, m_Check_Box_Cube);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Center_X, m_Edition_Zone_Center_X);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Center_Y, m_Edition_Zone_Center_Y);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Center_Z, m_Edition_Zone_Center_Z);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Height, m_Edition_Zone_Height);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Length, m_Edition_Zone_Length);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Width, m_Edition_Zone_Width);
|
|
DDX_Text(pDX, IDC_Edition_Zone_X_Maxi, m_Edition_Zone_X_Maxi);
|
|
DDX_Text(pDX, IDC_Edition_Zone_X_Mini, m_Edition_Zone_X_Mini);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Y_Maxi, m_Edition_Zone_Y_Maxi);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Y_Mini, m_Edition_Zone_Y_Mini);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Z_Maxi, m_Edition_Zone_Z_Maxi);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Z_Mini, m_Edition_Zone_Z_Mini);
|
|
DDX_Control(pDX, IDC_Slider_Size, m_Slider_Size);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CZDxBoxInfoWindow, CDialog)
|
|
//{{AFX_MSG_MAP(CZDxBoxInfoWindow)
|
|
ON_BN_CLICKED(IDC_Radio_Button_Center, On_Radio_Button_Center)
|
|
ON_BN_CLICKED(IDC_Radio_Button_Extrema, On_Radio_Button_Extrema)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_X_Mini, On_Change_Edition_Zone_X_Mini)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Y_Mini, On_Change_Edition_Zone_Y_Mini)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Z_Mini, On_Change_Edition_Zone_Z_Mini)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_X_Maxi, On_Change_Edition_Zone_X_Maxi)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Y_Maxi, On_Change_Edition_Zone_Y_Maxi)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Z_Maxi, On_Change_Edition_Zone_Z_Maxi)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Center_X, On_Change_Edition_Zone_Center_X)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Center_Y, On_Change_Edition_Zone_Center_Y)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Center_Z, On_Change_Edition_Zone_Center_Z)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Length, On_Change_Edition_Zone_Length)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Width, On_Change_Edition_Zone_Width)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Height, On_Change_Edition_Zone_Height)
|
|
ON_BN_CLICKED(IDC_Check_Box_Cube, On_Check_Box_Cube)
|
|
ON_WM_HSCROLL()
|
|
ON_BN_CLICKED(IDC_Button_Init, On_Button_Init)
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - OnInitDialog
|
|
// initialisation of the window
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxBoxInfoWindow::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
m_Radio_Button = 0; // we show the Center screen
|
|
RefreshData (); // Init the other variables
|
|
|
|
// Register the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_Center , "TUT_BoxCenter" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Radio_Button_Extrema , "TUT_BoxExtrema" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Center_X , "TUT_BoxCenterX" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Center_Y , "TUT_BoxCenterY" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Center_Z , "TUT_BoxCenterZ" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Length , "TUT_BoxLength" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Width , "TUT_BoxWidth" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Height , "TUT_BoxHeight" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_X_Mini , "TUT_XMin" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Y_Mini , "TUT_YMin" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Z_Mini , "TUT_ZMin" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_X_Maxi , "TUT_XMax" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Y_Maxi , "TUT_YMax" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Z_Maxi , "TUT_ZMax" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Check_Box_Cube , "TUT_Cube" , TUT_e_Button);
|
|
TUT_M_vRegisterControlID (IDC_Slider_Size , "TUT_SizeSlider" , TUT_e_Slider);
|
|
TUT_M_vRegisterControlID (IDC_Button_Init , "TUT_BoxInit" , TUT_e_Button);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - SetZDxObjectToEdit
|
|
// set the ZDx object to edit :
|
|
// we fill the different fields in the window with the data of a ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::SetZDxShapeToEdit (ZDx_Shape * _pZDxShape)
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pZDxBox = _pZDxShape;
|
|
m_pBox3D = (Box3D *) _pZDxShape -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Radio_Button_Center
|
|
// clic on the radio button Center : we show the fields for the center
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Radio_Button_Center ()
|
|
{
|
|
m_Radio_Button = 0;
|
|
|
|
// Fill the variables for the screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
MTH3D_tdstVector Center = m_pBox3D->GetCenter ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Edition_Zone_Center_X . Format ("%.4g" , Center . xX);
|
|
m_Edition_Zone_Center_Y . Format ("%.4g" , Center . xY);
|
|
m_Edition_Zone_Center_Z . Format ("%.4g" , Center . xZ);
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_Edition_Zone_Length . Format ("%.4g" , m_pBox3D->GetLength ());
|
|
m_Edition_Zone_Width . Format ("%.4g" , m_pBox3D->GetWidth ());
|
|
m_Edition_Zone_Height . Format ("%.4g" , m_pBox3D->GetHeight ());
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
// Hide the items for the extrema screen
|
|
GetDlgItem (IDC_Frame_Mini) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_X_Mini) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Y_Mini) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Z_Mini) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_X_Mini) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Y_Mini) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Z_Mini) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Frame_Maxi) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_X_Maxi) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Y_Maxi) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Z_Maxi) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_X_Maxi) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Y_Maxi) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Z_Maxi) -> ShowWindow (SW_HIDE);
|
|
|
|
// Show the items for the Center screen
|
|
GetDlgItem (IDC_Frame_Center) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Center_X) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Center_Y) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Center_Z) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Length) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Width) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Height) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Center_X) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Center_Y) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Center_Z) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Length) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Width) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Height) -> ShowWindow (SW_SHOW);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Radio_Button_Extrema
|
|
// clic on the radio button Center : we show the fields for the extrema
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Radio_Button_Extrema ()
|
|
{
|
|
m_Radio_Button = 1;
|
|
|
|
// Fill the variables for the screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
MTH3D_tdstVector MinPoint = m_pBox3D->GetMinPoint ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Edition_Zone_X_Mini . Format ("%.4g" , MinPoint . xX);
|
|
m_Edition_Zone_Y_Mini . Format ("%.4g" , MinPoint . xY);
|
|
m_Edition_Zone_Z_Mini . Format ("%.4g" , MinPoint . xZ);
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
MTH3D_tdstVector MaxPoint = m_pBox3D->GetMaxPoint ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Edition_Zone_X_Maxi . Format ("%.4g" , MaxPoint . xX);
|
|
m_Edition_Zone_Y_Maxi . Format ("%.4g" , MaxPoint . xY);
|
|
m_Edition_Zone_Z_Maxi . Format ("%.4g" , MaxPoint . xZ);
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
// Hide the items for the Center screen
|
|
GetDlgItem (IDC_Frame_Center) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Center_X) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Center_Y) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Center_Z) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Length) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Width) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Static_Text_Height) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Center_X) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Center_Y) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Center_Z) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Length) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Width) -> ShowWindow (SW_HIDE);
|
|
GetDlgItem (IDC_Edition_Zone_Height) -> ShowWindow (SW_HIDE);
|
|
|
|
// Show the items for the extrema screen
|
|
GetDlgItem (IDC_Frame_Mini) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_X_Mini) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Y_Mini) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Z_Mini) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_X_Mini) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Y_Mini) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Z_Mini) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Frame_Maxi) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_X_Maxi) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Y_Maxi) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Static_Text_Z_Maxi) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_X_Maxi) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Y_Maxi) -> ShowWindow (SW_SHOW);
|
|
GetDlgItem (IDC_Edition_Zone_Z_Maxi) -> ShowWindow (SW_SHOW);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Center_X
|
|
// this function is called when the user changes the X coordinate of the center :
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Center_X ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetCenterX ((float) atof (m_Edition_Zone_Center_X));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Center_Y
|
|
// this function is called when the user changes the X coordinate of the center :
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Center_Y ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetCenterY ((float) atof (m_Edition_Zone_Center_Y));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Center_Z
|
|
// this function is called when the user changes the Z coordinate of the center :
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Center_Z ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetCenterZ ((float) atof (m_Edition_Zone_Center_Z));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Length
|
|
// this function is called when the user changes the length of the box : we update the variables
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Length ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Length = (float) atof (m_Edition_Zone_Length);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetLength (& Length);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change width and height
|
|
{
|
|
m_Edition_Zone_Width = m_Edition_Zone_Height = m_Edition_Zone_Length;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
CorrectValue &= m_pBox3D -> SetWidth (& Length);
|
|
CorrectValue &= m_pBox3D -> SetHeight (& Length);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
// If one of the given value is not correct (negative), we refresh the display
|
|
if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Width
|
|
// this function is called when the user changes the width of the box : we update the variables
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Width ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Width = (float) atof (m_Edition_Zone_Width);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetWidth (& Width);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change length and height
|
|
{
|
|
m_Edition_Zone_Length = m_Edition_Zone_Height = m_Edition_Zone_Width;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
CorrectValue &= m_pBox3D -> SetLength (& Width);
|
|
CorrectValue &= m_pBox3D -> SetHeight (& Width);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
// If one of the given value is not correct (negative), we refresh the display
|
|
if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Height
|
|
// this function is called when the user changes the height of the box : we update the variables
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Height ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Height = (float) atof (m_Edition_Zone_Height);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetHeight (& Height);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change length and width
|
|
{
|
|
m_Edition_Zone_Length = m_Edition_Zone_Width = m_Edition_Zone_Height;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
CorrectValue &= m_pBox3D -> SetLength (& Height);
|
|
CorrectValue &= m_pBox3D -> SetWidth (& Height);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
// If one of the given value is not correct (negative), we refresh the display
|
|
if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_X_Mini
|
|
// this function is called when the user changes the X coordinate of the min point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_X_Mini()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float X_Mini = (float) atof (m_Edition_Zone_X_Mini);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetMinPointX (& X_Mini);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change Y_Mini and Z_Mini too
|
|
{
|
|
float Y_Mini = (float) (atof (m_Edition_Zone_Y_Maxi) - atof (m_Edition_Zone_X_Maxi) + X_Mini);
|
|
float Z_Mini = (float) (atof (m_Edition_Zone_Z_Maxi) - atof (m_Edition_Zone_X_Maxi) + X_Mini);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetMinPointY (& Y_Mini);
|
|
m_pBox3D -> SetMinPointZ (& Z_Mini);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData (TRUE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
else if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Y_Mini
|
|
// this function is called when the user changes the Y coordinate of the min point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Y_Mini()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Y_Mini = (float) atof (m_Edition_Zone_Y_Mini);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetMinPointY (& Y_Mini);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change X_Mini and Z_Mini too
|
|
{
|
|
float X_Mini = (float) (atof (m_Edition_Zone_X_Maxi) - atof (m_Edition_Zone_Y_Maxi) + Y_Mini);
|
|
float Z_Mini = (float) (atof (m_Edition_Zone_Z_Maxi) - atof (m_Edition_Zone_Y_Maxi) + Y_Mini);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetMinPointX (& X_Mini);
|
|
m_pBox3D -> SetMinPointZ (& Z_Mini);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData (TRUE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
else if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Z_Mini
|
|
// this function is called when the user changes the Z coordinate of the min point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Z_Mini()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Z_Mini = (float) atof (m_Edition_Zone_Z_Mini);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetMinPointZ (& Z_Mini);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change X_Mini and Y_Mini too
|
|
{
|
|
float X_Mini = (float) (atof (m_Edition_Zone_X_Maxi) - atof (m_Edition_Zone_Z_Maxi) + Z_Mini);
|
|
float Y_Mini = (float) (atof (m_Edition_Zone_Y_Maxi) - atof (m_Edition_Zone_Z_Maxi) + Z_Mini);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetMinPointX (& X_Mini);
|
|
m_pBox3D -> SetMinPointY (& Y_Mini);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData (TRUE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
else if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_X_Maxi
|
|
// this function is called when the user changes the X coordinate of the max point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_X_Maxi()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float X_Maxi = (float) atof (m_Edition_Zone_X_Maxi);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetMaxPointX (& X_Maxi);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change Y_Maxi and Z_Maxi too
|
|
{
|
|
float Y_Maxi = (float) (atof (m_Edition_Zone_Y_Mini) + X_Maxi - atof (m_Edition_Zone_X_Mini));
|
|
float Z_Maxi = (float) (atof (m_Edition_Zone_Z_Mini) + X_Maxi - atof (m_Edition_Zone_X_Mini));
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetMaxPointY (& Y_Maxi);
|
|
m_pBox3D -> SetMaxPointZ (& Z_Maxi);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData (TRUE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
else if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Y_Maxi
|
|
// this function is called when the user changes the Y coordinate of the max point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Y_Maxi()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Y_Maxi = (float) atof (m_Edition_Zone_Y_Maxi);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetMaxPointY (& Y_Maxi);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change X_Maxi and Z_Maxi too
|
|
{
|
|
float X_Maxi = (float) (atof (m_Edition_Zone_X_Mini) + Y_Maxi - atof (m_Edition_Zone_Y_Mini));
|
|
float Z_Maxi = (float) (atof (m_Edition_Zone_Z_Mini) + Y_Maxi - atof (m_Edition_Zone_Y_Mini));
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetMaxPointX (& X_Maxi);
|
|
m_pBox3D -> SetMaxPointZ (& Z_Maxi);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData (TRUE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
else if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Change_Edition_Zone_Z_Maxi
|
|
// this function is called when the user changes the Z coordinate of the max point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Change_Edition_Zone_Z_Maxi()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Z_Maxi = (float) atof (m_Edition_Zone_Z_Maxi);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
BOOL CorrectValue = m_pBox3D -> SetMaxPointZ (& Z_Maxi);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
if (m_ZDxIsACube) // If it is a cube, we must change X_Maxi and Y_Maxi too
|
|
{
|
|
float X_Maxi = (float) (atof (m_Edition_Zone_X_Mini) + Z_Maxi - atof (m_Edition_Zone_Z_Mini));
|
|
float Y_Maxi = (float) (atof (m_Edition_Zone_Y_Mini) + Z_Maxi - atof (m_Edition_Zone_Z_Mini));
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetMaxPointX (& X_Maxi);
|
|
m_pBox3D -> SetMaxPointY (& Y_Maxi);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData (TRUE);
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
else if (! CorrectValue) RefreshData (TRUE);
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Check_Box_Cube
|
|
// this function is called when the user clic on the check box Cube
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Check_Box_Cube()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
m_ZDxIsACube = m_Check_Box_Cube;
|
|
|
|
if (m_ZDxIsACube) // if the check box Cube is selected, then length, width and height must be equal
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
//Box3D * p = m_pBox3D; // pointer to the ZDx box object
|
|
|
|
GLI_tdxValue L = (m_pBox3D->GetLength () + m_pBox3D->GetWidth () + m_pBox3D->GetHeight ()) / 3;
|
|
|
|
m_pBox3D->SetLength (& L);
|
|
m_pBox3D->SetWidth (& L);
|
|
m_pBox3D->SetHeight (& L);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
// update the screen
|
|
if (m_Radio_Button == 0) On_Radio_Button_Center ();
|
|
else On_Radio_Button_Extrema ();
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
RefreshSlider ();
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - RefreshSlider
|
|
// Refresh the position of the slider
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::RefreshSlider ()
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
double BoxAverageSize = (m_pBox3D -> GetLength () + m_pBox3D -> GetWidth () + m_pBox3D -> GetHeight ()) / 3.0;
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
m_Slider_Size . SetOwner (this);
|
|
m_Slider_Size . SetRange (0 , 150 , TRUE);
|
|
m_Slider_Size . SetPos ((long) (BoxAverageSize / m_FatherAverageSize * 100));
|
|
m_Slider_Size . SetTicFreq (50);
|
|
|
|
UpdateData (FALSE);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - RefreshSizeFromSlider
|
|
// Refresh the size of the box when the position of the slider has changed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::RefreshSizeFromSlider ()
|
|
{
|
|
float OldBoxAverageSize, NewBoxAverageSize;
|
|
float NewLength, NewWidth, NewHeight;
|
|
float Coef;
|
|
|
|
UpdateData (TRUE);
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
OldBoxAverageSize = (float) ((m_pBox3D -> GetLength () + m_pBox3D -> GetWidth () + m_pBox3D -> GetHeight ()) / 3.0);
|
|
NewBoxAverageSize = (float) (m_FatherAverageSize * m_Slider_Size . GetPos () / 100.0);
|
|
|
|
if (!OldBoxAverageSize)
|
|
{
|
|
MTH3D_tdstVector Difference;
|
|
MTH3D_M_vSubVector (& Difference , & m_FatherMaxPoint , & m_FatherMinPoint);
|
|
|
|
NewLength = NewBoxAverageSize * MTH3D_M_xGetXofVector (& Difference);
|
|
NewWidth = NewBoxAverageSize * MTH3D_M_xGetYofVector (& Difference);
|
|
NewHeight = NewBoxAverageSize * MTH3D_M_xGetZofVector (& Difference);
|
|
}
|
|
else
|
|
{
|
|
Coef = NewBoxAverageSize / OldBoxAverageSize;
|
|
NewLength = m_pBox3D -> GetLength () * Coef;
|
|
NewWidth = m_pBox3D -> GetWidth () * Coef;
|
|
NewHeight = m_pBox3D -> GetHeight () * Coef;
|
|
}
|
|
|
|
m_pBox3D -> SetLength (& NewLength);
|
|
m_pBox3D -> SetWidth (& NewWidth);
|
|
m_pBox3D -> SetHeight (& NewHeight);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
RefreshData (TRUE);
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - RefreshData
|
|
// this function is called when the data need to be refreshed (because of a Undo, for instance)
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::RefreshData (BOOL _bKeepCube)
|
|
{
|
|
// Init the variables
|
|
if (! _bKeepCube) m_Check_Box_Cube = m_ZDxIsACube = FALSE;
|
|
|
|
// Init the variables on the screen
|
|
if (m_Radio_Button == 0) On_Radio_Button_Center ();
|
|
else On_Radio_Button_Extrema ();
|
|
|
|
RefreshSlider ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - RefreshData
|
|
// this function is called when the data need to be refreshed (because of a Undo, for instance)
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::RefreshData ()
|
|
{
|
|
RefreshData (FALSE);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - GetFirstControlOfWindow
|
|
// Get the first control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxBoxInfoWindow::GetFirstControlOfWindow ()
|
|
{
|
|
return m_Radio_Button == 0 ? GetDlgItem (IDC_Radio_Button_Center)
|
|
: GetDlgItem (IDC_Edition_Zone_X_Mini);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - GetLastControlOfWindow
|
|
// Get the last control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxBoxInfoWindow::GetLastControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Check_Box_Cube);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - OnHScroll
|
|
// Call when the slider is changed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::OnHScroll(UINT nSBCode , UINT nPos , CScrollBar * pScrollBar)
|
|
{
|
|
if (pScrollBar == (void *) & m_Slider_Size) RefreshSizeFromSlider ();
|
|
else CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - On_Button_Init
|
|
// Call when the user clics on the Init button : we reinit the position and the size of the box
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::On_Button_Init ()
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pBox3D -> SetMinPoint (& m_FatherMinPoint);
|
|
m_pBox3D -> SetMaxPoint (& m_FatherMaxPoint);
|
|
m_pBox3D -> SetMinPoint (& m_FatherMinPoint);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
RefreshData ();
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxBox -> RedrawZDxObject ();
|
|
((CZDxInfoWindow *) GetParent ()) -> Apply ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxBoxInfoWindow - OnDestroy
|
|
// Call when the window is destroyed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxBoxInfoWindow::OnDestroy ()
|
|
{
|
|
// Unregister the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vUnregisterControlID (IDC_Radio_Button_Center );
|
|
TUT_M_vUnregisterControlID (IDC_Radio_Button_Extrema );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Center_X);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Center_Y);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Center_Z);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Length );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Width );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Height );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_X_Mini );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Y_Mini );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Z_Mini );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_X_Maxi );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Y_Maxi );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Z_Maxi );
|
|
TUT_M_vUnregisterControlID (IDC_Check_Box_Cube );
|
|
TUT_M_vUnregisterControlID (IDC_Slider_Size );
|
|
TUT_M_vUnregisterControlID (IDC_Button_Init );
|
|
|
|
CZDxShapeInfoWindow::OnDestroy ();
|
|
}
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
// class CZDxPointInfoWindow
|
|
//
|
|
// Window that shows informations about a ZDx Point object
|
|
//*****************************************************************************
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow
|
|
// general functions
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CZDxPointInfoWindow::CZDxPointInfoWindow(CWnd* _pParent , ZDx_Point * _pObject)
|
|
{
|
|
// Call the CDialog constructor
|
|
CDialog::CDialog(CZDxPointInfoWindow::IDD, _pParent);
|
|
|
|
//{{AFX_DATA_INIT(CZDxPointInfoWindow)
|
|
m_Edition_Zone_X = _T("");
|
|
m_Edition_Zone_Y = _T("");
|
|
m_Edition_Zone_Z = _T("");
|
|
//}}AFX_DATA_INIT
|
|
|
|
// Store the pointer to the ZDx box object
|
|
m_pZDxPoint = _pObject;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pPoint3D = (Point3D *) _pObject -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
// Create the window
|
|
Create (IDD_ZDD_Point_Info_Window , _pParent);
|
|
}
|
|
|
|
void CZDxPointInfoWindow::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CZDxPointInfoWindow)
|
|
DDX_Text(pDX, IDC_Edition_Zone_X, m_Edition_Zone_X);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Y, m_Edition_Zone_Y);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Z, m_Edition_Zone_Z);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CZDxPointInfoWindow, CDialog)
|
|
//{{AFX_MSG_MAP(CZDxPointInfoWindow)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_X, On_Change_Edition_Zone_X)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Y, On_Change_Edition_Zone_Y)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Z, On_Change_Edition_Zone_Z)
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - OnInitDialog
|
|
// initialisation of the window
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxPointInfoWindow::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
RefreshData (); // Init the variables
|
|
|
|
// Register the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_X , "TUT_PointX" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Y , "TUT_PointY" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Z , "TUT_PointZ" , TUT_e_TextEdit);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - SetZDxObjectToEdit
|
|
// set the ZDx object to edit :
|
|
// we fill the different fields in the window with the data of a ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxPointInfoWindow::SetZDxShapeToEdit (ZDx_Shape * _pZDxShape)
|
|
{
|
|
m_pZDxPoint = (ZDx_Point *) _pZDxShape;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pPoint3D = (Point3D *) _pZDxShape -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - On_Change_Edition_Zone_X
|
|
// this function is called when the user changes the X coordinate of the point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxPointInfoWindow::On_Change_Edition_Zone_X ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pPoint3D -> SetPointX ((float) atof (m_Edition_Zone_X));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxPoint -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - On_Change_Edition_Zone_Y
|
|
// this function is called when the user changes the Y coordinate of the point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxPointInfoWindow::On_Change_Edition_Zone_Y ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pPoint3D -> SetPointY ((float) atof (m_Edition_Zone_Y));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxPoint -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - On_Change_Edition_Zone_Z
|
|
// this function is called when the user changes the Z coordinate of the point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxPointInfoWindow::On_Change_Edition_Zone_Z ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pPoint3D -> SetPointZ ((float) atof (m_Edition_Zone_Z));
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxPoint -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - RefreshData
|
|
// this function is called when the data need to be refreshed (because of a Undo, for instance)
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxPointInfoWindow::RefreshData ()
|
|
{
|
|
// Init the variables on the screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
MTH3D_tdstVector Point = m_pPoint3D -> GetPoint ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Edition_Zone_X . Format ("%.4g" , Point . xX);
|
|
m_Edition_Zone_Y . Format ("%.4g" , Point . xY);
|
|
m_Edition_Zone_Z . Format ("%.4g" , Point . xZ);
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - GetFirstControlOfWindow
|
|
// Get the first control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxPointInfoWindow::GetFirstControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Edition_Zone_X);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - GetLastControlOfWindow
|
|
// Get the last control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxPointInfoWindow::GetLastControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Edition_Zone_Z);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxPointInfoWindow - OnDestroy
|
|
// Call when the window is destroyed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxPointInfoWindow::OnDestroy ()
|
|
{
|
|
// Unregister the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_X);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Y);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Z);
|
|
|
|
CZDxShapeInfoWindow::OnDestroy ();
|
|
}
|
|
|
|
|
|
//*****************************************************************************
|
|
// class CZDxConeInfoWindow
|
|
//
|
|
// Window that shows informations about a ZDx Cone object
|
|
//*****************************************************************************
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow
|
|
// general functions
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
CZDxConeInfoWindow::CZDxConeInfoWindow(CWnd* _pParent , ZDx_Shape * _pObject)
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
{
|
|
// Call the CDialog constructor
|
|
CDialog::CDialog(CZDxConeInfoWindow::IDD, _pParent);
|
|
|
|
//{{AFX_DATA_INIT(CZDxConeInfoWindow)
|
|
m_Edition_Zone_Angle = _T("");
|
|
m_Edition_Zone_Radius = _T("");
|
|
m_Edition_Zone_X_Base = _T("");
|
|
m_Edition_Zone_X_Top = _T("");
|
|
m_Edition_Zone_Y_Base = _T("");
|
|
m_Edition_Zone_Y_Top = _T("");
|
|
m_Edition_Zone_Z_Base = _T("");
|
|
m_Edition_Zone_Z_Top = _T("");
|
|
//}}AFX_DATA_INIT
|
|
|
|
// Store the pointer to the ZDx box object
|
|
m_pZDxCone = _pObject;
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D = (Cone3D *) _pObject -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
// Create the window
|
|
Create (IDD_ZDD_Cone_Info_Window , _pParent);
|
|
}
|
|
|
|
void CZDxConeInfoWindow::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CZDxConeInfoWindow)
|
|
DDX_Text(pDX, IDC_Edition_Zone_Angle, m_Edition_Zone_Angle);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Radius, m_Edition_Zone_Radius);
|
|
DDX_Text(pDX, IDC_Edition_Zone_X_Base, m_Edition_Zone_X_Base);
|
|
DDX_Text(pDX, IDC_Edition_Zone_X_Top, m_Edition_Zone_X_Top);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Y_Base, m_Edition_Zone_Y_Base);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Y_Top, m_Edition_Zone_Y_Top);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Z_Base, m_Edition_Zone_Z_Base);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Z_Top, m_Edition_Zone_Z_Top);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CZDxConeInfoWindow, CDialog)
|
|
//{{AFX_MSG_MAP(CZDxConeInfoWindow)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Angle, On_Change_Edition_Zone_Angle)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Radius, On_Change_Edition_Zone_Radius)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_X_Base, On_Change_Edition_Zone_X_Base)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_X_Top, On_Change_Edition_Zone_X_Top)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Y_Base, On_Change_Edition_Zone_Y_Base)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Y_Top, On_Change_Edition_Zone_Y_Top)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Z_Base, On_Change_Edition_Zone_Z_Base)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Z_Top, On_Change_Edition_Zone_Z_Top)
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - OnInitDialog
|
|
// initialisation of the window
|
|
//-----------------------------------------------------------------------------
|
|
BOOL CZDxConeInfoWindow::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
RefreshData (); // Init the variables
|
|
|
|
// Register the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_X_Top , "TUT_TopX" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Y_Top , "TUT_TopY" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Z_Top , "TUT_TopZ" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_X_Base , "TUT_BaseX" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Y_Base , "TUT_BaseY" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Z_Base , "TUT_BaseZ" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Radius , "TUT_ConeRadius" , TUT_e_TextEdit);
|
|
TUT_M_vRegisterControlID (IDC_Edition_Zone_Angle , "TUT_ConeAngle" , TUT_e_TextEdit);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - SetZDxObjectToEdit
|
|
// set the ZDx object to edit :
|
|
// we fill the different fields in the window with the data of a ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::SetZDxShapeToEdit (ZDx_Shape * _pZDxShape)
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pZDxCone = _pZDxShape;
|
|
m_pCone3D = (Cone3D *) _pZDxShape -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
RefreshData ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_X_Base
|
|
// this function is called when the user changes the X coordinate of the base point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_X_Base ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetBasePointX ((float) atof (m_Edition_Zone_X_Base));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_Y_Base
|
|
// this function is called when the user changes the Y coordinate of the base point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_Y_Base ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetBasePointY ((float) atof (m_Edition_Zone_Y_Base));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_Z_Base
|
|
// this function is called when the user changes the Z coordinate of the base point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_Z_Base ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetBasePointZ ((float) atof (m_Edition_Zone_Z_Base));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_X_Top
|
|
// this function is called when the user changes the X coordinate of the top point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_X_Top ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetTopPointX ((float) atof (m_Edition_Zone_X_Top));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_Y_Top
|
|
// this function is called when the user changes the Y coordinate of the top point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_Y_Top ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetTopPointY ((float) atof (m_Edition_Zone_Y_Top));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_Z_Top
|
|
// this function is called when the user changes the Z coordinate of the top point
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_Z_Top ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetTopPointZ ((float) atof (m_Edition_Zone_Z_Top));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_Radius
|
|
// this function is called when the user changes the radius of the cone
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_Radius ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Radius = (float) atof (m_Edition_Zone_Radius);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetRadius (& Radius);
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // When one changes the radius, the angle changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - On_Change_Edition_Zone_Angle
|
|
// this function is called when the user changes the angle of the cone
|
|
// we update the variable
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::On_Change_Edition_Zone_Angle ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Angle = (float) atof (m_Edition_Zone_Angle);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_pCone3D -> SetAngle (& Angle);
|
|
|
|
m_Edition_Zone_Radius . Format ("%.4g" , m_pCone3D -> GetRadius ()); // When one changes the angle, the radius changes too
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
SetZDxHasBeenChanged (TRUE); // Indicate that the ZDx changes
|
|
m_pZDxCone -> RedrawZDxObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - RefreshData
|
|
// this function is called when the data need to be refreshed (because of a Undo, for instance)
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::RefreshData ()
|
|
{
|
|
// Init the variables on the screen
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
MTH3D_tdstVector BasePoint = m_pCone3D -> GetBasePoint ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Edition_Zone_X_Base . Format ("%.4g" , BasePoint . xX);
|
|
m_Edition_Zone_Y_Base . Format ("%.4g" , BasePoint . xY);
|
|
m_Edition_Zone_Z_Base . Format ("%.4g" , BasePoint . xZ);
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
MTH3D_tdstVector TopPoint = m_pCone3D -> GetTopPoint ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
m_Edition_Zone_X_Top . Format ("%.4g" , TopPoint . xX);
|
|
m_Edition_Zone_Y_Top . Format ("%.4g" , TopPoint . xY);
|
|
m_Edition_Zone_Z_Top . Format ("%.4g" , TopPoint . xZ);
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
m_Edition_Zone_Radius . Format ("%.4g" , m_pCone3D -> GetRadius ());
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ());
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - GetFirstControlOfWindow
|
|
// Get the first control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxConeInfoWindow::GetFirstControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Edition_Zone_X_Top);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - GetLastControlOfWindow
|
|
// Get the last control of the window
|
|
//-----------------------------------------------------------------------------
|
|
CWnd * CZDxConeInfoWindow::GetLastControlOfWindow ()
|
|
{
|
|
return GetDlgItem (IDC_Edition_Zone_Angle);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class CZDxConeInfoWindow - OnDestroy
|
|
// Call when the window is destroyed
|
|
//-----------------------------------------------------------------------------
|
|
void CZDxConeInfoWindow::OnDestroy ()
|
|
{
|
|
// Unregister the controls for the tutorial
|
|
TUT_M_vGetTutDll ();
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_X_Top );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Y_Top );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Z_Top );
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_X_Base);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Y_Base);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Z_Base);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Radius);
|
|
TUT_M_vUnregisterControlID (IDC_Edition_Zone_Angle );
|
|
|
|
CZDxShapeInfoWindow::OnDestroy ();
|
|
}
|