📄 dlg07.cpp
字号:
// Dlg07.cpp : implementation file
//
#include "stdafx.h"
#include "DSP.h"
#include "Dlg07.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlg07 dialog
CDlg07::CDlg07(CWnd* pParent /*=NULL*/)
: CDialog(CDlg07::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlg07)
m_wp = 0.0;
m_ws = 0.0;
m_attenuation = 0.0;
//}}AFX_DATA_INIT
}
void CDlg07::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlg07)
DDX_Text(pDX, IDC_EDIT1, m_wp);
DDX_Text(pDX, IDC_EDIT2, m_ws);
DDX_Text(pDX, IDC_EDIT3, m_attenuation);
DDX_Control(pDX, IDC_MSFLEXGRID1, m_grid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlg07, CDialog)
//{{AFX_MSG_MAP(CDlg07)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlg07 message handlers
void CDlg07::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData();
int i;
sgnhdn.GetLowpassHdn(m_wp,m_ws,m_attenuation);
sgnwn.SelectWindowStyle(m_wp,m_ws,m_attenuation);
sgnhn.GetLowpassHn(m_wp,m_ws,m_attenuation);
sgnhdn.FFT();
CDC* pDC = GetDC();
m_grid.SetRows(5);
m_grid.SetCols(sgnhn.length+1);
for (i=1;i<=sgnhn.length;i++)
{
m_grid.SetColWidth ( i,( long ) ( 144 * 1440.0 / pDC->GetDeviceCaps(LOGPIXELSX) ) );
}
m_grid.SetTextMatrix(1,0,"hdn");
m_grid.SetTextMatrix(2,0,"wn");
m_grid.SetTextMatrix(3,0,"hn");
m_grid.SetTextMatrix(4,0,"Hw");
CString str;
CString str1;
for (i=0;i<sgnhn.length;i++)
{ str.Format("%d",i+1);
m_grid.SetTextMatrix(0,i+1,str);
str.Empty();
str.Format("%4.8f",sgnhdn.sgnt[i]);
m_grid.SetTextMatrix(1,i+1,str);
str.Empty();
str.Format("%4.8f",sgnwn.sgnt[i]);
m_grid.SetTextMatrix(2,i+1,str);
str.Empty();
str.Format("%4.8f",sgnhn.sgnt[i]);
m_grid.SetTextMatrix(3,i+1,str);
str.Empty();
str1.Empty();
str.Format("%4.4f",sgnhn.sgnw[i].real);
str1.Format("%4.4f",sgnhn.sgnw[i].imag);
if (sgnhn.sgnw[i].imag>0)
str=str+'+'+str1+'i';
else
str=str+str1+'i';
m_grid.SetTextMatrix(4,i+1,str);
}
UpdateData(FALSE);
}
void CDlg07::OnCancel()
{
// TODO: Add extra cleanup here
MessageBox("真的要退出吗?");
CDialog::OnCancel();
}
void CDlg07::OnOK()
{
// TODO: Add extra validation here
sgn.FreqChangeToTime(sgnhn);
CDialog::OnOK();
drawdiscrete=FALSE;
}
void CDlg07::OnButton2()
{
// TODO: Add your control notification handler code here
sgn.FreqChangeToTime(sgnhn);
sgn.ChangeToDB();
CDialog::OnOK();
drawdiscrete=FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -