FilterDlg.cpp
上传用户:tianjuedz
上传日期:2022-08-10
资源大小:2349k
文件大小:2k
- // FilterDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ED256.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_fEdit1 = 0.0f;
- m_fEdit2 = 0.0f;
- m_fEdit3 = 0.0f;
- m_fEdit4 = 0.0f;
- m_fEdit5 = 0.0f;
- m_fEdit6 = 0.0f;
- m_fEdit7 = 0.0f;
- m_fEdit8 = 0.0f;
- m_fEdit9 = 0.0f;
- //}}AFX_DATA_INIT
- }
- void CFilterDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CFilterDlg)
- DDX_Control(pDX, IDC_TYPE, m_cType);
- DDX_Text(pDX, IDC_EDIT1, m_fEdit1);
- DDX_Text(pDX, IDC_EDIT2, m_fEdit2);
- DDX_Text(pDX, IDC_EDIT3, m_fEdit3);
- DDX_Text(pDX, IDC_EDIT4, m_fEdit4);
- DDX_Text(pDX, IDC_EDIT5, m_fEdit5);
- DDX_Text(pDX, IDC_EDIT6, m_fEdit6);
- DDX_Text(pDX, IDC_EDIT7, m_fEdit7);
- DDX_Text(pDX, IDC_EDIT8, m_fEdit8);
- DDX_Text(pDX, IDC_EDIT9, m_fEdit9);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CFilterDlg, CDialog)
- //{{AFX_MSG_MAP(CFilterDlg)
- ON_CBN_SELENDOK(IDC_TYPE, OnSelEndOKType)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CFilterDlg message handlers
- void CFilterDlg::OnSelEndOKType() {
- int type = m_cType.GetCurSel();
- if (type == 0) {
- for (int i=0;i<9;i++) SetDlgItemInt(IDC_EDIT1+i, 1);
- SetDlgItemInt(IDC_EDIT5,-8);
- UpdateData(true);
- }
- if (type == 1) {
- m_fEdit1 = 1.0f/6.0f;
- m_fEdit3 = 1.0f/6.0f;
- m_fEdit7 = 1.0f/6.0f;
- m_fEdit9 = 1.0f/6.0f;
- m_fEdit2 = 4.0f/6.0f;
- m_fEdit4 = 4.0f/6.0f;
- m_fEdit6 = 4.0f/6.0f;
- m_fEdit8 = 4.0f/6.0f;
- m_fEdit5 = -20.0f/6.0f;
- UpdateData(false);
- }
- }
- void CFilterDlg::OnOK() {
- UpdateData();
- CDialog::OnOK();
- }
- void CFilterDlg::SetFilter(float *filter) {
- m_fEdit1 = (*filter); filter++;
- m_fEdit2 = (*filter); filter++;
- m_fEdit3 = (*filter); filter++;
- m_fEdit4 = (*filter); filter++;
- m_fEdit5 = (*filter); filter++;
- m_fEdit6 = (*filter); filter++;
- m_fEdit7 = (*filter); filter++;
- m_fEdit8 = (*filter); filter++;
- m_fEdit9 = (*filter); filter++;
- }
- BOOL CFilterDlg::OnInitDialog() {
- CDialog::OnInitDialog();
-
- UpdateData(false); // Data should be set w/SetFilter().
-
- m_cType.SetCurSel(1);
- OnSelEndOKType();
- return TRUE;
- }