Compare commits

..

No commits in common. "05dce90378036b4106ca304c34aaa047bac7754c" and "15e3d30cdb863752c68ede00b8170a99192046c7" have entirely different histories.

6 changed files with 148 additions and 156 deletions

View File

@ -26,57 +26,60 @@ CControlView::CControlView()
, m_nCursor1(0)
, m_nCursor2(1023)
, m_nCursorROI(0)
, m_nCursorROICount(0) {
, m_nCursorROICount(0)
{
}
CControlView::~CControlView() {
CControlView::~CControlView()
{
}
void CControlView::DoDataExchange(CDataExchange* pDX) {
void CControlView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
DDX_Text(pDX, IDC_COND, m_nCond);
DDX_Text(pDX, IDC_TIME, m_nTimeStr);
DDX_Text(pDX, IDC_TCOUNT, m_nTotalCount);
DDX_Text(pDX, IDC_PCOUNT, m_nPartCount);
DDX_Text(pDX, IDC_MCOUNT, m_nMaxCount);
DDX_Control(pDX, IDC_MODE, m_ComboMode);
DDX_Control(pDX, IDC_AXIS, m_ComboAxis);
DDX_Text(pDX, IDC_RANGE, m_nLC);
DDX_Text(pDX, IDC_WIDTH, m_nWidth);
DDX_Text(pDX, IDC_CURSOR1, m_nCursor1);
DDX_Text(pDX, IDC_CURSOR2, m_nCursor2);
DDX_Text(pDX, IDC_CURSORROI, m_nCursorROI);
DDX_Text(pDX, IDC_CURSORROI_COUNT, m_nCursorROICount);
DDX_Control(pDX, IDC_MODE, m_ComboMode);
DDX_Control(pDX, IDC_AXIS, m_ComboAxis);
DDX_Control(pDX, IDC_SOURCE, m_ComboSource);
}
BEGIN_MESSAGE_MAP(CControlView, CFormView)
ON_WM_SIZE()
ON_CBN_SELCHANGE(IDC_SOURCE, &CControlView::OnCbnSelchangeSource)
ON_CBN_SELCHANGE(IDC_MODE, &CControlView::OnCbnSelchangeMode)
ON_CBN_SELCHANGE(IDC_AXIS, &CControlView::OnCbnSelchangeAxis)
END_MESSAGE_MAP()
// CControlView 诊断
#ifdef _DEBUG
void CControlView::AssertValid() const {
void CControlView::AssertValid() const
{
CFormView::AssertValid();
}
#ifndef _WIN32_WCE
void CControlView::Dump(CDumpContext& dc) const {
void CControlView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif
#endif //_DEBUG
void CControlView::SetCond(BOOL flag) {
void CControlView::SetCond(BOOL flag)
{
((CEdit*)GetDlgItem(IDC_COND))->EnableWindow(flag);
}
// CControlView 消息处理程序
void CControlView::OnSize(UINT nType, int cx, int cy) {
void CControlView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
CRect rect;
GetClientRect(&rect); // 获取当前客户区view大小
@ -87,7 +90,8 @@ void CControlView::OnSize(UINT nType, int cx, int cy) {
SetScrollSizes(MM_HIMETRIC, size); // 将CScrollView的大小设置为当前客户区大小
}
void CControlView::OnInitialUpdate() {
void CControlView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// 添加运行模式
@ -98,47 +102,8 @@ void CControlView::OnInitialUpdate() {
m_ComboAxis.AddString((CString)"线性");
m_ComboAxis.AddString((CString)"对数");
m_ComboAxis.SetCurSel(0);
// 添加模拟源
m_ComboSource.AddString((CString)"Co60");
m_ComboSource.AddString((CString)"Cs137");
m_ComboSource.AddString((CString)"Na22");
m_ComboSource.SetCurSel(1);
}
void CControlView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/) {
}
void CControlView::OnCbnSelchangeSource() {
CString tmp;
CMainFrame* pFrame = (CMainFrame*)GetParentFrame();
m_ComboSource.GetWindowText(tmp);
OutputDebugString(tmp);
if (tmp != m_sSource) {
pFrame->OnStaStop();
pFrame->OnStaClear();
}
if (tmp == "Cs137") pFrame->OnSimuCsOpt();
else if (tmp == "Co60") pFrame->OnSimuCoOpt();
else pFrame->OnSimuNaOpt();
}
void CControlView::OnCbnSelchangeMode() {
CString tmp;
CMainFrame* pFrame = (CMainFrame*)GetParentFrame();
m_ComboMode.GetWindowText(tmp);
OutputDebugString(tmp);
if (tmp == "时间") m_sMode = "Time";
else m_sMode = "Count";
}
void CControlView::OnCbnSelchangeAxis() {
CString tmp;
CMainFrame* pFrame = (CMainFrame*)GetParentFrame();
m_ComboAxis.GetWindowText(tmp);
OutputDebugString(tmp);
if (tmp == "对数") pFrame->OnAxisLog();
else pFrame->OnAxisLinear();
void CControlView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/)
{
}

View File

@ -1,5 +1,7 @@
#pragma once
#include "MCADoc.h"
// CControlView 窗体视图
class CControlView : public CFormView
@ -34,7 +36,6 @@ public:
virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/);
// 选择信息
CString m_sMode = (CString)"Time";
CString m_sSource = (CString)"Cs137";
CString m_sAxisMode = (CString)"Linear";
CString m_sRangeMode = (CString)"Auto";
@ -60,10 +61,4 @@ public:
int m_nMaxCount;
CComboBox m_ComboMode;
CComboBox m_ComboAxis;
CComboBox m_ComboSource;
// 下拉框选择
afx_msg void OnCbnSelchangeSource();
afx_msg void OnCbnSelchangeMode();
afx_msg void OnCbnSelchangeAxis();
};

Binary file not shown.

View File

@ -65,7 +65,8 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_UPDATE_COMMAND_UI(ID_DATA_5, &CMainFrame::OnUpdateData5)
END_MESSAGE_MAP()
static UINT indicators[] = {
static UINT indicators[] =
{
ID_SEPARATOR, // 状态行指示器
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
@ -74,14 +75,17 @@ static UINT indicators[] = {
// CMainFrame 构造/析构
CMainFrame::CMainFrame() noexcept {
CMainFrame::CMainFrame() noexcept
{
// TODO: 在此添加成员初始化代码
}
CMainFrame::~CMainFrame() {
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
@ -112,7 +116,8 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext) {
CCreateContext* pContext)
{
// 左右拆分窗口1行2列
VERIFY(m_wndSplitter.CreateStatic(this, 1, 2,
WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST));
@ -132,7 +137,8 @@ BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
return TRUE;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) {
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style &= ~WS_THICKFRAME;
@ -140,7 +146,8 @@ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) {
return TRUE;
}
void CMainFrame::OnLoadToolBarIcon() {
void CMainFrame::OnLoadToolBarIcon()
{
HICON icon;
m_imgList.Create(50, 50, TRUE | ILC_COLOR32, 10, 0);
@ -169,30 +176,35 @@ void CMainFrame::OnLoadToolBarIcon() {
// CMainFrame 诊断
#ifdef _DEBUG
void CMainFrame::AssertValid() const {
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const {
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
int RoundupPowerof2(int val) {
int CMainFrame::RoundupPowerof2(int val)
{
if ((val & (val - 1)) == 0) return val;
int andv = 1 << 30;
while ((andv & val) == 0) andv = andv >> 1;
return andv << 1;
}
double GetMilliTime() {
double CMainFrame::GetMilliTime()
{
std::chrono::milliseconds ms = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch()
);
return ms.count() / 1000.;
}
void CMainFrame::UpdateValue() {
void CMainFrame::UpdateValue()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -218,12 +230,14 @@ void CMainFrame::UpdateValue() {
pView->UpdateData(FALSE);
}
void CMainFrame::SaveFirst() {
void CMainFrame::SaveFirst()
{
int res = MessageBox(TEXT("打开前是否保存?"), TEXT("保存文件"), MB_YESNO | MB_ICONQUESTION);
if (res == IDYES) OnOptSave();
}
void CMainFrame::SmoothThree() {
void CMainFrame::SmoothThree()
{
pDoc->m_nChannelSmooth[0] = (5 * pDoc->m_nChannelCount[0] + 2 * pDoc->m_nChannelCount[1] - pDoc->m_nChannelCount[2]) / 6;
for (int i = 1; i < 1023; i++)
pDoc->m_nChannelSmooth[i] = (pDoc->m_nChannelCount[i - 1] + pDoc->m_nChannelCount[i] + pDoc->m_nChannelCount[i + 1]) / 3;
@ -231,7 +245,8 @@ void CMainFrame::SmoothThree() {
for (int i = 0; i < 1024; i++) pDoc->m_nChannelSmooth[i] = max(0, pDoc->m_nChannelSmooth[i]);
}
void CMainFrame::SmoothFive() {
void CMainFrame::SmoothFive()
{
pDoc->m_nChannelSmooth[0] = (3 * pDoc->m_nChannelCount[0] + 2 * pDoc->m_nChannelCount[1] + pDoc->m_nChannelCount[2] - pDoc->m_nChannelCount[4]) / 5;
pDoc->m_nChannelSmooth[1] = (4 * pDoc->m_nChannelCount[0] + 3 * pDoc->m_nChannelCount[1] + 2 * pDoc->m_nChannelCount[2] + pDoc->m_nChannelCount[3]) / 10;
for (int i = 2; i < 1022; i++)
@ -241,46 +256,17 @@ void CMainFrame::SmoothFive() {
for (int i = 0; i < 1024; i++) pDoc->m_nChannelSmooth[i] = max(0, pDoc->m_nChannelSmooth[i]);
}
void CMainFrame::OnSimuCoOpt() {
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pView->m_sSource = (CString)"Co60";
pView->m_ComboSource.SetCurSel(0);
m_bCoFlag = FALSE;
m_bCsFlag = TRUE;
m_bNaFlag = TRUE;
}
void CMainFrame::OnSimuCsOpt() {
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pView->m_sSource = (CString)"Cs137";
pView->m_ComboSource.SetCurSel(1);
m_bCoFlag = TRUE;
m_bCsFlag = FALSE;
m_bNaFlag = TRUE;
}
void CMainFrame::OnSimuNaOpt() {
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pView->m_sSource = (CString)"Na22";
pView->m_ComboSource.SetCurSel(2);
m_bCoFlag = TRUE;
m_bCsFlag = TRUE;
m_bNaFlag = FALSE;
}
// CMainFrame 消息处理程序
void CMainFrame::OnTimer(UINT_PTR nIDEvent) {
void CMainFrame::OnTimer(UINT_PTR nIDEvent)
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pDoc->SetModifiedFlag(TRUE);
// 判断终止
if ((pView->m_sMode == "Time" && pView->m_nTime >= pView->m_nCond) || (pView->m_sMode == "Count" && pView->m_nTotalCount >= pView->m_nCond))
CString tmp;
pView->m_ComboMode.GetWindowText(tmp);
if ((tmp == "时间" && pView->m_nTime >= pView->m_nCond) || (tmp == "计数" && pView->m_nTotalCount >= pView->m_nCond))
OnStaStop();
else {
// 生成随机信号
@ -291,11 +277,17 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent) {
UpdateValue();
}
// 修改坐标轴
pView->m_ComboAxis.GetWindowText(tmp);
if (tmp == "对数") OnAxisLog();
else OnAxisLinear();
pDoc->UpdateAllViews(NULL);
CFrameWnd::OnTimer(nIDEvent);
}
void CMainFrame::OnClose() {
void CMainFrame::OnClose()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pDoc->IsModified()) {
int res = MessageBox(TEXT("退出前是否保存?"), TEXT("保存文件"), MB_YESNO | MB_ICONQUESTION);
@ -305,7 +297,8 @@ void CMainFrame::OnClose() {
CFrameWnd::OnClose();
}
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) {
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
if (pMsg->message == WM_KEYDOWN && pMsg->wParam >= 0x25 && pMsg->wParam <= 0x28) {
@ -322,7 +315,8 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) {
return CFrameWnd::PreTranslateMessage(pMsg);
}
void CMainFrame::OnOptOpen() {
void CMainFrame::OnOptOpen()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -377,7 +371,8 @@ void CMainFrame::OnOptOpen() {
}
}
void CMainFrame::OnOptSave() {
void CMainFrame::OnOptSave()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -388,9 +383,8 @@ void CMainFrame::OnOptSave() {
CString szfile = fileDlg.GetPathName();
std::ofstream ofs(szfile);
std::string str = CStringA(pView->m_sSource);
ofs << pView->m_nTime << std::endl;
ofs << str.c_str() << std::endl;
ofs << pView->m_sSource << std::endl;
for (int i = 0; i < 1024; i++)
ofs << i << ", " << pDoc->m_nChannelCount[i] << std::endl;
@ -399,7 +393,8 @@ void CMainFrame::OnOptSave() {
pDoc->SetModifiedFlag(FALSE);
}
void CMainFrame::OnStaStart() {
void CMainFrame::OnStaStart()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -416,11 +411,13 @@ void CMainFrame::OnStaStart() {
SetTimer(1, 20, NULL);
}
void CMainFrame::OnUpdateStaStart(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateStaStart(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bStartFlag);
}
void CMainFrame::OnStaStop() {
void CMainFrame::OnStaStop()
{
// 设置状态
m_bStartFlag = TRUE;
m_bStopFlag = FALSE;
@ -430,11 +427,13 @@ void CMainFrame::OnStaStop() {
KillTimer(1);
}
void CMainFrame::OnUpdateStaStop(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateStaStop(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bStopFlag);
}
void CMainFrame::OnStaClear() {
void CMainFrame::OnStaClear()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -455,77 +454,99 @@ void CMainFrame::OnStaClear() {
pDoc->SetModifiedFlag(FALSE);
}
void CMainFrame::OnUpdateStaClear(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateStaClear(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bClearFlag);
}
void CMainFrame::OnSimuCo() {
void CMainFrame::OnSimuCo()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
OnSimuCoOpt();
pView->m_sSource = (CString)"Co60";
m_bCoFlag = FALSE;
m_bCsFlag = TRUE;
m_bNaFlag = TRUE;
OnStaStop();
OnStaClear();
}
void CMainFrame::OnUpdateSimuCo(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateSimuCo(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bCoFlag);
}
void CMainFrame::OnSimuCs() {
void CMainFrame::OnSimuCs()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
OnSimuCoOpt();
pView->m_sSource = (CString)"Cs137";
m_bCoFlag = TRUE;
m_bCsFlag = FALSE;
m_bNaFlag = TRUE;
OnStaStop();
OnStaClear();
}
void CMainFrame::OnUpdateSimuCs(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateSimuCs(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bCsFlag);
}
void CMainFrame::OnSimuNa() {
void CMainFrame::OnSimuNa()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
OnSimuCoOpt();
pView->m_sSource = (CString)"Na22";
m_bCoFlag = TRUE;
m_bCsFlag = TRUE;
m_bNaFlag = FALSE;
OnStaStop();
OnStaClear();
}
void CMainFrame::OnUpdateSimuNa(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateSimuNa(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bNaFlag);
}
void CMainFrame::OnAxisLinear() {
void CMainFrame::OnAxisLinear()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pView->m_sAxisMode = (CString)"Linear";
pView->m_ComboAxis.SetCurSel(0);
m_bLinearFlag = FALSE;
m_bLogFlag = TRUE;
}
void CMainFrame::OnUpdateAxisLinear(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateAxisLinear(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bLinearFlag);
}
void CMainFrame::OnAxisLog() {
void CMainFrame::OnAxisLog()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pView->m_sAxisMode = (CString)"Log";
pView->m_sRangeMode = "Auto";
pView->m_ComboAxis.SetCurSel(1);
m_bAutoFlag = FALSE;
m_bLinearFlag = TRUE;
m_bLogFlag = FALSE;
}
void CMainFrame::OnUpdateAxisLog(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateAxisLog(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bLogFlag);
}
void CMainFrame::OnRangeAuto() {
void CMainFrame::OnRangeAuto()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -535,11 +556,13 @@ void CMainFrame::OnRangeAuto() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnUpdateRangeAuto(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateRangeAuto(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bAutoFlag);
}
void CMainFrame::OnRangeD4() {
void CMainFrame::OnRangeD4()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -550,7 +573,8 @@ void CMainFrame::OnRangeD4() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnRangeD2() {
void CMainFrame::OnRangeD2()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -561,7 +585,8 @@ void CMainFrame::OnRangeD2() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnRangeM2() {
void CMainFrame::OnRangeM2()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -572,7 +597,8 @@ void CMainFrame::OnRangeM2() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnRangeM4() {
void CMainFrame::OnRangeM4()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -583,7 +609,8 @@ void CMainFrame::OnRangeM4() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnDataOrigin() {
void CMainFrame::OnDataOrigin()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -595,11 +622,13 @@ void CMainFrame::OnDataOrigin() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnUpdateDataOrigin(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateDataOrigin(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bOriginFlag);
}
void CMainFrame::OnData3() {
void CMainFrame::OnData3()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -611,11 +640,13 @@ void CMainFrame::OnData3() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnUpdateData3(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateData3(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bTSmoothFlag);
}
void CMainFrame::OnData5() {
void CMainFrame::OnData5()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -627,11 +658,13 @@ void CMainFrame::OnData5() {
pDoc->UpdateAllViews(NULL);
}
void CMainFrame::OnUpdateData5(CCmdUI* pCmdUI) {
void CMainFrame::OnUpdateData5(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bFSmoothFlag);
}
void CMainFrame::OnDataPeak() {
void CMainFrame::OnDataPeak()
{
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -706,4 +739,4 @@ void CMainFrame::OnDataPeak() {
CString strText;
strText.Format(_T("幅值%.3f\n均值%.3f\n标准差%.3f"), amplitude, mean, sigma);
AfxMessageBox(strText);
}
}

View File

@ -53,13 +53,12 @@ protected:
public:
CMCADoc* pDoc = nullptr;
CControlView* pView = nullptr;
int RoundupPowerof2(int val);
double GetMilliTime();
void UpdateValue();
void SaveFirst();
void SmoothThree();
void SmoothFive();
void OnSimuCoOpt();
void OnSimuCsOpt();
void OnSimuNaOpt();
// 消息处理
afx_msg void OnTimer(UINT_PTR nIDEvent);

View File

@ -22,7 +22,7 @@
#define IDC_TIME 1019
#define IDC_TCOUNT 1020
#define IDC_BCHA 1021
#define IDC_SOURCE 1021
#define IDC_ECHA 1022
#define IDC_CURSOR1 1023
#define IDC_CURSORROI_COUNT 1024
#define IDC_RANGE 1025