//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File        : DlgObject.cpp: implementation of the CDlgObject class.
// Author      : Ionut Grozea
// Date        : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __DLGOBJECT_HPP__
#define __DLGOBJECT_HPP__

#ifdef ACTIVE_EDITOR
#include "DlgObject.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

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgObject::CDlgObject
// Date   : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new dialog
// Author      : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date         :
// By           :
//////////////////////////////////////////////////////////////////////////////////////////////////////

CDlgObject::CDlgObject(ITObject3D * p_ITObject ,CWnd* pParent /*=NULL*/)
	: CDialog(CDlgObject::IDD, pParent)
{
	 m_pITObject = p_ITObject; 
	//{{AFX_DATA_INIT(CDlgObject)
	m_fscaleX = 0.0f;
	m_fscaleY = 0.0f;
	m_fscaleZ = 0.0f;
	//}}AFX_DATA_INIT
}


void CDlgObject::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgObject)
 	DDX_Text(pDX, IDC_EDITSCALEX, m_fscaleX);
	DDX_Text(pDX, IDC_EDITSCALEY, m_fscaleY);
	DDX_Text(pDX, IDC_EDITSCALEZ, m_fscaleZ);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgObject, CDialog)
	//{{AFX_MSG_MAP(CDlgObject)
	ON_EN_CHANGE(IDC_EDITSCALEX, OnChangeEditscalex)
	ON_EN_CHANGE(IDC_EDITSCALEY, OnChangeEditscaley)
	ON_EN_CHANGE(IDC_EDITSCALEZ, OnChangeEditscalez)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgObject message handlers
 int CDlgObject::mfn_iGetIntPos(float radius)
{
	return (int) ( radius * 10);
}

float CDlgObject::mfn_fSliderInt2Float(int sliderVal)
{
	return sliderVal/10.0f;
}


void CDlgObject::OnChangeEditscalex() 
{
	UpdateData(TRUE);
	m_pITObject->SetScaleX(m_fscaleX);
	(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());

}

void CDlgObject::OnChangeEditscaley() 
{
	UpdateData(TRUE);
	m_pITObject->SetScaleY(m_fscaleY);
	(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());

}

void CDlgObject::OnChangeEditscalez() 
{
	UpdateData(TRUE);
	m_pITObject->SetScaleZ(m_fscaleZ);
	(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
 	
}

BOOL CDlgObject::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
 	m_fscaleX = 1.f;
 	m_fscaleY = 1.f;
 	m_fscaleZ = 1.f;
	UpdateData(FALSE);
	return TRUE;   
}
#endif //ACTIVE_EDITOR
#endif //__DLGOBJECT_HPP__
