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