EditorDlg.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. // EditorDlg.h : 头文件
  2. //
  3. #pragma once
  4. #include "afxcmn.h"
  5. #include "afxwin.h"
  6. #include "BtnST.h"
  7. // CEditorDlg 对话框
  8. class CEditorDlg : public CDialog
  9. {
  10. // 构造
  11. public:
  12. CEditorDlg(CWnd* pParent = NULL); // 标准构造函数
  13. // 对话框数据
  14. enum { IDD = IDD_EDITOR_DIALOG };
  15. protected:
  16. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
  17. // 实现
  18. protected:
  19. HICON m_hIcon;
  20. // 生成的消息映射函数
  21. virtual BOOL OnInitDialog();
  22. afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  23. afx_msg void OnPaint();
  24. afx_msg HCURSOR OnQueryDragIcon();
  25. DECLARE_MESSAGE_MAP()
  26. public:
  27. CImageList m_imgList;
  28. CTreeCtrl m_CtrlTree;
  29. CPoint m_mousePoint;
  30. #if 1
  31. // 根结点;
  32. HTREEITEM hRunRootItem;
  33. // 设备;
  34. typedef struct _STDeviceItem
  35. {
  36. HTREEITEM hDevice;
  37. CString strDevice;
  38. }STDevice,*pSTDevice;
  39. // 厂家;
  40. typedef struct _STFactoryItem
  41. {
  42. HTREEITEM hFactory;
  43. CString strFactory;
  44. vector <STDevice> vtDevice;
  45. }STFactory,*pSTFactory;
  46. // 类别;
  47. typedef struct _STTreeInfoItem
  48. {
  49. HTREEITEM hType;
  50. CString strType;
  51. vector <STFactory> vtFactory;
  52. }STTreeInfo,*pSTTreeInfo;
  53. // 树信息;
  54. vector <STTreeInfo> vtSTTreeInfo;
  55. #endif
  56. int TypeTreeItem(HTREEITEM &hItem); // 返回指定树项在vtSTTreeInfo中的层信息;
  57. void InitTreeCtrlInfo();
  58. void ClearTreeCtrlInfo(HTREEITEM hItem = NULL);
  59. void InitSTButtons();
  60. void ClearCtrlText(); // 清空所有编辑控件内容;
  61. CString m_strName; // 设备名;
  62. CString m_strOldDeviceName;
  63. CString m_strOldKey;
  64. CString m_strOldMark;
  65. CString m_strDepotPath;
  66. CString m_strRutDepotPath;
  67. protected:
  68. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  69. public:
  70. virtual BOOL DestroyWindow();
  71. public:
  72. CTreeCtrl m_CtrlSubTree;
  73. // 设备下的指令格式的具体项;
  74. typedef struct _STComInfoImplItem
  75. {
  76. HTREEITEM hComInfoImpl;
  77. CString strComInfoImpl;
  78. }STComInfoImplItem,*pSTComInfoImplItem;
  79. // 设备下的指令格式;
  80. typedef struct _STComInfoItem
  81. {
  82. HTREEITEM hComInfo;
  83. CString strComInfo;// = "指令格式";
  84. vector <STComInfoImplItem> vtComInfoImpl;
  85. }STComInfo,*pSTComInfo;
  86. // 指令实现具体项;
  87. typedef struct _STComTableImpl
  88. {
  89. HTREEITEM hComTableImpl;
  90. CString strComTableImpl;
  91. }STComTableImpl,*pSTComTableImpl;
  92. // 指令实现项;
  93. typedef struct _STComTable
  94. {
  95. HTREEITEM hComTable;
  96. CString strComTable;
  97. vector <STComTableImpl> vtComTableImpl;
  98. }STComTable,*pSTComTable;
  99. typedef struct _STComImpl
  100. {
  101. HTREEITEM hComImpl;
  102. CString strComImpl;// "指令实现"
  103. vector <STComTable> vtComTable;
  104. }STComImpl,*pSTComImpl;
  105. // 根结点;
  106. typedef struct _STDeviceImpl
  107. {
  108. HTREEITEM hDevice;
  109. CString strDevice;
  110. STComInfo tSTComInfo;
  111. STComImpl tSTComImpl;
  112. //vector <STComTable> vtComTable;
  113. }STDeviceImpl,pSTDeviceImpl;
  114. STDeviceImpl tSTDeviceImpl;
  115. void InitDeviceComInfo(CString strName);
  116. void ClearTreeInfo(HTREEITEM hItem = NULL);
  117. void InitCommandInfo(HTREEITEM &hItem);
  118. int TypeCommandTreeItem(HTREEITEM &hItem);
  119. CString m_strDeviceName; // 设备名称;
  120. CString m_strDeviceID; // 设备ID号;
  121. CComboBox m_cobRate; // 波特率;
  122. CComboBox m_cobDatabit; // 数据位;
  123. CComboBox m_cobStopbit; // 停止位;
  124. CComboBox m_cobParity; // 校验码;
  125. CString m_strResponseTime; // 响应时间;
  126. CString m_strFrequency; // 采集频率;
  127. CString m_strLineType; // 接线类型;
  128. CString m_strComType; // 通信协议类型;
  129. CString m_strPindef; // 串口接线针角定义;
  130. CString m_strFactory;
  131. CString m_strClassType;
  132. CString m_strDeviceName2;
  133. CString m_strModelNum;
  134. CString m_strSeries;
  135. CString m_strProtocol;
  136. CString m_strCmdSize;
  137. CString m_strCmdKey1;
  138. CString m_strKeyLen;
  139. CComboBox m_cobKeyType;
  140. CString m_strKeyContx1;
  141. CComboBox m_cobStore;
  142. CString m_strMark;
  143. CString m_strCmdTip;
  144. CString m_strCmdKey2;
  145. CString m_strKeyContx2;
  146. CButtonST m_btnModifyDevice;
  147. CButtonST m_btnModifyCmdStyle;
  148. CButtonST m_btnModifyCmdImpl;
  149. afx_msg void OnAdddevice();
  150. afx_msg void OnAddcmdStyle();
  151. afx_msg void OnAddcmdimpl();
  152. afx_msg void OnAddcmdimteimpl();
  153. afx_msg void OnAddDeviceProperty();
  154. afx_msg void OnBnClickedModifydevice();
  155. afx_msg void OnBnClickedModifycmdstyle();
  156. afx_msg void OnBnClickedModifycmdimpl();
  157. afx_msg void OnDeletedevice();
  158. afx_msg void OnDeleteitem();
  159. afx_msg void OnDeletecmdimpl();
  160. protected:
  161. void Enable_1(BOOL bSet);
  162. void Enable_2(BOOL bSet);
  163. void Enable_3(BOOL bSet);
  164. void Expand_Tree_1();
  165. void Expand_Tree_2();
  166. /************************************************************************/
  167. /* */
  168. /************************************************************************/
  169. int m_nCurHeight; //存储对话框中的当前高度,并处理OnVScroll方法中的滚动。
  170. int m_nHeightScrollPos;//来存储当前垂直滚动位置
  171. int m_nCurWidth;
  172. int m_nWidthScrollPos;
  173. CRect m_rect;
  174. public:
  175. afx_msg void OnSize(UINT nType, int cx, int cy);
  176. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  177. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  178. };