LAPTOP-SNT8I5JK\Boounion
2025-10-10 8cd1ad310c5e559435ff38e518b8fad89852b55f
1.ControlJob属性页设置 ;
已修改8个文件
68 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CCjPage3.cpp 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CCjPage3.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CControlJob.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CControlJob.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CControlJobManagerDlg.cpp 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CControlJobManagerDlg.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CCjPage3.cpp
@@ -29,6 +29,7 @@
BEGIN_MESSAGE_MAP(CCjPage3, CCjPageBase)
    ON_WM_DESTROY()
    ON_EN_CHANGE(IDC_EDIT_CJ_ID, &CCjPage3::OnEnChangeEditCjId)
END_MESSAGE_MAP()
@@ -69,5 +70,40 @@
int CCjPage3::OnApply()
{
    // SERVO::CControlJob*
    if (m_pContext == nullptr) return -1;
    SERVO::CControlJob* pControlJob = (SERVO::CControlJob*)m_pContext;
    // 更新名称
    BOOL bOkName = TRUE;
    char szBuffer[256];
    GetDlgItemText(IDC_EDIT_CJ_ID, szBuffer, 256);
    pControlJob->setId(std::string(szBuffer));
    ContentChanged(1);
    return 0;
}
void CCjPage3::OnSetContext(void* pContext)
{
    UpdateCjData();
}
void CCjPage3::UpdateCjData()
{
    if (m_pContext == nullptr) return;
    m_bContentChangedLock = TRUE;
    SERVO::CControlJob* pControlJob = (SERVO::CControlJob*)m_pContext;
    SetDlgItemText(IDC_EDIT_CJ_ID, pControlJob->id().c_str());
    m_bContentChangedLock = FALSE;
}
void CCjPage3::OnEnChangeEditCjId()
{
    ContentChanged(0);
}
SourceCode/Bond/Servo/CCjPage3.h
@@ -1,5 +1,6 @@
#pragma once
#include "CCjPageBase.h"
#include "CControlJob.h"
// CPjPage1 对话框
@@ -15,6 +16,8 @@
protected:
    void Resize();
    virtual int OnApply();
    virtual void OnSetContext(void* pContext);
    void UpdateCjData();
// 对话框数据
#ifdef AFX_DESIGN_TIME
@@ -28,4 +31,5 @@
public:
    virtual BOOL OnInitDialog();
    afx_msg void OnDestroy();
    afx_msg void OnEnChangeEditCjId();
};
SourceCode/Bond/Servo/CControlJob.cpp
@@ -38,6 +38,12 @@
        m_tEnd = src.m_tEnd;
    }
    void CControlJob::setId(std::string& id)
    {
        m_cjId = trimCopy(id);
        clampString(m_cjId, MAX_ID_LEN);
    }
    bool CControlJob::addPJ(const std::string& pjId) {
        if (pjId.empty()) return false;
        auto id = pjId;
SourceCode/Bond/Servo/CControlJob.h
@@ -42,6 +42,7 @@
        // —— 基本属性 —— //
        const std::string& id()     const noexcept { return m_cjId; }
        void setId(std::string& id);
        CJState            state()  const noexcept { return m_state; }
        uint8_t            priority() const noexcept { return m_priority; }
        void               setPriority(uint8_t p) noexcept { m_priority = p; }
SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
@@ -78,6 +78,9 @@
            if (contextType == 1) {
                UpProcessJobId((PJWarp*)pContext);
            }
            else if (contextType == 2) {
                UpControlJobId((SERVO::CControlJob*)pContext);
            }
        }
    };
@@ -307,7 +310,8 @@
            SERVO::CControlJob* cj = (SERVO::CControlJob*)m_tree.GetItemData(hSel);
            ASSERT(m_pages.size() == 3);
            if (0 == ShowPage(2)) {
                SERVO::CControlJob* pControlJob = (SERVO::CControlJob*)m_tree.GetItemData(hSel);
                m_pages[2]->SetContext(pControlJob, 2);
            }
        }
        else if (m_tree.GetParentItem(hParent) == nullptr) {
@@ -406,6 +410,20 @@
    }
}
void CControlJobManagerDlg::UpControlJobId(SERVO::CControlJob* pControlJob)
{
    // 更新树控件
    // 遍历根节点
    HTREEITEM hRoot = m_tree.GetRootItem();
    if (hRoot != nullptr) {
        DWORD_PTR data = m_tree.GetItemData(hRoot);
        if ((void*)data == pControlJob) {
            m_tree.SetItemText(hRoot, pControlJob->id().c_str());
            return; // 找到就返回
        }
    }
}
void CControlJobManagerDlg::LoadState()
{
    if (!m_bHasState) return;
SourceCode/Bond/Servo/CControlJobManagerDlg.h
@@ -25,6 +25,7 @@
    bool AddPorcessJob(SERVO::CProcessJob* pj);
    bool RemovePorcessJob(SERVO::CProcessJob* pj);
    void UpProcessJobId(PJWarp* pjWarp);
    void UpControlJobId(SERVO::CControlJob* pControlJob);
    void InitData();
    void LoadState();
    void SaveState();
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/resource.h
Binary files differ