diff --git a/MCA/ControlView.cpp b/MCA/ControlView.cpp index 337df01..34575a0 100644 --- a/MCA/ControlView.cpp +++ b/MCA/ControlView.cpp @@ -26,60 +26,57 @@ 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大小 @@ -90,8 +87,7 @@ void CControlView::OnSize(UINT nType, int cx, int cy) SetScrollSizes(MM_HIMETRIC, size); // 将CScrollView的大小设置为当前客户区大小 } -void CControlView::OnInitialUpdate() -{ +void CControlView::OnInitialUpdate() { CFormView::OnInitialUpdate(); // 添加运行模式 @@ -102,8 +98,47 @@ 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::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(); } diff --git a/MCA/ControlView.h b/MCA/ControlView.h index 140083e..24555f0 100644 --- a/MCA/ControlView.h +++ b/MCA/ControlView.h @@ -1,7 +1,5 @@ #pragma once -#include "MCADoc.h" - // CControlView 窗体视图 class CControlView : public CFormView @@ -36,6 +34,7 @@ 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"; @@ -61,4 +60,10 @@ 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(); }; diff --git a/MCA/MCA.rc b/MCA/MCA.rc index 2940abf..26e4cf2 100644 Binary files a/MCA/MCA.rc and b/MCA/MCA.rc differ diff --git a/MCA/MainFrm.cpp b/MCA/MainFrm.cpp index 31a6fe4..40248f3 100644 --- a/MCA/MainFrm.cpp +++ b/MCA/MainFrm.cpp @@ -65,8 +65,7 @@ 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, @@ -75,17 +74,14 @@ 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; @@ -116,8 +112,7 @@ 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)); @@ -137,8 +132,7 @@ 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; @@ -146,8 +140,7 @@ 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); @@ -176,35 +169,30 @@ 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 CMainFrame::RoundupPowerof2(int val) -{ +int 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 CMainFrame::GetMilliTime() -{ +double GetMilliTime() { std::chrono::milliseconds ms = std::chrono::duration_cast( 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)); @@ -230,14 +218,12 @@ 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; @@ -245,8 +231,7 @@ 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++) @@ -256,17 +241,46 @@ 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); // 判断终止 - CString tmp; - pView->m_ComboMode.GetWindowText(tmp); - if ((tmp == "时间" && pView->m_nTime >= pView->m_nCond) || (tmp == "计数" && pView->m_nTotalCount >= pView->m_nCond)) + if ((pView->m_sMode == "Time" && pView->m_nTime >= pView->m_nCond) || (pView->m_sMode == "Count" && pView->m_nTotalCount >= pView->m_nCond)) OnStaStop(); else { // 生成随机信号 @@ -277,17 +291,11 @@ 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); @@ -297,8 +305,7 @@ 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) { @@ -315,8 +322,7 @@ 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)); @@ -371,8 +377,7 @@ 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)); @@ -394,8 +399,7 @@ 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)); @@ -412,13 +416,11 @@ 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; @@ -428,13 +430,11 @@ 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,67 +455,47 @@ 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)); - - pView->m_sSource = (CString)"Co60"; - m_bCoFlag = FALSE; - m_bCsFlag = TRUE; - m_bNaFlag = TRUE; + OnSimuCoOpt(); 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)); - - pView->m_sSource = (CString)"Cs137"; - m_bCoFlag = TRUE; - m_bCsFlag = FALSE; - m_bNaFlag = TRUE; + OnSimuCoOpt(); 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)); - - pView->m_sSource = (CString)"Na22"; - m_bCoFlag = TRUE; - m_bCsFlag = TRUE; - m_bNaFlag = FALSE; + OnSimuCoOpt(); 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)); @@ -525,13 +505,11 @@ void CMainFrame::OnAxisLinear() 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)); @@ -543,13 +521,11 @@ void CMainFrame::OnAxisLog() 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)); @@ -559,13 +535,11 @@ 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)); @@ -576,8 +550,7 @@ 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)); @@ -588,8 +561,7 @@ 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)); @@ -600,8 +572,7 @@ 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)); @@ -612,8 +583,7 @@ 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)); @@ -625,13 +595,11 @@ 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)); @@ -643,13 +611,11 @@ 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)); @@ -661,13 +627,11 @@ 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)); @@ -742,4 +706,4 @@ void CMainFrame::OnDataPeak() CString strText; strText.Format(_T("幅值%.3f\n均值%.3f\n标准差%.3f"), amplitude, mean, sigma); AfxMessageBox(strText); -} \ No newline at end of file +} diff --git a/MCA/MainFrm.h b/MCA/MainFrm.h index 17a07e9..7a0563a 100644 --- a/MCA/MainFrm.h +++ b/MCA/MainFrm.h @@ -53,12 +53,13 @@ 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); diff --git a/MCA/Resource.h b/MCA/Resource.h index 8a648f2..3ab5a50 100644 --- a/MCA/Resource.h +++ b/MCA/Resource.h @@ -22,7 +22,7 @@ #define IDC_TIME 1019 #define IDC_TCOUNT 1020 #define IDC_BCHA 1021 -#define IDC_ECHA 1022 +#define IDC_SOURCE 1021 #define IDC_CURSOR1 1023 #define IDC_CURSORROI_COUNT 1024 #define IDC_RANGE 1025