reman3/Rayman_X/cpa/tempgrp/OGD/src/DLGPNT3D.CPP

174 lines
6.7 KiB
C++

//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgPoint3D.cpp : implementation file
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "3Dinterf.hpp"
#include "DlgPnt3D.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgPoint3D dialog
CDlgPoint3D::CDlgPoint3D(Point3D *pPoint3D, CWnd* pParent /*=NULL*/)
: CDialog(CDlgPoint3D::IDD, pParent)
{
m_pPoint3D = pPoint3D;
//{{AFX_DATA_INIT(CDlgPoint3D)
m_Edition_Zone_X = _T("");
m_Edition_Zone_Y = _T("");
m_Edition_Zone_Z = _T("");
//}}AFX_DATA_INIT
}
void CDlgPoint3D::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgPoint3D)
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(CDlgPoint3D, CDialog)
//{{AFX_MSG_MAP(CDlgPoint3D)
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)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - OnInitDialog
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : initialisation of the window
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgPoint3D::OnInitDialog()
{
CDialog::OnInitDialog();
RefreshData (); // Init the variables
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - On_Change_Edition_Zone_X
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::On_Change_Edition_Zone_X ()
{
UpdateData (TRUE); // Update variables from screen
m_pPoint3D -> SetPointX ((float) atof (m_Edition_Zone_X));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - On_Change_Edition_Zone_Y
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Y coordinate of the point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::On_Change_Edition_Zone_Y ()
{
UpdateData (TRUE); // Update variables from screen
m_pPoint3D -> SetPointY ((float) atof (m_Edition_Zone_Y));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - On_Change_Edition_Zone_Z
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::On_Change_Edition_Zone_Z ()
{
UpdateData (TRUE); // Update variables from screen
m_pPoint3D -> SetPointZ ((float) atof (m_Edition_Zone_Z));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - RefreshData
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the data need to be refreshed (because of a Undo, for instance)
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::RefreshData ()
{
// Init the variables on the screen
MTH3D_tdstVector Point = m_pPoint3D -> GetPoint ();
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
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : void CDlgCone3D::RedrawBackground
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : redraws the main view.
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::RedrawBackground (void)
{
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}