// StackSizeDlg.cpp : implementation file
//

#include "stdafx.h"
#include "GUICons.h"
#include "StackSizeDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStackSizeDlg dialog


CStackSizeDlg::CStackSizeDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStackSizeDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStackSizeDlg)
	m_val1 = 0;
	m_val2 = 0;
	m_val3 = 0;
	m_val4 = 0;
	//}}AFX_DATA_INIT
	m_noCstr = false;
}


void CStackSizeDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStackSizeDlg)
	DDX_Control(pDX, IDC_CSTRSPIN, m_spin4);
	DDX_Control(pDX, IDC_SPIN3, m_spin3);
	DDX_Control(pDX, IDC_SPIN2, m_spin2);
	DDX_Control(pDX, IDC_SPIN1, m_spin1);
	DDX_Text(pDX, IDC_EDIT1, m_val1);
	DDV_MinMaxUInt(pDX, m_val1, 0, 256);
	DDX_Text(pDX, IDC_EDIT2, m_val2);
	DDV_MinMaxUInt(pDX, m_val2, 0, 256);
	DDX_Text(pDX, IDC_EDIT3, m_val3);
	DDV_MinMaxUInt(pDX, m_val3, 0, 256);
	DDX_Text(pDX, IDC_CSTREDIT, m_val4);
	DDV_MinMaxUInt(pDX, m_val4, 0, 256);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CStackSizeDlg message handlers



BOOL CStackSizeDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	for (int i = IDC_SPIN1; i <= IDC_CSTRSPIN; i++) {
		CSpinButtonCtrl* sp = static_cast<CSpinButtonCtrl*>(GetDlgItem(i));
		ASSERT ( sp != NULL );
		sp->SetRange(0,256);
	}

	if (m_noCstr) {
		for (int i = IDC_CSTRSPIN; i<=IDC_CSTRKB; i++) {
			CWnd *p = GetDlgItem(i);
			if ( p != NULL )
				p->EnableWindow(FALSE);
		}
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
