📄 config.cpp
字号:
// Config.cpp : implementation file
//
#include "stdafx.h"
#include "vib.h"
//#include "Config.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CConfig dialog
CConfig::CConfig(CWnd* pParent /*=NULL*/)
: CDialog(CConfig::IDD, pParent)
{
//{{AFX_DATA_INIT(CConfig)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConfig)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConfig, CDialog)
//{{AFX_MSG_MAP(CConfig)
ON_BN_CLICKED(IDC_DEFAULT, OnDefault)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConfig message handlers
void CConfig::OnDefault()
{
// TODO: Add your control notification handler code here
if(MessageBox("确定使用预设",NULL,MB_ICONQUESTION|MB_YESNO)==IDYES)
{
theApp.DefautConfig();
LoadData();
}
}
void CConfig::LoadData()
{
CString str;
CComboBox* cbo;
str.Format("%d ms",theApp.m_msWinFFT);
SetDlgItemText(IDC_FFT_TIME,str);
if(theApp.m_nFreqHalfLive>0)str.Format("%d 秒",theApp.m_nFreqHalfLive);
else str="(无)";
SetDlgItemText(IDC_FREQ_HALFLIVE,str);
if(theApp.m_nFreqBlur>0)str.Format("%d Hz",theApp.m_nFreqBlur);
else str="(无)";
SetDlgItemText(IDC_FREQ_BLUR,str);
cbo=(CComboBox*)GetDlgItem(IDC_FREQ_VALUE);
cbo->SetCurSel(theApp.m_nFreqValue);
if(theApp.m_nPassbandFreq1>0)str.Format("%d Hz",theApp.m_nPassbandFreq1);
else str="(无)";
SetDlgItemText(IDC_PASSBAND1,str);
if(theApp.m_nPassbandFreq2>0)str.Format("%d Hz",theApp.m_nPassbandFreq2);
else str="(无)";
SetDlgItemText(IDC_PASSBAND2,str);
str.Format("%d Hz",theApp.m_nTransbandWidth);
SetDlgItemText(IDC_TRANSBAND,str);
CheckDlgButton(IDC_MODULATE,theApp.m_bModulate);
str.Format("%d ms",theApp.m_msDispMaxTime);
SetDlgItemText(IDC_DISP_MAXTIME,str);
str.Format("%d 倍",theApp.m_nDispSignalPlus);
SetDlgItemText(IDC_DISP_SIGNALPLUS,str);
str.Format("%d Hz",theApp.m_nDispMaxFreq);
SetDlgItemText(IDC_DISP_MAXFREQ,str);
str.Format("%d 倍",theApp.m_nDispFreqPlus);
SetDlgItemText(IDC_DISP_FREQPLUS,str);
}
BOOL CConfig::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
theApp.m_pView->StopWave();
LoadData();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CConfig::OnOK()
{
// TODO: Add extra validation here
CComboBox* cbo;
CString str;
GetDlgItemText(IDC_FFT_TIME,str);
theApp.m_msWinFFT=atoi(str);
GetDlgItemText(IDC_FREQ_HALFLIVE,str);
theApp.m_nFreqHalfLive=atoi(str);
GetDlgItemText(IDC_FREQ_BLUR,str);
theApp.m_nFreqBlur=atoi(str);
cbo=(CComboBox*)GetDlgItem(IDC_FREQ_VALUE);
theApp.m_nFreqValue=cbo->GetCurSel();
GetDlgItemText(IDC_PASSBAND1,str);
theApp.m_nPassbandFreq1=atoi(str);
GetDlgItemText(IDC_PASSBAND2,str);
theApp.m_nPassbandFreq2=atoi(str);
GetDlgItemText(IDC_TRANSBAND,str);
theApp.m_nTransbandWidth=atoi(str);
theApp.m_bModulate=IsDlgButtonChecked(IDC_MODULATE);
GetDlgItemText(IDC_DISP_MAXTIME,str);
theApp.m_msDispMaxTime=atoi(str);
GetDlgItemText(IDC_DISP_SIGNALPLUS,str);
theApp.m_nDispSignalPlus=atoi(str);
GetDlgItemText(IDC_DISP_MAXFREQ,str);
theApp.m_nDispMaxFreq=atoi(str);
GetDlgItemText(IDC_DISP_FREQPLUS,str);
theApp.m_nDispFreqPlus=atoi(str);
theApp.SaveConfig();
theApp.LoadConfig();
CDialog::OnOK();
}
void CConfig::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
theApp.m_pView->StartWave();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -