darker
2025-02-18 1f5df45b8e213de70e91a7ca54d6e2219cd967ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
// ServoDlg.h : Í·Îļþ
//
 
#pragma once
#include "ServoGraph.h"
#include "BlButton.h"
#include "LogDlg.h"
#include "TerminalDisplayDlg.h"
 
enum DeviceStatus {
    ONLINE,       // ÔÚÏß
    OFFLINE,      // ÀëÏß
};
 
// CServoDlg ¶Ô»°¿ò
class CServoDlg : public CDialogEx
{
// ¹¹Ôì
public:
    CServoDlg(CWnd* pParent = NULL);    // ±ê×¼¹¹Ô캯Êý
 
 
public:
    void ShowTerminalText(const char* pszText, unsigned int duration = -1);
 
private:
    void InitRxWindows();
    void Resize();
    void UpdateLogBtn();
    void UpdateRobotPosition(float percentage);
    void RotateRobot(float angleInDegrees);
    void UpdateDeviceStatus(int id, DeviceStatus status);
 
 
private:
    IObserver* m_pObserver;
    BOOL m_bShowLogWnd;
    CLogDlg* m_pLogDlg;
    CTerminalDisplayDlg* m_pTerminalDisplayDlg;
 
 
// ¶Ô»°¿òÊý¾Ý
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_SERVO_DIALOG };
#endif
 
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV Ö§³Ö
 
 
private:
    BOOL m_bIsRobotMoving;
 
// ÊµÏÖ
protected:
    HICON m_hIcon;
    CServoGraph* m_pGraph;
    COLORREF m_crBkgnd;
    HBRUSH m_hbrBkgnd;
    CBlButton m_btnLog;
 
 
    // Éú³ÉµÄÏûÏ¢Ó³É亯Êý
    virtual BOOL OnInitDialog();
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
    afx_msg void OnPaint();
    afx_msg HCURSOR OnQueryDragIcon();
    DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedOk();
    afx_msg void OnBnClickedCancel();
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    afx_msg void OnDestroy();
    afx_msg void OnBnClickedButtonLog();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnClose();
    afx_msg LRESULT OnLogDlgHide(WPARAM wParam, LPARAM lParam);
    afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
    afx_msg void OnMove(int x, int y);
    afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
    afx_msg void OnMenuFileSettings();
    afx_msg void OnUpdateMenuFileSettings(CCmdUI* pCmdUI);
    afx_msg void OnMenuFileSecsTest();
    afx_msg void OnUpdateMenuFileSecsTest(CCmdUI* pCmdUI);
    afx_msg void OnMenuWndLog();
    afx_msg void OnUpdateMenuWndLog(CCmdUI* pCmdUI);
    afx_msg void OnMenuFileExit();
    afx_msg void OnUpdateMenuFileExit(CCmdUI* pCmdUI);
    afx_msg void OnMenuHelpAbout();
    afx_msg void OnTimer(UINT_PTR nIDEvent);
    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
};