LAPTOP-T815PCOQ\25526
2024-12-11 90a3116d249b070b670093afcc41e984aeab657d
1.编辑框添加查找和替换功能 2. 按钮闪烁时间修改为0.5秒
已修改3个文件
48 ■■■■ 文件已修改
SourceCode/Bond/BondEq/RegexEdit.cpp 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/RegexEdit.h 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
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;
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)) {