shingoesView.cpp
Upload User: tdk119
Upload Date: 2008-01-21
Package Size: 51k
Code Size: 3k
Category:

Graph Drawing

Development Platform:

Visual C++

  1. // shingoesView.cpp : implementation of the CShingoesView class
  2. //
  3. #include "stdafx.h"
  4. #include "shingoes.h"
  5. #include "shingoesDoc.h"
  6. #include "shingoesView.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CShingoesView
  14. IMPLEMENT_DYNCREATE(CShingoesView, CView)
  15. BEGIN_MESSAGE_MAP(CShingoesView, CView)
  16. //{{AFX_MSG_MAP(CShingoesView)
  17. // NOTE - the ClassWizard will add and remove mapping macros here.
  18. //    DO NOT EDIT what you see in these blocks of generated code!
  19. //}}AFX_MSG_MAP
  20. // Standard printing commands
  21. ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  22. ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  23. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  24. END_MESSAGE_MAP()
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CShingoesView construction/destruction
  27. CShingoesView::CShingoesView()
  28. {
  29. // TODO: add construction code here
  30. }
  31. CShingoesView::~CShingoesView()
  32. {
  33. }
  34. BOOL CShingoesView::PreCreateWindow(CREATESTRUCT& cs)
  35. {
  36. // TODO: Modify the Window class or styles here by modifying
  37. //  the CREATESTRUCT cs
  38. return CView::PreCreateWindow(cs);
  39. }
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CShingoesView drawing
  42. void CShingoesView::OnDraw(CDC* pDC)
  43. {
  44. CShingoesDoc* pDoc = GetDocument();
  45. ASSERT_VALID(pDoc);
  46. // TODO: add draw code for native data here
  47. CRect rect, rectx, recty;
  48. GetClientRect(rect);
  49. rect.DeflateRect(10,10,10,10);
  50. rectx.left = rect.left;
  51. rectx.top = rect.bottom - 20;
  52. rectx.right = rect.right;
  53. rectx.bottom = rect.bottom;
  54. recty.left = rect.left;
  55. recty.top = rect.top;
  56. recty.right = recty.left + 20;
  57. recty.bottom = rect.bottom;
  58. rect.left += 20;
  59. rect.bottom -= 20;
  60. graph.SetGraphRect(rect);
  61. graph.SetXrect(rectx);
  62. graph.SetYrect(recty);
  63. graph.SetDataLength(pDoc->GetDataLength());
  64. graph.SetData(pDoc->GetData());
  65. graph.SetDC(pDC);
  66. graph.Paint();
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CShingoesView printing
  70. BOOL CShingoesView::OnPreparePrinting(CPrintInfo* pInfo)
  71. {
  72. // default preparation
  73. return DoPreparePrinting(pInfo);
  74. }
  75. void CShingoesView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  76. {
  77. // TODO: add extra initialization before printing
  78. }
  79. void CShingoesView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  80. {
  81. // TODO: add cleanup after printing
  82. }
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CShingoesView diagnostics
  85. #ifdef _DEBUG
  86. void CShingoesView::AssertValid() const
  87. {
  88. CView::AssertValid();
  89. }
  90. void CShingoesView::Dump(CDumpContext& dc) const
  91. {
  92. CView::Dump(dc);
  93. }
  94. CShingoesDoc* CShingoesView::GetDocument() // non-debug version is inline
  95. {
  96. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CShingoesDoc)));
  97. return (CShingoesDoc*)m_pDocument;
  98. }
  99. #endif //_DEBUG
  100. /////////////////////////////////////////////////////////////////////////////
  101. // CShingoesView message handlers