2022-03-20 15:14:44 +08:00
|
|
|
|
// ControlView.cpp: 实现文件
|
|
|
|
|
//
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
|
|
#include "MCA.h"
|
|
|
|
|
#include "MCADoc.h"
|
|
|
|
|
#include "MainFrm.h"
|
2022-06-02 18:01:18 +08:00
|
|
|
|
#include "DetailView.h"
|
2022-03-20 15:14:44 +08:00
|
|
|
|
#include "ControlView.h"
|
|
|
|
|
|
|
|
|
|
// CControlView
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNCREATE(CControlView, CFormView)
|
|
|
|
|
|
|
|
|
|
CControlView::CControlView()
|
|
|
|
|
: CFormView(IDD_DIALOG_CONTROL)
|
2022-05-31 22:21:20 +08:00
|
|
|
|
, m_nCond(100)
|
|
|
|
|
, m_nT0(0)
|
|
|
|
|
, m_nTime(0)
|
|
|
|
|
, m_nTimeStr((CString)'0')
|
|
|
|
|
, m_nTotalCount(0)
|
|
|
|
|
, m_nPartCount(0)
|
|
|
|
|
, m_nMaxCount(0)
|
2022-06-02 10:08:38 +08:00
|
|
|
|
, m_nLC(4)
|
2022-06-03 01:47:52 +08:00
|
|
|
|
, m_nWidth(1024)
|
2022-05-31 22:21:20 +08:00
|
|
|
|
, m_nCursor1(0)
|
|
|
|
|
, m_nCursor2(1023)
|
|
|
|
|
, m_nCursorROI(0)
|
2022-06-04 01:40:27 +08:00
|
|
|
|
, m_nCursor1Count(0)
|
|
|
|
|
, m_nCursor2Count(0)
|
2022-06-03 13:30:39 +08:00
|
|
|
|
, m_nCursorROICount(0) {
|
2022-03-20 15:14:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 13:30:39 +08:00
|
|
|
|
CControlView::~CControlView() {
|
2022-03-20 15:14:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 13:30:39 +08:00
|
|
|
|
void CControlView::DoDataExchange(CDataExchange* pDX) {
|
2022-05-31 22:21:20 +08:00
|
|
|
|
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);
|
2022-06-02 10:08:38 +08:00
|
|
|
|
DDX_Text(pDX, IDC_RANGE, m_nLC);
|
2022-06-03 01:47:52 +08:00
|
|
|
|
DDX_Text(pDX, IDC_WIDTH, m_nWidth);
|
2022-05-31 22:21:20 +08:00
|
|
|
|
DDX_Text(pDX, IDC_CURSOR1, m_nCursor1);
|
|
|
|
|
DDX_Text(pDX, IDC_CURSOR2, m_nCursor2);
|
|
|
|
|
DDX_Text(pDX, IDC_CURSORROI, m_nCursorROI);
|
2022-06-04 01:40:27 +08:00
|
|
|
|
DDX_Text(pDX, IDC_CURSOR1_COUNT, m_nCursor1Count);
|
|
|
|
|
DDX_Text(pDX, IDC_CURSOR2_COUNT, m_nCursor2Count);
|
2022-05-31 22:21:20 +08:00
|
|
|
|
DDX_Text(pDX, IDC_CURSORROI_COUNT, m_nCursorROICount);
|
2022-06-03 13:30:39 +08:00
|
|
|
|
DDX_Control(pDX, IDC_MODE, m_ComboMode);
|
|
|
|
|
DDX_Control(pDX, IDC_AXIS, m_ComboAxis);
|
|
|
|
|
DDX_Control(pDX, IDC_SOURCE, m_ComboSource);
|
2022-03-20 15:14:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CControlView, CFormView)
|
2022-05-30 16:36:01 +08:00
|
|
|
|
ON_WM_SIZE()
|
2022-06-03 13:30:39 +08:00
|
|
|
|
ON_CBN_SELCHANGE(IDC_SOURCE, &CControlView::OnCbnSelchangeSource)
|
|
|
|
|
ON_CBN_SELCHANGE(IDC_MODE, &CControlView::OnCbnSelchangeMode)
|
|
|
|
|
ON_CBN_SELCHANGE(IDC_AXIS, &CControlView::OnCbnSelchangeAxis)
|
2022-06-02 10:08:38 +08:00
|
|
|
|
END_MESSAGE_MAP()
|
2022-03-20 15:14:44 +08:00
|
|
|
|
|
|
|
|
|
// CControlView 诊断
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
2022-06-03 13:30:39 +08:00
|
|
|
|
void CControlView::AssertValid() const {
|
2022-03-20 15:14:44 +08:00
|
|
|
|
CFormView::AssertValid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef _WIN32_WCE
|
2022-06-03 13:30:39 +08:00
|
|
|
|
void CControlView::Dump(CDumpContext& dc) const {
|
2022-03-20 15:14:44 +08:00
|
|
|
|
CFormView::Dump(dc);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif //_DEBUG
|
|
|
|
|
|
2022-06-03 13:30:39 +08:00
|
|
|
|
void CControlView::SetCond(BOOL flag) {
|
2022-06-02 18:01:18 +08:00
|
|
|
|
((CEdit*)GetDlgItem(IDC_COND))->EnableWindow(flag);
|
2022-06-02 14:57:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-20 15:14:44 +08:00
|
|
|
|
// CControlView 消息处理程序
|
2022-06-03 13:30:39 +08:00
|
|
|
|
void CControlView::OnSize(UINT nType, int cx, int cy) {
|
2022-05-30 16:36:01 +08:00
|
|
|
|
CFormView::OnSize(nType, cx, cy);
|
|
|
|
|
CRect rect;
|
|
|
|
|
GetClientRect(&rect); // 获取当前客户区view大小
|
|
|
|
|
|
|
|
|
|
CSize size;
|
|
|
|
|
size.cx = rect.right - rect.left;
|
|
|
|
|
size.cy = rect.bottom - rect.top;
|
|
|
|
|
SetScrollSizes(MM_HIMETRIC, size); // 将CScrollView的大小设置为当前客户区大小
|
2022-05-31 22:21:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 13:30:39 +08:00
|
|
|
|
void CControlView::OnInitialUpdate() {
|
2022-05-31 22:21:20 +08:00
|
|
|
|
CFormView::OnInitialUpdate();
|
|
|
|
|
|
|
|
|
|
// 添加运行模式
|
|
|
|
|
m_ComboMode.AddString((CString)"时间");
|
|
|
|
|
m_ComboMode.AddString((CString)"计数");
|
|
|
|
|
m_ComboMode.SetCurSel(0);
|
|
|
|
|
// 添加坐标轴模式
|
|
|
|
|
m_ComboAxis.AddString((CString)"线性");
|
|
|
|
|
m_ComboAxis.AddString((CString)"对数");
|
|
|
|
|
m_ComboAxis.SetCurSel(0);
|
2022-06-03 13:30:39 +08:00
|
|
|
|
// 添加模拟源
|
|
|
|
|
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*/) {
|
2022-05-31 22:21:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 13:30:39 +08:00
|
|
|
|
void CControlView::OnCbnSelchangeSource() {
|
|
|
|
|
CString tmp;
|
|
|
|
|
CMainFrame* pFrame = (CMainFrame*)GetParentFrame();
|
|
|
|
|
m_ComboSource.GetWindowText(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);
|
|
|
|
|
|
|
|
|
|
if (tmp == "时间") m_sMode = "Time";
|
|
|
|
|
else m_sMode = "Count";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CControlView::OnCbnSelchangeAxis() {
|
|
|
|
|
CString tmp;
|
|
|
|
|
CMainFrame* pFrame = (CMainFrame*)GetParentFrame();
|
|
|
|
|
m_ComboAxis.GetWindowText(tmp);
|
|
|
|
|
|
|
|
|
|
if (tmp == "对数") pFrame->OnAxisLog();
|
|
|
|
|
else pFrame->OnAxisLinear();
|
2022-05-31 22:21:20 +08:00
|
|
|
|
}
|