// imp_configwindow.cpp : implementation file
//

#include "stdafx.h"
#include "b01mkhistrngs.h"
#include "imp_configwindow.h"
#include "imp_block.h"


// CImpBlockConfigWindow dialog

IMPLEMENT_DYNAMIC(CImpBlockConfigWindow, CDialog)

CImpBlockConfigWindow::CImpBlockConfigWindow(CWnd* pParent /*=NULL*/, IUnknown* pUnkOuter)
	: CDialog(CImpBlockConfigWindow::IDD, pParent)
	, m_strName(_T(""))
	, m_bCheckFile(FALSE)
	, m_bSkipEmptyLayers(FALSE)
	, m_bDisableInput(FALSE)
{
	m_pImpBlock = (CImpBlock*)pUnkOuter;
}

CImpBlockConfigWindow::~CImpBlockConfigWindow()
{
}

void CImpBlockConfigWindow::DoDataExchange(CDataExchange* pDX)
{
	EnterCriticalSection(&m_pImpBlock->m_cs);

	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDITTXTSFCMIN, m_pImpBlock->m_fTxtSfcMin);
	DDX_Text(pDX, IDC_EDITTXTSFCMAX, m_pImpBlock->m_fTxtSfcMax);

	LeaveCriticalSection(&m_pImpBlock->m_cs);

	if ( pDX->m_bSaveAndValidate )
		m_pImpBlock->SetModifiedFlag(TRUE);
}


BEGIN_MESSAGE_MAP(CImpBlockConfigWindow, CDialog)
	ON_BN_CLICKED(IDC_APPLY, &CImpBlockConfigWindow::OnBnClickedApply)
END_MESSAGE_MAP()


// CImpBlockConfigWindow message handlers

void CImpBlockConfigWindow::OnCancel()
{
	CDialog::OnCancel();
	DestroyWindow();
}

void CImpBlockConfigWindow::OnOK()
{
	CDialog::OnOK();
	DestroyWindow();
}

void CImpBlockConfigWindow::OnBnClickedApply()
{
	CDataExchange dx(this, TRUE);
	DoDataExchange(&dx);
}
