📄 dlg08.cpp
字号:
// Dlg08.cpp : implementation file
//
#include "stdafx.h"
#include "DSP.h"
#include "Dlg08.h"
#include "src/system.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlg08 dialog
CDlg08::CDlg08(CWnd* pParent /*=NULL*/)
: CDialog(CDlg08::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlg08)
m_yz = _T("");
m_xz = _T("");
//}}AFX_DATA_INIT
}
void CDlg08::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlg08)
DDX_Text(pDX, IDC_EDIT1, m_yz);
DDX_Text(pDX, IDC_EDIT2, m_xz);
DDX_Control(pDX, IDC_MSFLEXGRID1, m_grid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlg08, CDialog)
//{{AFX_MSG_MAP(CDlg08)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlg08 message handlers
void CDlg08::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData();
int i;
Dsignal sgny,sgnx;
sgny.CStringToSignal(m_yz);
sgnx.CStringToSignal(m_xz);
Dsystem sys;
sys.initial(1.0,sgny,sgnx);
sgntemp=sys.GetAllResponseAbs();
sgntemp.FFT();
CDC* pDC = GetDC();
m_grid.SetRows(3);
m_grid.SetCols(sgntemp.length+1);
for (i=1;i<=sgntemp.length;i++)
{
m_grid.SetColWidth ( i,( long ) ( 144 * 1440.0 / pDC->GetDeviceCaps(LOGPIXELSX) ) );
}
m_grid.SetTextMatrix(1,0,"Time");
m_grid.SetTextMatrix(2,0,"Freq");
CString str;
CString str1;
for (i=0;i<sgntemp.length;i++)
{ str.Format("%d",i+1);
m_grid.SetTextMatrix(0,i+1,str);
str.Empty();
str.Format("%4.4f",sgntemp.sgnt[i]);
m_grid.SetTextMatrix(1,i+1,str);
str.Empty();
str1.Empty();
str.Format("%4.4f",sgntemp.sgnw[i].real);
str1.Format("%4.4f",sgntemp.sgnw[i].imag);
if (sgntemp.sgnw[i].imag>0)
str=str+'+'+str1+'i';
else
str=str+str1+'i';
m_grid.SetTextMatrix(2,i+1,str);
}
UpdateData(FALSE);
}
void CDlg08::OnCancel()
{
// TODO: Add extra cleanup here
MessageBox("真的要退出吗?");
CDialog::OnCancel();
}
void CDlg08::OnOK()
{
// TODO: Add extra validation here
sgn.FreqChangeToTime(sgntemp);
drawdiscrete=FALSE;
MessageBox("转换完毕");
CDialog::OnOK();
}
void CDlg08::OnButton2()
{
// TODO: Add your control notification handler code here
sgn.FreqChangeToTime(sgntemp);
sgn.ChangeToDB();
drawdiscrete=FALSE;
MessageBox("转换完毕");
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -