From ec2b63378e47ac0aba4e0265b63a5cd26e373a32 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 26 五月 2025 18:02:57 +0800
Subject: [PATCH] 1.添加了状态栏;

---
 Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.6(1).xlsx |    0 
 SourceCode/Bond/Servo/Servo.vcxproj                             |    2 
 SourceCode/Bond/Servo/CMyStatusbar.h                            |   41 ++++++++++
 SourceCode/Bond/Servo/Servo.vcxproj.filters                     |    2 
 SourceCode/Bond/Servo/resource.h                                |    0 
 SourceCode/Bond/Servo/Servo.rc                                  |    0 
 SourceCode/Bond/Servo/CMyStatusbar.cpp                          |  110 +++++++++++++++++++++++++++
 SourceCode/Bond/Servo/ServoDlg.cpp                              |   63 +++++++++++++--
 SourceCode/Bond/Servo/Common.h                                  |    3 
 SourceCode/Bond/Servo/ServoDlg.h                                |    2 
 10 files changed, 214 insertions(+), 9 deletions(-)

diff --git "a/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.6\0501\051.xlsx" "b/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.6\0501\051.xlsx"
new file mode 100644
index 0000000..22de365
--- /dev/null
+++ "b/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.6\0501\051.xlsx"
Binary files differ
diff --git a/SourceCode/Bond/Servo/CMyStatusbar.cpp b/SourceCode/Bond/Servo/CMyStatusbar.cpp
new file mode 100644
index 0000000..1d85905
--- /dev/null
+++ b/SourceCode/Bond/Servo/CMyStatusbar.cpp
@@ -0,0 +1,110 @@
+锘�// CMyStatusbar.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "CMyStatusbar.h"
+#include "afxdialogex.h"
+
+
+// CMyStatusbar 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CMyStatusbar, CDialogEx)
+
+CMyStatusbar::CMyStatusbar(CWnd* pParent /*=nullptr*/)
+	: CDialogEx(IDD_STATUSBAR, pParent)
+{
+	m_crBkgnd = STATUSBAR_BK_NORMAL;
+}
+
+CMyStatusbar::~CMyStatusbar()
+{
+}
+
+void CMyStatusbar::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CMyStatusbar, CDialogEx)
+	ON_WM_CTLCOLOR()
+	ON_WM_DESTROY()
+	ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+
+// CMyStatusbar 娑堟伅澶勭悊绋嬪簭
+
+
+void CMyStatusbar::setBkgnd(COLORREF color)
+{
+	if (m_brBkgnd.GetSafeHandle() != nullptr) {
+		m_brBkgnd.DeleteObject();
+	}
+
+	m_brBkgnd.CreateSolidBrush(color);
+	Invalidate(); 
+	UpdateWindow();
+}
+
+void CMyStatusbar::setRunTimeText(const char* pszText)
+{
+	SetDlgItemText(IDC_LABEL_RUNTIME, pszText);
+}
+
+BOOL CMyStatusbar::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+HBRUSH CMyStatusbar::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	// TODO:  鍦ㄦ鏇存敼 DC 鐨勪换浣曠壒鎬�
+
+	if (nCtlColor == CTLCOLOR_STATIC) {
+		pDC->SetBkMode(TRANSPARENT);
+		pDC->SetBkColor(m_crBkgnd);
+		pDC->SetTextColor(RGB(255, 255, 255));
+	}
+
+	if (m_brBkgnd.GetSafeHandle() == nullptr) {
+		m_brBkgnd.CreateSolidBrush(m_crBkgnd);
+	}
+
+	return (HBRUSH)m_brBkgnd;
+}
+
+void CMyStatusbar::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+}
+
+void CMyStatusbar::OnSize(UINT nType, int cx, int cy)
+{
+	CDialogEx::OnSize(nType, cx, cy);
+	if (nullptr == GetDlgItem(IDC_LABEL_RUNTIME)) return;
+	Resize();
+}
+
+void CMyStatusbar::Resize()
+{
+	CRect rcClient, rcItem;
+	CWnd* pItem = nullptr;
+	int x;
+	GetClientRect(&rcClient);
+
+	x = 120;
+	pItem = GetDlgItem(IDC_LABEL_RUNTIME);
+	pItem->GetClientRect(rcItem);
+	pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height());
+}
diff --git a/SourceCode/Bond/Servo/CMyStatusbar.h b/SourceCode/Bond/Servo/CMyStatusbar.h
new file mode 100644
index 0000000..283ca03
--- /dev/null
+++ b/SourceCode/Bond/Servo/CMyStatusbar.h
@@ -0,0 +1,41 @@
+锘�#pragma once
+
+
+// CMyStatusbar 瀵硅瘽妗�
+
+class CMyStatusbar : public CDialogEx
+{
+	DECLARE_DYNAMIC(CMyStatusbar)
+
+public:
+	CMyStatusbar(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
+	virtual ~CMyStatusbar();
+
+
+public:
+	void setBkgnd(COLORREF color);
+	void setRunTimeText(const char* pszText);
+
+private:
+	void Resize();
+
+private:
+	COLORREF m_crBkgnd;
+	CBrush m_brBkgnd;
+
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_STATUSBAR };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 鏀寔
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	afx_msg void OnDestroy();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+};
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index 5915999..361ce0d 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -38,6 +38,9 @@
 #define CR_MSGBOX_TITLE						RGB(200, 216, 246)
 #define CR_MSGBOX_MESSAGE					RGB(200, 216, 246)
 #define TOP_TOOLBAR_BACKGROUND				RGB(240, 240, 240)	
+#define STATUSBAR_BK_NORMAL					RGB(195, 195, 195)
+#define STATUSBAR_BK_RUNNING				RGB(34, 177, 76)
+#define STATUSBAR_BK_ALARM					RGB(255, 127, 39)
 
 /* LOG BTN */
 #define BTN_LOG_FRAME_NORMAL			RGB(88, 88, 88)
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index 45c8ff9..16108f5 100644
--- a/SourceCode/Bond/Servo/Servo.rc
+++ b/SourceCode/Bond/Servo/Servo.rc
Binary files differ
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index 599c92c..1d72e67 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -200,6 +200,7 @@
   <ItemGroup>
     <ClInclude Include="CEquipmentPage3.h" />
     <ClInclude Include="CGlassPool.h" />
+    <ClInclude Include="CMyStatusbar.h" />
     <ClInclude Include="CRobotCmdContainerDlg.h" />
     <ClInclude Include="CRobotCmdTestDlg.h" />
     <ClInclude Include="CPagePortStatus.h" />
@@ -309,6 +310,7 @@
   <ItemGroup>
     <ClCompile Include="CEquipmentPage3.cpp" />
     <ClCompile Include="CGlassPool.cpp" />
+    <ClCompile Include="CMyStatusbar.cpp" />
     <ClCompile Include="CRobotCmdContainerDlg.cpp" />
     <ClCompile Include="CRobotCmdTestDlg.cpp" />
     <ClCompile Include="CPagePortStatus.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index 6e77b3f..391e792 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -114,6 +114,7 @@
     <ClCompile Include="JobSlotGrid.cpp" />
     <ClCompile Include="TopToolbar.cpp" />
     <ClCompile Include="HorizontalLine.cpp" />
+    <ClCompile Include="CMyStatusbar.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="AlarmManager.h" />
@@ -227,6 +228,7 @@
     <ClInclude Include="JobSlotGrid.h" />
     <ClInclude Include="TopToolbar.h" />
     <ClInclude Include="HorizontalLine.h" />
+    <ClInclude Include="CMyStatusbar.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Servo.rc" />
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index cb8666e..69a0d76 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -25,6 +25,10 @@
 /* 创建终端的定时器 */
 #define TIMER_ID_CREATE_TERMINAL		1
 
+/* 运行时间定时器 */
+#define TIMER_ID_UPDATE_RUMTIME			2
+
+
 
 // 用于应用程序“关于”菜单项的 CAboutDlg 对话框
 
@@ -79,6 +83,7 @@
 	m_pPageLog = nullptr;
 	m_pPageRecipe = nullptr;
 	m_pTopToolbar = nullptr;
+	m_pMyStatusbar = nullptr;
 }
 
 void CServoDlg::DoDataExchange(CDataExchange* pDX)
@@ -258,6 +263,13 @@
 	m_pPanelAttributes = new CPanelAttributes();
 	m_pPanelAttributes->Create(IDD_PANEL_ATTRIBUTES, this);
 	
+
+	// statusbar
+	m_pMyStatusbar = new CMyStatusbar();
+	m_pMyStatusbar->Create(IDD_STATUSBAR, this);
+	m_pMyStatusbar->ShowWindow(SW_SHOW);
+
+
 
 	// 调整初始窗口位置
 	CRect rcWnd;
@@ -512,6 +524,12 @@
 		m_pTopToolbar = nullptr;
 	}
 
+	if (m_pMyStatusbar != nullptr) {
+		m_pMyStatusbar->DestroyWindow();
+		delete m_pMyStatusbar;
+		m_pMyStatusbar = nullptr;
+	}
+
 	if (m_pTerminalDisplayDlg != nullptr) {
 		m_pTerminalDisplayDlg->DestroyWindow();
 		delete m_pTerminalDisplayDlg;
@@ -592,34 +610,39 @@
 }
 
 #define TOOLBAR_HEIGHT		78
+#define STATUSBAR_HEIGHT	38
 void CServoDlg::Resize()
 {
 	CRect rcClient, rcItem;
 	CWnd* pItem = nullptr;
-	int x, y;
+	int x, y, y2;
 	GetClientRect(&rcClient);
 
 	x = 0;
 	y = 0;
+	y2 = rcClient.bottom - STATUSBAR_HEIGHT;
 	m_pTopToolbar->MoveWindow(0, 0, rcClient.Width(), TOOLBAR_HEIGHT);
 	y += TOOLBAR_HEIGHT;
+
+
+	
 
 	int nPanelWidth = 0;
 	if (m_pPanelMaster != nullptr) {
 		nPanelWidth = m_pPanelMaster->getPanelWidth();
-		m_pPanelMaster->MoveWindow(x, y, nPanelWidth, rcClient.Height());
+		m_pPanelMaster->MoveWindow(x, y, nPanelWidth, y2 - y);
 		x += nPanelWidth;
 	}
 
 	if (m_pPanelEquipment != nullptr && m_pPanelEquipment->IsWindowVisible()) {
 		nPanelWidth = m_pPanelEquipment->getPanelWidth();
-		m_pPanelEquipment->MoveWindow(x, y, nPanelWidth, rcClient.Height());
+		m_pPanelEquipment->MoveWindow(x, y, nPanelWidth, y2 - y);
 		x += nPanelWidth;
 	}
 
 	if (m_pPanelAttributes != nullptr && m_pPanelAttributes->IsWindowVisible()) {
 		nPanelWidth = m_pPanelAttributes->getPanelWidth();
-		m_pPanelAttributes->MoveWindow(x, y, nPanelWidth, rcClient.Height());
+		m_pPanelAttributes->MoveWindow(x, y, nPanelWidth, y2 - y);
 		x += nPanelWidth;
 	}
 
@@ -630,11 +653,14 @@
 	y += rcItem.Height();
 
 
-	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);
+	m_pPageGraph1->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
+	m_pPageGraph2->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
+	m_pPageRecipe->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
+	m_pPageAlarm->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
+	m_pPageLog->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
+
+
+	m_pMyStatusbar->MoveWindow(0, y2, rcClient.Width(), STATUSBAR_HEIGHT);
 }
 
 void CServoDlg::OnClose()
@@ -673,6 +699,21 @@
 		m_pTerminalDisplayDlg->Create(IDD_DIALOG_TERMINAL_DISPLAY, this);
 	}
 
+	if (TIMER_ID_UPDATE_RUMTIME == nIDEvent) {
+		static int index = 0; index++;
+		if (index >= 4) index = 0;
+		static char* status[] = {"|", "/", "--", "\\"};
+
+		CTime time = CTime::GetCurrentTime();
+		CString strText;
+		strText.Format(_T("已运行:%d-%02d-%02d %02d:%02d:%02d   %s"),
+			time.GetYear(), time.GetMonth(), time.GetDay(),
+			time.GetHour(), time.GetMinute(), time.GetSecond(),
+			status[index]);
+		m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText);
+	}
+
+
 	CDialogEx::OnTimer(nIDEvent);
 }
 
@@ -709,12 +750,16 @@
 		theApp.m_model.getMaster().start();
 		m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE);
 		m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(TRUE);
+		m_pMyStatusbar->setBkgnd(STATUSBAR_BK_RUNNING);
+		SetTimer(TIMER_ID_UPDATE_RUMTIME, 1000, nullptr);
 
 	}
 	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);
+		m_pMyStatusbar->setBkgnd(STATUSBAR_BK_ALARM);
+		KillTimer(TIMER_ID_UPDATE_RUMTIME);
 	}
 	else if (id == IDC_BUTTON_ROBOT) {
 		SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.getMaster().getEquipment(EQ_ID_EFEM);
diff --git a/SourceCode/Bond/Servo/ServoDlg.h b/SourceCode/Bond/Servo/ServoDlg.h
index b38bd30..774cb22 100644
--- a/SourceCode/Bond/Servo/ServoDlg.h
+++ b/SourceCode/Bond/Servo/ServoDlg.h
@@ -14,6 +14,7 @@
 #include "CPageGraph1.h"
 #include "CPageGraph2.h"
 #include "TopToolbar.h"
+#include "CMyStatusbar.h"
 
 
 // CServoDlg 对话框
@@ -61,6 +62,7 @@
 	CPanelMaster* m_pPanelMaster;
 	CPanelEquipment* m_pPanelEquipment;
 	CPanelAttributes* m_pPanelAttributes;
+	CMyStatusbar* m_pMyStatusbar;
 
 	// 生成的消息映射函数
 	virtual BOOL OnInitDialog();
diff --git a/SourceCode/Bond/Servo/resource.h b/SourceCode/Bond/Servo/resource.h
index 8707561..47c40f8 100644
--- a/SourceCode/Bond/Servo/resource.h
+++ b/SourceCode/Bond/Servo/resource.h
Binary files differ

--
Gitblit v1.9.3