RTDemoView.h
上传用户:oy0519
上传日期:2008-01-20
资源大小:124k
文件大小:3k
源码类别:

绘图程序

开发平台:

Visual C++

  1. // RTDemoView.h : interface of the CRTDemoView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_RTDemoVIEW_H__12551283_E7E7_11D3_85BC_0008C777FFEE__INCLUDED_)
  5. #define AFX_RTDemoVIEW_H__12551283_E7E7_11D3_85BC_0008C777FFEE__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "RealTime.h"
  10. #include "RTSlider.h"
  11. #include "random.h"
  12. class CRTDemoView : public CView
  13. {
  14. // just want to save time using temporary variables
  15. int    i, m, n;
  16. double m_dY, m_dValue;
  17. protected: // create from serialization only
  18. CRTDemoView();
  19. DECLARE_DYNCREATE(CRTDemoView)
  20. // Attributes
  21. public:
  22. CRTDemoDoc* GetDocument();
  23. CRealTime  m_Graph;
  24. RndGen Rn;
  25. DWORD  m_nStartTime;
  26. int    m_nTimeSpan;
  27. DWORD  MaxSeconds;
  28. DWORD  mSec;
  29. double CyclesPerSec;
  30. DWORD  CurrentTime;
  31. BOOL   m_bCanSize;
  32. CRTSlider m_SliderTick;
  33. CRect   m_SRect;
  34. int   m_sSize;
  35. int   m_sTicks;
  36. BOOL   m_bFlag;
  37. BOOL   CanTicks;
  38. DWORD   m_nTicks;
  39. BOOL   m_bRealTime;
  40. BOOL   m_bTimerOn;
  41. // Operations
  42. public:
  43. void DrawFrame(CRect& rect, COLORREF cr, const char* Title);
  44. void Redraw();
  45. void SetData(int i);
  46. void RefreshGraph();
  47. RECT& GetGraphRect();
  48. CWnd* GetRTForm();
  49. void  ResetSlider(int Ticks);
  50. void  GetYValues(int Index);
  51. void  TicksRanges();
  52. void  RTKillTimer();
  53. void  RTRestoreTimer();
  54. void  RemoveALine(int Index);
  55. BOOL  InsertALine(int index, COLORREF color, double low, double high, 
  56.   const char* name, const char* desc, const char* unit, 
  57.   double min, double max, int style, int width);
  58. void  SaveAModifiedLine();
  59. void  GetColorAndName(int index, COLORREF& cr, CString& name);
  60. // Overrides
  61. // ClassWizard generated virtual function overrides
  62. //{{AFX_VIRTUAL(CRTDemoView)
  63. public:
  64. virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  65. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  66. virtual void OnInitialUpdate();
  67. protected:
  68. virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  69. virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  70. virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  71. //}}AFX_VIRTUAL
  72. // Implementation
  73. public:
  74. virtual ~CRTDemoView();
  75. #ifdef _DEBUG
  76. virtual void AssertValid() const;
  77. virtual void Dump(CDumpContext& dc) const;
  78. #endif
  79. protected:
  80. CString m_sString;
  81. DWORD   MillSeconds;
  82. int SpeedLevel;
  83. // Generated message map functions
  84. protected:
  85. afx_msg void OnContextMenu(CWnd*, CPoint point);
  86. //{{AFX_MSG(CRTDemoView)
  87. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  88. afx_msg void OnTimer(UINT nIDEvent);
  89. afx_msg void OnDestroy();
  90. afx_msg void OnSize(UINT nType, int cx, int cy);
  91. afx_msg void OnSpeedTimerspeed();
  92. afx_msg void OnUpdateSpeedTimerspeed(CCmdUI* pCmdUI);
  93. //}}AFX_MSG
  94. DECLARE_MESSAGE_MAP()
  95. };
  96. #ifndef _DEBUG  // debug version in RTDemoView.cpp
  97. inline CRTDemoDoc* CRTDemoView::GetDocument()
  98.    { return (CRTDemoDoc*)m_pDocument; }
  99. #endif
  100. /////////////////////////////////////////////////////////////////////////////
  101. //{{AFX_INSERT_LOCATION}}
  102. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  103. #endif // !defined(AFX_RTDemoVIEW_H__12551283_E7E7_11D3_85BC_0008C777FFEE__INCLUDED_)