home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c05 / lab07 / ex02 / diffview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.8 KB  |  126 lines

  1. // diffView.cpp : implementation of the CDiffView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "diff.h"
  6.  
  7. #include "diffDoc.h"
  8. #include "diffView.h"
  9.  
  10. #include "progressstatusbar.h"
  11.  
  12. #include "splitter.h"
  13. #include "mainfrm.h"
  14. #ifdef _DEBUG
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CDiffView
  21.  
  22. IMPLEMENT_DYNCREATE(CDiffView, CRichEditView)
  23.  
  24. BEGIN_MESSAGE_MAP(CDiffView, CRichEditView)
  25.     //{{AFX_MSG_MAP(CDiffView)
  26.     ON_WM_DROPFILES()
  27.     //}}AFX_MSG_MAP
  28.     // Standard printing commands
  29.     ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint)
  30.     ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
  31.     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRichEditView::OnFilePrintPreview)
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CDiffView construction/destruction
  36.  
  37. CDiffView::CDiffView()
  38. {
  39.     // TODO: add construction code here
  40.  
  41. }
  42.  
  43. CDiffView::~CDiffView()
  44. {
  45. }
  46.  
  47. BOOL CDiffView::PreCreateWindow(CREATESTRUCT& cs)
  48. {
  49.     // TODO: Modify the Window class or styles here by modifying
  50.     //  the CREATESTRUCT cs
  51.  
  52.     return CRichEditView::PreCreateWindow(cs);
  53. }
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CDiffView drawing
  57.  
  58. void CDiffView::OnDraw(CDC* pDC)
  59. {
  60.     CDiffDoc* pDoc = GetDocument();
  61.     ASSERT_VALID(pDoc);
  62.  
  63.     // TODO: add draw code for native data here
  64. }
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CDiffView printing
  68.  
  69. BOOL CDiffView::OnPreparePrinting(CPrintInfo* pInfo)
  70. {
  71.     // default preparation
  72.     return DoPreparePrinting(pInfo);
  73. }
  74.  
  75. void CDiffView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  76. {
  77.     // TODO: add extra initialization before printing
  78. }
  79.  
  80. void CDiffView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  81. {
  82.     // TODO: add cleanup after printing
  83. }
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CDiffView diagnostics
  87.  
  88. #ifdef _DEBUG
  89. void CDiffView::AssertValid() const
  90. {
  91.     CRichEditView::AssertValid();
  92. }
  93.  
  94. void CDiffView::Dump(CDumpContext& dc) const
  95. {
  96.     CRichEditView::Dump(dc);
  97. }
  98.  
  99. CDiffDoc* CDiffView::GetDocument() // non-debug version is inline
  100. {
  101.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDiffDoc)));
  102.     return (CDiffDoc*)m_pDocument;
  103. }
  104. #endif //_DEBUG
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CDiffView message handlers
  108.  
  109. void CDiffView::OnInitialUpdate() 
  110. {
  111.     CRichEditView::OnInitialUpdate();
  112.     
  113.     GetRichEditCtrl().SetReadOnly();
  114.     
  115. }
  116.  
  117. void CDiffView::OnDropFiles(HDROP hDropInfo) 
  118. {
  119.     CDiffApp::GetApp()->GetMainFrame()->
  120.         SendMessage ( WM_DROPFILES,
  121.                       (WPARAM)hDropInfo);
  122.     //Don't call the default -- we don't want OLE
  123.     //embedding behavior    
  124.     //CRichEditView::OnDropFiles(hDropInfo);
  125. }
  126.