123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- // EditorDlg.h : 头文件
- //
- #pragma once
- #include "afxcmn.h"
- #include "afxwin.h"
- #include "BtnST.h"
- // CEditorDlg 对话框
- class CEditorDlg : public CDialog
- {
- // 构造
- public:
- CEditorDlg(CWnd* pParent = NULL); // 标准构造函数
- // 对话框数据
- enum { IDD = IDD_EDITOR_DIALOG };
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
- // 实现
- protected:
- HICON m_hIcon;
- // 生成的消息映射函数
- virtual BOOL OnInitDialog();
- afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- DECLARE_MESSAGE_MAP()
- public:
- CImageList m_imgList;
- CTreeCtrl m_CtrlTree;
- CPoint m_mousePoint;
- #if 1
- // 根结点;
- HTREEITEM hRunRootItem;
- // 设备;
- typedef struct _STDeviceItem
- {
- HTREEITEM hDevice;
- CString strDevice;
- }STDevice,*pSTDevice;
- // 厂家;
- typedef struct _STFactoryItem
- {
- HTREEITEM hFactory;
- CString strFactory;
- vector <STDevice> vtDevice;
- }STFactory,*pSTFactory;
- // 类别;
- typedef struct _STTreeInfoItem
- {
- HTREEITEM hType;
- CString strType;
- vector <STFactory> vtFactory;
- }STTreeInfo,*pSTTreeInfo;
- // 树信息;
- vector <STTreeInfo> vtSTTreeInfo;
- #endif
- int TypeTreeItem(HTREEITEM &hItem); // 返回指定树项在vtSTTreeInfo中的层信息;
- void InitTreeCtrlInfo();
- void ClearTreeCtrlInfo(HTREEITEM hItem = NULL);
- void InitSTButtons();
- void ClearCtrlText(); // 清空所有编辑控件内容;
- CString m_strName; // 设备名;
- CString m_strOldDeviceName;
- CString m_strOldKey;
- CString m_strOldMark;
- CString m_strDepotPath;
- CString m_strRutDepotPath;
- protected:
- virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
- public:
- virtual BOOL DestroyWindow();
- public:
- CTreeCtrl m_CtrlSubTree;
- // 设备下的指令格式的具体项;
- typedef struct _STComInfoImplItem
- {
- HTREEITEM hComInfoImpl;
- CString strComInfoImpl;
- }STComInfoImplItem,*pSTComInfoImplItem;
- // 设备下的指令格式;
- typedef struct _STComInfoItem
- {
- HTREEITEM hComInfo;
- CString strComInfo;// = "指令格式";
- vector <STComInfoImplItem> vtComInfoImpl;
- }STComInfo,*pSTComInfo;
- // 指令实现具体项;
- typedef struct _STComTableImpl
- {
- HTREEITEM hComTableImpl;
- CString strComTableImpl;
- }STComTableImpl,*pSTComTableImpl;
- // 指令实现项;
- typedef struct _STComTable
- {
- HTREEITEM hComTable;
- CString strComTable;
- vector <STComTableImpl> vtComTableImpl;
- }STComTable,*pSTComTable;
- typedef struct _STComImpl
- {
- HTREEITEM hComImpl;
- CString strComImpl;// "指令实现"
- vector <STComTable> vtComTable;
- }STComImpl,*pSTComImpl;
- // 根结点;
- typedef struct _STDeviceImpl
- {
- HTREEITEM hDevice;
- CString strDevice;
- STComInfo tSTComInfo;
- STComImpl tSTComImpl;
- //vector <STComTable> vtComTable;
- }STDeviceImpl,pSTDeviceImpl;
- STDeviceImpl tSTDeviceImpl;
- void InitDeviceComInfo(CString strName);
- void ClearTreeInfo(HTREEITEM hItem = NULL);
- void InitCommandInfo(HTREEITEM &hItem);
- int TypeCommandTreeItem(HTREEITEM &hItem);
- CString m_strDeviceName; // 设备名称;
- CString m_strDeviceID; // 设备ID号;
- CComboBox m_cobRate; // 波特率;
- CComboBox m_cobDatabit; // 数据位;
- CComboBox m_cobStopbit; // 停止位;
- CComboBox m_cobParity; // 校验码;
- CString m_strResponseTime; // 响应时间;
- CString m_strFrequency; // 采集频率;
- CString m_strLineType; // 接线类型;
- CString m_strComType; // 通信协议类型;
- CString m_strPindef; // 串口接线针角定义;
-
- CString m_strFactory;
- CString m_strClassType;
- CString m_strDeviceName2;
- CString m_strModelNum;
- CString m_strSeries;
- CString m_strProtocol;
- CString m_strCmdSize;
- CString m_strCmdKey1;
- CString m_strKeyLen;
- CComboBox m_cobKeyType;
- CString m_strKeyContx1;
- CComboBox m_cobStore;
- CString m_strMark;
- CString m_strCmdTip;
- CString m_strCmdKey2;
- CString m_strKeyContx2;
- CButtonST m_btnModifyDevice;
- CButtonST m_btnModifyCmdStyle;
- CButtonST m_btnModifyCmdImpl;
- afx_msg void OnAdddevice();
- afx_msg void OnAddcmdStyle();
- afx_msg void OnAddcmdimpl();
- afx_msg void OnAddcmdimteimpl();
- afx_msg void OnAddDeviceProperty();
- afx_msg void OnBnClickedModifydevice();
- afx_msg void OnBnClickedModifycmdstyle();
- afx_msg void OnBnClickedModifycmdimpl();
- afx_msg void OnDeletedevice();
- afx_msg void OnDeleteitem();
- afx_msg void OnDeletecmdimpl();
- protected:
- void Enable_1(BOOL bSet);
- void Enable_2(BOOL bSet);
- void Enable_3(BOOL bSet);
- void Expand_Tree_1();
- void Expand_Tree_2();
- /************************************************************************/
- /* */
- /************************************************************************/
- int m_nCurHeight; //存储对话框中的当前高度,并处理OnVScroll方法中的滚动。
- int m_nHeightScrollPos;//来存储当前垂直滚动位置
- int m_nCurWidth;
- int m_nWidthScrollPos;
- CRect m_rect;
- public:
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- };
|