From 863f21995955fb3e9aa471430218967d4e642c27 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 29 五月 2025 16:11:24 +0800
Subject: [PATCH] Merge branch 'liuyang'
---
SourceCode/Bond/Servo/PortConfigurationDlg.cpp | 146 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 146 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
new file mode 100644
index 0000000..79a1e11
--- /dev/null
+++ b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
@@ -0,0 +1,146 @@
+锘�// PortConfigurationDlg.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "afxdialogex.h"
+#include "PortConfigurationDlg.h"
+#include "NewCellTypes/GridCellCheck.h"
+#include "NewCellTypes/GridCellCombo.h"
+#include "NewCellTypes/GridCellNumeric.h"
+
+
+// CPortConfigurationDlg 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CPortConfigurationDlg, CDialogEx)
+
+CPortConfigurationDlg::CPortConfigurationDlg(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG_PORT_CONFIGURATION, pParent)
+{
+
+}
+
+CPortConfigurationDlg::~CPortConfigurationDlg()
+{
+}
+
+void CPortConfigurationDlg::InitGrid()
+{
+ if (m_wndGrid.GetSafeHwnd() == NULL) {
+ return;
+ }
+
+ const int nCols = 3;
+ const int nFixRows = 1;
+ const int nRows = 9;
+
+ int nColIdx = 0;
+ m_wndGrid.DeleteAllItems();
+ m_wndGrid.SetVirtualMode(FALSE);
+
+ // 璁剧疆鏍峰紡棰滆壊
+ m_wndGrid.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor);
+ m_wndGrid.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor);
+ m_wndGrid.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor);
+ m_wndGrid.SetFixedTextColor(g_nGridFixFontColor);
+
+ // 琛屽垪鏁伴噺
+ m_wndGrid.SetRowCount(nRows);
+ m_wndGrid.SetColumnCount(nCols);
+ m_wndGrid.SetFixedRowCount(nFixRows);
+ m_wndGrid.SetFixedColumnCount(0);
+
+ // 璁剧疆鍒楀
+ m_wndGrid.SetColumnWidth(nColIdx, 50);
+ m_wndGrid.SetItemText(0, nColIdx++, _T("Slot ID"));
+ m_wndGrid.SetColumnWidth(nColIdx, 150);
+ m_wndGrid.SetItemText(0, nColIdx++, _T("EQ Recipe"));
+ m_wndGrid.SetColumnWidth(nColIdx, 150);
+ m_wndGrid.SetItemText(0, nColIdx++, _T("Panel ID"));
+ m_wndGrid.SetColumnWidth(nColIdx, 60);
+ m_wndGrid.SetItemText(0, nColIdx++, _T("鍚敤"));
+
+ // 璁剧疆琛屼负鏍峰紡
+ m_wndGrid.SetFixedRowSelection(FALSE);
+ m_wndGrid.SetFixedColumnSelection(FALSE);
+ m_wndGrid.SetEditable(TRUE);
+ m_wndGrid.SetRowResize(FALSE);
+ m_wndGrid.SetColumnResize(TRUE);
+ m_wndGrid.SetListMode(TRUE);
+ m_wndGrid.EnableSelection(TRUE);
+ m_wndGrid.SetSingleRowSelection(TRUE);
+ m_wndGrid.ExpandColumnsToFit(TRUE);
+ m_wndGrid.ExpandLastColumn();
+
+ // 鑷姩璁$畻骞惰缃瘡琛岄珮搴�
+ CRect rcClient;
+ m_wndGrid.GetClientRect(&rcClient);
+ int nAvailableHeight = rcClient.Height();
+ int nEachRowHeight = max(24, nAvailableHeight / nRows);
+
+ for (int i = 0; i < nRows; ++i) {
+ m_wndGrid.SetRowHeight(i, nEachRowHeight);
+ }
+
+ FillGrid();
+}
+
+void CPortConfigurationDlg::FillGrid()
+{
+ //CStringArray recipeOptions;
+ //recipeOptions.Add(_T("Recipe A"));
+ //recipeOptions.Add(_T("Recipe B"));
+ //recipeOptions.Add(_T("Recipe C"));
+
+ for (int i = 1; i < 9; ++i) {
+ CString strIndex;
+ strIndex.Format(_T("%d"), i);
+ m_wndGrid.SetItemText(i, 0, strIndex);
+ m_wndGrid.SetItemState(i, 0, GVIS_READONLY);
+
+ // EQ Recipe - ComboBox
+ //if (m_wndGrid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellCombo))) {
+ // CGridCellCombo* pCell = static_cast<CGridCellCombo*>(m_wndGrid.GetCell(i, 1));
+ // pCell->SetOptions(recipeOptions);
+ // pCell->SetStyle(CBS_DROPDOWNLIST);
+ //}
+ //m_wndGrid.SetItemText(i, 1, recipeOptions[0]);
+
+ // Panel ID - 鍙紪杈�
+ m_wndGrid.SetItemText(i, 1, _T(""));
+
+ // Checkbox
+ m_wndGrid.SetCellType(i, 2, RUNTIME_CLASS(CGridCellCheck));
+ CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 2));
+ if (pCheck) {
+ pCheck->SetCheck(FALSE);
+ }
+ }
+
+ m_wndGrid.Invalidate();
+ m_wndGrid.UpdateWindow();
+}
+
+void CPortConfigurationDlg::DoDataExchange(CDataExchange* pDX)
+{
+ DDX_Control(pDX, IDC_GRID_PANEL_RECIPE, m_wndGrid);
+ CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CPortConfigurationDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CPortConfigurationDlg 娑堟伅澶勭悊绋嬪簭
+
+BOOL CPortConfigurationDlg::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
+ InitGrid();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
--
Gitblit v1.9.3