// FilterDlg.cpp : implementation file
//

#include "stdafx.h"
#include "extractor.h"
#include "FilterDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFilterDlg dialog


CFilterDlg::CFilterDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CFilterDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFilterDlg)
	m_nPixelThreshold = 20;
	m_iFilterNum = 4;		//default is no filter.
	m_nNewPFrameThreshold = 15;
	m_fNewIFrameThreshold = 1.0f;
	//}}AFX_DATA_INIT
}


void CFilterDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFilterDlg)
	DDX_Text(pDX, IDC_EDIT1, m_nPixelThreshold);
	DDX_Radio(pDX, IDC_RADIO1, m_iFilterNum);
	DDX_Text(pDX, IDC_EDIT3, m_nNewPFrameThreshold);
	DDX_Text(pDX, IDC_EDIT2, m_fNewIFrameThreshold);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFilterDlg, CDialog)
	//{{AFX_MSG_MAP(CFilterDlg)
	ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
	ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
	ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFilterDlg message handlers

void CFilterDlg::OnRadio5() 
{
	// TODO: Add your control notification handler code here
	this->m_byFilterType=0;
	this->m_byFilterRange=0;

	
}

void CFilterDlg::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	this->m_byFilterType=1;
	this->m_byFilterRange=1;

}

void CFilterDlg::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	this->m_byFilterType=1;
	this->m_byFilterRange=2;
}

void CFilterDlg::OnRadio3() 
{
	// TODO: Add your control notification handler code here
	this->m_byFilterType=2;
	this->m_byFilterRange=1;

}

void CFilterDlg::OnRadio4() 
{
	// TODO: Add your control notification handler code here
	this->m_byFilterType=2;
	this->m_byFilterRange=2;

}

void CFilterDlg::OnChangeEdit1() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	this->UpdateData(TRUE);
}

void CFilterDlg::OnChangeEdit2() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	this->UpdateData(TRUE);
}

void CFilterDlg::OnOK() 
{
	// TODO: Add extra validation here
	this->UpdateData();
	CDialog::OnOK();
}

BYTE CFilterDlg::GetFilterRange()
{
	return this->m_byFilterRange;
}

BYTE CFilterDlg::GetFilterType()
{
	return this->m_byFilterType;
}

float CFilterDlg::GetMaxDiff()
{
	return this->m_fNewIFrameThreshold;
}

short CFilterDlg::GetMinDiff()
{
	return this->m_nNewPFrameThreshold;
}

short CFilterDlg::GetMinDistance()
{
	return this->m_nPixelThreshold;
}
