206 lines
5.2 KiB
C++
206 lines
5.2 KiB
C++
//ROMTEAM WorldEditor
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
// File : ITcon3D.cpp: implementation of the DlgITCone class.
|
|
// Author : Ionut Grozea
|
|
// Date : 97.11
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "DlgITCone.h"
|
|
|
|
#include "stdafx.h"
|
|
#include "ACP_Base.h"
|
|
#include "ITF.h"
|
|
#include "incGAM.h"
|
|
#include "GLI.h"
|
|
#include "DPT.h"
|
|
|
|
#undef CPA_WANTS_IMPORT
|
|
#undef CPA_EXPORT
|
|
#define CPA_WANTS_EXPORT
|
|
#include "OGD.h"
|
|
#undef CPA_WANTS_EXPORT
|
|
#define CPA_WANTS_IMPORT
|
|
|
|
class ITCon3D;
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : DlgITCone::DlgITCone
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : constructor to create a new dialog
|
|
// Author : Ionut Grozea
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
DlgITCone::DlgITCone(ITCon3D * pCon , float Radius , float Height ,int Nt , int Ns , CWnd* pParent /*=NULL*/)
|
|
: CDialog(DlgITCone::IDD, pParent)
|
|
{
|
|
m_poCon = pCon;
|
|
m_fHeightOld = Height;
|
|
m_fRadiusOld = Radius;
|
|
m_iNxOld = Nt;
|
|
m_iNyOld = Ns;
|
|
//{{AFX_DATA_INIT(DlgITCone)
|
|
m_fHeight = Height;
|
|
m_fRadius = Radius;
|
|
m_iNx = Nt;
|
|
m_iNy = Ns;
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void DlgITCone::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(DlgITCone)
|
|
DDX_Control(pDX, IDC_SLIDERY, m_SliderY);
|
|
DDX_Control(pDX, IDC_SLIDERX, m_SliderX);
|
|
DDX_Control(pDX, IDC_SLIDERRADIUS, m_fSliderRadius);
|
|
DDX_Control(pDX, IDC_SLIDERHEIGHT, m_fSliderHeight);
|
|
DDX_Text(pDX, IDC_EDITHEIGHT, m_fHeight);
|
|
DDX_Text(pDX, IDC_EDITRADIUS, m_fRadius);
|
|
DDX_Text(pDX, IDC_EDITX, m_iNx);
|
|
DDV_MinMaxInt(pDX, m_iNx, 3, 20);
|
|
DDX_Text(pDX, IDC_EDITY, m_iNy);
|
|
DDV_MinMaxInt(pDX, m_iNy, 3, 20);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(DlgITCone, CDialog)
|
|
//{{AFX_MSG_MAP(DlgITCone)
|
|
ON_WM_HSCROLL()
|
|
ON_EN_CHANGE(IDC_EDITHEIGHT, OnChangeEditheight)
|
|
ON_EN_CHANGE(IDC_EDITRADIUS, OnChangeEditradius)
|
|
ON_EN_CHANGE(IDC_EDITX, OnChangeEditx)
|
|
ON_EN_CHANGE(IDC_EDITY, OnChangeEdity)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// DlgITCone message handlers
|
|
|
|
void DlgITCone::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
|
{
|
|
|
|
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
|
|
|
|
CWnd *m_Slider1 , *m_Slider2 ,*m_Slider3 , *m_Slider4 ;
|
|
m_Slider1 = GetDlgItem(IDC_SLIDERRADIUS);
|
|
m_Slider2 = GetDlgItem(IDC_SLIDERHEIGHT);
|
|
m_Slider3 = GetDlgItem(IDC_SLIDERX);
|
|
m_Slider4 = GetDlgItem(IDC_SLIDERY);
|
|
if (m_Slider1 == pScrollBar)
|
|
{
|
|
m_fRadius=mfn_fSliderInt2Float(m_fSliderRadius.GetPos());
|
|
UpdateData(FALSE);
|
|
m_poCon->SetRadius(m_fRadius);
|
|
}
|
|
if (m_Slider2 == pScrollBar)
|
|
{
|
|
m_fHeight=mfn_fSliderInt2Float(m_fSliderHeight.GetPos());
|
|
UpdateData(FALSE);
|
|
m_poCon->SetHeight(m_fHeight);
|
|
}
|
|
if (m_Slider3 == pScrollBar)
|
|
{
|
|
m_iNx= m_SliderX.GetPos();
|
|
UpdateData(FALSE);
|
|
m_poCon->SetSamplingRate(m_iNx , m_iNy);
|
|
}
|
|
if (m_Slider4 == pScrollBar)
|
|
{
|
|
m_iNy= m_SliderY.GetPos();
|
|
UpdateData(FALSE);
|
|
m_poCon->SetSamplingRate(m_iNx , m_iNy+1);
|
|
}
|
|
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
|
|
int DlgITCone::mfn_iGetIntPos(float fVal)
|
|
{
|
|
return (int) ( fVal* 10);
|
|
}
|
|
|
|
float DlgITCone::mfn_fSliderInt2Float(int sliderVal)
|
|
{
|
|
return sliderVal/10.0f;
|
|
}
|
|
|
|
|
|
|
|
BOOL DlgITCone::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
m_SliderX.SetRange(4,20);
|
|
m_SliderY.SetRange(3,20);
|
|
m_fSliderRadius.SetPos(mfn_iGetIntPos(m_fRadius));
|
|
m_fSliderHeight.SetPos(mfn_iGetIntPos(m_fHeight));
|
|
m_SliderX.SetPos(m_iNx);
|
|
m_SliderY.SetPos(m_iNy);
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
|
|
|
|
|
|
void DlgITCone::OnChangeEditheight()
|
|
{
|
|
UpdateData();
|
|
m_fSliderHeight.SetPos(mfn_iGetIntPos(m_fHeight));
|
|
m_poCon->SetHeight(m_fHeight);
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
void DlgITCone::OnChangeEditradius()
|
|
{
|
|
UpdateData();
|
|
m_fSliderRadius.SetPos(mfn_iGetIntPos(m_fRadius));
|
|
m_poCon->SetRadius(m_fRadius);
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
|
|
void DlgITCone::OnChangeEditx()
|
|
{
|
|
UpdateData();
|
|
m_SliderX.SetPos(m_iNx);
|
|
m_poCon->SetSamplingRate(m_iNx , m_iNy);
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
void DlgITCone::OnChangeEdity()
|
|
{
|
|
UpdateData();
|
|
m_SliderY.SetPos(m_iNy);
|
|
m_poCon->SetSamplingRate(m_iNx , m_iNy+1);
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
void DlgITCone::OnCancel()
|
|
{
|
|
|
|
m_iNx = m_iNxOld;
|
|
m_iNy = m_iNyOld;
|
|
m_fRadius = m_fRadiusOld;
|
|
m_fHeight= m_fHeightOld;
|
|
m_poCon->SetSamplingRate(m_iNx , m_iNy);
|
|
m_poCon->SetRadius(m_fRadius);
|
|
m_poCon->SetHeight(m_fHeight);
|
|
CDialog::OnCancel();
|
|
|
|
CDialog::OnCancel();
|
|
}
|