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