LAPTOP-SNT8I5JK\Boounion
2025-03-26 8942dacbc2bfaf8aec6a360671de20b0fbf32273
1.Equipment属性页对话框,准备用于展示Equipment数据,里面的Glass等。
已添加8个文件
已修改5个文件
506 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CEquipmentPage1.cpp 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipmentPage1.h 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipmentPage2.cpp 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipmentPage2.h 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CHMPropertyDlg.cpp 212 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CHMPropertyDlg.h 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CHMPropertyPage.cpp 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CHMPropertyPage.h 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPageGraph2.cpp 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj.filters 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipmentPage1.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,54 @@
// CEquipmentPage1.cpp: å®žçŽ°æ–‡ä»¶
//
#include "stdafx.h"
#include "Servo.h"
#include "CEquipmentPage1.h"
#include "afxdialogex.h"
// CEquipmentPage1 å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CEquipmentPage1, CHMPropertyPage)
CEquipmentPage1::CEquipmentPage1(CWnd* pParent /*=nullptr*/)
    : CHMPropertyPage(IDD_PAGE_EQUIPMENT1, pParent)
{
    m_pEquipment = nullptr;
}
CEquipmentPage1::~CEquipmentPage1()
{
}
void CEquipmentPage1::DoDataExchange(CDataExchange* pDX)
{
    CHMPropertyPage::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CEquipmentPage1, CHMPropertyPage)
END_MESSAGE_MAP()
// CEquipmentPage1 æ¶ˆæ¯å¤„理程序
void CEquipmentPage1::OnApply()
{
    __super::OnApply();
    AfxMessageBox("CEquipmentPage1::OnApply()");
}
void CEquipmentPage1::setEquipment(SERVO::CEquipment* pEquipment)
{
    m_pEquipment = pEquipment;
}
BOOL CEquipmentPage1::OnInitDialog()
{
    CHMPropertyPage::OnInitDialog();
    // TODO:  åœ¨æ­¤æ·»åŠ é¢å¤–çš„åˆå§‹åŒ–
    return TRUE;  // return TRUE unless you set the focus to a control
                  // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
}
SourceCode/Bond/Servo/CEquipmentPage1.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
#pragma once
#include "CHMPropertyPage.h"
#include "CEquipment.h"
// CEquipmentPage1 å¯¹è¯æ¡†
class CEquipmentPage1 : public CHMPropertyPage
{
    DECLARE_DYNAMIC(CEquipmentPage1)
public:
    CEquipmentPage1(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CEquipmentPage1();
    virtual void OnApply();
    void setEquipment(SERVO::CEquipment* pEquipment);
private:
    SERVO::CEquipment* m_pEquipment;
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_PAGE_EQUIPMENT1 };
#endif
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    DECLARE_MESSAGE_MAP()
public:
    virtual BOOL OnInitDialog();
};
SourceCode/Bond/Servo/CEquipmentPage2.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
// CEquipmentPage2.cpp: å®žçŽ°æ–‡ä»¶
//
#include "stdafx.h"
#include "Servo.h"
#include "CEquipmentPage2.h"
#include "afxdialogex.h"
// CEquipmentPage2 å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CEquipmentPage2, CHMPropertyPage)
CEquipmentPage2::CEquipmentPage2(CWnd* pParent /*=nullptr*/)
    : CHMPropertyPage(IDD_PAGE_EQUIPMENT2, pParent)
{
    m_pEquipment = nullptr;
}
CEquipmentPage2::~CEquipmentPage2()
{
}
void CEquipmentPage2::DoDataExchange(CDataExchange* pDX)
{
    CHMPropertyPage::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CEquipmentPage2, CHMPropertyPage)
