From fa64ecef1f17fa7268fe8052adbd1344016bd2c5 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期二, 03 二月 2026 10:50:29 +0800
Subject: [PATCH] 1.右侧显示Slot数据;
---
SourceCode/Bond/Servo/Servo.vcxproj | 2
SourceCode/Bond/Servo/Servo.vcxproj.filters | 2
SourceCode/Bond/Servo/CPageGraph1.h | 10 +
SourceCode/Bond/Servo/CSlotTableCtrl.cpp | 187 +++++++++++++++++++++++
SourceCode/Bond/Servo/CSlotTableCtrl.h | 39 ++++
SourceCode/Bond/Servo/CPageGraph1.cpp | 196 ++++++++++++++++++++++++
6 files changed, 433 insertions(+), 3 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPageGraph1.cpp b/SourceCode/Bond/Servo/CPageGraph1.cpp
index 30d0811..2427181 100644
--- a/SourceCode/Bond/Servo/CPageGraph1.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph1.cpp
@@ -8,6 +8,27 @@
#include "Common.h"
#include "CEquipment.h"
#include "CGlass.h"
+#include "CServoUtilsTool.h"
+
+namespace {
+ const UINT kSlotTableId = 60001;
+
+ bool ParseHexColor(const char* psz, COLORREF& outColor)
+ {
+ if (psz == nullptr || *psz == '\0') return false;
+ while (*psz == ' ' || *psz == '\t') ++psz;
+ if (*psz == '#') ++psz;
+ if (psz[0] == '0' && (psz[1] == 'x' || psz[1] == 'X')) psz += 2;
+ char* endPtr = nullptr;
+ unsigned long value = strtoul(psz, &endPtr, 16);
+ if (endPtr == psz) return false;
+ BYTE r = (BYTE)((value >> 16) & 0xFF);
+ BYTE g = (BYTE)((value >> 8) & 0xFF);
+ BYTE b = (BYTE)(value & 0xFF);
+ outColor = RGB(r, g, b);
+ return true;
+ }
+}
const std::map<SERVO::ROBOT_POSITION, RobotPositionMapping> g_positionMap = {
{ SERVO::ROBOT_POSITION::Port1, { SERVO::ROBOT_POSITION::Port1, 1.00f, 0.00f } },
@@ -59,6 +80,12 @@
m_crBkgnd = PAGE_GRPAH1_BACKGROUND_COLOR; // 鑳屾櫙棰滆壊
m_hbrBkgnd = nullptr; // 鑳屾櫙鍒峰彞鏌�
m_slotBarTestMode = 0; // 0=off,1=has,2=processing
+ m_pSelectedEquipment = nullptr;
+ m_slotTableRowCount = 1;
+ m_slotTableRowHeight = 20;
+ m_slotTablePadding = 8;
+ m_slotTableHeaderHeight = 22;
+ m_slotTableTitleHeight = 20;
// ===== 鏈哄櫒浜哄姩鐢荤姸鎬佸垵濮嬪寲 =====
m_bIsRobotMoving = FALSE; // 褰撳墠鏄惁姝e湪鍔ㄧ敾绉诲姩
@@ -136,6 +163,150 @@
m_pGraph->Invalidata();
}
+void CPageGraph1::LayoutSlotTable()
+{
+ if (GetSafeHwnd() == nullptr) return;
+
+ std::string iniPath = GetConfigPath();
+ m_slotTableRowHeight = GetPrivateProfileIntA("Graph1", "SlotTableRowHeight", 20, iniPath.c_str());
+ m_slotTablePadding = GetPrivateProfileIntA("Graph1", "SlotTablePadding", 8, iniPath.c_str());
+ m_slotTableHeaderHeight = GetPrivateProfileIntA("Graph1", "SlotTableHeaderHeight", 22, iniPath.c_str());
+ m_slotTableTitleHeight = GetPrivateProfileIntA("Graph1", "SlotTableTitleHeight", 20, iniPath.c_str());
+ char colorBuf[32] = { 0 };
+ COLORREF lineColor = RGB(230, 230, 230);
+ COLORREF headerBgColor = RGB(245, 245, 245);
+ GetPrivateProfileStringA("Graph1", "SlotTableLineColor", "", colorBuf, sizeof(colorBuf), iniPath.c_str());
+ if (!ParseHexColor(colorBuf, lineColor)) {
+ lineColor = RGB(230, 230, 230);
+ }
+ GetPrivateProfileStringA("Graph1", "SlotTableHeaderBgColor", "", colorBuf, sizeof(colorBuf), iniPath.c_str());
+ if (!ParseHexColor(colorBuf, headerBgColor)) {
+ headerBgColor = RGB(245, 245, 245);
+ }
+ if (m_slotTableRowHeight < 14) m_slotTableRowHeight = 14;
+ if (m_slotTableRowHeight > 40) m_slotTableRowHeight = 40;
+ if (m_slotTablePadding < 2) m_slotTablePadding = 2;
+ if (m_slotTablePadding > 16) m_slotTablePadding = 16;
+ if (m_slotTableHeaderHeight < 16) m_slotTableHeaderHeight = 16;
+ if (m_slotTableHeaderHeight > 40) m_slotTableHeaderHeight = 40;
+ if (m_slotTableTitleHeight < 16) m_slotTableTitleHeight = 16;
+ if (m_slotTableTitleHeight > 40) m_slotTableTitleHeight = 40;
+ int cfgX = GetPrivateProfileIntA("Graph1", "SlotTableX", -1, iniPath.c_str());
+ int cfgY = GetPrivateProfileIntA("Graph1", "SlotTableY", -1, iniPath.c_str());
+
+ CRect rcClient;
+ GetClientRect(&rcClient);
+
+ int cfgW = max(160, rcClient.Width() / 3);
+ if (cfgW > 280) cfgW = 280;
+
+ const int titleHeight = m_slotTableTitleHeight;
+ const int headerHeight = m_slotTableHeaderHeight;
+ const int rowHeight = m_slotTableRowHeight;
+ int rows = m_slotTableRowCount;
+ if (rows < 1) rows = 1;
+ if (rows > 8) rows = 8;
+ int cfgH = titleHeight + headerHeight + rowHeight * rows + 6;
+
+ if (cfgW > rcClient.Width() - 6) cfgW = max(160, rcClient.Width() - 6);
+ if (cfgH > rcClient.Height() - 6) cfgH = max(80, rcClient.Height() - 6);
+
+ int x = (cfgX >= 0) ? cfgX : (rcClient.right - cfgW - 6);
+ int y = (cfgY >= 0) ? cfgY : 12;
+
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+// if (x + cfgW > rcClient.right) x = max(0, rcClient.right - cfgW);
+// if (y + cfgH > rcClient.bottom) y = max(0, rcClient.bottom - cfgH);
+
+ CRect rcTable(x, y, x + cfgW, y + cfgH);
+ if (m_slotTable.GetSafeHwnd() == nullptr) {
+ BOOL created = m_slotTable.Create(this, rcTable, kSlotTableId);
+ m_slotTable.SetTitle(_T("Slot Info"));
+ m_slotTable.SetRowHeight(m_slotTableRowHeight);
+ m_slotTable.SetPadding(m_slotTablePadding);
+ m_slotTable.SetHeaderHeight(m_slotTableHeaderHeight);
+ m_slotTable.SetTitleHeight(m_slotTableTitleHeight);
+ m_slotTable.SetLineColor(lineColor);
+ m_slotTable.SetHeaderBgColor(headerBgColor);
+ LOGI("[Graph1] SlotTable create ret=%d hwnd=%p err=%lu rc=(%d,%d)-(%d,%d)",
+ created, m_slotTable.GetSafeHwnd(), GetLastError(),
+ rcTable.left, rcTable.top, rcTable.right, rcTable.bottom);
+ }
+ else {
+ m_slotTable.MoveWindow(&rcTable);
+ m_slotTable.SetRowHeight(m_slotTableRowHeight);
+ m_slotTable.SetPadding(m_slotTablePadding);
+ m_slotTable.SetHeaderHeight(m_slotTableHeaderHeight);
+ m_slotTable.SetTitleHeight(m_slotTableTitleHeight);
+ m_slotTable.SetLineColor(lineColor);
+ m_slotTable.SetHeaderBgColor(headerBgColor);
+ LOGI("[Graph1] SlotTable moved rc=(%d,%d)-(%d,%d)", rcTable.left, rcTable.top, rcTable.right, rcTable.bottom);
+ }
+
+ // 濡傛灉瓒呭嚭鍙鍖哄煙锛屽己鍒剁Щ鍒板乏涓婅浣滀负鍏滃簳
+ CRect rcWnd;
+ m_slotTable.GetWindowRect(&rcWnd);
+ ScreenToClient(&rcWnd);
+ LOGI("[Graph1] SlotTable wnd rc=(%d,%d)-(%d,%d) client=(%d,%d)",
+ rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, rcClient.right, rcClient.bottom);
+ if (rcWnd.right <= 0 || rcWnd.bottom <= 0 ||
+ rcWnd.left >= rcClient.right || rcWnd.top >= rcClient.bottom) {
+ CRect rcFallback(10, 10, 10 + cfgW, 10 + cfgH);
+ m_slotTable.MoveWindow(&rcFallback);
+ LOGI("[Graph1] SlotTable fallback rc=(%d,%d)-(%d,%d)", rcFallback.left, rcFallback.top, rcFallback.right, rcFallback.bottom);
+ }
+ m_slotTable.SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
+
+ if (auto* pGraphWnd = GetDlgItem(IDC_SERVO_GRAPH1)) {
+ pGraphWnd->SetWindowPos(&CWnd::wndBottom, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ }
+ m_slotTable.BringWindowToTop();
+}
+
+void CPageGraph1::UpdateSlotTable(SERVO::CEquipment* pEquipment)
+{
+ if (m_slotTable.GetSafeHwnd() == nullptr) return;
+
+ std::vector<CSlotTableCtrl::Row> rows;
+ if (pEquipment != nullptr) {
+ LOGI("[Graph1] UpdateSlotTable eq=%s(%p)", pEquipment->getName().c_str(), pEquipment);
+ for (int i = 0; i < SLOT_MAX && rows.size() < 8; ++i) {
+ SERVO::CSlot* pSlot = pEquipment->getSlot(i);
+ if (pSlot == nullptr || !pSlot->isEnable()) continue;
+
+ CSlotTableCtrl::Row row;
+ row.slot.Format(_T("%d"), pSlot->getNo());
+
+ CContext* pCtx = pSlot->getContext();
+ if (pCtx == nullptr) {
+ pCtx = pSlot->getTempContext();
+ }
+ SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pCtx);
+ if (pGlass != nullptr) {
+ row.glassId = pGlass->getID().c_str();
+ row.type = SERVO::CServoUtilsTool::getMaterialsTypeText(pGlass->getType()).c_str();
+ }
+
+ rows.push_back(row);
+ }
+ }
+ LOGI("[Graph1] SlotTable rows=%zu", rows.size());
+
+ m_slotTableRowCount = static_cast<int>(rows.size());
+ if (m_slotTableRowCount < 1) m_slotTableRowCount = 1;
+ if (m_slotTableRowCount > 8) m_slotTableRowCount = 8;
+ LayoutSlotTable();
+
+ if (pEquipment != nullptr) {
+ m_slotTable.SetTitle(CString(pEquipment->getName().c_str()));
+ }
+ else {
+ m_slotTable.SetTitle(_T("Slot Info"));
+ }
+ m_slotTable.SetRows(rows);
+}
+
void CPageGraph1::InitRxWindows()
{
/* code */
@@ -205,12 +376,16 @@
BOOL CPageGraph1::OnInitDialog()
{
CDialogEx::OnInitDialog();
+ ModifyStyle(0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
InitRxWindows();
SetTimer(TIMER_ID_DEVICE_STATUS, 800, nullptr);
SetTimer(TIMER_ID_ROBOT_STATUS, 1000, nullptr); // 姣� 1000ms 鏇存柊涓�娆$姸鎬�
// 鍥剧ず
m_pGraph = CServoGraph::Hook(GetDlgItem(IDC_SERVO_GRAPH1)->GetSafeHwnd());
+ if (auto* pGraphWnd = GetDlgItem(IDC_SERVO_GRAPH1)) {
+ pGraphWnd->ModifyStyle(0, WS_CLIPSIBLINGS);
+ }
CString strPath;
strPath.Format(_T("%s\\res\\Servo001.bmp"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
m_pGraph->AddImage(1, (LPTSTR)(LPCTSTR)strPath, 0, 0);
@@ -222,6 +397,8 @@
strPath.Format(_T("%s\\res\\GraphLegend.bmp"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
m_pGraph->AddImage(IMAGE_LEGEND, (LPTSTR)(LPCTSTR)strPath, 0, 0);
UpdateLegendPosition();
+ LayoutSlotTable();
+ m_slotTable.ShowWindow(SW_SHOW);
// 娣诲姞鎸囩ず鍣�
// Bonder
@@ -447,6 +624,8 @@
GetClientRect(&rcClient);
GetDlgItem(IDC_SERVO_GRAPH1)->MoveWindow(0, 0, rcClient.Width(), rcClient.Height());
UpdateLegendPosition();
+ LayoutSlotTable();
+ m_slotTable.ShowWindow(SW_SHOW);
}
void CPageGraph1::UpdateRobotPosition(float percentage)
@@ -554,8 +733,8 @@
};
static const EquipmentBindInfo EQUIPMENT_BIND_LIST[] = {
- { EQ_ID_EFEM, INDICATE_ROBOT_ARM1 },
- { EQ_ID_EFEM, INDICATE_ROBOT_ARM2 },
+ { EQ_ID_ARM_TRAY1, INDICATE_ROBOT_ARM1 },
+ { EQ_ID_ARM_TRAY2, INDICATE_ROBOT_ARM2 },
{ EQ_ID_Bonder1, INDICATE_BONDER1 },
{ EQ_ID_Bonder2, INDICATE_BONDER2 },
{ EQ_ID_LOADPORT1, INDICATE_LPORT1 },
@@ -565,7 +744,8 @@
{ EQ_ID_FLIPER, INDICATE_FLIPER },
{ EQ_ID_VACUUMBAKE, INDICATE_VACUUM_BAKE },
{ EQ_ID_ALIGNER, INDICATE_ALIGNER },
- { EQ_ID_BAKE_COOLING, INDICATE_BAKE_COOLING }
+ { EQ_ID_BAKE_COOLING, INDICATE_BAKE_COOLING },
+ { EQ_ID_MEASUREMENT, INDICATE_MEASUREMENT }
};
for (const auto& stBindInfo : EQUIPMENT_BIND_LIST)
@@ -761,6 +941,16 @@
if (pGraphNmhdr->dwData == INDICATE_LPORT1) {
}
+
+ if (m_pGraph != nullptr) {
+ LayoutSlotTable();
+ LOGI("[Graph1] item clicked id=%u", (unsigned)pGraphNmhdr->dwData);
+ auto* pEq = (SERVO::CEquipment*)m_pGraph->GetIndicateBoxData((int)pGraphNmhdr->dwData);
+ m_pSelectedEquipment = pEq;
+ UpdateSlotTable(pEq);
+ }
+ m_slotTable.ShowWindow(SW_SHOW);
+ m_slotTable.BringWindowToTop();
*pResult = 0;
}
diff --git a/SourceCode/Bond/Servo/CPageGraph1.h b/SourceCode/Bond/Servo/CPageGraph1.h
index 1d6f9b8..fac346d 100644
--- a/SourceCode/Bond/Servo/CPageGraph1.h
+++ b/SourceCode/Bond/Servo/CPageGraph1.h
@@ -1,6 +1,7 @@
锘�#pragma once
#include "ServoGraph.h"
#include "ServoCommo.h"
+#include "CSlotTableCtrl.h"
namespace SERVO {
class CEquipment;
@@ -49,6 +50,8 @@
void ApplySlotBarTestPattern(int mode);
void UpdateLegendPosition();
+ void UpdateSlotTable(SERVO::CEquipment* pEquipment);
+ void LayoutSlotTable();
private:
IObserver* m_pObserver;
@@ -86,6 +89,13 @@
// 涓や釜鏈烘鑷傜浉瀵逛簬鏈哄櫒浜轰腑蹇冪殑鍋忕Щ锛堝儚绱犲潗鏍囷級
POINT m_arm1Offset;
POINT m_arm2Offset;
+ SERVO::CEquipment* m_pSelectedEquipment;
+ CSlotTableCtrl m_slotTable;
+ int m_slotTableRowCount;
+ int m_slotTableRowHeight;
+ int m_slotTablePadding;
+ int m_slotTableHeaderHeight;
+ int m_slotTableTitleHeight;
// 瀵硅瘽妗嗘暟鎹�
diff --git a/SourceCode/Bond/Servo/CSlotTableCtrl.cpp b/SourceCode/Bond/Servo/CSlotTableCtrl.cpp
new file mode 100644
index 0000000..0bcd24c
--- /dev/null
+++ b/SourceCode/Bond/Servo/CSlotTableCtrl.cpp
@@ -0,0 +1,187 @@
+锘�// CSlotTableCtrl.cpp
+#include "stdafx.h"
+#include "CSlotTableCtrl.h"
+
+BEGIN_MESSAGE_MAP(CSlotTableCtrl, CWnd)
+ ON_WM_PAINT()
+ ON_WM_ERASEBKGND()
+END_MESSAGE_MAP()
+
+BOOL CSlotTableCtrl::Create(CWnd* pParent, const RECT& rc, UINT nID)
+{
+ CString className = AfxRegisterWndClass(
+ CS_HREDRAW | CS_VREDRAW,
+ ::LoadCursor(NULL, IDC_ARROW),
+ (HBRUSH)::GetStockObject(WHITE_BRUSH),
+ NULL);
+
+ return CWnd::CreateEx(0, className, _T(""), WS_CHILD | WS_VISIBLE, rc, pParent, nID);
+}
+
+void CSlotTableCtrl::SetRows(const std::vector<Row>& rows)
+{
+ m_rows = rows;
+ if (m_rows.size() > 8) {
+ m_rows.resize(8);
+ }
+ Invalidate();
+}
+
+void CSlotTableCtrl::SetTitle(const CString& title)
+{
+ m_title = title;
+ Invalidate();
+}
+
+void CSlotTableCtrl::SetRowHeight(int height)
+{
+ if (height < 14) height = 14;
+ if (height > 40) height = 40;
+ m_rowHeight = height;
+ Invalidate();
+}
+
+void CSlotTableCtrl::SetPadding(int padding)
+{
+ if (padding < 2) padding = 2;
+ if (padding > 16) padding = 16;
+ m_padding = padding;
+ Invalidate();
+}
+
+void CSlotTableCtrl::SetHeaderHeight(int height)
+{
+ if (height < 16) height = 16;
+ if (height > 40) height = 40;
+ m_headerHeight = height;
+ Invalidate();
+}
+
+void CSlotTableCtrl::SetTitleHeight(int height)
+{
+ if (height < 16) height = 16;
+ if (height > 40) height = 40;
+ m_titleHeight = height;
+ Invalidate();
+}
+
+void CSlotTableCtrl::SetLineColor(COLORREF color)
+{
+ m_lineColor = color;
+ Invalidate();
+}
+
+void CSlotTableCtrl::SetHeaderBgColor(COLORREF color)
+{
+ m_headerBgColor = color;
+ Invalidate();
+}
+
+void CSlotTableCtrl::Clear()
+{
+ m_rows.clear();
+ m_title.Empty();
+ Invalidate();
+}
+
+BOOL CSlotTableCtrl::OnEraseBkgnd(CDC* /*pDC*/)
+{
+ return TRUE;
+}
+
+void CSlotTableCtrl::OnPaint()
+{
+ CPaintDC dc(this);
+ CRect rcClient;
+ GetClientRect(&rcClient);
+
+ CFont* pOldFont = (CFont*)dc.SelectStockObject(DEFAULT_GUI_FONT);
+ dc.SetBkMode(TRANSPARENT);
+
+ const COLORREF kBorder = m_lineColor;
+ const COLORREF kHeaderBg = m_headerBgColor;
+ const COLORREF kGrid = m_lineColor;
+ const COLORREF kText = RGB(30, 30, 30);
+ const COLORREF kTitle = RGB(80, 80, 80);
+
+ dc.FillSolidRect(&rcClient, RGB(255, 255, 255));
+ dc.SetTextColor(kText);
+
+ const int titleHeight = m_title.IsEmpty() ? 0 : m_titleHeight;
+ const int headerHeight = m_headerHeight;
+ const int rowHeight = m_rowHeight;
+
+ CRect rcTitle = rcClient;
+ rcTitle.bottom = rcTitle.top + titleHeight;
+ if (titleHeight > 0) {
+ dc.FillSolidRect(&rcTitle, RGB(250, 250, 250));
+ CRect rcTitleText = rcTitle;
+ rcTitleText.DeflateRect(6, 2);
+ dc.SetTextColor(kTitle);
+ dc.DrawText(m_title, &rcTitleText, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
+ dc.SetTextColor(kText);
+ }
+
+ CRect rcHeader = rcClient;
+ rcHeader.top += titleHeight;
+ rcHeader.bottom = rcHeader.top + headerHeight;
+ dc.FillSolidRect(&rcHeader, kHeaderBg);
+
+ int totalW = rcClient.Width();
+ int col1 = max(40, totalW * 20 / 100);
+ int col3 = max(40, totalW * 20 / 100);
+ int col2 = totalW - col1 - col3;
+ if (col2 < 60) col2 = 60;
+ if (col1 + col2 + col3 > totalW) {
+ col3 = max(30, totalW - col1 - col2);
+ }
+
+ int x1 = rcClient.left;
+ int x2 = x1 + col1;
+ int x3 = x2 + col2;
+
+ CRect rc;
+ rc = rcHeader; rc.right = x2; rc.DeflateRect(m_padding, 0);
+ dc.DrawText(_T("Slot"), &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+ rc = rcHeader; rc.left = x2; rc.right = x3; rc.DeflateRect(m_padding, 0);
+ dc.DrawText(_T("Glass ID"), &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+ rc = rcHeader; rc.left = x3; rc.DeflateRect(m_padding, 0);
+ dc.DrawText(_T("G1/G2"), &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+
+ // grid lines
+ dc.FillSolidRect(rcClient.left, rcHeader.bottom - 1, rcClient.Width(), 1, kGrid);
+ dc.FillSolidRect(x2 - 1, rcHeader.top, 1, rcClient.bottom - rcHeader.top, kGrid);
+ dc.FillSolidRect(x3 - 1, rcHeader.top, 1, rcClient.bottom - rcHeader.top, kGrid);
+
+ int bodyTop = rcHeader.bottom;
+ if (m_rows.empty()) {
+ CRect rcBody = rcClient;
+ rcBody.top = bodyTop + 4;
+ dc.DrawText(_T("No slot data"), &rcBody, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+ }
+ else {
+ for (size_t i = 0; i < m_rows.size(); ++i) {
+ CRect rcRow = rcClient;
+ rcRow.top = bodyTop + static_cast<int>(i) * rowHeight;
+ rcRow.bottom = rcRow.top + rowHeight;
+ if (rcRow.top >= rcClient.bottom) break;
+ // 琛屽垎闅旂嚎锛堟渶鍚庝竴琛屼笉鐢伙紝閬垮厤搴曢儴澶氫竴鏉$嚎锛�
+ if (i + 1 < m_rows.size() && rcRow.bottom < rcClient.bottom - 1) {
+ dc.FillSolidRect(rcRow.left, rcRow.bottom - 1, rcClient.Width(), 1, kGrid);
+ }
+
+ CRect rcCell;
+ rcCell = rcRow; rcCell.right = x2; rcCell.DeflateRect(m_padding, 0);
+ dc.DrawText(m_rows[i].slot, &rcCell, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+ rcCell = rcRow; rcCell.left = x2; rcCell.right = x3; rcCell.DeflateRect(m_padding, 0);
+ dc.DrawText(m_rows[i].glassId, &rcCell, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+ rcCell = rcRow; rcCell.left = x3; rcCell.DeflateRect(m_padding, 0);
+ dc.DrawText(m_rows[i].type, &rcCell, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+ }
+ }
+
+ // border
+ dc.Draw3dRect(&rcClient, kBorder, kBorder);
+
+ dc.SelectObject(pOldFont);
+}
diff --git a/SourceCode/Bond/Servo/CSlotTableCtrl.h b/SourceCode/Bond/Servo/CSlotTableCtrl.h
new file mode 100644
index 0000000..f0ec97b
--- /dev/null
+++ b/SourceCode/Bond/Servo/CSlotTableCtrl.h
@@ -0,0 +1,39 @@
+锘�#pragma once
+#include <vector>
+#include <afxwin.h>
+
+class CSlotTableCtrl : public CWnd
+{
+public:
+ struct Row {
+ CString slot;
+ CString glassId;
+ CString type;
+ };
+
+ BOOL Create(CWnd* pParent, const RECT& rc, UINT nID);
+ void SetRows(const std::vector<Row>& rows);
+ void SetTitle(const CString& title);
+ void SetRowHeight(int height);
+ void SetPadding(int padding);
+ void SetHeaderHeight(int height);
+ void SetTitleHeight(int height);
+ void SetLineColor(COLORREF color);
+ void SetHeaderBgColor(COLORREF color);
+ void Clear();
+
+protected:
+ afx_msg void OnPaint();
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ DECLARE_MESSAGE_MAP()
+
+private:
+ std::vector<Row> m_rows;
+ CString m_title;
+ int m_rowHeight = 20;
+ int m_padding = 8;
+ int m_headerHeight = 22;
+ int m_titleHeight = 20;
+ COLORREF m_lineColor = RGB(230, 230, 230);
+ COLORREF m_headerBgColor = RGB(245, 245, 245);
+};
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index f1eff4a..45e0f7a 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -346,6 +346,7 @@
<ClInclude Include="ColorTransfer.h" />
<ClInclude Include="CPageCassetteCtrlCmd.h" />
<ClInclude Include="CPageGraph1.h" />
+ <ClInclude Include="CSlotTableCtrl.h" />
<ClInclude Include="CPageGraph2.h" />
<ClInclude Include="CPagePortProperty.h" />
<ClInclude Include="CPanelAttributes.h" />
@@ -574,6 +575,7 @@
<ClCompile Include="ColorTransfer.cpp" />
<ClCompile Include="CPageCassetteCtrlCmd.cpp" />
<ClCompile Include="CPageGraph1.cpp" />
+ <ClCompile Include="CSlotTableCtrl.cpp" />
<ClCompile Include="CPageGraph2.cpp" />
<ClCompile Include="CPagePortProperty.cpp" />
<ClCompile Include="CPanelAttributes.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index 09bb6e1..c4fcb9f 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -72,6 +72,7 @@
<ClCompile Include="MapPosWnd.cpp" />
<ClCompile Include="HmTab.cpp" />
<ClCompile Include="CPageGraph1.cpp" />
+ <ClCompile Include="CSlotTableCtrl.cpp" />
<ClCompile Include="CPageGraph2.cpp" />
<ClCompile Include="CGlass.cpp" />
<ClCompile Include="CPath.cpp" />
@@ -316,6 +317,7 @@
<ClInclude Include="MapPosWnd.h" />
<ClInclude Include="HmTab.h" />
<ClInclude Include="CPageGraph1.h" />
+ <ClInclude Include="CSlotTableCtrl.h" />
<ClInclude Include="CPageGraph2.h" />
<ClInclude Include="CGlass.h" />
<ClInclude Include="CPath.h" />
--
Gitblit v1.9.3