LAPTOP-SNT8I5JK\Boounion
2024-12-02 df0863b2c29fa227d186e6b8aeb4a856dcae12f3
SourceCode/Bond/BondEq/BondEqDlg.cpp
@@ -74,6 +74,7 @@
   m_pMainContainer = nullptr;
   m_pHomeDialog = nullptr;
   m_pActiveView = nullptr;
   m_pActiveComponentDlg = nullptr;
}
void CBondEqDlg::DoDataExchange(CDataExchange* pDX)
@@ -134,7 +135,26 @@
               }
            }
         }
         else if (RX_CODE_SELECT_COMPONENT == code) {
            CComponent* pComponent;
            if (pAny->getPtrValue("ptr", (void*&)pComponent)) {
               if (pComponent->getClassName().compare("CPLC") == 0) {
                  if (m_pMainContainer != nullptr) {
                     if (m_pActiveComponentDlg != nullptr) {
                        if (m_pActiveComponentDlg->GetContext() != (void*)pComponent) {
                           m_pActiveComponentDlg->DestroyWindow();
                           delete m_pActiveComponentDlg;
                           m_pActiveComponentDlg = nullptr;
                        }
                     }
                     if (m_pActiveComponentDlg == nullptr) {
                        m_pActiveComponentDlg = CreateComponentPLCDlg(pComponent);
                     }
                  }
               }
            }
         }
         pAny->release();
      }, [&]() -> void {
         // onComplete
@@ -366,6 +386,12 @@
      m_pActiveView = nullptr;
   }
   if (m_pActiveComponentDlg != nullptr) {
      m_pActiveComponentDlg->DestroyWindow();
      delete m_pActiveComponentDlg;
      m_pActiveComponentDlg = nullptr;
   }
   if (m_hbrBkgnd != nullptr) {
      ::DeleteObject(m_hbrBkgnd);
   }
@@ -482,19 +508,18 @@
void CBondEqDlg::OnMenuFileSettings()
{
   /*
   CAxisSettingsDlg axisDlg;
   axisDlg.SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)"));
   axisDlg.SetRecipeName(_T("Default"));
   axisDlg.DoModal();
   */
   // Cavity VacuumBake AfterBake AOI
   /*
   CIOMonitoringDlg dlg;
   dlg.SetIOManager("Cavity");
   dlg.SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)"));
   dlg.DoModal();
   */
   /*
   CSettingsDlg dlg;
@@ -548,7 +573,7 @@
{
   int id = (int)lParam;
   if (id == VIEW_TOOL_BTN_CLOSE) {
      CloseView((CBaseView*)wParam);
      CloseView((CComponentDlg*)wParam);
   }
   return 0;
@@ -658,6 +683,14 @@
   m_pMainContainer->Resize();
}
void CBondEqDlg::CloseView(CComponentDlg* pView)
{
   pView->DestroyWindow();
   delete pView;
   m_pActiveComponentDlg = nullptr;
   m_pMainContainer->Resize();
}
CHomeDialog* CBondEqDlg::CreateHomeDlg()
{
   CHomeDialog* pDlg = new CHomeDialog(m_pMainContainer);
@@ -741,3 +774,27 @@
      m_pTopToolbar->SetOperatorBtnText(_T("未登录"));
   }
}
CComponentPLCDlg* CBondEqDlg::CreateComponentPLCDlg(CComponent* pComponent)
{
   CComponentPLCDlg* pDlg = new CComponentPLCDlg(m_pMainContainer);
   pDlg->Create(IDD_COMPONENT_PLC, m_pMainContainer);
   pDlg->SetContext(pComponent);
   CString strIcon0, strIcon1, strIcon2, strIcon3;
   strIcon0.Format(_T("%s\\Res\\small_close0.ico"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
   strIcon1.Format(_T("%s\\Res\\small_close1.ico"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
   strIcon2.Format(_T("%s\\Res\\small_close2.ico"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
   strIcon3.Format(_T("%s\\Res\\small_close3.ico"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
   pDlg->AddToolBtn(VIEW_TOOL_BTN_CLOSE,
      (LPTSTR)(LPCTSTR)strIcon0,
      (LPTSTR)(LPCTSTR)strIcon1,
      (LPTSTR)(LPCTSTR)strIcon2,
      (LPTSTR)(LPCTSTR)strIcon3, "关闭");
   pDlg->ShowWindow(SW_SHOW);
   pDlg->SetWindowText(pComponent->getName().c_str());
   m_pMainContainer->Resize();
   return pDlg;
}