219 lines
5.2 KiB
C++
219 lines
5.2 KiB
C++
//ROMTEAM WorldEditor
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
// File : CDlgITSphere.cpp: implementation of the CDlgITSphere class.
|
|
// Author : Ionut Grozea
|
|
// Date : 97.11
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#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
|
|
|
|
#include "3dinterf.hpp"
|
|
#include "DlgITSphere.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : CDlgITSphere::CDlgITSphere
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : constructor to create a new dialog
|
|
// Author : Ionut Grozea
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
CDlgITSphere::CDlgITSphere(float radius,int m_Ns,int m_Nt , ITSphere3D*pSphere, CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDlgITSphere::IDD, pParent)
|
|
{
|
|
|
|
//{{AFX_DATA_INIT(CDlgITSphere)
|
|
m_fRadius = 0.0f;
|
|
m_Nx = 0;
|
|
m_Ny = 0;
|
|
//}}AFX_DATA_INIT
|
|
m_Nx = m_Ns;
|
|
m_Ny = m_Nt;
|
|
m_fRadius = radius;
|
|
m_NxOld = m_Ns;
|
|
m_NyOld = m_Nt;
|
|
m_fRadiusOld = radius;
|
|
m_poSphere=pSphere;
|
|
}
|
|
|
|
|
|
void CDlgITSphere::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
|
|
//{{AFX_DATA_MAP(CDlgITSphere)
|
|
|
|
|
|
//}}AFX_DATA_MAP
|
|
|
|
if (!pDX->m_bSaveAndValidate)
|
|
{
|
|
mfn_poGetSlider1()->SetPos(mfn_iGetIntPos(m_fRadius));
|
|
mfn_poGetSlider2()->SetPos(m_Nx);
|
|
mfn_poGetSlider3()->SetPos(m_Ny);
|
|
}
|
|
|
|
|
|
if (!pDX->m_bSaveAndValidate)
|
|
{
|
|
DDX_Text(pDX, IDC_EDIT1, m_fRadius);
|
|
DDX_Text(pDX, IDC_EDIT2, m_Nx);
|
|
DDX_Text(pDX, IDC_EDIT3, m_Ny);
|
|
}
|
|
else
|
|
{
|
|
CString csText1;
|
|
GetDlgItem(IDC_EDIT1)->GetWindowText(csText1);
|
|
m_fRadius=(float)atof(csText1);
|
|
|
|
CString csText2;
|
|
GetDlgItem(IDC_EDIT2)->GetWindowText(csText2);
|
|
m_Nx= atoi(csText2);
|
|
|
|
CString csText3;
|
|
GetDlgItem(IDC_EDIT3)->GetWindowText(csText3);
|
|
m_Ny= atoi(csText3);
|
|
}
|
|
DDV_MinMaxFloat(pDX, m_fRadius, 0.f, 10.f);
|
|
//show the effect
|
|
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgITSphere, CDialog)
|
|
//{{AFX_MSG_MAP(CDlgITSphere)
|
|
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
|
|
ON_WM_HSCROLL()
|
|
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
|
|
ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit3)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgITSphere message handlers
|
|
|
|
BOOL CDlgITSphere::OnInitDialog()
|
|
{
|
|
mfn_poGetSlider1()->SetRange(0,100);
|
|
mfn_poGetSlider2()->SetRange(4,20);
|
|
mfn_poGetSlider3()->SetRange(4,20);
|
|
CDialog::OnInitDialog();
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
|
|
|
|
|
|
int CDlgITSphere::mfn_iGetIntPos(float radius)
|
|
{
|
|
return (int) ( radius * 10);
|
|
}
|
|
|
|
float CDlgITSphere::mfn_fSliderInt2Float(int sliderVal)
|
|
{
|
|
return sliderVal/10.0f;
|
|
}
|
|
|
|
|
|
|
|
|
|
CSliderCtrl* CDlgITSphere::mfn_poGetSlider1()
|
|
{
|
|
return (CSliderCtrl* )GetDlgItem(IDC_SLIDER1);
|
|
}
|
|
CSliderCtrl* CDlgITSphere::mfn_poGetSlider2()
|
|
{
|
|
return (CSliderCtrl* )GetDlgItem(IDC_SLIDER2);
|
|
}
|
|
CSliderCtrl* CDlgITSphere::mfn_poGetSlider3()
|
|
{
|
|
return (CSliderCtrl* )GetDlgItem(IDC_SLIDER3);
|
|
}
|
|
|
|
void CDlgITSphere::OnChangeEdit1()
|
|
{
|
|
UpdateData();
|
|
mfn_poGetSlider1()->SetPos(mfn_iGetIntPos(m_fRadius));
|
|
m_poSphere->SetRadius(m_fRadius);
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
}
|
|
|
|
void CDlgITSphere::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
|
{
|
|
|
|
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
|
|
CWnd *m_Slider1 ,*m_Slider3 , *m_Slider2;
|
|
m_Slider1 = GetDlgItem(IDC_SLIDER1);
|
|
m_Slider2 = GetDlgItem(IDC_SLIDER2);
|
|
m_Slider3 = GetDlgItem(IDC_SLIDER3);
|
|
if (m_Slider1 == pScrollBar)
|
|
{
|
|
m_fRadius=mfn_fSliderInt2Float(mfn_poGetSlider1()->GetPos());
|
|
if ( !m_fRadius) m_fRadius+=0.1f;
|
|
UpdateData(FALSE);
|
|
m_poSphere->SetRadius(m_fRadius);
|
|
}
|
|
if (m_Slider2 == pScrollBar)
|
|
{
|
|
m_Nx= (mfn_poGetSlider2()->GetPos());
|
|
UpdateData(FALSE);
|
|
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
|
|
}
|
|
if (m_Slider3 == pScrollBar)
|
|
{
|
|
m_Ny= (mfn_poGetSlider3()->GetPos());
|
|
UpdateData(FALSE);
|
|
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
|
|
}
|
|
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
void CDlgITSphere::OnChangeEdit2()
|
|
{
|
|
UpdateData();
|
|
mfn_poGetSlider2()->SetPos(m_Nx);
|
|
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
void CDlgITSphere::OnChangeEdit3()
|
|
{
|
|
UpdateData();
|
|
mfn_poGetSlider3()->SetPos(m_Ny);
|
|
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
|
|
}
|
|
|
|
void CDlgITSphere::OnCancel()
|
|
{
|
|
m_Nx = m_NxOld;
|
|
m_Ny = m_NyOld;
|
|
m_fRadius = m_fRadiusOld;
|
|
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
|
|
m_poSphere->SetRadius(m_fRadius);
|
|
CDialog::OnCancel();
|
|
}
|