📄 boyecutterview.cpp
字号:
/////////////////////////////////////////////////////////////////////////////
// CBoyeCutterView message handlers
void CBoyeCutterView::OnArc()
{
// TODO: Add your command handler code here
}
void CBoyeCutterView::OnCircle()
{
// TODO: Add your command handler code here
CXPDeviceInfo deviceInfo;
if (!m_pFacade->getDeviceInfo(deviceInfo))
{
AfxMessageBox("请先设置设备信息。");
return;
}
CXPCutSetting *pCutSetting = m_pFacade->getCutSetting(0);
if (pCutSetting == NULL)
{
AfxMessageBox("请先设好切割设置。");
return;
}
GetDocument()->setDrawCircle(true);
Invalidate();
if (IDOK == AfxMessageBox("开始运行", IDOK))
run();
}
void CBoyeCutterView::OnClearScreen()
{
// TODO: Add your command handler code here
GetDocument()->clearContent();
m_pFacade->clearAllPaths();
Invalidate();
}
void CBoyeCutterView::OnCutParameter()
{
// TODO: Add your command handler code here
CXPCutSetting *pCutSetting = m_pFacade->getCutSetting(0);
if (pCutSetting != NULL)
{
m_pFacade->showCutSettingDlg(*pCutSetting);
}
else
{
CXPCutSetting cutSetting;
m_pFacade->showCutSettingDlg(cutSetting);
m_pFacade->addCutSetting(0, cutSetting);
}
}
void CBoyeCutterView::OnDeviceinfoSetting()
{
// TODO: Add your command handler code here
CXPDeviceInfo deviceInfo;
m_pFacade->getDeviceInfo(deviceInfo);
if (m_pFacade->showDeviceInfoDlg(deviceInfo))
m_pFacade->setDeviceInfo(deviceInfo);
}
void CBoyeCutterView::OnLaserParameter()
{
// TODO: Add your command handler code here
CXPLaserPara laserPara;
if (!m_pFacade->getLaserPara(laserPara))
{
AfxMessageBox("请先设置设备信息。");
return;
}
if (m_pFacade->showLaserParaDlg(laserPara))
m_pFacade->setLaserPara(laserPara);
}
void CBoyeCutterView::OnMoveParameter()
{
// TODO: Add your command handler code here
CXPMotionPara motionPara;
if (!m_pFacade->getMotionPara(motionPara))
{
AfxMessageBox("请先设置设备信息。");
return;
}
if (m_pFacade->showMotionParaDlg(motionPara))
m_pFacade->setMotionPara(motionPara);
}
void CBoyeCutterView::OnNetOutput()
{
// TODO: Add your command handler code here
m_pFacade->outputNetWorkSetting();
}
void CBoyeCutterView::OnNetworkParameter()
{
// TODO: Add your command handler code here
CXPNetworkSetting ns;
m_pFacade->getNetworkSetting(ns);
if (m_pFacade->showNetWorkSettingDlg(ns))
{
if(ns.checkValidity())
m_pFacade->setNetworkSetting(ns);
}
}
void CBoyeCutterView::OnSline()
{
// TODO: Add your command handler code here
CXPDeviceInfo deviceInfo;
if (!m_pFacade->getDeviceInfo(deviceInfo))
{
AfxMessageBox("请先设置设备信息。");
return;
}
CXPCutSetting *pCutSetting = m_pFacade->getCutSetting(0);
if (pCutSetting == NULL)
{
AfxMessageBox("请先设好切割设置。");
return;
}
GetDocument()->setDrawHline(true);
Invalidate();
if (IDOK == AfxMessageBox("开始运行", IDOK))
run();
}
void CBoyeCutterView::OnSqure()
{
// TODO: Add your command handler code here
CXPDeviceInfo deviceInfo;
if (!m_pFacade->getDeviceInfo(deviceInfo))
{
AfxMessageBox("请先设置设备信息。");
return;
}
CXPCutSetting *pCutSetting = m_pFacade->getCutSetting(0);
if (pCutSetting == NULL)
{
AfxMessageBox("请先设好切割设置。");
return;
}
GetDocument()->setDrawRect(true);
Invalidate();
if (IDOK == AfxMessageBox("开始运行", IDOK))
run();
}
void CBoyeCutterView::OnSystemOutput()
{
// TODO: Add your command handler code here
m_pFacade->outputSystemSetting();
}
void CBoyeCutterView::OnSystemParameter()
{
// TODO: Add your command handler code here
CXPSystemPara systemPara;
if (!m_pFacade->getSystemPara(systemPara))
{
AfxMessageBox("请先设置设备信息。");
return;
}
if (m_pFacade->showSystemParaDlg(systemPara))
m_pFacade->setSystemPara(systemPara);
}
void CBoyeCutterView::OnTest()
{
// TODO: Add your command handler code here
if(m_pFacade->getDebugFlag())
m_pFacade->setDebugFlag(false);
else
m_pFacade->setDebugFlag(true);
}
void CBoyeCutterView::OnVline()
{
// TODO: Add your command handler code here
CXPDeviceInfo deviceInfo;
if (!m_pFacade->getDeviceInfo(deviceInfo))
{
AfxMessageBox("请先设置设备信息。");
return;
}
CXPCutSetting *pCutSetting = m_pFacade->getCutSetting(0);
if (pCutSetting == NULL)
{
AfxMessageBox("请先设好切割设置。");
return;
}
GetDocument()->setDrawVline(true);
Invalidate();
if (IDOK == AfxMessageBox("开始运行", IDOK))
run();
}
void CBoyeCutterView::OnWronginfo()
{
// TODO: Add your command handler code here
AfxMessageBox(m_pFacade->getError());
CString sErrorCode;
sErrorCode.Format("错误代码:%d", m_pFacade->getErrorCode());
AfxMessageBox(sErrorCode);
}
void CBoyeCutterView::OnUpdateWronginfo(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_pFacade->getErrorCode() == 0 ? FALSE:TRUE) ;
}
void CBoyeCutterView::OnUpdateTest(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_pFacade->getDebugFlag());
}
void CBoyeCutterView::OnUpdateNetworkParameter(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_pFacade->isDeviceInfoSet());
}
void CBoyeCutterView::OnUpdateCutParameter(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_pFacade->isDeviceInfoSet());
}
void CBoyeCutterView::OnUpdateSystemParameter(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_pFacade->isDeviceInfoSet());
}
void CBoyeCutterView::OnUpdateMoveParameter(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_pFacade->isDeviceInfoSet());
}
void CBoyeCutterView::OnUpdateLaserParameter(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_pFacade->isDeviceInfoSet());
}
void CBoyeCutterView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CView::OnLButtonDown(nFlags, point);
}
void CBoyeCutterView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CView::OnLButtonUp(nFlags, point);
}
void CBoyeCutterView::run()
{
m_pFacade->clearAllPaths();
CBoyeCutterDoc* pDoc = GetDocument();
CString sTitle = pDoc->GetTitle();
m_pFacade->setFileName(sTitle);
if(pDoc->drawHline())
{
m_pFacade->beginPath(0);
m_pFacade->moveTo(100,100);
m_pFacade->lineTo(200,100);
m_pFacade->endPath();
}
if(pDoc->drawVline())
{
m_pFacade->beginPath(0);
m_pFacade->moveTo(200,50);
m_pFacade->lineTo(200,250);
m_pFacade->endPath();
}
if(pDoc->drawRect())
{
m_pFacade->beginPath(0);
m_pFacade->moveTo(100,100);
m_pFacade->lineTo(300,100);
m_pFacade->lineTo(300,300);
m_pFacade->lineTo(100,300);
m_pFacade->lineTo(100,100);
m_pFacade->endPath();
}
if(pDoc->drawCircle())
{
m_pFacade->beginPath(0);
m_pFacade->circle(150,150,50,0);
m_pFacade->endPath();
}
m_pFacade->run();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -