| | |
| | | #include "CPageCassetteCtrlCmd.h" |
| | | #include "CJobDataB.h" |
| | | |
| | | #define WM_MANUAL_ROUTE_REAPPLY (WM_APP + 105) |
| | | |
| | | |
| | | // CPageGraph2 对话框 |
| | | |
| | |
| | | ON_WM_DESTROY() |
| | | ON_WM_SIZE() |
| | | ON_WM_TIMER() |
| | | ON_MESSAGE(WM_MANUAL_ROUTE_REAPPLY, &CPageGraph2::OnManualRouteMsg) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | // onNext |
| | | pAny->addRef(); |
| | | int code = pAny->getCode(); |
| | | if (RX_CODE_EQ_DATA_CHANGED == code) { |
| | | // 通知设备状态 |
| | | if (RX_CODE_EQ_DATA_CHANGED == code |
| | | || RX_CODE_LOADPORT_STATUS_CHANGED == code) { |
| | | // 设备数据变化 / LoadPort状态变化 都可能导致slot上下文变化,需刷新指示格 |
| | | SERVO::CEquipment* pEquipment = nullptr; |
| | | if (pAny->getPtrValue("ptr", (void*&)pEquipment) && pEquipment != nullptr) { |
| | | UpdateItemIndicators(pEquipment); |
| | |
| | | }; |
| | | listener.onEqItemPosChanged = [&](EQITEM* pItem, int x, int y) -> void { |
| | | ASSERT(pItem); |
| | | PostMessage(WM_MANUAL_ROUTE_REAPPLY, 0, 0); |
| | | }; |
| | | listener.onDblckEqItem = [&](EQITEM* pItem) -> bool { |
| | | ASSERT(pItem); |
| | |
| | | m_pEqsGraphWnd = CEqsGraphWnd::FromHandle(GetDlgItem(IDC_EQSGRAPHWND1)->m_hWnd); |
| | | m_pEqsGraphWnd->SetBkgndColor(m_crBkgnd); |
| | | m_pEqsGraphWnd->SetOnListener(listener); |
| | | m_pEqsGraphWnd->SetIndicatorSize(10); |
| | | m_pEqsGraphWnd->SetIndicatorMargin(0); |
| | | |
| | | CString strIniFile, strItem; |
| | | strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | int nIndicatorSize = GetPrivateProfileInt("PageGraph2", _T("IndicatorSize"), 10, strIniFile); |
| | | int nIndicatorMargin = GetPrivateProfileInt("PageGraph2", _T("IndicatorMargin"), 0, strIniFile); |
| | | m_pEqsGraphWnd->SetIndicatorSize(nIndicatorSize); |
| | | m_pEqsGraphWnd->SetIndicatorMargin(nIndicatorMargin); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // 异常: OCX 属性页应返回 FALSE |
| | |
| | | } |
| | | } |
| | | |
| | | void CPageGraph2::ApplyManualRoutes() |
| | | { |
| | | if (m_pEqsGraphWnd == nullptr) { |
| | | return; |
| | | } |
| | | |
| | | auto pMeasurement = (SERVO::CEquipment*)theApp.m_model.m_master.getEquipment(EQ_ID_MEASUREMENT); |
| | | auto pLoadPort1 = (SERVO::CEquipment*)theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT1); |
| | | auto pLoadPort3 = (SERVO::CEquipment*)theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT3); |
| | | auto pLoadPort4 = (SERVO::CEquipment*)theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT4); |
| | | if (pMeasurement == nullptr || pLoadPort1 == nullptr || pLoadPort3 == nullptr) { |
| | | return; |
| | | } |
| | | |
| | | SERVO::CPin* pOut1 = pMeasurement->getPin("Out1"); |
| | | SERVO::CPin* pOut2 = pMeasurement->getPin("Out2"); |
| | | SERVO::CPin* pIn1 = pLoadPort1->getPin("In"); |
| | | SERVO::CPin* pIn3 = pLoadPort3->getPin("In"); |
| | | if (pOut1 == nullptr || pOut2 == nullptr || pIn1 == nullptr || pIn3 == nullptr) { |
| | | return; |
| | | } |
| | | |
| | | if (pOut1->getConnectedPin() == pIn1) { |
| | | PIN* pGraphOut1 = m_pEqsGraphWnd->GetPin((DWORD_PTR)pMeasurement, (DWORD_PTR)pOut1); |
| | | PIN* pGraphIn1 = m_pEqsGraphWnd->GetPin((DWORD_PTR)pLoadPort1, (DWORD_PTR)pIn1); |
| | | if (pGraphOut1 != nullptr && pGraphIn1 != nullptr) { |
| | | m_pEqsGraphWnd->SetManualRoute(pGraphOut1, pGraphIn1, TRUE); |
| | | } |
| | | } |
| | | |
| | | if (pOut2->getConnectedPin() == pIn3) { |
| | | PIN* pGraphOut2 = m_pEqsGraphWnd->GetPin((DWORD_PTR)pMeasurement, (DWORD_PTR)pOut2); |
| | | PIN* pGraphIn3 = m_pEqsGraphWnd->GetPin((DWORD_PTR)pLoadPort3, (DWORD_PTR)pIn3); |
| | | if (pGraphOut2 != nullptr && pGraphIn3 != nullptr) { |
| | | m_pEqsGraphWnd->SetManualRoute(pGraphOut2, pGraphIn3, FALSE); |
| | | if (pLoadPort4 != nullptr && pGraphOut2->nLinePtCount >= 6) { |
| | | EQITEM* pGraphPort4 = m_pEqsGraphWnd->GetItem((DWORD_PTR)pLoadPort4); |
| | | if (pGraphPort4 != nullptr) { |
| | | int yTarget = pGraphPort4->rect.bottom + 20; |
| | | if (pGraphOut2->ptConnectedLine[2].y < yTarget) { |
| | | pGraphOut2->ptConnectedLine[2].y = yTarget; |
| | | pGraphOut2->ptConnectedLine[3].y = yTarget; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CPageGraph2::OnTimer(UINT_PTR nIDEvent) |
| | | { |
| | | if (1 == nIDEvent) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | ApplyManualRoutes(); |
| | | } |
| | | |
| | | CDialogEx::OnTimer(nIDEvent); |
| | | } |
| | | |
| | | LRESULT CPageGraph2::OnManualRouteMsg(WPARAM wParam, LPARAM lParam) |
| | | { |
| | | ApplyManualRoutes(); |
| | | CWnd* pGraphWnd = GetDlgItem(IDC_EQSGRAPHWND1); |
| | | if (pGraphWnd != nullptr) { |
| | | pGraphWnd->Invalidate(FALSE); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | void CPageGraph2::SaveEqsGraphData() |
| | | { |
| | | char szFilepath[MAX_PATH]; |