fix: end judgment
This commit is contained in:
parent
2e03506916
commit
15e3d30cdb
@ -263,33 +263,24 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
|
||||
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))
|
||||
OnStaStop();
|
||||
else {
|
||||
// 生成随机信号
|
||||
int n = rand() % 50 + 25;
|
||||
int n = rand() % 10 + 5;
|
||||
pDoc->RandomPeak(pView->m_sSource, n);
|
||||
|
||||
// 更新
|
||||
UpdateValue();
|
||||
|
||||
// 判断终止
|
||||
CString tmp;
|
||||
pView->m_ComboMode.GetWindowText(tmp);
|
||||
if (tmp == "时间" && pView->m_nTime >= pView->m_nCond) OnStaStop();
|
||||
if (tmp == "计数" && pView->m_nTotalCount >= pView->m_nCond) OnStaStop();
|
||||
}
|
||||
|
||||
// 修改坐标轴
|
||||
pView->m_ComboAxis.GetWindowText(tmp);
|
||||
if (tmp == "对数") {
|
||||
m_bAutoFlag = FALSE;
|
||||
pView->m_sAxisMode = "Log";
|
||||
pView->m_sRangeMode = "Auto";
|
||||
m_bLinearFlag = TRUE;
|
||||
m_bLogFlag = FALSE;
|
||||
}
|
||||
else {
|
||||
pView->m_sAxisMode = "Linear";
|
||||
m_bLinearFlag = FALSE;
|
||||
m_bLogFlag = TRUE;
|
||||
}
|
||||
if (tmp == "对数") OnAxisLog();
|
||||
else OnAxisLinear();
|
||||
|
||||
pDoc->UpdateAllViews(NULL);
|
||||
CFrameWnd::OnTimer(nIDEvent);
|
||||
@ -324,29 +315,6 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
|
||||
return CFrameWnd::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
void CMainFrame::OnStaStart()
|
||||
{
|
||||
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
|
||||
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
||||
|
||||
// 重置结束条件
|
||||
pView->m_nT0 = GetMilliTime();
|
||||
// 设置状态
|
||||
m_bStartFlag = FALSE;
|
||||
m_bStopFlag = TRUE;
|
||||
m_bClearFlag = FALSE;
|
||||
pView->SetCond(FALSE);
|
||||
// 获取屏幕值至变量
|
||||
pView->UpdateData(TRUE);
|
||||
// 设置更新
|
||||
SetTimer(1, 100, NULL);
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateStaStart(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->Enable(m_bStartFlag);
|
||||
}
|
||||
|
||||
void CMainFrame::OnOptOpen()
|
||||
{
|
||||
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
|
||||
@ -366,11 +334,19 @@ void CMainFrame::OnOptOpen()
|
||||
|
||||
try
|
||||
{
|
||||
// 获取时间
|
||||
std::getline(ifs, line);
|
||||
pView->m_nTime = 0;
|
||||
pView->m_nT0 = GetMilliTime() - std::stof(line);
|
||||
|
||||
// 获取源
|
||||
std::getline(ifs, line);
|
||||
pView->m_sSource = line.c_str();
|
||||
if (pView->m_sSource == "Cs137") OnSimuCs();
|
||||
else if (pView->m_sSource == "Co60") OnSimuCo();
|
||||
else OnSimuNa();
|
||||
|
||||
// 获取计数
|
||||
while (std::getline(ifs, line))
|
||||
{
|
||||
std::stringstream ss(line);
|
||||
@ -381,8 +357,11 @@ void CMainFrame::OnOptOpen()
|
||||
cnt += 1;
|
||||
}
|
||||
for (int i = 1; i < 1024; i++) pDoc->m_nChannelCount[i] = count[i];
|
||||
|
||||
// 其他设置
|
||||
m_bClearFlag = TRUE;
|
||||
pView->m_sRangeMode = "Auto";
|
||||
pView->m_sSmoothType = "Origin";
|
||||
UpdateValue();
|
||||
pDoc->UpdateAllViews(NULL);
|
||||
}
|
||||
@ -414,6 +393,29 @@ void CMainFrame::OnOptSave()
|
||||
pDoc->SetModifiedFlag(FALSE);
|
||||
}
|
||||
|
||||
void CMainFrame::OnStaStart()
|
||||
{
|
||||
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
|
||||
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
||||
|
||||
// 重置结束条件
|
||||
pView->m_nT0 = GetMilliTime();
|
||||
// 设置状态
|
||||
m_bStartFlag = FALSE;
|
||||
m_bStopFlag = TRUE;
|
||||
m_bClearFlag = FALSE;
|
||||
pView->SetCond(FALSE);
|
||||
// 获取屏幕值至变量
|
||||
pView->UpdateData(TRUE);
|
||||
// 设置更新
|
||||
SetTimer(1, 20, NULL);
|
||||
}
|
||||
|
||||
void CMainFrame::OnUpdateStaStart(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->Enable(m_bStartFlag);
|
||||
}
|
||||
|
||||
void CMainFrame::OnStaStop()
|
||||
{
|
||||
// 设置状态
|
||||
@ -532,6 +534,8 @@ void CMainFrame::OnAxisLog()
|
||||
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
||||
|
||||
pView->m_sAxisMode = (CString)"Log";
|
||||
pView->m_sRangeMode = "Auto";
|
||||
m_bAutoFlag = FALSE;
|
||||
m_bLinearFlag = TRUE;
|
||||
m_bLogFlag = FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user