// CPACDgPI.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"

#include "EDACDgPI.hpp"
#include "_AInterf.hpp"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define C_MIN_POS		0
#define C_MAX_POS		100

/////////////////////////////////////////////////////////////////////////////
// EdActors_ProgressInfoDialog dialog

BEGIN_MESSAGE_MAP(EdActors_ProgressInfoDialog, CDialog)
	//{{AFX_MSG_MAP(EdActors_ProgressInfoDialog)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


//******************************************************************************
EdActors_ProgressInfoDialog::EdActors_ProgressInfoDialog(CString csMessage,
																											 CWnd* pParent /*=NULL*/)
	: CDialog(EdActors_ProgressInfoDialog::IDD, &g_oBaseFrame)
{
	hOldInstance = AfxGetResourceHandle();
	AfxSetResourceHandle(g_stActorEditorIdentity.hModule);

	//{{AFX_DATA_INIT(EdActors_ProgressInfoDialog)
	m_csMessage = csMessage;
	//}}AFX_DATA_INIT

	//Creates Window
	Create(EdActors_ProgressInfoDialog::IDD, AfxGetMainWnd());
}

//******************************************************************************
EdActors_ProgressInfoDialog::~EdActors_ProgressInfoDialog()
{
	AfxSetResourceHandle(hOldInstance);
}

//******************************************************************************
void EdActors_ProgressInfoDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(EdActors_ProgressInfoDialog)
	DDX_Text(pDX, IDC_STATIC_MESSAGE, m_csMessage);
	//}}AFX_DATA_MAP
}


/////////////////////////////////////////////////////////////////////////////
// EdActors_ProgressInfoDialog message handlers
//******************************************************************************
BOOL EdActors_ProgressInfoDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CProgressCtrl *pclProgressCtrl = (CProgressCtrl *)GetDlgItem(IDC_PROGRESS);
	pclProgressCtrl->SetRange(C_MIN_POS, C_MAX_POS);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

//******************************************************************************
void EdActors_ProgressInfoDialog::m_fn_vSetProgress(unsigned char ucProgessValue)
{
	CProgressCtrl *pclProgressCtrl = (CProgressCtrl *)GetDlgItem(IDC_PROGRESS);

	if ( ucProgessValue < C_MIN_POS )
		ucProgessValue = C_MIN_POS;
	else if ( ucProgessValue > C_MAX_POS )
		ucProgessValue = C_MAX_POS;

	pclProgressCtrl->SetPos(ucProgessValue);
}

