From 22c4fd7bb3ef1d7c6bfc67baf79aed53d22d8636 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期五, 14 十一月 2025 18:00:06 +0800
Subject: [PATCH] 1.竖排slot格子指示;

---
 SourceCode/Bond/Servo/CPageGraph2.cpp |    3 ++-
 SourceCode/Bond/Servo/EqsGraphWnd.h   |   24 ++++++++++++++----------
 SourceCode/Bond/Servo/EqsGraphWnd.cpp |   33 ++++++++++++++++++++++-----------
 3 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index d898004..9710c29 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -302,7 +302,8 @@
 	m_pEqsGraphWnd = CEqsGraphWnd::FromHandle(GetDlgItem(IDC_EQSGRAPHWND1)->m_hWnd);
 	m_pEqsGraphWnd->SetBkgndColor(m_crBkgnd);
 	m_pEqsGraphWnd->SetOnListener(listener);
-
+	m_pEqsGraphWnd->SetIndicatorSize(10);
+	m_pEqsGraphWnd->SetIndicatorMargin(0);
 
 	return TRUE;  // return TRUE unless you set the focus to a control
 				  // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
diff --git a/SourceCode/Bond/Servo/EqsGraphWnd.cpp b/SourceCode/Bond/Servo/EqsGraphWnd.cpp
index fbdd34b..cca80eb 100644
--- a/SourceCode/Bond/Servo/EqsGraphWnd.cpp
+++ b/SourceCode/Bond/Servo/EqsGraphWnd.cpp
@@ -64,6 +64,8 @@
 	m_nMagneticLinHoz = 0;
 	m_nMagneticLinVer = 0;
 	m_hFontTitle = nullptr;
+	m_nIndicatorSize = 10;
+	m_nIndicatorMargin = 3;
 
 }
 
@@ -157,6 +159,20 @@
 
 	m_crItemIdText[0] = CColorTransfer::ApproximateColor(m_crItemNameText[0], -0.3f);
 	m_crItemIdText[1] = CColorTransfer::ApproximateColor(m_crItemNameText[1], -0.3f);
+}
+
+void CEqsGraphWnd::SetIndicatorSize(int nSize)
+{
+	if (nSize > 0) {
+		m_nIndicatorSize = nSize;
+	}
+}
+
+void CEqsGraphWnd::SetIndicatorMargin(int nMargin)
+{
+	if (nMargin >= 0) {
+		m_nIndicatorMargin = nMargin;
+	}
 }
 
 void CEqsGraphWnd::EnableScroll(BOOL bEnable)
@@ -1964,10 +1980,10 @@
 			::DrawText(hMemDC, pItem->text, (int)strlen(pItem->text), &rcItem,
 				DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
 
-			// 澶氫釜鎸囩ず鐏細宸︿笂瑙掞紝鎸� 4 鍒� 脳 2 琛屾帓鍒�
-			const int indicatorSize = 10;
-			const int indicatorMargin = 3;
-			const int indicatorsPerRow = 4;
+			// indicators vertical column layout
+			const int indicatorSize = m_nIndicatorSize;
+			const int indicatorMargin = m_nIndicatorMargin;
+			const int indicatorX = rcItem.left + 5;
 
 			for (int k = 0; k < EQITEM_INDICATOR_COUNT; ++k) {
 				BYTE indicatorState = pItem->nIndicatorState[k];
@@ -1975,17 +1991,12 @@
 					continue;
 				}
 
-				int row = k / indicatorsPerRow;
-				int col = k % indicatorsPerRow;
-
 				RECT rcIndicator;
-				rcIndicator.left = rcItem.left + 5 + col * (indicatorSize + indicatorMargin);
-				rcIndicator.top = rcItem.top + 5 + row * (indicatorSize + indicatorMargin);
+				rcIndicator.left = indicatorX;
+				rcIndicator.top = rcItem.top + 5 + k * (indicatorSize + indicatorMargin);
 				rcIndicator.right = rcIndicator.left + indicatorSize;
 				rcIndicator.bottom = rcIndicator.top + indicatorSize;
 
-
-				// 鐢婚珮浜�/鐏拌壊鏂瑰潡
 				RECT rcInner = rcIndicator;
 				::InflateRect(&rcInner, -1, -1);
 				::FillRect(hMemDC, &rcInner, indicatorState == INDICATOR_STATE_HIGHLIGHT
diff --git a/SourceCode/Bond/Servo/EqsGraphWnd.h b/SourceCode/Bond/Servo/EqsGraphWnd.h
index 6bf7ae6..aaf9804 100644
--- a/SourceCode/Bond/Servo/EqsGraphWnd.h
+++ b/SourceCode/Bond/Servo/EqsGraphWnd.h
@@ -1,4 +1,4 @@
-#pragma once
+锘�#pragma once
 #include <functional>
 
 
@@ -64,7 +64,7 @@
 	DWORD_PTR pInPins;
 	DWORD_PTR pOutPins;
 	int nFlashFlag;
-	BYTE nIndicatorState[EQITEM_INDICATOR_COUNT]; // 0=隐藏, 1=高亮, 2=灰色
+	BYTE nIndicatorState[EQITEM_INDICATOR_COUNT]; // 0=闅愯棌, 1=楂樹寒, 2=鐏拌壊
 } EQITEM;
 
 typedef struct tagPIN
@@ -155,6 +155,8 @@
 	void FlashItem(EQITEM* pItem);
 	void AnimationItem(EQITEM*pItem);
 	void ShowItemIndicator(DWORD_PTR dwItemData, int state, int nIndex = 0);
+	void SetIndicatorSize(int nSize);
+	void SetIndicatorMargin(int nMargin);
 
 private:
 	void Init();
@@ -202,7 +204,7 @@
 	EQITEM*		m_pFlashItem;
 	EQITEM*		m_pAnimationItem;
 	PIN *		m_pCurPin;
-	PIN *		m_pSelLineOutPin;		// 选中的连线的两个pin中的out pin
+	PIN *		m_pSelLineOutPin;		// 閫変腑鐨勮繛绾跨殑涓や釜pin涓殑out pin
 
 private:
 	HWND		m_hWnd;
@@ -211,12 +213,12 @@
 	HFONT		m_hFontTitle;
 
 private:
-	BOOL m_bUseGdiPlus;					// 使用GDI+绘图?
-	COLORREF m_crItemBackground[2];		// item的颜色,normal, active
-	COLORREF m_crItemFrame[2];			// item的边框,normal, active
+	BOOL m_bUseGdiPlus;					// 浣跨敤GDI+缁樺浘锛�
+	COLORREF m_crItemBackground[2];		// item鐨勯鑹诧紝normal锛� active
+	COLORREF m_crItemFrame[2];			// item鐨勮竟妗嗭紝normal锛� active
 	COLORREF m_crItemNameText[2];
 	COLORREF m_crItemIdText[2];
-	COLORREF m_crPinBkgnd[3];			// pin的颜色,normal, active, enable connect
+	COLORREF m_crPinBkgnd[3];			// pin鐨勯鑹诧紝normal, active, enable connect
 	int m_nCurSel;
 	EqsGraphListener m_listener;
 	CPtrArray m_arItem;
@@ -224,18 +226,20 @@
 	int m_nItemRound;
 
 private:
-	int m_nStageCx;			// 画布大小
+	int m_nStageCx;			// 鐢诲竷澶у皬
 	int m_nStageCy;
 	int m_nOffsetX;
 	int m_nOffsetY;
+	int m_nIndicatorSize;
+	int m_nIndicatorMargin;
 
-	// 动画
+	// 鍔ㄧ敾
 	RECTF m_rcAnimation;
 	RECTF m_rcAninationStep;
 	int m_nAninationStep;
 	int m_nAninationDuration;		// ms
 
-	// 字体
+	// 瀛椾綋
 	HFONT m_hFontName;
 	HFONT m_hFontId;
 

--
Gitblit v1.9.3