From bea6407b376a4e426f0b120bae569fba6ab867db Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 08 十一月 2025 17:55:47 +0800
Subject: [PATCH] 1.CMaster.cpp 第 1644/1667/1691 行在记录 SV 曲线时通过 getGlassFromSlot(0) 取玻璃,而各设备的 initSlots() 都是从 1 开始编号(例如 CBonder.cpp (line 408)、CVacuumBake.cpp (line 415) 等)。槽位 0 永远不存在,所以 pGlass 始终是 nullptr,pGlass->addSVData(...) 的分支从未执行。结果 SERVO::CGlass::m_svDatas 里没有任何曲线数据,GlassJson::ToPrettyString 生成的 pretty 字符串也就没有 sv_datas,导出 CSV 时自然读不到曲线。 同一段代码还有一个潜在 Bug:虽然判断了 channel - 1 < bonderTypes.size(),但真正索引却用的是 bonderTypes[channel]。索引偏移会导致数据类型错位,最后一个通道甚至可能越界。即使修正了槽位,这里也需要同步改成 bonderTypes[channel - 1](另外两处 vacuumbakeTypes、coolingTypes 也一样)。
---
SourceCode/Bond/Servo/BlButton.cpp | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/SourceCode/Bond/Servo/BlButton.cpp b/SourceCode/Bond/Servo/BlButton.cpp
index 2bddd2b..ff75530 100644
--- a/SourceCode/Bond/Servo/BlButton.cpp
+++ b/SourceCode/Bond/Servo/BlButton.cpp
@@ -36,6 +36,7 @@
m_hIcon[1] = nullptr;
m_nIconWidth = 0;
m_nFlashState = 0;
+ m_bTextRight = FALSE;
}
@@ -159,6 +160,11 @@
return m_nFlashState != 0;
}
+void CBlButton::SetTextRight()
+{
+ m_bTextRight = TRUE;
+}
+
void CBlButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
HDC hDC = lpDrawItemStruct->hDC;
@@ -200,15 +206,24 @@
HICON hIcon = this->IsWindowEnabled() ? m_hIcon[0] : m_hIcon[01];
if (hIcon != nullptr) {
int xIcon = (rcClient.right - rcClient.top - m_nIconWidth) / 2;
+ if (m_bTextRight) {
+ xIcon = 15;
+ }
+
if (m_hMenu != nullptr) xIcon -= 10;
int yIcon = (rcClient.bottom - rcClient.top - m_nIconWidth) / 2;
- if (nTextLen != 0) {
+ if (nTextLen != 0 && !m_bTextRight) {
yIcon -= 8;
}
DrawIconEx(hDC, xIcon, yIcon,
hIcon, m_nIconWidth, m_nIconWidth, 0, 0, DI_NORMAL);
- rcText.top = yIcon + m_nIconWidth + 2;
+ if (m_bTextRight) {
+ rcText.left = xIcon + m_nIconWidth + 2;
+ }
+ else {
+ rcText.top = yIcon + m_nIconWidth + 2;
+ }
}
@@ -223,18 +238,19 @@
::SetBkMode(hDC, TRANSPARENT);
::SetTextColor(hDC, m_crText[state]);
+ UINT format1 = m_bTextRight ? DT_LEFT : DT_CENTER;
if ((BS_MULTILINE & GetStyle()) == BS_MULTILINE) {
CRect rcBound;
int height = DrawTextA(hDC, szText, (int)strlen(szText), &rcBound, DT_CENTER | DT_CALCRECT | DT_EDITCONTROL);
rcText.top = rcBound.top + (rcClient.bottom - rcClient.top - height) / 2;
rcText.bottom = rcText.top + height;
- DrawTextA(hDC, szText, (int)strlen(szText), &rcText, DT_CENTER | DT_EDITCONTROL);
+ DrawTextA(hDC, szText, (int)strlen(szText), &rcText, format1 | DT_EDITCONTROL);
}
else {
if (m_hMenu != nullptr) {
rcText.right -= (10);
}
- DrawTextA(hDC, szText, (int)strlen(szText), &rcText, DT_VCENTER | DT_CENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+ DrawTextA(hDC, szText, (int)strlen(szText), &rcText, format1 | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
}
::SelectObject(hDC, hOldFont);
--
Gitblit v1.9.3