From f068115ebf6f12b7e9c9d96b46b061a5c7bc42ac Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期一, 13 一月 2025 16:52:09 +0800
Subject: [PATCH] 1. 移出自定义输入限制编辑框 2. 轴设定的编辑框做输入限制

---
 /dev/null                                               |   74 ------------
 SourceCode/Bond/BoounionPLC/AxisDetailSettingsDlg.cpp   |   10 +
 SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters |    6 -
 SourceCode/Bond/BoounionPLC/AxisSettingsDlg.cpp         |  205 +++++++++++++++++++++++----------
 SourceCode/Bond/BoounionPLC/AxisSettingsDlg.h           |   26 +---
 SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj         |    2 
 6 files changed, 160 insertions(+), 163 deletions(-)

diff --git a/SourceCode/Bond/BoounionPLC/AxisDetailSettingsDlg.cpp b/SourceCode/Bond/BoounionPLC/AxisDetailSettingsDlg.cpp
index 82f070b..3ac128e 100644
--- a/SourceCode/Bond/BoounionPLC/AxisDetailSettingsDlg.cpp
+++ b/SourceCode/Bond/BoounionPLC/AxisDetailSettingsDlg.cpp
@@ -460,6 +460,16 @@
 	strTitle.Format(_T("杞寸粏閮ㄨ瀹�(PLC: %s)"), m_pPLC->getName().c_str());
 	SetWindowText(strTitle);
 
+	// 涓嶅彲缂栬緫
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_POS_MIN)->EnableWindow(FALSE);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_AUTO_SPEED_MIN)->EnableWindow(FALSE);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_ACCE_TIME_MIN)->EnableWindow(FALSE);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_ACCE_TIME_MAX)->EnableWindow(FALSE);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_DECE_TIME_MIN)->EnableWindow(FALSE);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_DECE_TIME_MAX)->EnableWindow(FALSE);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_MICROMENTUM_MIN)->EnableWindow(FALSE);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_MICROMENTUM_MAX)->EnableWindow(FALSE);
+
 	// 鑾峰彇杞存暟鎹�
 	auto axisDetails = m_pAxisManager->GetAxis(m_nAxisNO);
 	if (axisDetails.id == -1) {
diff --git a/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.cpp b/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.cpp
index 9b58189..9492fdf 100644
--- a/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.cpp
+++ b/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.cpp
@@ -8,6 +8,7 @@
 #include "AxisDetailSettingsDlg.h"
 #include "ToolUnits.h"
 #include <cctype>
+#include <regex>
 
 
 #define COLOR_GREEN_ON    RGB(0, 255, 0)  // 姝e父鐘舵�佺豢鑹�
@@ -53,10 +54,6 @@
 		m_pBlBtns[i] = new CBlButton();
 	}
 
-	for (int i = 0; i < EDIT_MAX; i++) {
-		m_pRegexEdit[i] = new CRegexEdit();
-	}
-
 	for (int i = 0; i < LABEL_MAX; i++) {
 		m_pBlLabels[i] = new CBLLabel();
 	}
@@ -73,10 +70,6 @@
 {
 	for (int i = 0; i < BTN_MAX; i++) {
 		delete m_pBlBtns[i];
-	}
-
-	for (int i = 0; i < EDIT_MAX; i++) {
-		delete m_pRegexEdit[i];
 	}
 
 	for (int i = 0; i < LABEL_MAX; i++) {
@@ -179,24 +172,6 @@
 	SetLabelColorBasedOnState(*m_pBlLabels[LABEL_ERR], m_bErr, COLOR_RED, COLOR_GREEN_OFF);
 }
 
-void CAxisSettingsDlg::UpdateRegexEdit(CRegexEdit* pRegexEdit, const ValueRange& range, const CString& title)
-{
-	auto formatDouble = [](double value) -> CString {
-		CString str;
-		str.Format(_T("%.3f"), value);
-		return str;
-	};
-
-	pRegexEdit->SetWindowText(formatDouble(range.currentValue));
-	pRegexEdit->SetRegexType(RegexType::Decimal);
-	pRegexEdit->SetValueRange(range.minValue, range.maxValue);
-	pRegexEdit->SetInvalidInputCallback([title, range]() {
-		CString strError;
-		strError.Format(_T("%s鐨勫�煎繀椤诲湪 %.3f 鍜� %.3f 涔嬮棿锛�"), title, range.minValue, range.maxValue);
-		AfxMessageBox(strError);
-	});
-}
-
 void CAxisSettingsDlg::UpdatePageButtonStates()
 {
 	for (int i = 0; i < AXIS_PAGE_SIZE; ++i) {
@@ -270,11 +245,11 @@
 	m_staticAxisDescription.SetWindowText(CString(axisDetails.description.c_str()));	// 杞存弿杩�
 	m_staticStartAddress.SetWindowText(CString(axisDetails.startAddress.c_str()));		// 璧峰鍦板潃
 
-	UpdateRegexEdit(m_pRegexEdit[EDIT_MICROMENTUM], axisDetails.jogDistance, _T("寰姩閲�"));
-	UpdateRegexEdit(m_pRegexEdit[EDIT_MANUAL_SPEED], axisDetails.manualSpeed, _T("鎵嬪姩閫熷害"));
-	UpdateRegexEdit(m_pRegexEdit[EDIT_AUTO_SPEED], axisDetails.autoSpeed, _T("鑷姩閫熷害"));
-	UpdateRegexEdit(m_pRegexEdit[EDIT_ACCE_TIME], axisDetails.accelerationTime, _T("鍔犻�熸椂闂�"));
-	UpdateRegexEdit(m_pRegexEdit[EDIT_DECE_TIME], axisDetails.decelerationTime, _T("鍑忛�熸椂闂�"));
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_MANUAL_SPEED)->SetWindowText(formatDouble(axisDetails.manualSpeed.currentValue));
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_AUTO_SPEED)->SetWindowText(formatDouble(axisDetails.autoSpeed.currentValue));
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_ACCE_TIME)->SetWindowText(formatDouble(axisDetails.accelerationTime.currentValue));
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_DECE_TIME)->SetWindowText(formatDouble(axisDetails.decelerationTime.currentValue));
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_MICROMENTUM)->SetWindowText(formatDouble(axisDetails.jogDistance.currentValue));
 }
 
 void CAxisSettingsDlg::RefreshPositionDetails(int nAxisId, int pageNumber)
@@ -308,13 +283,16 @@
 			CString value;
 			value.Format(_T("%.3f"), position.range.currentValue);
 			if (pPositionCtrl) {
-				pPositionCtrl->SetWindowText(value);
 				pPositionCtrl->EnableWindow(position.isEnable);
-
 				if (position.isEnable) {
-					CString strError;
-					strError.Format(_T("瀹氫綅鐐�%d"), i + 1);
-					UpdateRegexEdit((CRegexEdit*)pPositionCtrl, position.range, strError);
+					if (!IsFloatInRange((LPTSTR)(LPCTSTR)value, position.range.minValue, position.range.maxValue)) {
+						CString strError;
+						strError.Format(_T("瀹氫綅鐐�%d鍊煎繀椤诲湪 %.3f 鍜� %.3f 涔嬮棿锛�"), i + 1, position.range.minValue, position.range.maxValue);
+						ShowTipText(strError, 5);
+					}
+					else {
+						pPositionCtrl->SetWindowText(value);
+					}
 				}
 			}
 		}
@@ -363,8 +341,8 @@
 	// 鍒ゆ柇杈撳叆鐨勫�兼槸鍚﹀湪鍚堟硶鑼冨洿鍐�
 	if (enteredValue < minValue || enteredValue > maxValue) {
 		CString strError;
-		strError.Format(_T("瀹氫綅鐐圭殑鍊煎繀椤诲湪 %f 鍜� %f 涔嬮棿锛�"), minValue, maxValue);
-		pDescriptionCtrl->SetWindowText(strError);
+		strError.Format(_T("瀹氫綅鐐�%d鐨勫�煎繀椤诲湪 %f 鍜� %f 涔嬮棿锛�"), currentIndex + 1, minValue, maxValue);
+		ShowTipText(strError, 5);
 	}
 	else {
 		position.range.currentValue = enteredValue;
@@ -402,19 +380,19 @@
 
 	// 鑾峰彇鐣岄潰涓婄殑淇敼鍙傛暟
 	CString text;
-	m_pRegexEdit[EDIT_MANUAL_SPEED]->GetWindowText(text);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_MANUAL_SPEED)->GetWindowText(text);
 	axisData.manualSpeed.currentValue = _ttof(text);
 
-	m_pRegexEdit[EDIT_AUTO_SPEED]->GetWindowText(text);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_AUTO_SPEED)->GetWindowText(text);
 	axisData.autoSpeed.currentValue = _ttof(text);
 
-	m_pRegexEdit[EDIT_ACCE_TIME]->GetWindowText(text);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_ACCE_TIME)->GetWindowText(text);
 	axisData.accelerationTime.currentValue = _ttof(text);
 
-	m_pRegexEdit[EDIT_DECE_TIME]->GetWindowText(text);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_DECE_TIME)->GetWindowText(text);
 	axisData.decelerationTime.currentValue = _ttof(text);
 
-	m_pRegexEdit[EDIT_MICROMENTUM]->GetWindowText(text);
+	GetDlgItem(IDC_EDIT_AXIS_MODITFY_MICROMENTUM)->GetWindowText(text);
 	axisData.jogDistance.currentValue = _ttof(text);
 
 	// 鏇存柊瀹氫綅鐐规暟鎹�
@@ -773,11 +751,15 @@
 	ON_BN_CLICKED(IDC_BUTTON_AXIS_UPDATE_UI, &CAxisSettingsDlg::OnBnClickedButtonAxisUpdateUi)
 	ON_BN_CLICKED(IDC_BUTTON_AXIS_DETAIL_SETTINGS, &CAxisSettingsDlg::OnBnClickedButtonAxisDetailSettings)
 	ON_MESSAGE(ID_MSG_UPDATA_DATA_TO_UI, &CAxisSettingsDlg::OnUpdateDataToUI)
+	ON_EN_KILLFOCUS(IDC_EDIT_AXIS_MODITFY_MANUAL_SPEED, &CAxisSettingsDlg::OnKillfocusEditAxisModitfyManualSpeed)
+	ON_EN_KILLFOCUS(IDC_EDIT_AXIS_MODITFY_AUTO_SPEED, &CAxisSettingsDlg::OnKillfocusEditAxisModitfyAutoSpeed)
+	ON_EN_KILLFOCUS(IDC_EDIT_AXIS_MODITFY_DECE_TIME, &CAxisSettingsDlg::OnKillfocusEditAxisModitfyDeceTime)
+	ON_EN_KILLFOCUS(IDC_EDIT_AXIS_MODITFY_ACCE_TIME, &CAxisSettingsDlg::OnKillfocusEditAxisModitfyAcceTime)
+	ON_EN_KILLFOCUS(IDC_EDIT_AXIS_MODITFY_MICROMENTUM, &CAxisSettingsDlg::OnEnKillfocusEditAxisModitfyMicromentum)
 	ON_WM_SIZE()
 	ON_WM_TIMER()
 	ON_WM_CLOSE()
 	ON_WM_CTLCOLOR()
-	ON_EN_KILLFOCUS(IDC_EDIT_AXIS_MODITFY_MICROMENTUM, &CAxisSettingsDlg::OnEnKillfocusEditAxisModitfyMicromentum)
 END_MESSAGE_MAP()
 
 
@@ -825,18 +807,6 @@
 
 		AdjustLabelFont(*pLabel);
 	}
-	
-	// 鍒濆鍖栫紪杈戞
-	m_pRegexEdit[EDIT_MANUAL_SPEED]->SubclassDlgItem(IDC_EDIT_AXIS_MODITFY_MANUAL_SPEED, this);
-	m_pRegexEdit[EDIT_AUTO_SPEED]->SubclassDlgItem(IDC_EDIT_AXIS_MODITFY_AUTO_SPEED, this);
-	m_pRegexEdit[EDIT_ACCE_TIME]->SubclassDlgItem(IDC_EDIT_AXIS_MODITFY_ACCE_TIME, this);
-	m_pRegexEdit[EDIT_DECE_TIME]->SubclassDlgItem(IDC_EDIT_AXIS_MODITFY_DECE_TIME, this);
-	m_pRegexEdit[EDIT_MICROMENTUM]->SubclassDlgItem(IDC_EDIT_AXIS_MODITFY_MICROMENTUM, this);
-	m_pRegexEdit[EDIT_ANCHOR_POINT1]->SubclassDlgItem(IDC_EDIT_AXIS_ANCHOR_POINT1, this);
-	m_pRegexEdit[EDIT_ANCHOR_POINT2]->SubclassDlgItem(IDC_EDIT_AXIS_ANCHOR_POINT2, this);
-	m_pRegexEdit[EDIT_ANCHOR_POINT3]->SubclassDlgItem(IDC_EDIT_AXIS_ANCHOR_POINT3, this);
-	m_pRegexEdit[EDIT_ANCHOR_POINT4]->SubclassDlgItem(IDC_EDIT_AXIS_ANCHOR_POINT4, this);
-	m_pRegexEdit[EDIT_ANCHOR_POINT5]->SubclassDlgItem(IDC_EDIT_AXIS_ANCHOR_POINT5, this);
 
 	// 鎸夐挳鍒濆鍖�
 	m_pBlBtns[BTN_PAGE1]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP1, this);
@@ -1384,6 +1354,110 @@
 	return 0;
 }
 
+void CAxisSettingsDlg::OnKillfocusEditAxisModitfyManualSpeed()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	int nAxisId = GetCurrentSelectedAxisID();
+	if (nAxisId == -1) {
+		AfxMessageBox(_T("璇烽�夋嫨涓�涓湁鏁堢殑杞寸紪鍙凤紒"));
+		return;
+	}
+	auto axisDetails = m_pAxisManager->GetAxis(nAxisId);
+	auto dMinValue = axisDetails.manualSpeed.minValue;
+	auto dMaxValue = axisDetails.manualSpeed.maxValue;
+
+	CString strText;
+	GetDlgItemText(IDC_EDIT_AXIS_MODITFY_MANUAL_SPEED, strText);
+	if (!IsFloatInRange((LPTSTR)(LPCTSTR)strText, dMinValue, dMaxValue)) {
+		CString strError;
+		strError.Format(_T("鎵嬪姩閫熷害鍊煎繀椤诲湪 %.3f 鍜� %.3f 涔嬮棿锛�"), dMinValue, dMaxValue);
+		ShowTipText(strError, 5);
+	}
+}
+
+void CAxisSettingsDlg::OnKillfocusEditAxisModitfyAutoSpeed()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	int nAxisId = GetCurrentSelectedAxisID();
+	if (nAxisId == -1) {
+		AfxMessageBox(_T("璇烽�夋嫨涓�涓湁鏁堢殑杞寸紪鍙凤紒"));
+		return;
+	}
+	auto axisDetails = m_pAxisManager->GetAxis(nAxisId);
+	auto dMinValue = axisDetails.autoSpeed.minValue;
+	auto dMaxValue = axisDetails.autoSpeed.maxValue;
+
+	CString strText;
+	GetDlgItemText(IDC_EDIT_AXIS_MODITFY_AUTO_SPEED, strText);
+	if (!IsFloatInRange((LPTSTR)(LPCTSTR)strText, dMinValue, dMaxValue)) {
+		CString strError;
+		strError.Format(_T("鑷姩閫熷害鍊煎繀椤诲湪 %.3f 鍜� %.3f 涔嬮棿锛�"), dMinValue, dMaxValue);
+		ShowTipText(strError, 5);
+	}
+}
+
+void CAxisSettingsDlg::OnKillfocusEditAxisModitfyAcceTime()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	int nAxisId = GetCurrentSelectedAxisID();
+	if (nAxisId == -1) {
+		AfxMessageBox(_T("璇烽�夋嫨涓�涓湁鏁堢殑杞寸紪鍙凤紒"));
+		return;
+	}
+	auto axisDetails = m_pAxisManager->GetAxis(nAxisId);
+	auto dMinValue = axisDetails.accelerationTime.minValue;
+	auto dMaxValue = axisDetails.accelerationTime.maxValue;
+
+	CString strText;
+	GetDlgItemText(IDC_EDIT_AXIS_MODITFY_ACCE_TIME, strText);
+	if (!IsFloatInRange((LPTSTR)(LPCTSTR)strText, dMinValue, dMaxValue)) {
+		CString strError;
+		strError.Format(_T("鍔犻�熸椂闂村�煎繀椤诲湪 %.3f 鍜� %.3f 涔嬮棿锛�"), dMinValue, dMaxValue);
+		ShowTipText(strError, 5);
+	}
+}
+
+void CAxisSettingsDlg::OnKillfocusEditAxisModitfyDeceTime()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+	int nAxisId = GetCurrentSelectedAxisID();
+	if (nAxisId == -1) {
+		AfxMessageBox(_T("璇烽�夋嫨涓�涓湁鏁堢殑杞寸紪鍙凤紒"));
+		return;
+	}
+	auto axisDetails = m_pAxisManager->GetAxis(nAxisId);
+	auto dMinValue = axisDetails.decelerationTime.minValue;
+	auto dMaxValue = axisDetails.decelerationTime.maxValue;
+
+	CString strText;
+	GetDlgItemText(IDC_EDIT_AXIS_MODITFY_DECE_TIME, strText);
+	if (!IsFloatInRange((LPTSTR)(LPCTSTR)strText, dMinValue, dMaxValue)) {
+		CString strError;
+		strError.Format(_T("鍑忛�熸椂闂村�煎繀椤诲湪 %.3f 鍜� %.3f 涔嬮棿锛�"), dMinValue, dMaxValue);
+		ShowTipText(strError, 5);
+	}
+}
+
+void CAxisSettingsDlg::OnEnKillfocusEditAxisModitfyMicromentum()
+{
+	int nAxisId = GetCurrentSelectedAxisID();
+	if (nAxisId == -1) {
+		AfxMessageBox(_T("璇烽�夋嫨涓�涓湁鏁堢殑杞寸紪鍙凤紒"));
+		return;
+	}
+	auto axisDetails = m_pAxisManager->GetAxis(nAxisId);
+	auto dMinValue = axisDetails.jogDistance.minValue;
+	auto dMaxValue = axisDetails.jogDistance.maxValue;
+
+	CString strText;
+	GetDlgItemText(IDC_EDIT_AXIS_MODITFY_MICROMENTUM, strText);
+	if (!IsFloatInRange((LPTSTR)(LPCTSTR)strText, dMinValue, dMaxValue)) {
+		CString strError;
+		strError.Format(_T("寰姩閲忓�煎繀椤诲湪 %.3f 鍜� %.3f 涔嬮棿锛�"), dMinValue, dMaxValue);
+		ShowTipText(strError, 5);
+	}
+}
+
 void CAxisSettingsDlg::OnTimer(UINT_PTR nIDEvent)
 {
 	if (TIMER_READ_PLC_DATA == nIDEvent) {
@@ -1454,12 +1528,19 @@
 	GetDlgItem(IDC_LABEL_TIP)->ShowWindow(SW_HIDE);
 }
 
-void CAxisSettingsDlg::OnEnKillfocusEditAxisModitfyMicromentum()
+bool CAxisSettingsDlg::IsFloatInRange(const std::string& strInput, double fLowerBound, double fUpperBound)
 {
-	CString strText;
-	GetDlgItemText(IDC_EDIT_AXIS_MODITFY_MICROMENTUM, strText);
-	double value = atof(strText);
-	if (value < 0.0 || value > 0.1) {
-		ShowTipText("寰姩閲忓�煎繀椤诲湪0.0 ~ 0.1涔嬮棿", 5);
+	// 鏄惁涓哄悎娉曟诞鐐规暟
+	std::regex floatRegex(R"([-+]?\d*\.?\d+([eE][-+]?\d+)?)");
+	if (!std::regex_match(strInput, floatRegex)) {
+		return false;
+	}
+
+	try {
+		double value = std::stod(strInput);
+		return value >= fLowerBound && value <= fUpperBound;
+	}
+	catch (const std::exception&) {
+		return false;
 	}
 }
diff --git a/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.h b/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.h
index 240812f..565a385 100644
--- a/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.h
+++ b/SourceCode/Bond/BoounionPLC/AxisSettingsDlg.h
@@ -1,7 +1,6 @@
 锘�#pragma once
 #include "BlButton.h"
 #include "BLLabel.h"
-#include "RegexEdit.h"
 #include "CBaseDlg.h"
 #include "PLC.h"
 #include "AxisManager.h"
@@ -17,19 +16,6 @@
 #define LABEL_READY		3
 #define LABEL_BUSY		4
 #define LABEL_ERR		5
-
-// RegexEdit鎺т欢
-#define EDIT_MAX			10
-#define EDIT_MANUAL_SPEED	0
-#define EDIT_AUTO_SPEED		1
-#define EDIT_ACCE_TIME		2
-#define EDIT_DECE_TIME		3
-#define EDIT_MICROMENTUM	4
-#define EDIT_ANCHOR_POINT1	5
-#define EDIT_ANCHOR_POINT2	6
-#define EDIT_ANCHOR_POINT3	7
-#define EDIT_ANCHOR_POINT4	8
-#define EDIT_ANCHOR_POINT5	9
 
 // BUTTON鎺т欢
 #define BTN_MAX			15
@@ -88,7 +74,6 @@
 	void SetLabelColor(CBLLabel& label, COLORREF color);
 	void SetLabelColorBasedOnState(CBLLabel& label, BOOL bState, COLORREF colorTrue, COLORREF colorFalse);
 	void UpdateLabels();
-	void UpdateRegexEdit(CRegexEdit* pRegexEdit, const ValueRange& range, const CString& title);
 	void UpdatePageButtonStates();
 	void HideEditCursor(int nCtrlID);
 	int GetCurrentSelectedAxisID();
@@ -105,6 +90,7 @@
 	void ReadPLCDataToUI(int nAxisId);
 	void ShowTipText(const char* pszText, float sec);
 	void HideTip();
+	bool IsFloatInRange(const std::string& strInput, double fLowerBound, double fUpperBound);
 
 private:
 	CPLC* m_pPLC;
@@ -122,7 +108,6 @@
 	// 鎺т欢
 	CBlButton* m_pBlBtns[BTN_MAX];
 	CBLLabel* m_pBlLabels[LABEL_MAX];
-	CRegexEdit* m_pRegexEdit[EDIT_MAX];
 	CComboBox m_comboAxisNO;
 	CStatic m_staticAxisNO, m_staticAxisDescription, m_staticStartAddress;
 
@@ -169,10 +154,13 @@
 	afx_msg void OnBnClickedButtonAxisUpdateUi();
 	afx_msg void OnBnClickedButtonAxisDetailSettings();
 	afx_msg LRESULT OnUpdateDataToUI(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnKillfocusEditAxisModitfyManualSpeed();
+	afx_msg void OnKillfocusEditAxisModitfyAutoSpeed();
+	afx_msg void OnKillfocusEditAxisModitfyDeceTime();
+	afx_msg void OnKillfocusEditAxisModitfyAcceTime();
+	afx_msg void OnEnKillfocusEditAxisModitfyMicromentum();
 	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	afx_msg void OnClose();
-	DECLARE_MESSAGE_MAP()
-public:
 	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
-	afx_msg void OnEnKillfocusEditAxisModitfyMicromentum();
+	DECLARE_MESSAGE_MAP()
 };
diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj
index c4d1ecc..4c023ff 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj
@@ -230,7 +230,6 @@
     <ClInclude Include="PagePlcList.h" />
     <ClInclude Include="PLC.h" />
     <ClInclude Include="PlcView.h" />
-    <ClInclude Include="RegexEdit.h" />
     <ClInclude Include="Resource.h" />
     <ClInclude Include="stdafx.h" />
     <ClInclude Include="targetver.h" />
@@ -280,7 +279,6 @@
     <ClCompile Include="PagePlcList.cpp" />
     <ClCompile Include="PLC.cpp" />
     <ClCompile Include="PlcView.cpp" />
-    <ClCompile Include="RegexEdit.cpp" />
     <ClCompile Include="stdafx.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters
index d3f05ab..96bd33d 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters
@@ -156,9 +156,6 @@
     <ClInclude Include="CBaseDlg.h">
       <Filter>澶存枃浠�</Filter>
     </ClInclude>
-    <ClInclude Include="RegexEdit.h">
-      <Filter>澶存枃浠�</Filter>
-    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="BoounionPLC.cpp">
@@ -279,9 +276,6 @@
       <Filter>婧愭枃浠�</Filter>
     </ClCompile>
     <ClCompile Include="CBaseDlg.cpp">
-      <Filter>婧愭枃浠�</Filter>
-    </ClCompile>
-    <ClCompile Include="RegexEdit.cpp">
       <Filter>婧愭枃浠�</Filter>
     </ClCompile>
   </ItemGroup>
diff --git a/SourceCode/Bond/BoounionPLC/RegexEdit.cpp b/SourceCode/Bond/BoounionPLC/RegexEdit.cpp
deleted file mode 100644
index b7d4e2c..0000000
--- a/SourceCode/Bond/BoounionPLC/RegexEdit.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-#include "stdafx.h"
-#include "RegexEdit.h"
-#include <stdexcept>
-
-IMPLEMENT_DYNAMIC(CRegexEdit, CEdit)
-
-CRegexEdit::CRegexEdit()
-{
-    m_enRegexType = RegexType::Alphanumeric;
-	m_dMinValue = LDBL_MIN;
-	m_dMaxValue = LDBL_MAX;
-}
-
-CRegexEdit::~CRegexEdit()
-{
-}
-
-void CRegexEdit::SetRegexType(RegexType enType)
-{
-    m_enRegexType = enType;
-}
-
-void CRegexEdit::SetCustomRegex(const std::string& strCustomRegex)
-{
-    m_strCustomRegex = strCustomRegex;
-}
-
-void CRegexEdit::SetValueRange(long double dMinValue, long double dMaxValue)
-{
-    m_dMinValue = dMinValue;
-    m_dMaxValue = dMaxValue;
-}
-
-void CRegexEdit::SetCustomComparator(std::function<bool(const std::string&)> comparator)
-{
-	m_customComparator = comparator;
-}
-
-void CRegexEdit::SetInvalidInputCallback(std::function<void()> callback)
-{
-    m_invalidInputCallback = callback;
-}
-
-bool CRegexEdit::FindMatch(const std::string& pattern, std::string& foundText)
-{
-    CString currentText;
-    GetWindowText(currentText);
-
-    std::string text(CT2A(currentText.GetString()));
-    std::regex regexPattern(pattern);
-    std::smatch match;
-
-    if (std::regex_search(text, match, regexPattern)) {
-        foundText = match.str();
-        return true;
-    }
-    return false;
-}
-
-void CRegexEdit::ReplaceMatch(const std::string& pattern, const std::string& replacement)
-{
-    CString currentText;
-    GetWindowText(currentText);
-
-    std::string text(CT2A(currentText.GetString()));
-    std::regex regexPattern(pattern);
-    std::string result = std::regex_replace(text, regexPattern, replacement);
-
-    SetWindowText(CString(result.c_str()));
-}
-
-std::regex CRegexEdit::GetCurrentRegex() const
-{
-    switch (m_enRegexType)
-    {
-    case RegexType::Alphanumeric:
-        return std::regex("^[a-zA-Z0-9]*$");        // 字母和数字
-    case RegexType::Letters:
-        return std::regex("^[a-zA-Z]*$");           // 只允许字母
-    case RegexType::Digits:
-        return std::regex("^\\d*$");                // 只允许数字
-    case RegexType::Decimal:
-        return std::regex("^[-+]?\\d+(\\.\\d+)?$"); // 允许小数和整数
-    case RegexType::Custom:
-        return std::regex(m_strCustomRegex);        // 自定义正则
-    default:
-        return std::regex(".*");                    // 默认允许输入任何内容
-    }
-}
-
-bool CRegexEdit::IsValueInRange(const std::string& strText)
-{
-    try {
-        if (m_enRegexType == RegexType::Digits || m_enRegexType == RegexType::Decimal) {
-            if (strText.find('.') == std::string::npos) {
-                int nValue = std::stoi(strText);
-                return nValue >= static_cast<int>(m_dMinValue) && nValue <= static_cast<int>(m_dMaxValue);
-            }
-            else {
-                double dValue = std::stod(strText);
-                return dValue >= m_dMinValue && dValue <= m_dMaxValue;
-            }
-        }
-    }
-    catch (const std::invalid_argument&) {
-        return false;
-    }
-
-    return true;
-}
-
-BEGIN_MESSAGE_MAP(CRegexEdit, CEdit)
-    ON_WM_CHAR()
-END_MESSAGE_MAP()
-
-void CRegexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
-{
-    CEdit::OnChar(nChar, nRepCnt, nFlags);
-    return;
-
-    // 处理删除键和退格键
-    if (nChar == VK_BACK || nChar == VK_DELETE) {
-        CEdit::OnChar(nChar, nRepCnt, nFlags);
-        return;
-    }
-
-    CString strCurrent;
-    GetWindowText(strCurrent);
-
-    // 获取光标当前位置
-    int nStartChar, nEndChar;
-    GetSel(nStartChar, nEndChar); // 获取当前选区的起始和结束位置
-
-    std::string strText(CT2A(strCurrent.GetBuffer()));
-    strText.insert(strText.begin() + nStartChar, (char)nChar);
-
-    bool bValid = m_customComparator ? m_customComparator(strText) : IsValueInRange(strText);
-    if (std::regex_match(strText, GetCurrentRegex()) && bValid) {
-        CEdit::OnChar(nChar, nRepCnt, nFlags);
-    }
-    else {
-        if (m_invalidInputCallback) {
-            m_invalidInputCallback();
-        }
-    }
-}
\ No newline at end of file
diff --git a/SourceCode/Bond/BoounionPLC/RegexEdit.h b/SourceCode/Bond/BoounionPLC/RegexEdit.h
deleted file mode 100644
index 0632d00..0000000
--- a/SourceCode/Bond/BoounionPLC/RegexEdit.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#if !defined(AFX_REGEXEDIT_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
-#define AFX_REGEXEDIT_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_
-
-#if _MSC_VER >= 1000
-#pragma once
-#endif // _MSC_VER >= 1000
-
-#include <afxwin.h>
-#include <regex>
-#include <functional>
-#include <limits>
-
-// 枚举类型:正则表达式类型
-enum class RegexType
-{
-    Alphanumeric,   // 允许字母和数字
-    Letters,        // 只允许字母
-    Digits,         // 只允许数字
-    Decimal,        // 允许小数和整数
-    Custom          // 自定义正则
-};
-
-class CRegexEdit : public CEdit
-{
-    DECLARE_DYNAMIC(CRegexEdit)
-
-public:
-    // 构造与析构
-    CRegexEdit();
-    virtual ~CRegexEdit();
-
-    // 设置正则类型
-    void SetRegexType(RegexType enType);
-
-    // 设置自定义正则表达式
-    void SetCustomRegex(const std::string& strCustomRegex);
-
-    // 设置数值范围(整数或浮点)
-    void SetValueRange(long double dMinValue, long double dMaxValue);
-
-    // 设置自定义比较函数
-    void SetCustomComparator(std::function<bool(const std::string&)> comparator);
-
-	// 设置输入不合法函数
-    void SetInvalidInputCallback(std::function<void()> callback);
-
-    // 查找匹配内容
-    bool FindMatch(const std::string& pattern, std::string& foundText);
-
-    // 替换匹配内容
-    void ReplaceMatch(const std::string& pattern, const std::string& replacement);
-
-protected:
-    // 根据枚举值返回对应的正则表达式
-    std::regex GetCurrentRegex() const;
-
-    // 校验输入是否在指定范围内
-    bool IsValueInRange(const std::string& strText);
-
-protected:
-    RegexType m_enRegexType;        // 当前选中的正则类型
-    std::string m_strCustomRegex;   // 自定义正则表达式
-	long double m_dMinValue;        // 最小值
-	long double m_dMaxValue;		// 最大值
-
-	std::function<bool(const std::string&)> m_customComparator; // 自定义比较函数
-    std::function<void()> m_invalidInputCallback;               // 不合法输入的回调函数
-
-protected:
-    void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
-    DECLARE_MESSAGE_MAP()
-};
-
-#endif // !defined(AFX_REGEXEDIT_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
\ No newline at end of file

--
Gitblit v1.9.3