END_MESSAGE_MAP()
// CEquipmentPage2 æ¶ˆæ¯å¤„理程序
void CEquipmentPage2::OnApply()
{
    __super::OnApply();
    AfxMessageBox("CEquipmentPage2::OnApply()");
}
void CEquipmentPage2::setEquipment(SERVO::CEquipment* pEquipment)
{
    m_pEquipment = pEquipment;
}
BOOL CEquipmentPage2::OnInitDialog()
{
    CHMPropertyPage::OnInitDialog();
    AfxMessageBox(m_pEquipment->getClassName());
    return TRUE;  // return TRUE unless you set the focus to a control
                  // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
}
SourceCode/Bond/Servo/CEquipmentPage2.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
#pragma once
#include "CHMPropertyPage.h"
#include "CEquipment.h"
// CEpuipmentPage2 å¯¹è¯æ¡†
class CEquipmentPage2 : public CHMPropertyPage
{
    DECLARE_DYNAMIC(CEquipmentPage2)
public:
    CEquipmentPage2(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CEquipmentPage2();
    virtual void OnApply();
    void setEquipment(SERVO::CEquipment* pEquipment);
private:
    SERVO::CEquipment* m_pEquipment;
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_PAGE_EQUIPMENT2 };
#endif
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    DECLARE_MESSAGE_MAP()
public:
    virtual BOOL OnInitDialog();
};
SourceCode/Bond/Servo/CHMPropertyDlg.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,212 @@
// CEquipmentDlg.cpp: å®žçŽ°æ–‡ä»¶
//
#include "stdafx.h"
#include "Servo.h"
#include "CHMPropertyDlg.h"
#include "afxdialogex.h"
#include "HmTab.h"
// CEquipmentDlg å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CHMPropertyDlg, CDialogEx)
CHMPropertyDlg::CHMPropertyDlg(CWnd* pParent /*=nullptr*/)
    : CDialogEx(IDD_DIALOG_PROPERTY, pParent)
{
    m_crBkgnd = APPDLG_BACKGROUND_COLOR;
    m_hbrBkgnd = nullptr;
    m_nWndWidth = 0;
    m_nWndHeight = 0;
}
CHMPropertyDlg::CHMPropertyDlg(const char* pszTitle, int width, int height)
    : CDialogEx(IDD_DIALOG_PROPERTY, nullptr)
{
    m_crBkgnd = APPDLG_BACKGROUND_COLOR;
    m_hbrBkgnd = nullptr;
    m_nWndWidth = width;
    m_nWndHeight = height;
    m_strTitle = pszTitle;
}
CHMPropertyDlg::~CHMPropertyDlg()
{
}
void CHMPropertyDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CHMPropertyDlg, CDialogEx)
    ON_WM_CTLCOLOR()
    ON_WM_DESTROY()
    ON_WM_SIZE()
    ON_NOTIFY(BYHMTAB_SEL_CHANGED, IDC_TAB1, &CHMPropertyDlg::OnTabSelChanged)
    ON_BN_CLICKED(IDOK, &CHMPropertyDlg::OnBnClickedOk)
    ON_BN_CLICKED(IDC_BUTTON_APPLY, &CHMPropertyDlg::OnBnClickedButtonApply)
