LAPTOP-SNT8I5JK\Boounion
2025-05-20 ebc5dba7e2b0dccb9583faefa21ffd3454792788
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -9,7 +9,6 @@
#include "Common.h"
#include "Log.h"
#include "SecsTestDlg.h"
#include "AlarmDlg.h"
#include <chrono>
#include <thread>
#include <cmath>
@@ -61,7 +60,6 @@
// CServoDlg 对话框
CServoDlg::CServoDlg(CWnd* pParent /*=NULL*/)
   : CDialogEx(IDD_SERVO_DIALOG, pParent)
{
@@ -77,13 +75,12 @@
   m_pPageGraph2 = nullptr;
   m_pPageAlarm = nullptr;
   m_pPageLog = nullptr;
   m_pPageRecipe = nullptr;
}
void CServoDlg::DoDataExchange(CDataExchange* pDX)
{
   CDialogEx::DoDataExchange(pDX);
   DDX_Control(pDX, IDC_BUTTON_LOG, m_btnLog);
   DDX_Control(pDX, IDC_BUTTON_ALARM, m_btnAlarm);
}
BEGIN_MESSAGE_MAP(CServoDlg, CDialogEx)
@@ -218,9 +215,11 @@
   m_pPageGraph1->Create(IDD_PAGE_GRAPH1, this);
   m_pPageGraph2 = new CPageGraph2();
   m_pPageGraph2->Create(IDD_PAGE_GRAPH2, this);
   m_pPageAlarm = new CAlarmDlg();
   m_pPageRecipe = new CPageRecipe();
   m_pPageRecipe->Create(IDD_PAGE_RECIPE, this);
   m_pPageAlarm = new CPageAlarm();
   m_pPageAlarm->Create(IDD_DIALOG_ALARM, this);
   m_pPageLog = new CLogDlg();
   m_pPageLog = new CPageLog();
   m_pPageLog->Create(IDD_DIALOG_LOG, this);
   CHmTab* m_pTab = CHmTab::Hook(GetDlgItem(IDC_TAB1)->m_hWnd);
@@ -228,6 +227,7 @@
   m_pTab->SetItemMarginLeft(18);
   m_pTab->AddItem("״̬ͼ", FALSE);
   m_pTab->AddItem("连接图", TRUE);
   m_pTab->AddItem("配方", TRUE);
   m_pTab->AddItem("报警", TRUE);
   m_pTab->AddItem("日志", TRUE);
   m_pTab->SetCurSel(0);
@@ -527,6 +527,12 @@
      m_pPageGraph2 = nullptr;
   }
   if (m_pPageRecipe != nullptr) {
      m_pPageRecipe->DestroyWindow();
      delete m_pPageRecipe;
      m_pPageRecipe = nullptr;
   }
   if (m_pPageAlarm != nullptr) {
      m_pPageAlarm->DestroyWindow();
      delete m_pPageAlarm;
@@ -556,6 +562,7 @@
   if (GetDlgItem(IDC_TAB1) == nullptr) return;
   if (m_pPageGraph1 == nullptr) return;
   if (m_pPageGraph2 == nullptr) return;
   if (m_pPageRecipe == nullptr) return;
   if (m_pPageAlarm == nullptr) return;
   if (m_pPageLog == nullptr) return;
   
@@ -600,6 +607,7 @@
   m_pPageGraph1->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y);
   m_pPageGraph2->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y);
   m_pPageRecipe->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y);
   m_pPageAlarm->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y);
   m_pPageLog->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y);
}
@@ -645,7 +653,7 @@
LRESULT CServoDlg::OnPanelResize(WPARAM wParam, LPARAM lParam)
{
   int width = wParam;
   int width = (int)wParam;
   // m_pPanel->SetPanelWidth(width);
   Resize();
@@ -662,11 +670,9 @@
void CServoDlg::ShowChildPage(int index)
{
   ASSERT(0 <= index && index < 4);
   static CWnd* pPages[] = { m_pPageGraph1, m_pPageGraph2, m_pPageAlarm, m_pPageLog };
   for (int i = 0; i < 4; i++) {
   ASSERT(0 <= index && index < 5);
   static CWnd* pPages[] = { m_pPageGraph1, m_pPageGraph2, m_pPageRecipe, m_pPageAlarm, m_pPageLog };
   for (int i = 0; i < 5; i++) {
      pPages[i]->ShowWindow(i == index ? SW_SHOW : SW_HIDE);
   }
}
}