123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- // TestWizardToolDlg.h : 头文件
- //
- #pragma once
- #include "afxwin.h"
- // 按钮id起始值;
- #define BTNID 11000
- #define WM_IR_SHOT_IMG WM_USER + 10012
- #define NAME_LEN 32
- #define DESC_LEN 128
- #define VALUE_LEN 16
- typedef struct __BTN_INFO__
- {
- CMFCButton *pBTN;
- bool bUsed;
- bool bCreated;
- __BTN_INFO__(){
- pBTN = NULL;
- bUsed = false;
- bCreated = false;
- }
- }BTNInfo, *pBTNInfo;
- // layout.xml item;
- typedef struct __KEY_INFO__
- {
- bool bUse;
- std::string strName;
- std::string strDesc;
- std::string strValue;
- std::string strType;
- int width;
- int height;
- DWORD color;
- BTNInfo *pbtnInfo;
- __KEY_INFO__(){
- pbtnInfo = NULL;
- bUse = false;
- }
- }KeyInfo, *pKeyInfo;
- // CTestWizardToolDlg 对话框
- class CTestWizardToolDlg : public CDialog
- {
- // 构造
- public:
- CTestWizardToolDlg(CWnd* pParent = NULL); // 标准构造函数
- // 对话框数据
- enum { IDD = IDD_TESTWIZARDTOOL_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();
- afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
- DECLARE_MESSAGE_MAP()
- public:
- int m_nCols;
- int m_nRowSpacing;
- int m_nColSpacing;
- int m_nDefaultWidth;
- int m_nDefaultHeight;
- int m_nTopMargin;
- int m_nLeftMargin;
- CComboBox m_cbCOM;
- CComboBox m_cbSignals;
- int m_nComboHeight;
- std::vector<std::string> m_vtPorts;
- std::vector<KeyInfo> m_vtKeyInfo;
- std::map<UINT, KeyInfo*> m_map_key;
- std::vector<std::string> m_vtTWSignal;
- std::vector<BTNInfo*> m_vtBTNInfo;
- CBaseSerial m_Serial;
- CRect m_rcGroup;
- void AdjustLayout();
- void InitSerialCombobox();
- void InitCommandCombobox();
- void LoadSignals();
- void LoadKeyInfo(std::vector<KeyInfo> &vtKeyInfo, std::string path);
- void ConvertOldSignalsToNew(std::string strOldSignal, std::string strNewSignal);
- BTNInfo *GetUnUseBTN();
- void SetBTNStatus(BTNInfo *pbtnInfo, BOOL bStatus = TRUE);
- void SetAllBTNUnUsed();
- void ClearAllBTNInfo();
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
- afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
- afx_msg void OnSignalBtnClick(UINT uId);
- afx_msg void OnBnClickedOpenCom();
- afx_msg void OnCbnSelchangeSingals();
- afx_msg void OnBnClickedReloadSignal();
- afx_msg void OnDestroy();
- protected:
- virtual void OnOK();
- // 自动根据Combobox选项长度设置宽度;
- void AutoSetDroppedWidth(CComboBox* pCombobox);
- public:
- CMFCButton m_btnOpen;
- CMFCButton m_btnReload;
- void InitBtnStyle();
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- CStatic m_stGroup;
- };
|