END_MESSAGE_MAP()
// CEquipmentDlg æ¶ˆæ¯å¤„理程序
void CHMPropertyDlg::addPage(CHMPropertyPage* pPage, const char* pszName)
{
    pPage->SetWindowTextA(pszName);
    m_pages.push_back(pPage);
}
BOOL CHMPropertyDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();
    if (m_nWndWidth != 0 && m_nWndHeight != 0) {
        SetWindowPos(nullptr, 0, 0, m_nWndWidth, m_nWndHeight, SWP_NOMOVE);
        CenterWindow();
    }
    SetWindowText(m_strTitle);
    // Tab
    CString strTitle;
    CHmTab* m_pTab = CHmTab::Hook(GetDlgItem(IDC_TAB1)->m_hWnd);
    m_pTab->SetPaddingLeft(20);
    m_pTab->SetItemMarginLeft(18);
    for (int i = 0; i < m_pages.size(); i++) {
        m_pages[i]->SetParent(this);
        m_pages[i]->GetWindowText(strTitle);
        m_pTab->AddItem(strTitle, i == m_pages.size() - 1);
    }
    m_pTab->SetCurSel(0);
    ShowChildPage(0);
    Resize();
    return TRUE;  // return TRUE unless you set the focus to a control
                  // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
}
HBRUSH CHMPropertyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
    if (nCtlColor == CTLCOLOR_STATIC) {
        pDC->SetBkColor(m_crBkgnd);
        pDC->SetTextColor(RGB(0, 0, 0));
    }
    if (m_hbrBkgnd == nullptr) {
        m_hbrBkgnd = CreateSolidBrush(m_crBkgnd);
    }
    return m_hbrBkgnd;
}
void CHMPropertyDlg::OnDestroy()
{
    CDialogEx::OnDestroy();
    for (auto item : m_pages) {
        item->DestroyWindow();
        delete item;
    }
    if (m_hbrBkgnd != nullptr) {
        ::DeleteObject(m_hbrBkgnd);
    }
}
void CHMPropertyDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);
    if (GetDlgItem(IDC_TAB1) == nullptr) return;
    Resize();
}
void CHMPropertyDlg::Resize()
{
    CWnd* pItem;
    CRect rcClient, rcItem;
    GetClientRect(&rcClient);
    int x2, y, y2;
    x2 = rcClient.right - 12;
    y = 0;
    y2 = rcClient.bottom - 12;
    pItem = GetDlgItem(IDC_TAB1);
    pItem->GetWindowRect(&rcItem);
    pItem->MoveWindow(0, y, rcClient.Width(), rcItem.Height());
    y += rcItem.Height();
    // [确定]按钮
    pItem = GetDlgItem(IDOK);
    pItem->GetWindowRect(&rcItem);
    pItem->MoveWindow(x2 - rcItem.Width(), y2 - rcItem.Height(),
        rcItem.Width(), rcItem.Height());
    x2 -= rcItem.Width();
    x2 -= 8;
    // [应用]按钮
    pItem = GetDlgItem(IDC_BUTTON_APPLY);
    pItem->GetWindowRect(&rcItem);
    pItem->MoveWindow(x2 - rcItem.Width(), y2 - rcItem.Height(),
        rcItem.Width(), rcItem.Height());
    y2 -= rcItem.Height();
    y2 -= 12;
    // åˆ†éš”线
    pItem = GetDlgItem(IDC_LINE1);
    pItem->GetWindowRect(&rcItem);
    pItem->MoveWindow(0, y2, rcClient.Width(), rcItem.Height());
    for (auto item : m_pages) {
        item->MoveWindow(0, y, rcClient.Width(), y2 - y);
    }
}
void CHMPropertyDlg::OnTabSelChanged(NMHDR* nmhdr, LRESULT* result)
{
    BYHMTAB_NMHDR* pNmhdrex = (BYHMTAB_NMHDR*)nmhdr;
    ShowChildPage((int)pNmhdrex->dwData);
    *result = 0;
}
void CHMPropertyDlg::ShowChildPage(unsigned int index)
{
    ASSERT(index < m_pages.size());
    for (int i = 0; i < m_pages.size(); i++) {
        m_pages[i]->ShowWindow(i == index ? SW_SHOW : SW_HIDE);
    }
}
void CHMPropertyDlg::SetWindowSize(int width, int height)
{
    m_nWndWidth = width;
    m_nWndHeight = height;
}
void CHMPropertyDlg::OnBnClickedOk()
{
    for (auto item : m_pages) {
        item->OnApply();
    }
    CDialogEx::OnOK();
}
void CHMPropertyDlg::OnBnClickedButtonApply()
{
    for (int i = 0; i < m_pages.size(); i++) {
        if (m_pages[i]->IsWindowVisible()) {
            m_pages[i]->OnApply();
        }
    }
}
SourceCode/Bond/Servo/CHMPropertyDlg.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
#pragma once
#include <vector>
#include "CHMPropertyPage.h"
// CEquipmentDlg å¯¹è¯æ¡†
class CHMPropertyDlg : public CDialogEx
{
    DECLARE_DYNAMIC(CHMPropertyDlg)
public:
    CHMPropertyDlg(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    CHMPropertyDlg(const char* pszTitle, int width, int height);
    virtual ~CHMPropertyDlg();
public:
    void addPage(CHMPropertyPage* pPage, const char* pszName);
    void ShowChildPage(unsigned int index);
    void SetWindowSize(int width, int height);
private:
    void Resize();
private:
    COLORREF m_crBkgnd;
    HBRUSH m_hbrBkgnd;
    CString m_strTitle;
    std::vector<CHMPropertyPage*> m_pages;
    int m_nWndWidth;
    int m_nWndHeight;
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_PROPERTY };
#endif
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    DECLARE_MESSAGE_MAP()
public:
    virtual BOOL OnInitDialog();
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    afx_msg void OnDestroy();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnTabSelChanged(NMHDR* nmhdr, LRESULT* result);
    afx_msg void OnBnClickedOk();
    afx_msg void OnBnClickedButtonApply();
};
SourceCode/Bond/Servo/CHMPropertyPage.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
#include "stdafx.h"
#include "CHMPropertyPage.h"
IMPLEMENT_DYNAMIC(CHMPropertyPage, CDialogEx)
CHMPropertyPage::CHMPropertyPage(UINT nID, CWnd* pPage) : CDialogEx(nID, pPage)
{
}
CHMPropertyPage::~CHMPropertyPage()
{
}
void CHMPropertyPage::OnApply()
{
}
SourceCode/Bond/Servo/CHMPropertyPage.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
#pragma once
class CHMPropertyPage : public CDialogEx
{
    DECLARE_DYNAMIC(CHMPropertyPage)
public:
    CHMPropertyPage(UINT nID, CWnd* pPage);            // æ ‡å‡†æž„造函数
    virtual ~CHMPropertyPage();                        // æžæž„函数
    virtual void OnApply();
};
SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -5,6 +5,9 @@
#include "Servo.h"
#include "CPageGraph2.h"
#include "afxdialogex.h"
#include "CHMPropertyDlg.h"
#include "CEquipmentPage1.h"
#include "CEquipmentPage2.h"
// CPageGraph2 å¯¹è¯æ¡†
@@ -80,6 +83,20 @@
    };
    listener.onDblckEqItem = [&](EQITEM* pItem) -> bool {
        ASSERT(pItem);
        SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
        CHMPropertyDlg dlg(pEquipment->getName().c_str(), 600, 680);
        CEquipmentPage1* pPage1 = new CEquipmentPage1();
        pPage1->setEquipment(pEquipment);
        pPage1->Create(IDD_PAGE_EQUIPMENT1);
        dlg.addPage(pPage1, "test1");
        CEquipmentPage2* pPage2 = new CEquipmentPage2();
        pPage2->setEquipment(pEquipment);
        pPage2->Create(IDD_PAGE_EQUIPMENT2);
        dlg.addPage(pPage2, "Glass");
        dlg.DoModal();
        return true;
    };
    listener.onRclickEqItem = [&](EQITEM* pItem) -> bool {
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/Servo.vcxproj
@@ -215,9 +215,13 @@
    <ClInclude Include="CEqModeStep.h" />
    <ClInclude Include="CEqProcessStep.h" />
    <ClInclude Include="CEqStatusStep.h" />
    <ClInclude Include="CEquipmentPage1.h" />
    <ClInclude Include="CEquipmentPage2.h" />
    <ClInclude Include="CEqVCREnableStep.h" />
    <ClInclude Include="CFliper.h" />
    <ClInclude Include="CGlass.h" />
    <ClInclude Include="CHMPropertyDlg.h" />
    <ClInclude Include="CHMPropertyPage.h" />
    <ClInclude Include="CLoadPort.h" />
    <ClInclude Include="CMeasurement.h" />
    <ClInclude Include="ColorTransfer.h" />
@@ -284,9 +288,13 @@
    <ClCompile Include="CEqModeStep.cpp" />
    <ClCompile Include="CEqProcessStep.cpp" />
    <ClCompile Include="CEqStatusStep.cpp" />
    <ClCompile Include="CEquipmentPage1.cpp" />
    <ClCompile Include="CEquipmentPage2.cpp" />
    <ClCompile Include="CEqVCREnableStep.cpp" />
    <ClCompile Include="CFliper.cpp" />
    <ClCompile Include="CGlass.cpp" />
    <ClCompile Include="CHMPropertyDlg.cpp" />
    <ClCompile Include="CHMPropertyPage.cpp" />
    <ClCompile Include="CLoadPort.cpp" />
    <ClCompile Include="CMeasurement.cpp" />
    <ClCompile Include="ColorTransfer.cpp" />
SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -75,6 +75,10 @@
    <ClCompile Include="CPageGraph2.cpp" />
    <ClCompile Include="CGlass.cpp" />
    <ClCompile Include="CPath.cpp" />
    <ClCompile Include="CEquipmentPage1.cpp" />
    <ClCompile Include="CEquipmentPage2.cpp" />
    <ClCompile Include="CHMPropertyPage.cpp" />
    <ClCompile Include="CHMPropertyDlg.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="AlarmManager.h" />
@@ -148,6 +152,10 @@
    <ClInclude Include="CPageGraph2.h" />
    <ClInclude Include="CGlass.h" />
    <ClInclude Include="CPath.h" />
    <ClInclude Include="CEquipmentPage1.h" />
    <ClInclude Include="CEquipmentPage2.h" />
    <ClInclude Include="CHMPropertyPage.h" />
    <ClInclude Include="CHMPropertyDlg.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="Servo.rc" />
SourceCode/Bond/Servo/resource.h
Binary files differ