/*****************************************************************************
* Copyright (c) 1990-98 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/


// PropSignaling.cpp : implementation file
//

#include "stdafx.h"
#include "PropSignaling.h"

#include "dxbtypes.h"
#include "mgmthlc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPropSignaling property page

IMPLEMENT_DYNCREATE(CPropSignaling, CPropertyPage)

CPropSignaling::CPropSignaling() : CPropertyPage(CPropSignaling::IDD)
{
	//{{AFX_DATA_INIT(CPropSignaling)
	m_dwDigits = 0;
	//}}AFX_DATA_INIT
}

CPropSignaling::~CPropSignaling()
{
}

void CPropSignaling::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropSignaling)
	DDX_Control(pDX, IDC_CT1WinkDigits_Spin, m_ctrlDigitsSpin);
	DDX_Control(pDX, IDC_CT1Digits, m_ctrlDigits);
	DDX_Control(pDX, IDC_CT1Start, m_ctrlStart);
	DDX_Text(pDX, IDC_CT1Digits, m_dwDigits);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropSignaling, CPropertyPage)
	//{{AFX_MSG_MAP(CPropSignaling)
	ON_CBN_SELCHANGE(IDC_CT1Start, OnSelchangeCT1Start)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropSignaling message handlers

static DWORD const g_adwStartValues[] =
{
   CT1_LOOP_START,
   CT1_WINK_START,
   CT1_GROUND_START,
   CT1_IMMED_START,
};

void CPropSignaling::OnSelchangeCT1Start() 
{
   try
   {
      m_ctrlDigits.EnableWindow(g_adwStartValues[m_ctrlStart.GetCurSel()] == CT1_WINK_START);
   }
   catch (CAffirmException ae)
   {
   }
}

void CPropSignaling::OnOK() 
{
   UpdateData();

   m_dwStart = g_adwStartValues[m_ctrlStart.GetCurSel()];

	CPropertyPage::OnOK();
}

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

   SetCurSelFromValue(m_ctrlStart, m_dwStart, g_adwStartValues, ElementCount(g_adwStartValues));
   m_ctrlDigitsSpin.SetRange(0, 20);

   UpdateData(FALSE);

   OnSelchangeCT1Start();

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