123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- // MainFrm.h : CMainFrame 类的接口
- //
- #pragma once
- #include "TRAYICON.H"
- #include "ViewManager.h"
- #include "WindowManager.h"
- #include "DlgBmp.h"
- #include "ChildFrm.h"
- #include "OOExToolBar.h"
- #include "DlgComport.h"
- #include "IDEDoc.h"
- #include "Dlg_ToolBar.h"
- #include "Dlg_ZuTaiAdd.h"
- #include "DlgOfTop.h"
- #define USE_NEWTOP 0 // [7/27/2013 Zero]
- #define WM_MY_NEW_ALERT WM_USER + 102
- #define VIEW_MAX_NUM 1000 //画面最大数
- typedef struct tag_PIC_VAR {
- CString sPicPath;
- CString sCaption[1000];
- int nType[1000];//0:m_bVariant 1:m_strDynShow
- } PIC_VAR;
- class CMDIAutoHideFrame;
- class CMainFrame : public CMDIAutoHideFrame
- {
- DECLARE_DYNAMIC(CMainFrame)
- public:
- CMainFrame();
- // 属性
- public:
- //////////////////////////////////
- // Tab View 变量
- CViewManager m_wndViewManager;
- CMDIClient m_MDIClient;
- ////////////////////////////////
- //TrayIcon相关变量
- CTrayIcon m_trayIcon; // my tray icon
- BOOL m_bShutdown; // OK to terminate TRAYTEST
- BOOL m_bShowTrayNotifications; // display info in main window
- //左边树形
- CcHnDockPageBar m_hleftDockBar; // 左边停靠栏 [8/6/2013 Zero]
- CTreeCtrl m_wndTree;
- //通知列表
- CDockPageBar m_hbottomDockBar; // 底部停靠栏 [8/6/2013 Zero]
- //上面工具栏
- CDockPageBar m_htopDockBar; // 顶端停靠栏 [8/6/2013 Zero]
- #if USE_NEWTOP
- CDlg_ToolBar *m_pToolBar;
- #else
- CDlgOfTop *m_wndOfTop;
- #endif
- WINDOWPLACEMENT m_wpPrev;
- CRect m_FullScreenWindowRect;
- CMenu m_OrgMenu;
- CRect m_mainRect;
- CStatusBar m_wndStatusBar;
- ////////////////////////////////////
- // 子窗体
- CChildFrame *m_pViewIDE[MAX_VIEW_NUM];
- CFormView *m_pActiveView;
- int m_nViewCount;
- CIDEDoc *m_pDoc;
- //CDlgDevice m_wndDevice;
- CDlgComport m_wndComport;
- CDlg_ZuTaiAdd *m_pDlgZuTaiAdd;
- HTREEITEM m_hSerialGroup[MAX_SERIAL_NUM]; //串口组
- HTREEITEM m_hSerialDev[MAX_SERIAL_NUM][MAX_DEVICE_NUM]; //串口设备
- HTREEITEM m_hNetworkDev[MAX_NETWORK_NUM]; //以太网设备
- HANDLE m_hViewPollThread;
-
- protected: // 控件条嵌入成员
- CToolBar m_wndToolBar;
- CToolBar m_wndDrawToolBar;
- CToolBar m_wndDrawAlignBar;
- //COOBmpToolBar m_wndRunToolBar;
- bool m_bHideLeft;
- CDlgBmp* m_dlgControl;
- CImageList m_wndImageList;
- private:
- HTREEITEM m_hMonitor; //监控站
- HTREEITEM m_hIOGroup; //IO
- HTREEITEM m_hScript; //脚本设置
- HTREEITEM m_hActionWithAlarm; //报警联动
- HTREEITEM m_hVariant; //数据字典
- public:
- HTREEITEM m_hSerial; //232设置
- HTREEITEM m_hEtherNet; //以太网设置
- private:
- HTREEITEM m_hAnalog; //变量
- HTREEITEM m_hSystem; //系统参数
- HTREEITEM m_hCurrent; //当前所选
- CPoint m_mousePoint;
- HTREEITEM m_hScriptGroup[MAX_SCRIPT_NUM]; //脚本
- int m_nPortNum, m_nDeviceNum; //串口数和设备数
- int m_nScripts;
- // 操作
- public:
- static DWORD WINAPI ViewPollThread( void *pData );
- void OnEditCommond();
- void ManageHisData();
- void LoadEventPara();
- void StoreEventPara();
- void SetEventPara();
- void StoreRunPara(BOOL bStartRun);
- void HideRunBar();
- void AddIDEView(CString strDesc, CString strPath);
- int GetIDEViewIndex(CString strPath);
- void AddDevice();
- void DeleteDev(int nIsHint);
- void InitTreeInfo(void);
- int FinishedAddDevice(int nIsDelete, CString strUid);
- private:
- BOOL InstallIcons();
- void FileSearch(HTREEITEM hItem, CString strPath, CString strFileName, int nLayer);
- BOOL DirSearch(CString strPath, CString strFileName);
- BOOL FindTreeItem(HTREEITEM hSrcItem, HTREEITEM hDestItem);
- void OnRun();
- int GetIDEViewFreeIndex(CString strPath);
- bool ShowView(void);
- void DeleteDirectory(CString strDir);
- void LoadRunPara();
- void SetRunPara();
- public:
- int GetNetworkChannelIndex();
- int GetFreeSerialTreeItem();
- int GetFreeNetworkTreeItem();
- int GetIndexSerialTreeItem(CString strSrc);
- int GetIndexNetworkTreeItem(CString strSrc);
- int ShowDevProperty(HTREEITEM hSelectedItem);
- void ShowCaptionMenu(BOOL bShow);
- // 重写
- public:
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- // 实现
- public:
- virtual ~CMainFrame();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- // 生成的消息映射函数
- protected:
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- #if USE_TRAYICON
- afx_msg LRESULT OnTrayNotification(WPARAM wp, LPARAM lp);
- afx_msg LRESULT OnTaskBarCreated(WPARAM wp, LPARAM lp);
- #endif
- DECLARE_MESSAGE_MAP()
- public:
- afx_msg void OnClose();
- afx_msg void OnSuperEnd();
- afx_msg void OnTrayOpen();
- protected:
- virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
- public:
- afx_msg void OnAdddevoce();
- afx_msg void OnUpdateAdddevoce(CCmdUI *pCmdUI);
- afx_msg void OnZuTaiAdd();
- afx_msg void OnUpdateZuTaiAdd(CCmdUI *pCmdUI);
- afx_msg void OnDeleteport();
- afx_msg void OnUpdateDeleteport(CCmdUI *pCmdUI);
- afx_msg void OnAddPort();
- afx_msg void OnUpdateAddPort(CCmdUI *pCmdUI);
- afx_msg void OnAddScript();
- afx_msg void OnUpdateAddScript(CCmdUI *pCmdUI);
- afx_msg void OnAddview();
- afx_msg void OnUpdateAddview(CCmdUI *pCmdUI);
- afx_msg void OnAddview2();
- afx_msg void OnUpdateAddview2(CCmdUI *pCmdUI);
- afx_msg void OnEditSort();
- afx_msg void OnUpdateEditSort(CCmdUI *pCmdUI);
- afx_msg void OnDeletedevice();
- afx_msg void OnUpdateDeletedevice(CCmdUI *pCmdUI);
- afx_msg void OnDeleteview();
- afx_msg void OnUpdateDeleteview(CCmdUI *pCmdUI);
- afx_msg void OnModifyViewName();
- afx_msg void OnUpdateModifyViewName(CCmdUI *pCmdUI);
- afx_msg void OnDeletescript();
- afx_msg void OnUpdateDeletescript(CCmdUI *pCmdUI);
- afx_msg void OnSetscript();
- afx_msg void OnUpdateSetscript(CCmdUI *pCmdUI);
- afx_msg void OnEditscript();
- afx_msg void OnUpdateEditscript(CCmdUI *pCmdUI);
- afx_msg void OnDestroy();
- afx_msg void OnUsers();
- afx_msg void OnUpdateUsers(CCmdUI* pCmdUI);
- afx_msg void OnEditPwdTool();
- afx_msg void OnUpdateEditPwd(CCmdUI* pCmdUI);
- afx_msg void OnSysPara();
- afx_msg void OnUpdateSysPare(CCmdUI* pCmdUI);
- afx_msg void OnEventmanage();
- afx_msg void OnEvent();
- afx_msg void OnUpdateEvent(CCmdUI* pCmdUI);
- afx_msg void OnSummaryLog();
- afx_msg void OnUpdateSummaryLog(CCmdUI* pCmdUI);
- afx_msg void OnControldialog();
- afx_msg void OnTimer(UINT nIDEvent);
- afx_msg void OnUserManager();
- afx_msg void OnEditPwd();
- afx_msg void OnSingleAnalog();
- afx_msg void OnUpdateSingleAnalog(CCmdUI* pCmdUI);
- afx_msg void OnGroupManager();
- afx_msg void OnSystemLog();
- afx_msg void OnUpdateSystemLog(CCmdUI* pCmdUI);
- afx_msg void OnNoticeRec();
- afx_msg void OnUpdateNoticeRec(CCmdUI* pCmdUI);
- afx_msg void OnUpdatePrint(CCmdUI* pCmdUI);
- public:
- bool m_bEvent;
- bool m_bPrint;
- bool m_bUsers;
- bool m_bSysPare;
- bool m_bAnalog;
- bool m_bDeviceLog;
- bool m_bSystemLog;
- bool m_bNoticeRec;
- bool m_bEditPwd;
- void MyExpandTree(HTREEITEM hTreeItem);
- void GetCurPicVarToSArray( CString sPicPath );
- protected:
- virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- PIC_VAR m_PIC_VAR[VIEW_MAX_NUM];
- bool GetPicIndexByPicPath( int &iIndex,CString sPicPath );
- bool GetPicPathByVarName( CString &sPicPath,CString sVarName );
- void InsertPicPathToStruct( int iIndex,CString sPicPath );
-
- bool VarIsExistInPic( int iIndex,CString sVarName,int &iInsertIndex );
- void GetVarFromGSAddToStruct( int iIndex,CString sGS );
- BOOL IsValidChar(char chr);
- void OnFullScreen() ;
- WINDOWPLACEMENT m_OldWndPlacement; //用来保存原窗口位置
- BOOL m_FullScreen;//全屏显示标志
- CRect m_FullScreenRect; //表示全屏显示时的窗口位置
- CString m_sPath;
- int GetLevel( CString sContent );
- CString GetPreStr( CString sContent );
- CString GetLastStr( CString sContent );
- void InsertToCStringArray( CStringArray &SA,int iInsertIndex,CString sContent,CString sPath );
- void FileSearchCHN( CStringArray &SA,CStringArray &SATemp,int iInsertIndex, CString strPath, CString strFileName, int nLayer);
- void AddViewToTree( HTREEITEM hItem, CStringArray &SA );
- public:
- bool MakeFolderExist( CString DirectoryName );
- bool CreateDirectoryCHN( CString DirectoryName );
- bool ExistFolder( CString FilePath );
- void CopyDirectory( CString sScrPath,CString sDescPath );
-
- void GetPicPathByTree( HTREEITEM hItemSelect,CString &sPath );
- };
|