// PageStdComAdvanced.cpp : implementation file
//

#include "stdafx.h"
#include "digiasyn.h"
#include "PageStdComAdvanced.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPageStdComAdvanced property page

IMPLEMENT_DYNCREATE(CPageStdComAdvanced, CPropertyPage)

CPageStdComAdvanced::CPageStdComAdvanced() : CPropertyPage(CPageStdComAdvanced::IDD)
{
	//{{AFX_DATA_INIT(CPageStdComAdvanced)
	m_fAltPin = FALSE;
	m_fCompleteWhenSent = FALSE;
	m_CloseTimeout = 0;
	m_fAllPorts = FALSE;
	m_fCloseTimeoutEnable = FALSE;
	//}}AFX_DATA_INIT
}

CPageStdComAdvanced::~CPageStdComAdvanced()
{
}

void CPageStdComAdvanced::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPageStdComAdvanced)
	DDX_Control(pDX, IDC_CHECK_CLOSETIMEOUT_ENABLE, m_ctlCloseTimeoutEnable);
	DDX_Control(pDX, IDC_EDIT_CLOSE_TIMEOUT, m_ctlCloseTimeout);
	DDX_Control(pDX, IDC_TIMEOUT_TEXT, m_ctlTimeoutText);
	DDX_Check(pDX, IDC_CHECK_ALTPIN, m_fAltPin);
	DDX_Check(pDX, IDC_CHECK_COMPLETEWHENSENT, m_fCompleteWhenSent);
	DDX_Text(pDX, IDC_EDIT_CLOSE_TIMEOUT, m_CloseTimeout);
	DDV_MinMaxDWord(pDX, m_CloseTimeout, 0, 3600);
	DDX_Check(pDX, IDC_CHECK_ALL_PORTS, m_fAllPorts);
	DDX_Check(pDX, IDC_CHECK_CLOSETIMEOUT_ENABLE, m_fCloseTimeoutEnable);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPageStdComAdvanced, CPropertyPage)
	//{{AFX_MSG_MAP(CPageStdComAdvanced)
	ON_BN_CLICKED(IDC_CHECK_CLOSETIMEOUT_ENABLE, OnCheckClosetimeoutEnable)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPageStdComAdvanced message handlers

BOOL CPageStdComAdvanced::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

   // Determine how timeout should be displayed
   m_ctlTimeoutText.EnableWindow(m_fCloseTimeoutEnable);
   m_ctlCloseTimeout.EnableWindow(m_fCloseTimeoutEnable);

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

void CPageStdComAdvanced::OnCheckClosetimeoutEnable() 
{
   // Determine how timeout should be displayed
   BOOL TimeoutEnabled = m_ctlCloseTimeoutEnable.GetCheck();
   m_ctlTimeoutText.EnableWindow(TimeoutEnabled);
   m_ctlCloseTimeout.EnableWindow(TimeoutEnabled);
}
