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