From 90a3116d249b070b670093afcc41e984aeab657d Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期三, 11 十二月 2024 17:23:21 +0800
Subject: [PATCH] 1.编辑框添加查找和替换功能 2. 按钮闪烁时间修改为0.5秒

---
 SourceCode/Bond/BondEq/RegexEdit.cpp            |   28 ++++++++++++++++++++++++++++
 SourceCode/Bond/BondEq/RegexEdit.h              |    6 ++++++
 SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp |   14 +++++++-------
 3 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/SourceCode/Bond/BondEq/RegexEdit.cpp b/SourceCode/Bond/BondEq/RegexEdit.cpp
index f3943e1..eaf8879 100644
--- a/SourceCode/Bond/BondEq/RegexEdit.cpp
+++ b/SourceCode/Bond/BondEq/RegexEdit.cpp
@@ -41,6 +41,34 @@
     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)
diff --git a/SourceCode/Bond/BondEq/RegexEdit.h b/SourceCode/Bond/BondEq/RegexEdit.h
index 07df2cd..0632d00 100644
--- a/SourceCode/Bond/BondEq/RegexEdit.h
+++ b/SourceCode/Bond/BondEq/RegexEdit.h
@@ -44,6 +44,12 @@
 	// 设置输入不合法函数
     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;
diff --git a/SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp b/SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp
index b5aae05..d8add62 100644
--- a/SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp
+++ b/SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp
@@ -1253,7 +1253,7 @@
 	handleAxisOperation(AxisOperationType::POSITION_1, true);
 	Sleep(200);
 	handleAxisOperation(AxisOperationType::POSITION_1, false);
-	m_pBlBtns[BTN_POINT1]->Flash(1000);
+	m_pBlBtns[BTN_POINT1]->Flash(500);
 }
 
 void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint2()
@@ -1428,7 +1428,7 @@
 	if (m_nBtnsFlashState6 & 0x01) {
 		// 06.0
 		if (!m_pBlBtns[BTN_JOG_OPR]->IsFlash()) {
-			m_pBlBtns[BTN_JOG_OPR]->Flash(1000);
+			m_pBlBtns[BTN_JOG_OPR]->Flash(500);
 		}
 	}
 	else if (m_nBtnsFlashState8 & 0x01) {
@@ -1444,7 +1444,7 @@
 
 	if (m_nBtnsFlashState6 & v) {
 		if (!m_pBlBtns[BTN_POINT1]->IsFlash()) {
-			m_pBlBtns[BTN_POINT1]->Flash(1000);
+			m_pBlBtns[BTN_POINT1]->Flash(500);
 		}
 	}
 	else if (m_nBtnsFlashState8 & v) {
@@ -1455,7 +1455,7 @@
 
 	if (m_nBtnsFlashState6 & (v << 1)) {
 		if (!m_pBlBtns[BTN_POINT2]->IsFlash()) {
-			m_pBlBtns[BTN_POINT2]->Flash(1000);
+			m_pBlBtns[BTN_POINT2]->Flash(500);
 		}
 	}
 	else if (m_nBtnsFlashState8 & (v << 1)) {
@@ -1466,7 +1466,7 @@
 
 	if (m_nBtnsFlashState6 & (v << 2)) {
 		if (!m_pBlBtns[BTN_POINT3]->IsFlash()) {
-			m_pBlBtns[BTN_POINT3]->Flash(1000);
+			m_pBlBtns[BTN_POINT3]->Flash(500);
 		}
 	}
 	else if (m_nBtnsFlashState8 & (v << 2)) {
@@ -1477,7 +1477,7 @@
 
 	if (m_nBtnsFlashState6 & (v << 3)) {
 		if (!m_pBlBtns[BTN_POINT4]->IsFlash()) {
-			m_pBlBtns[BTN_POINT4]->Flash(1000);
+			m_pBlBtns[BTN_POINT4]->Flash(500);
 		}
 	}
 	else if (m_nBtnsFlashState8 & (v << 3)) {
@@ -1488,7 +1488,7 @@
 
 	if (m_nBtnsFlashState6 & (v << 4)) {
 		if (!m_pBlBtns[BTN_POINT5]->IsFlash()) {
-			m_pBlBtns[BTN_POINT5]->Flash(1000);
+			m_pBlBtns[BTN_POINT5]->Flash(500);
 		}
 	}
 	else if (m_nBtnsFlashState8 & (v << 4)) {

--
Gitblit v1.9.3