// EditVB1313Pg.cpp : インプリメンテーション ファイル
//

#include "stdafx.h"
#include "dm2gded.h"
#include "EditVB1313Pg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEditVB1313Pg ダイアログ

void CEditVB1313Pg::Construction()
{
	//{{AFX_DATA_INIT(CEditVB1313Pg)
	m_strHB = _T("");
	m_strLB = _T("");
	m_fH3 = FALSE;
	m_fH4 = FALSE;
	m_fH5 = FALSE;
	m_fH6 = FALSE;
	m_fH7 = FALSE;
	m_fL3 = FALSE;
	m_fL4 = FALSE;
	m_fL5 = FALSE;
	m_fL6 = FALSE;
	m_fL7 = FALSE;
	m_iH3 = -1;
	m_iL3 = -1;
	//}}AFX_DATA_INIT
}

void CEditVB1313Pg::DoDataExchange(CDataExchange* pDX)
{
	CEditVPg::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CEditVB1313Pg)
	DDX_Text(pDX, IDC_STATIC_HB, m_strHB);
	DDX_Text(pDX, IDC_STATIC_LB, m_strLB);
	DDX_Check(pDX, IDC_CHECK_H3, m_fH3);
	DDX_Check(pDX, IDC_CHECK_H4, m_fH4);
	DDX_Check(pDX, IDC_CHECK_H5, m_fH5);
	DDX_Check(pDX, IDC_CHECK_H6, m_fH6);
	DDX_Check(pDX, IDC_CHECK_H7, m_fH7);
	DDX_Check(pDX, IDC_CHECK_L3, m_fL3);
	DDX_Check(pDX, IDC_CHECK_L4, m_fL4);
	DDX_Check(pDX, IDC_CHECK_L5, m_fL5);
	DDX_Check(pDX, IDC_CHECK_L6, m_fL6);
	DDX_Check(pDX, IDC_CHECK_L7, m_fL7);
	DDX_CBIndex(pDX, IDC_COMBO_H3, m_iH3);
	DDX_CBIndex(pDX, IDC_COMBO_L3, m_iL3);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CEditVB1313Pg, CEditVPg)
	//{{AFX_MSG_MAP(CEditVB1313Pg)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEditVB1313Pg メッセージ ハンドラ

int CEditVB1313Pg::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	m_iL3 = (m_nInitVal % 256) & 7;
	m_iH3 = (m_nInitVal / 256) & 7;

	m_fL3 = (m_nInitVal & (1 << 3)) ? 1 : 0;
	m_fL4 = (m_nInitVal & (1 << 4)) ? 1 : 0;
	m_fL5 = (m_nInitVal & (1 << 5)) ? 1 : 0;
	m_fL6 = (m_nInitVal & (1 << 6)) ? 1 : 0;
	m_fL7 = (m_nInitVal & (1 << 7)) ? 1 : 0;
	m_fH3 = (m_nInitVal & (1 <<11)) ? 1 : 0;
	m_fH4 = (m_nInitVal & (1 <<12)) ? 1 : 0;
	m_fH5 = (m_nInitVal & (1 <<13)) ? 1 : 0;
	m_fH6 = (m_nInitVal & (1 <<14)) ? 1 : 0;
	m_fH7 = (m_nInitVal & (1 <<15)) ? 1 : 0;

	CString strText;

	strText = m_wvcf.GetHintText(0);
	if (strText.IsEmpty())
		strText = "First byte:";
	m_strLB = strText;

	strText = m_wvcf.GetHintText(1);
	if (strText.IsEmpty())
		strText = "Second byte:";
	m_strHB = strText;

	if (CEditVPg::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	return 0;
}
