IRControlWnd.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
  2. // (“Fluent UI”)。该示例仅供参考,
  3. // 用以补充《Microsoft 基础类参考》和
  4. // MFC C++ 库软件随附的相关电子文档。
  5. // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
  6. // 若要了解有关 Fluent UI 许可计划的详细信息,请访问
  7. // https://go.microsoft.com/fwlink/?LinkId=238214.
  8. //
  9. // 版权所有(C) Microsoft Corporation
  10. // 保留所有权利。
  11. //#include "DlgIRControl.h"
  12. #include <map>
  13. #pragma once
  14. // 按钮id起始值;
  15. #define BTNID 11000
  16. #define WM_IR_SHOT_IMG WM_USER + 10012
  17. // layout.xml item;
  18. typedef struct __BTN_INFO__
  19. {
  20. std::string name;
  21. int width;
  22. int height;
  23. DWORD color;
  24. CMFCButton *pBTN = nullptr;
  25. bool bEnable = false;
  26. }BtnInfo, *pBtnInfo;
  27. class CIRControlToolBar : public CMFCToolBar
  28. {
  29. public:
  30. virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler)
  31. {
  32. CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler);
  33. }
  34. virtual BOOL AllowShowOnList() const { return FALSE; }
  35. };
  36. class CIRControlWnd : public CDockablePane
  37. {
  38. // 构造
  39. public:
  40. CIRControlWnd() noexcept;
  41. void AdjustLayout();
  42. // 特性
  43. public:
  44. protected:
  45. CFont m_fntPropList;
  46. // 重启服务端进程;
  47. CMFCButton m_btnRestart;
  48. // 信号集文件;
  49. CComboBox m_wndSignalCombo;
  50. // 选择通用遥控器;
  51. CMFCButton m_wndSignalCheck;
  52. #if __PANE_DLG__
  53. CDlgIRControl m_dlgIRControl;
  54. #endif
  55. // TREE一级选项;
  56. CComboBox m_cbTree1;
  57. // TREE二级选项;
  58. CComboBox m_cbTree2;
  59. // TREE三级;
  60. CComboBox m_cbTree3;
  61. // 实现
  62. public:
  63. virtual ~CIRControlWnd();
  64. // 去掉关闭按钮;但组合多个pane时无效;
  65. virtual BOOL CanBeClosed() const { return FALSE; };
  66. // 禁止拖动Pane;
  67. virtual BOOL FloatPane(CRect rectFloat, AFX_DOCK_METHOD dockMethod = DM_UNKNOWN, bool bShow = true) { return FALSE; }
  68. // 禁用停靠,双击底部无效(不会停靠)
  69. virtual BOOL CanFloat() const { return FALSE; };
  70. // 禁用大小;//崩溃;
  71. //virtual BOOL IsResizable() const {return FALSE;}
  72. protected:
  73. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  74. afx_msg void OnSize(UINT nType, int cx, int cy);
  75. afx_msg void OnExpandAllProperties();
  76. afx_msg void OnUpdateExpandAllProperties(CCmdUI* pCmdUI);
  77. afx_msg void OnSortProperties();
  78. afx_msg void OnUpdateSortProperties(CCmdUI* pCmdUI);
  79. afx_msg void OnProperties1();
  80. afx_msg void OnUpdateProperties1(CCmdUI* pCmdUI);
  81. afx_msg void OnProperties2();
  82. afx_msg void OnUpdateProperties2(CCmdUI* pCmdUI);
  83. afx_msg void OnSetFocus(CWnd* pOldWnd);
  84. afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
  85. // 下拉框选项变化事件;
  86. afx_msg void OnCbnSelchangeSignal();
  87. afx_msg void OnCbnSelchangeTree1();
  88. afx_msg void OnCbnSelchangeTree2();
  89. afx_msg void OnCbnSelchangeTree3();
  90. DECLARE_MESSAGE_MAP()
  91. void SetPropListFont();
  92. int m_nComboHeight;
  93. // 重启红老鼠;
  94. void StartIRDevice(BOOL bReStart = TRUE);
  95. // 禁用信号按钮;
  96. void DisableSignalBtn() {
  97. for (std::vector<BtnInfo>::iterator it = m_vtBtnInfo.begin(); it != m_vtBtnInfo.end(); it++)
  98. {
  99. it->bEnable = false;
  100. }
  101. }
  102. public:
  103. // 重载信号文件;
  104. void ReLoadSignalXml();
  105. std::map<UINT, BtnInfo&> m_map_btn;
  106. std::vector<std::string> m_vtsignal_gen;
  107. std::vector<std::string> m_vtsignal_pro;
  108. std::vector<std::string> m_vtsignal_tw;
  109. void LoadSignals();
  110. std::vector<BtnInfo> m_vtBtnInfo;
  111. void Loadlayout(std::vector<BtnInfo> &vt);
  112. afx_msg void OnPaint();
  113. // 单击按钮;
  114. afx_msg void OnSignalBtnClick(UINT uId);
  115. // 更新按钮状态;
  116. afx_msg void OnUpdateSignalBtn(CCmdUI* pCmdUI);
  117. // 更新checkbox状态;
  118. afx_msg void OnUpdateCheckBox(CCmdUI * pCmdUI);
  119. afx_msg void OnCheckBoxClicked();
  120. // 更新重启按钮状态;
  121. afx_msg void OnUpdateBtnRestartProc(CCmdUI* pCmdUI);
  122. afx_msg void OnBtnRestartProcClicked();
  123. // 更新按钮实际状态;
  124. void UpdateSignalBtnStatus();
  125. // 自动根据Combobox选项长度设置宽度;
  126. void AutoSetDroppedWidth(CComboBox* pCombobox);
  127. // CCombobox添加水平滚动条;
  128. void AddHScroll(CComboBox* pCombobox);
  129. //////////////////////////////////////////////////////////////////////////
  130. // 读取resource_run.cfg配置文件内容;
  131. typedef struct __RS_RUN_CFG__
  132. {
  133. std::string sound_list; // 声音级别;
  134. std::string sound1;
  135. std::string sound2;
  136. std::string full_cut; // 是否全步骤截图;('True/False')
  137. //....
  138. std::string tg39_port;
  139. std::string tv_port;
  140. std::string sat_home;
  141. std::string sat_result_dir;
  142. std::string chroma22293;
  143. //...
  144. std::string menutree_chip;
  145. std::string menutree_style;
  146. std::string menutree_channel;
  147. //...
  148. std::string chroma1;
  149. std::string chroma2;
  150. // 是否监听电视;
  151. bool bWatchTV;
  152. }RsRunCfg, * pRsRunCfg;
  153. RsRunCfg m_rscfg;
  154. void ReadResourceRunCfg();
  155. // 读取menutree目录;
  156. typedef struct __UI_TREE__
  157. {
  158. std::string ui;
  159. std::vector<std::string> vtSubUI;
  160. }UITree, * pUITree;
  161. std::map<std::string, std::vector<UITree>> m_map_tree;
  162. // 当前选中的MenuTree路径;
  163. TCHAR m_szCurMenuTreeDir[MAX_PATH];
  164. // 初始化MenuTree下拉框;
  165. void LoadMenuTreePath();
  166. void InitMenuTreeCombobox();
  167. // 遥控截图自定义消息;
  168. BOOL m_bSendKey;
  169. afx_msg LRESULT OnIRShotImg(WPARAM wparam, LPARAM lparam);
  170. };