/*****************************************************************************
* Copyright (c) 2000 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
*
*****************************************************************************/

// PropPgOther.cpp : implementation file
//

#include "stdafx.h"
#include "digidbp.h"
#include "PropPgOther.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPropPgOther property page

IMPLEMENT_DYNCREATE(CPropPgOther, CPropertyPage)

CPropPgOther::CPropPgOther() : CPropertyPage(CPropPgOther::IDD)
{
	//{{AFX_DATA_INIT(CPropPgOther)
	m_nCBit = 0;
	m_nDBit = 0;
	m_iGroup2Type = -1;
	//}}AFX_DATA_INIT

	try
	{
		m_Group2TypeMap.Init(SValueMap::MAP_E1R2_OUTGOINGTYPE);		
	}

    catch (CAffirmException ae)
    {
    }
}

CPropPgOther::~CPropPgOther()
{
}

void CPropPgOther::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropPgOther)
	DDX_Control(pDX, IDC_Group2Type, m_ctrlGroup2Type);
	DDX_Text(pDX, IDC_EDIT_CBit, m_nCBit);
	DDV_MinMaxUInt(pDX, m_nCBit, 0, 1);
	DDX_Text(pDX, IDC_EDIT_DBit, m_nDBit);
	DDV_MinMaxUInt(pDX, m_nDBit, 0, 1);
	DDX_CBIndex(pDX, IDC_Group2Type, m_iGroup2Type);
	//}}AFX_DATA_MAP
}

void CPropPgOther::SetGroup2Type(DWORD const dwGroup2Type)
{
   try
   {
      m_iGroup2Type = m_Group2TypeMap.ToIndex(dwGroup2Type);
      if (m_hWnd != NULL) UpdateData(FALSE);
   }
   catch (CAffirmException ae)
   {
   }
}

DWORD CPropPgOther::GetGroup2Type(void)
{
   DWORD dwGroup2Type = 0;

   try
   {
      if (m_hWnd != NULL) UpdateData();
      dwGroup2Type = m_Group2TypeMap.FromIndex(m_iGroup2Type);
   }
   catch (CAffirmException ae)
   {
   }

   return dwGroup2Type;
}


BEGIN_MESSAGE_MAP(CPropPgOther, CPropertyPage)
	//{{AFX_MSG_MAP(CPropPgOther)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropPgOther message handlers

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

	for (int i = 0; i < m_Group2TypeMap.astrDisplayNames.GetSize(); i++)
		m_ctrlGroup2Type.AddString(m_Group2TypeMap.astrDisplayNames[i]);

	UpdateData(FALSE); // Send variable data to the controls
		
	return TRUE;
}