From 94e388265ca97ba07b102c295529fd40b04b419d Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 26 五月 2025 15:26:09 +0800
Subject: [PATCH] 1.增加顶部工具条; 2.Robot cmd测试页面增加Robot命令的响应结果; 3.CMaster增加start, stop函数,准备编写调试逻辑;
---
SourceCode/Bond/Servo/ServoDlg.cpp | 67 ++++++++++++++++++++++++++++++---
1 files changed, 61 insertions(+), 6 deletions(-)
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index 3bf1852..cb8666e 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -13,6 +13,8 @@
#include <thread>
#include <cmath>
#include "HmTab.h"
+#include "CRobotCmdContainerDlg.h"
+#include "CRobotCmdTestDlg.h"
#ifdef _DEBUG
@@ -60,7 +62,6 @@
// CServoDlg 对话框
-
CServoDlg::CServoDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_SERVO_DIALOG, pParent)
{
@@ -76,13 +77,13 @@
m_pPageGraph2 = nullptr;
m_pPageAlarm = nullptr;
m_pPageLog = nullptr;
+ m_pPageRecipe = nullptr;
+ m_pTopToolbar = 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)
@@ -112,6 +113,7 @@
ON_WM_TIMER()
ON_MESSAGE(ID_MSG_PANEL_RESIZE, OnPanelResize)
ON_NOTIFY(BYHMTAB_SEL_CHANGED, IDC_TAB1, &CServoDlg::OnTabSelChanged)
+ ON_MESSAGE(ID_MSG_TOOLBAR_BTN_CLICKED, &CServoDlg::OnToolbarBtnClicked)
END_MESSAGE_MAP()
@@ -212,11 +214,24 @@
SetMenu(&menu);
+ // toolbar
+ m_pTopToolbar = new CTopToolbar();
+ m_pTopToolbar->Create(IDD_TOP_TOOLBAR, this);
+ m_pTopToolbar->ShowWindow(SW_SHOW);
+ m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
+ m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(FALSE);
+ HMENU hMenu = m_pTopToolbar->GetOperatorMenu();
+ ASSERT(hMenu);
+ ::EnableMenuItem(hMenu, ID_OPEATOR_SWITCH, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
+
+
// Tab
m_pPageGraph1 = new CPageGraph1();
m_pPageGraph1->Create(IDD_PAGE_GRAPH1, this);
m_pPageGraph2 = new CPageGraph2();
m_pPageGraph2->Create(IDD_PAGE_GRAPH2, this);
+ 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 CPageLog();
@@ -227,6 +242,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);
@@ -490,6 +506,12 @@
CDialogEx::OnDestroy();
+ if (m_pTopToolbar != nullptr) {
+ m_pTopToolbar->DestroyWindow();
+ delete m_pTopToolbar;
+ m_pTopToolbar = nullptr;
+ }
+
if (m_pTerminalDisplayDlg != nullptr) {
m_pTerminalDisplayDlg->DestroyWindow();
delete m_pTerminalDisplayDlg;
@@ -526,6 +548,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;
@@ -555,6 +583,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;
@@ -562,6 +591,7 @@
Invalidate();
}
+#define TOOLBAR_HEIGHT 78
void CServoDlg::Resize()
{
CRect rcClient, rcItem;
@@ -571,6 +601,9 @@
x = 0;
y = 0;
+ m_pTopToolbar->MoveWindow(0, 0, rcClient.Width(), TOOLBAR_HEIGHT);
+ y += TOOLBAR_HEIGHT;
+
int nPanelWidth = 0;
if (m_pPanelMaster != nullptr) {
nPanelWidth = m_pPanelMaster->getPanelWidth();
@@ -599,6 +632,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);
}
@@ -661,11 +695,32 @@
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);
}
}
+LRESULT CServoDlg::OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam)
+{
+ int id = (int)lParam;
+ if (id == IDC_BUTTON_RUN) {
+ theApp.m_model.getMaster().start();
+ m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE);
+ m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(TRUE);
+ }
+ else if (id == IDC_BUTTON_STOP) {
+ theApp.m_model.getMaster().stop();
+ m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE);
+ m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
+ }
+ else if (id == IDC_BUTTON_ROBOT) {
+ SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.getMaster().getEquipment(EQ_ID_EFEM);
+ CRobotCmdTestDlg dlg;
+ dlg.SetEFEM(pEFEM);
+ dlg.DoModal();
+ }
+ return 0;
+}
\ No newline at end of file
--
Gitblit v1.9.3