MainFrm.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. // MainFrm.h: CMainFrame 类的接口
  12. //
  13. #pragma once
  14. #include "FileView.h"
  15. #include "ClassView.h"
  16. #include "OutputWnd.h"
  17. #include "IRControlWnd.h"
  18. #include "CalendarBar.h"
  19. #include "Resource.h"
  20. #include "SATHelperDoc.h"
  21. #include "SATHelperView.h"
  22. #include "ChildFrm.h"
  23. #include "DeviceView.h"
  24. #include "UB530View.h"
  25. #include "filehelper.h"
  26. #include "DevicesWnd.h"
  27. #include "UpgradeWnd.h"
  28. //////////////////////////////////////////////////////////////////////////
  29. #include "TrayIcon.h"
  30. #define USE_TRAYICON 1
  31. // 状态栏消息;
  32. #define MSG_STATUS_BAR (WM_USER + 101)
  33. class COutlookBar : public CMFCOutlookBar
  34. {
  35. virtual BOOL AllowShowOnPaneMenu() const { return TRUE; }
  36. virtual void GetPaneName(CString& strName) const { BOOL bNameValid = strName.LoadString(IDS_OUTLOOKBAR); ASSERT(bNameValid); if (!bNameValid) strName.Empty(); }
  37. };
  38. class CMainFrame : public CMDIFrameWndEx
  39. {
  40. DECLARE_DYNAMIC(CMainFrame)
  41. public:
  42. CMainFrame() noexcept;
  43. // 特性
  44. public:
  45. CSATHelperDoc* m_pDoc;
  46. CFormView* m_pActiveView;
  47. CChildFrame* m_pViewIDE[10];
  48. CChildFrame* m_pUB530View;
  49. CChildFrame* m_pDeviceView;
  50. // 操作
  51. public:
  52. // 重写
  53. public:
  54. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  55. // 实现
  56. public:
  57. virtual ~CMainFrame();
  58. #ifdef _DEBUG
  59. virtual void AssertValid() const;
  60. virtual void Dump(CDumpContext& dc) const;
  61. #endif
  62. protected: // 控件条嵌入成员
  63. CMFCRibbonBar m_wndRibbonBar;
  64. CMFCRibbonApplicationButton m_MainButton;
  65. CMFCToolBarImages m_PanelImages;
  66. CMFCRibbonStatusBar m_wndStatusBar;
  67. #if __DOCKINGBAR__
  68. #if __FC_WIN__
  69. CFileView m_wndFileView;
  70. CClassView m_wndClassView;
  71. #endif
  72. #if __OUT_PUT_WIN__
  73. COutputWnd m_wndOutput;
  74. #endif
  75. CIRControlWnd m_wndIRControl;
  76. CDevicesWnd m_wndDevices;
  77. CUpgradeWnd m_wndUpgrade;
  78. #endif
  79. #if __OUTLOOKBAR__
  80. COutlookBar m_wndNavigationBar;
  81. CMFCShellTreeCtrl m_wndTree;
  82. CCalendarBar m_wndCalendar;
  83. #endif
  84. #if __CAPTIONBAR__
  85. CMFCCaptionBar m_wndCaptionBar;
  86. #endif
  87. // 生成的消息映射函数
  88. protected:
  89. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  90. afx_msg void OnWindowManager();
  91. afx_msg void OnApplicationLook(UINT id);
  92. afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
  93. afx_msg void OnViewCaptionBar();
  94. afx_msg void OnUpdateViewCaptionBar(CCmdUI* pCmdUI);
  95. afx_msg void OnOptions();
  96. afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
  97. afx_msg LRESULT OnMsgStatusBar(WPARAM wParam, LPARAM lParam);
  98. afx_msg void OnClose();
  99. void OnTraymenuExit();
  100. DECLARE_MESSAGE_MAP()
  101. #if __DOCKINGBAR__
  102. BOOL CreateDockingWindows();
  103. void SetDockingWindowIcons(BOOL bHiColorIcons);
  104. #endif
  105. #if __OUTLOOKBAR__
  106. BOOL CreateOutlookBar(CMFCOutlookBar& bar, UINT uiID, CMFCShellTreeCtrl& tree, CCalendarBar& calendar, int nInitialWidth);
  107. #endif
  108. #if __CAPTIONBAR__
  109. BOOL CreateCaptionBar();
  110. #endif
  111. int FindFocusedOutlookWnd(CMFCOutlookBarTabCtrl** ppOutlookWnd);
  112. CMFCOutlookBarTabCtrl* FindOutlookParent(CWnd* pWnd);
  113. CMFCOutlookBarTabCtrl* m_pCurrOutlookWnd;
  114. CMFCOutlookBarPane* m_pCurrOutlookPage;
  115. public:
  116. #if USE_TRAYICON
  117. void InitTrayIcon();
  118. // 托盘是否显示;
  119. BOOL m_isNotify;
  120. // 启动程序时,隐藏或显示对话框,在消息处理程序OnNcPaint()中使用;
  121. BOOL m_bShowNc;
  122. // 是否响应托盘消息;
  123. BOOL m_bNoticeTray;
  124. // 托盘工作类;
  125. ITrayIcon m_trayIcon;
  126. BOOL m_bAutoRuning;
  127. afx_msg LRESULT OnTrayNotification(WPARAM wp, LPARAM lp);
  128. afx_msg LRESULT OnTaskBarCreated(WPARAM wp, LPARAM lp);
  129. void TaskNotifyIcon(); // 托盘的工作内容;
  130. void TrayRight();
  131. #endif
  132. CMFCRibbonButton* GetRibbonButton(int uId) {
  133. return DYNAMIC_DOWNCAST(CMFCRibbonButton, m_wndRibbonBar.FindByID(uId));
  134. }
  135. // 设置状态栏文本;
  136. void SetRibbonStatusBarText(CString strText, int uId) {
  137. if (IsWindow(m_wndStatusBar))
  138. {
  139. CMFCRibbonBaseElement* pElement = m_wndStatusBar.FindByID(uId);
  140. if (pElement)
  141. {
  142. pElement->SetText(strText);
  143. pElement->Redraw();
  144. }
  145. }
  146. }
  147. public:
  148. virtual BOOL PreTranslateMessage(MSG* pMsg);
  149. //afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
  150. afx_msg LRESULT OnRibbonChanged(WPARAM wParam, LPARAM lParam);
  151. // 是否遥控截图;
  152. BOOL m_bShotIR;
  153. public:
  154. //////////////////////////////////////////////////////////////////////////
  155. //Global::BaiduCfg m_bdcfg;
  156. TCHAR m_szBaiduCfgPath[MAX_PATH];
  157. void ReadBaiduCfg(Global::BaiduCfg& bdcfg);
  158. //////////////////////////////////////////////////////////////////////////
  159. // 读取resource_run.cfg
  160. TCHAR m_szRsCfgPath[MAX_PATH];
  161. void ReadRsRunCfg(Global::RsRunCfg& rscfg);
  162. //////////////////////////////////////////////////////////////////////////
  163. // 读取menutree目录;
  164. typedef struct __UI_TREE__
  165. {
  166. std::string ui;
  167. std::vector<std::string> vtSubUI;
  168. }UITree, * pUITree;
  169. std::map<std::string, std::vector<UITree>> m_map_tree;
  170. // 当前选中的MenuTree路径;
  171. TCHAR m_szCurMenuTreeDir[MAX_PATH];
  172. void ReadTreePath();
  173. // 解析json;
  174. void ParseJson();
  175. // 运行设备;
  176. void RunDevice();
  177. std::vector<std::string> m_vtCOM;
  178. void InitCombobox_port();
  179. BOOL IsPortInserted(CMFCRibbonComboBox* pCommbox, LPCTSTR lpPort);
  180. afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
  181. public:
  182. void InitDevicePanel();
  183. // 全步骤截图;
  184. afx_msg void OnCheckFullCut();
  185. afx_msg void OnUpdateCheckFullCut(CCmdUI* pCmdUI);
  186. // 有声按钮;
  187. afx_msg void OnHadSound();
  188. afx_msg void OnUpdateHadSound(CCmdUI* pCmdUI);
  189. // 声音默认按钮;
  190. afx_msg void OnDefSound();
  191. afx_msg void OnUpdateDefSound(CCmdUI* pCmdUI);
  192. // 声音等级编辑框;
  193. // OCR账号下拉框;
  194. afx_msg void OnComboxOcr();
  195. afx_msg void OnUpdateComboxOcr(CCmdUI* pCmdUI);
  196. // MenuTree项目下拉框;
  197. afx_msg void OnComboProduct();
  198. afx_msg void OnUpdateComboProduct(CCmdUI* pCmdUI);
  199. // MenuTree UI下拉框;
  200. afx_msg void OnComboUi();
  201. afx_msg void OnUpdateComboUi(CCmdUI* pCmdUI);
  202. // MenuTree 子UI下拉框;
  203. afx_msg void OnComboSubUi();
  204. afx_msg void OnUpdateComboSubUi(CCmdUI* pCmdUI);
  205. // 信号仪1下拉框;
  206. afx_msg void OnCombo1_22293();
  207. afx_msg void OnUpdateCombo1_22293(CCmdUI* pCmdUI);
  208. // 信号仪2下拉框;
  209. afx_msg void OnCombo2_22293();
  210. afx_msg void OnUpdateCombo2_22293(CCmdUI* pCmdUI);
  211. // 信号仪1CheckBox;
  212. afx_msg void OnCheck1_22293();
  213. afx_msg void OnUpdateCheck1_22293(CCmdUI* pCmdUI);
  214. // 信号仪2CheckBox;
  215. afx_msg void OnCheck2_22293();
  216. afx_msg void OnUpdateCheck2_22293(CCmdUI* pCmdUI);
  217. afx_msg void OnCombo2Tv();
  218. afx_msg void OnUpdateCombo2Tv(CCmdUI* pCmdUI);
  219. afx_msg void OnCheckWatchtv();
  220. afx_msg void OnUpdateCheckWatchtv(CCmdUI* pCmdUI);
  221. afx_msg void OnTraymenuLogin();
  222. afx_msg void OnCheckEnabletw();
  223. afx_msg void OnUpdateCheckEnabletw(CCmdUI* pCmdUI);
  224. afx_msg void OnComboTwport();
  225. afx_msg void OnUpdateComboTwport(CCmdUI* pCmdUI);
  226. afx_msg void OnCheckRcontrol();
  227. afx_msg void OnUpdateCheckRcontrol(CCmdUI* pCmdUI);
  228. afx_msg void OnCheckActuator();
  229. afx_msg void OnUpdateCheckActuator(CCmdUI* pCmdUI);
  230. afx_msg void OnTimer(UINT_PTR nIDEvent);
  231. afx_msg void OnComboUsb();
  232. afx_msg void OnUpdateComboUsb(CCmdUI* pCmdUI);
  233. afx_msg void OnCheckUsb();
  234. afx_msg void OnUpdateCheckUsb(CCmdUI* pCmdUI);
  235. afx_msg void OnSwitchUsb();
  236. afx_msg void OnUpdateSwitchUsb(CCmdUI* pCmdUI);
  237. afx_msg void OnComboPower();
  238. afx_msg void OnUpdateComboPower(CCmdUI* pCmdUI);
  239. afx_msg void OnPowerCtrl();
  240. afx_msg void OnUpdatePowerCtrl(CCmdUI* pCmdUI);
  241. afx_msg void OnCheckTvport();
  242. afx_msg void OnUpdateCheckTvport(CCmdUI* pCmdUI);
  243. };