IDEView.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. #pragma once
  2. //#include "IDE.h"
  3. #include "drawobj.h"
  4. #include "graph.h"
  5. #include "IDEDoc.h"
  6. #define VIEW_USE_THREAD 0
  7. class CIDEView : public CScrollView
  8. {
  9. protected: // create from serialization only
  10. CIDEView();
  11. DECLARE_DYNCREATE(CIDEView)
  12. // Attributes
  13. public:
  14. CIDEDoc* GetDocument();
  15. UINT m_nID;
  16. CPoint m_pointMouse;
  17. CPoint m_startPoint,m_endPoint; //起始点
  18. CPoint m_lastPoint; //上一个点
  19. BOOL m_bMove; //能移动否
  20. BOOL m_bMoveElements; //是否有可移动的东西;
  21. BOOL m_mouseState;
  22. BOOL m_bHandle;
  23. BOOL m_bModified;
  24. CGraph* m_pGraph;
  25. CDrawObjList m_selection;
  26. CDrawObjList m_freezed;
  27. CDrawObjList m_copied;
  28. CDrawObjList m_deleted;
  29. CDrawObj * m_tempObj;
  30. CDrawObj * m_pCurActionObj; // 用来响应动作的当前图元;
  31. int m_nCurActionType; // 当前响应的动作类型,为了清除某些动作效果;
  32. int nDragHandle; //图元句柄,标识鼠标位置
  33. int nBDragHandle; //保持
  34. BOOL m_bDrag;
  35. BOOL m_bFreezed; //冻结状态
  36. BOOL m_bRectSelect; //区选
  37. CRect m_mouseRect;
  38. //字体
  39. int m_nRudoPosition; //undo位置
  40. int m_nCanUndoTimes; //可以undo数
  41. int m_nCanRedoTimes; //可以redo数
  42. bool m_bPolygon;
  43. CTime m_tblTime;
  44. #if VIEW_USE_THREAD
  45. HANDLE m_hIDEViewRunObject;
  46. HANDLE m_hFreshGraphThread;
  47. CRITICAL_SECTION m_csFreshGraph;
  48. HANDLE m_hFreshGraphObject;
  49. static DWORD WINAPI CIDEView::FreshGraphThread( void *pData );
  50. #endif
  51. // Operations
  52. public:
  53. // Overrides
  54. // ClassWizard generated virtual function overrides
  55. //{{AFX_VIRTUAL(CIDEView)
  56. public:
  57. virtual void OnDraw(CDC* pDC); // overridden to draw this view
  58. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  59. virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  60. protected:
  61. virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  62. virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  63. virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  64. virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
  65. virtual void OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView);
  66. //}}AFX_VIRTUAL
  67. // Implementation
  68. public:
  69. void SetHisTime(CTime time);
  70. void ChangeView();
  71. CDrawObj * CreateDrawObjbyNo(int objNo);
  72. virtual ~CIDEView();
  73. #ifdef _DEBUG
  74. virtual void AssertValid() const;
  75. virtual void Dump(CDumpContext& dc) const;
  76. #endif
  77. void KeyMove(int x1,int y1,int x2,int y2);
  78. BOOL IsSelected(CDrawObj* pDrawObj);
  79. void Select(CDrawObj* pObj, BOOL bAdd);
  80. void Remove(CDrawObj* pObj);
  81. CDrawObj* ObjectAt(CPoint point);
  82. void RefreshScrollSizes(void);
  83. CRect GetAlignRect(void);
  84. void ObjectIn(); //区域选
  85. void ExchangeSave(); //有改动记录
  86. void FileProcess(); //undo redo后,处理临时文件的改名
  87. protected:
  88. private:
  89. CString RegSearch(HKEY hKey, TCHAR rootKey[], CString path,CString sContent);
  90. void ShowOCX( CRect rect,CString sOcxPath,int iIndex,CString sPageName );
  91. CWnd m_OcxWnd;
  92. bool m_bOcxCreate;
  93. CString GetClsidbyName( CString sName );
  94. public:
  95. bool m_bIsHaveOCX;
  96. // Generated message map functions
  97. protected:
  98. //{{AFX_MSG(CIDEView)
  99. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  100. afx_msg void OnDestroy();
  101. afx_msg void OnEditUnfreeze();
  102. afx_msg void OnEditPaste();
  103. afx_msg void OnEditMovetofront();
  104. afx_msg void OnEditMovetoback();
  105. afx_msg void OnEditHinvert();
  106. afx_msg void OnEditFreeze();
  107. afx_msg void OnEditCut();
  108. afx_msg void OnEditCopy();
  109. afx_msg void OnEditDelete();
  110. afx_msg void OnDeskGrid();
  111. afx_msg void OnAlignTop();
  112. afx_msg void OnAlignVcenter();
  113. afx_msg void OnAlignRight();
  114. afx_msg void OnAlignLeft();
  115. afx_msg void OnAlignHcenter();
  116. afx_msg void OnAlignBottom();
  117. afx_msg void OnEditVinvert();
  118. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  119. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  120. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  121. afx_msg void OnPointer();
  122. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  123. afx_msg void OnFileNew();
  124. afx_msg void OnFileOpen();
  125. afx_msg void OnFileSave();
  126. afx_msg void OnFileSaveAs();
  127. afx_msg void OnAppExit();
  128. afx_msg void OnUpdateDeskGrid(CCmdUI* pCmdUI);
  129. afx_msg void OnUpdateEditFreeze(CCmdUI* pCmdUI);
  130. afx_msg void OnRedo();
  131. afx_msg void OnUndo();
  132. afx_msg void OnUpdateUndo(CCmdUI* pCmdUI);
  133. afx_msg void OnUpdateRedo(CCmdUI* pCmdUI);
  134. afx_msg void OnPicsize();
  135. afx_msg void OnUpdateAlignBottom(CCmdUI* pCmdUI);
  136. afx_msg void OnUpdateAlignHcenter(CCmdUI* pCmdUI);
  137. afx_msg void OnUpdateAlignLeft(CCmdUI* pCmdUI);
  138. afx_msg void OnUpdateAlignRight(CCmdUI* pCmdUI);
  139. afx_msg void OnUpdateAlignTop(CCmdUI* pCmdUI);
  140. afx_msg void OnUpdateAlignVcenter(CCmdUI* pCmdUI);
  141. afx_msg void OnUpdateEditHinvert(CCmdUI* pCmdUI);
  142. afx_msg void OnUpdateEditMovetoback(CCmdUI* pCmdUI);
  143. afx_msg void OnUpdateEditMovetofront(CCmdUI* pCmdUI);
  144. afx_msg void OnUpdateEditVinvert(CCmdUI* pCmdUI);
  145. afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
  146. afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
  147. afx_msg void OnUpdateEditClear(CCmdUI* pCmdUI);
  148. afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
  149. afx_msg void OnDrawTline();
  150. afx_msg void OnDrawText();
  151. afx_msg void OnDrawRect();
  152. afx_msg void OnDrawData();
  153. afx_msg void OnDraw3drect();
  154. afx_msg void OnDraw3circle();
  155. afx_msg void OnUpdatePointer(CCmdUI* pCmdUI);
  156. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  157. afx_msg void OnTimer(UINT nIDEvent);
  158. afx_msg void OnUpdateDraw3circle(CCmdUI* pCmdUI);
  159. afx_msg void OnUpdateDraw3drect(CCmdUI* pCmdUI);
  160. afx_msg void OnUpdateDrawData(CCmdUI* pCmdUI);
  161. afx_msg void OnUpdateDrawText(CCmdUI* pCmdUI);
  162. afx_msg void OnUpdateDrawTline(CCmdUI* pCmdUI);
  163. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  164. afx_msg void OnEditSave();
  165. afx_msg void OnUpdateEditSave(CCmdUI* pCmdUI);
  166. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  167. afx_msg void OnUpdateDrawRect(CCmdUI* pCmdUI);
  168. afx_msg void OnUpdatePicsize(CCmdUI* pCmdUI);
  169. afx_msg void OnDrawBitmap();
  170. afx_msg void OnUpdateDrawBitmap(CCmdUI* pCmdUI);
  171. afx_msg void OnDrawCurve();
  172. afx_msg void OnUpdateDrawCurve(CCmdUI* pCmdUI);
  173. afx_msg void OnDrawWatch();
  174. afx_msg void OnUpdateDrawWatch(CCmdUI* pCmdUI);
  175. afx_msg void OnDrawBar();
  176. afx_msg void OnUpdateDrawBar(CCmdUI* pCmdUI);
  177. afx_msg void OnVerspace();
  178. afx_msg void OnUpdateVerspace(CCmdUI* pCmdUI);
  179. afx_msg void OnSamewidth();
  180. afx_msg void OnUpdateSamewidth(CCmdUI* pCmdUI);
  181. afx_msg void OnSameheight();
  182. afx_msg void OnUpdateSameheight(CCmdUI* pCmdUI);
  183. afx_msg void OnHorspace();
  184. afx_msg void OnUpdateHorspace(CCmdUI* pCmdUI);
  185. afx_msg void OnAllsame();
  186. afx_msg void OnUpdateAllsame(CCmdUI* pCmdUI);
  187. afx_msg void OnOpenpic();
  188. afx_msg void OnDrawArc();
  189. afx_msg void OnDrawBreaker();
  190. afx_msg void OnDrawFan();
  191. afx_msg void OnDrawGrid();
  192. afx_msg void OnDrawHiscurve();
  193. afx_msg void OnDrawLine();
  194. afx_msg void OnDrawPie();
  195. afx_msg void OnDrawPipe();
  196. afx_msg void OnDrawPolygon();
  197. afx_msg void OnDrawReport();
  198. afx_msg void OnDrawSinglebar();
  199. afx_msg void OnDrawTransfer();
  200. afx_msg void OnDrawYpipe();
  201. afx_msg void OnDrawZheline();
  202. afx_msg void OnDrawZhepipe();
  203. afx_msg void OnDrawArrow();
  204. afx_msg void OnDrawEllipse();
  205. afx_msg void OnDrawSwitch();
  206. afx_msg void OnCombine();
  207. afx_msg void OnDiscombine();
  208. afx_msg void OnDrawRoundrect();
  209. afx_msg void OnDrawOCX();
  210. afx_msg void OnDrawGIF();
  211. afx_msg void OnDrawFlash();
  212. afx_msg void OnDrawBtnRadio();
  213. afx_msg void OnDrawBtnCheck();
  214. afx_msg void OnUpdateDrawSwitch(CCmdUI* pCmdUI);
  215. afx_msg void OnUpdateDrawArc(CCmdUI* pCmdUI);
  216. afx_msg void OnUpdateDrawArrow(CCmdUI* pCmdUI);
  217. afx_msg void OnUpdateDrawBreaker(CCmdUI* pCmdUI);
  218. afx_msg void OnUpdateDrawEllipse(CCmdUI* pCmdUI);
  219. afx_msg void OnUpdateDrawFan(CCmdUI* pCmdUI);
  220. afx_msg void OnUpdateDrawGrid(CCmdUI* pCmdUI);
  221. afx_msg void OnUpdateDrawHiscurve(CCmdUI* pCmdUI);
  222. afx_msg void OnUpdateDrawPie(CCmdUI* pCmdUI);
  223. afx_msg void OnUpdateDrawPipe(CCmdUI* pCmdUI);
  224. afx_msg void OnUpdateDrawPolygon(CCmdUI* pCmdUI);
  225. afx_msg void OnUpdateDrawReport(CCmdUI* pCmdUI);
  226. afx_msg void OnUpdateDrawSinglebar(CCmdUI* pCmdUI);
  227. afx_msg void OnUpdateDrawTransfer(CCmdUI* pCmdUI);
  228. afx_msg void OnUpdateDrawYpipe(CCmdUI* pCmdUI);
  229. afx_msg void OnUpdateDrawZheline(CCmdUI* pCmdUI);
  230. afx_msg void OnUpdateDrawZhepipe(CCmdUI* pCmdUI);
  231. afx_msg void OnUpdateDrawLine(CCmdUI* pCmdUI);
  232. afx_msg void OnUpdateDrawRoundrect(CCmdUI* pCmdUI);
  233. afx_msg void OnUpdateDiscombine(CCmdUI* pCmdUI);
  234. afx_msg void OnUpdateCombine(CCmdUI* pCmdUI);
  235. afx_msg void OnUpdateDrawOCX(CCmdUI* pCmdUI);
  236. afx_msg void OnUpdateDrawGIF(CCmdUI* pCmdUI);
  237. afx_msg void OnUpdateDrawFlash(CCmdUI* pCmdUI);
  238. //}}AFX_MSG
  239. afx_msg long OnOutbarNotify(WPARAM wParam, LPARAM lParam);
  240. DECLARE_MESSAGE_MAP()
  241. public:
  242. afx_msg void OnProperty();
  243. afx_msg void OnUpdateProperty(CCmdUI *pCmdUI);
  244. afx_msg void OnEditVar();
  245. afx_msg void OnUpdateEditVar(CCmdUI *pCmdUI);
  246. afx_msg void OnRealTimeCurve();
  247. afx_msg void OnUpdateRealTimeCurve(CCmdUI *pCmdUI);
  248. afx_msg void OnClose();
  249. afx_msg void OnKillFocus(CWnd* pNewWnd);
  250. afx_msg void OnSetFocus(CWnd* pOldWnd);
  251. void FileSave();
  252. protected:
  253. virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
  254. BOOL IsValidChar(char chr);
  255. CString GetVarNameFromGS( CString sGS );
  256. public:
  257. afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
  258. CString m_sVarName;
  259. };
  260. #ifndef _DEBUG // debug version in VectorView.cpp
  261. inline CIDEDoc* CIDEView::GetDocument()
  262. { return (CIDEDoc*)m_pDocument; }
  263. #endif