Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1.  
  2. // zezancijaView.cpp : implementation of the CzezancijaView class
  3. //
  4.  
  5. #include "stdafx.h"
  6. // SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail
  7. // and search filter handlers and allows sharing of document code with that project.
  8. #ifndef SHARED_HANDLERS
  9. #include "zezancija.h"
  10. #endif
  11.  
  12. #include "zezancijaDoc.h"
  13. #include "zezancijaView.h"
  14.  
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #endif
  18.  
  19.  
  20. // CzezancijaView
  21.  
  22. IMPLEMENT_DYNCREATE(CzezancijaView, CView)
  23.  
  24. BEGIN_MESSAGE_MAP(CzezancijaView, CView)
  25. // Standard printing commands
  26. ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
  27. ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
  28. ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CzezancijaView::OnFilePrintPreview)
  29. ON_WM_CONTEXTMENU()
  30. ON_WM_RBUTTONUP()
  31. END_MESSAGE_MAP()
  32.  
  33. // CzezancijaView construction/destruction
  34.  
  35. CzezancijaView::CzezancijaView()
  36. {
  37. // TODO: add construction code here
  38.  
  39. }
  40.  
  41. CzezancijaView::~CzezancijaView()
  42. {
  43. }
  44.  
  45. BOOL CzezancijaView::PreCreateWindow(CREATESTRUCT& cs)
  46. {
  47. // TODO: Modify the Window class or styles here by modifying
  48. // the CREATESTRUCT cs
  49.  
  50. return CView::PreCreateWindow(cs);
  51. }
  52.  
  53. // CzezancijaView drawing
  54.  
  55. CRect windowSize;
  56.  
  57. void crtanje(CDC*pDC)
  58. {
  59. CPen newPen(PS_SOLID, 5, RGB(48,48,48));
  60. CPen* oldPen = pDC->SelectObject(&newPen);
  61.  
  62. CBrush newBrush(RGB(255, 0, 0));
  63. CBrush* oldBrush = pDC->SelectObject(&newBrush);
  64.  
  65. pDC->MoveTo(windowSize.right * 0.9, windowSize.bottom);
  66. pDC->LineTo(windowSize.right * 0.9, windowSize.bottom * 0.9);
  67.  
  68. CPoint* dashboardPoints = new CPoint[4];
  69.  
  70. dashboardPoints[0].SetPoint(windowSize.right * 0.9, windowSize.bottom * 0.9);
  71. dashboardPoints[1].SetPoint(windowSize.right * 0.50, windowSize.bottom * 0.80);
  72. dashboardPoints[2].SetPoint(windowSize.right * 0.50, windowSize.bottom * 0.80);
  73. dashboardPoints[3].SetPoint(windowSize.right * 0.1, windowSize.bottom * 0.9);
  74.  
  75. pDC->PolyBezier(dashboardPoints, 4);
  76.  
  77. pDC->MoveTo(windowSize.right * 0.1, windowSize.bottom);
  78. pDC->LineTo(windowSize.right * 0.1, windowSize.bottom * 0.9);
  79.  
  80. CPen newPen2(PS_SOLID, 0, RGB(48, 48, 48));
  81. pDC->SelectObject(&newPen2);
  82. newPen.DeleteObject();
  83.  
  84. pDC->MoveTo(windowSize.right * 0.1, windowSize.bottom * 0.999);
  85. pDC->LineTo(windowSize.right * 0.9, windowSize.bottom * 0.999);
  86. //pDC->Rectangle(windowSize.right * 0.2, windowSize.bottom * 0.3, windowSize.right * 0.5, windowSize.bottom * 0.5);
  87. pDC->FloodFill(windowSize.right * 0.2, windowSize.bottom * 0.98, RGB(48, 48, 48));
  88.  
  89. CPoint* trianglePoints = new CPoint[3];
  90.  
  91. trianglePoints[0].SetPoint(windowSize.right * 0.6, windowSize.bottom * 0.6);
  92. trianglePoints[1].SetPoint(windowSize.right * 0.2, windowSize.bottom * 0.95);
  93. trianglePoints[2].SetPoint(windowSize.right * 0.4, windowSize.bottom * 0.3);
  94.  
  95. //pDC->Polygon(trianglePoints, 3);
  96.  
  97. pDC->SelectObject(oldPen);
  98. newPen2.DeleteObject();
  99. pDC->SelectObject(oldBrush);
  100. newBrush.DeleteObject();
  101. }
  102.  
  103. void Background(CDC*pDC)
  104. {
  105.  
  106.  
  107. }
  108.  
  109. void CzezancijaView::OnDraw(CDC* pDC)
  110. {
  111. CzezancijaDoc* pDoc = GetDocument();
  112. ASSERT_VALID(pDoc);
  113. if (!pDoc)
  114. return;
  115.  
  116. // TODO: add draw code for native data here
  117. GetClientRect(&windowSize);
  118. //pDC -> Rectangle(windowSize.right * 0.1, windowSize.bottom * 0.1, windowSize.right * 0.5, windowSize.bottom * 0.5);
  119.  
  120. crtanje(pDC);
  121. }
  122.  
  123.  
  124. // CzezancijaView printing
  125.  
  126.  
  127. void CzezancijaView::OnFilePrintPreview()
  128. {
  129. #ifndef SHARED_HANDLERS
  130. AFXPrintPreview(this);
  131. #endif
  132. }
  133.  
  134. BOOL CzezancijaView::OnPreparePrinting(CPrintInfo* pInfo)
  135. {
  136. // default preparation
  137. return DoPreparePrinting(pInfo);
  138. }
  139.  
  140. void CzezancijaView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  141. {
  142. // TODO: add extra initialization before printing
  143. }
  144.  
  145. void CzezancijaView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  146. {
  147. // TODO: add cleanup after printing
  148. }
  149.  
  150. void CzezancijaView::OnRButtonUp(UINT /* nFlags */, CPoint point)
  151. {
  152. ClientToScreen(&point);
  153. OnContextMenu(this, point);
  154. }
  155.  
  156. void CzezancijaView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
  157. {
  158. #ifndef SHARED_HANDLERS
  159. theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
  160. #endif
  161. }
  162.  
  163.  
  164. // CzezancijaView diagnostics
  165.  
  166. #ifdef _DEBUG
  167. void CzezancijaView::AssertValid() const
  168. {
  169. CView::AssertValid();
  170. }
  171.  
  172. void CzezancijaView::Dump(CDumpContext& dc) const
  173. {
  174. CView::Dump(dc);
  175. }
  176.  
  177. CzezancijaDoc* CzezancijaView::GetDocument() const // non-debug version is inline
  178. {
  179. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CzezancijaDoc)));
  180. return (CzezancijaDoc*)m_pDocument;
  181. }
  182. #endif //_DEBUG
  183.  
  184.  
  185. // CzezancijaView message handlers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement