TestWizardToolDlg.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // TestWizardToolDlg.h : 头文件
  2. //
  3. #pragma once
  4. #include "afxwin.h"
  5. // 按钮id起始值;
  6. #define BTNID 11000
  7. #define WM_IR_SHOT_IMG WM_USER + 10012
  8. #define NAME_LEN 32
  9. #define DESC_LEN 128
  10. #define VALUE_LEN 16
  11. typedef struct __BTN_INFO__
  12. {
  13. CMFCButton *pBTN;
  14. bool bUsed;
  15. bool bCreated;
  16. __BTN_INFO__(){
  17. pBTN = NULL;
  18. bUsed = false;
  19. bCreated = false;
  20. }
  21. }BTNInfo, *pBTNInfo;
  22. // layout.xml item;
  23. typedef struct __KEY_INFO__
  24. {
  25. bool bUse;
  26. std::string strName;
  27. std::string strDesc;
  28. std::string strValue;
  29. std::string strType;
  30. int width;
  31. int height;
  32. DWORD color;
  33. BTNInfo *pbtnInfo;
  34. __KEY_INFO__(){
  35. pbtnInfo = NULL;
  36. bUse = false;
  37. }
  38. }KeyInfo, *pKeyInfo;
  39. // CTestWizardToolDlg 对话框
  40. class CTestWizardToolDlg : public CDialog
  41. {
  42. // 构造
  43. public:
  44. CTestWizardToolDlg(CWnd* pParent = NULL); // 标准构造函数
  45. // 对话框数据
  46. enum { IDD = IDD_TESTWIZARDTOOL_DIALOG };
  47. protected:
  48. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
  49. // 实现
  50. protected:
  51. HICON m_hIcon;
  52. // 生成的消息映射函数
  53. virtual BOOL OnInitDialog();
  54. afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  55. afx_msg void OnPaint();
  56. afx_msg HCURSOR OnQueryDragIcon();
  57. afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
  58. DECLARE_MESSAGE_MAP()
  59. public:
  60. int m_nCols;
  61. int m_nRowSpacing;
  62. int m_nColSpacing;
  63. int m_nDefaultWidth;
  64. int m_nDefaultHeight;
  65. int m_nTopMargin;
  66. int m_nLeftMargin;
  67. CComboBox m_cbCOM;
  68. CComboBox m_cbSignals;
  69. int m_nComboHeight;
  70. std::vector<std::string> m_vtPorts;
  71. std::vector<KeyInfo> m_vtKeyInfo;
  72. std::map<UINT, KeyInfo*> m_map_key;
  73. std::vector<std::string> m_vtTWSignal;
  74. std::vector<BTNInfo*> m_vtBTNInfo;
  75. CBaseSerial m_Serial;
  76. CRect m_rcGroup;
  77. void AdjustLayout();
  78. void InitSerialCombobox();
  79. void InitCommandCombobox();
  80. void LoadSignals();
  81. void LoadKeyInfo(std::vector<KeyInfo> &vtKeyInfo, std::string path);
  82. void ConvertOldSignalsToNew(std::string strOldSignal, std::string strNewSignal);
  83. BTNInfo *GetUnUseBTN();
  84. void SetBTNStatus(BTNInfo *pbtnInfo, BOOL bStatus = TRUE);
  85. void SetAllBTNUnUsed();
  86. void ClearAllBTNInfo();
  87. afx_msg void OnSize(UINT nType, int cx, int cy);
  88. afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
  89. afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
  90. afx_msg void OnSignalBtnClick(UINT uId);
  91. afx_msg void OnBnClickedOpenCom();
  92. afx_msg void OnCbnSelchangeSingals();
  93. afx_msg void OnBnClickedReloadSignal();
  94. afx_msg void OnDestroy();
  95. protected:
  96. virtual void OnOK();
  97. // 自动根据Combobox选项长度设置宽度;
  98. void AutoSetDroppedWidth(CComboBox* pCombobox);
  99. public:
  100. CMFCButton m_btnOpen;
  101. CMFCButton m_btnReload;
  102. void InitBtnStyle();
  103. virtual BOOL PreTranslateMessage(MSG* pMsg);
  104. CStatic m_stGroup;
  105. };