home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c06 / lab05 / baseline / diff.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  3.7 KB  |  147 lines

  1. // diff.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "diff.h"
  6. #include "progress.h"
  7. #include "splitter.h"
  8. #include "diffDoc.h"
  9. #include "diffView.h"
  10. #include "FindDiff.h"
  11. #include "MainFrm.h"
  12.  
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CDiffApp
  20.  
  21. BEGIN_MESSAGE_MAP(CDiffApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CDiffApp)
  23.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27.     // Standard file based document commands
  28.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  29.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  30.     // Standard print setup command
  31.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CDiffApp construction
  36.  
  37. CDiffApp::CDiffApp()
  38. {
  39.     // TODO: add construction code here,
  40.     // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CDiffApp object
  45.  
  46. CDiffApp theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDiffApp initialization
  50.  
  51. BOOL CDiffApp::InitInstance()
  52. {
  53.     AfxEnableControlContainer();
  54.  
  55.     // Standard initialization
  56.     // If you are not using these features and wish to reduce the size
  57.     //  of your final executable, you should remove from the following
  58.     //  the specific initialization routines you do not need.
  59.  
  60. #ifdef _AFXDLL
  61.     Enable3dControls();            // Call this when using MFC in a shared DLL
  62. #else
  63.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  64. #endif
  65.  
  66.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  67.  
  68.     // Register the application's document templates.  Document templates
  69.     //  serve as the connection between documents, frame windows and views.
  70.  
  71.     CSingleDocTemplate* pDocTemplate;
  72.     pDocTemplate = new CSingleDocTemplate(
  73.         IDR_MAINFRAME,
  74.         RUNTIME_CLASS(CDiffDoc),
  75.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  76.         RUNTIME_CLASS(CDiffView));
  77.     AddDocTemplate(pDocTemplate);
  78.  
  79.     // Enable DDE Execute open
  80.     EnableShellOpen();
  81.     RegisterShellFileTypes();
  82.  
  83.     // Parse command line for standard shell commands, DDE, file open
  84.     CCommandLineInfo cmdInfo;
  85.     ParseCommandLine(cmdInfo);
  86.  
  87.     // Dispatch commands specified on the command line
  88.     if (!ProcessShellCommand(cmdInfo))
  89.         return FALSE;
  90.  
  91.     // Enable drag/drop open
  92.     m_pMainWnd->DragAcceptFiles();
  93.  
  94.     return TRUE;
  95. }
  96.  
  97. /////////////////////////////////////////////////////////////////////////////
  98. // CAboutDlg dialog used for App About
  99.  
  100. class CAboutDlg : public CDialog
  101. {
  102. public:
  103.     CAboutDlg();
  104.  
  105. // Dialog Data
  106.     //{{AFX_DATA(CAboutDlg)
  107.     enum { IDD = IDD_ABOUTBOX };
  108.     //}}AFX_DATA
  109.  
  110. // Implementation
  111. protected:
  112.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  113.     //{{AFX_MSG(CAboutDlg)
  114.         // No message handlers
  115.     //}}AFX_MSG
  116.     DECLARE_MESSAGE_MAP()
  117. };
  118.  
  119. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  120. {
  121.     //{{AFX_DATA_INIT(CAboutDlg)
  122.     //}}AFX_DATA_INIT
  123. }
  124.  
  125. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  126. {
  127.     CDialog::DoDataExchange(pDX);
  128.     //{{AFX_DATA_MAP(CAboutDlg)
  129.     //}}AFX_DATA_MAP
  130. }
  131.  
  132. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  133.     //{{AFX_MSG_MAP(CAboutDlg)
  134.         // No message handlers
  135.     //}}AFX_MSG_MAP
  136. END_MESSAGE_MAP()
  137.  
  138. // App command to run the dialog
  139. void CDiffApp::OnAppAbout()
  140. {
  141.     CAboutDlg aboutDlg;
  142.     aboutDlg.DoModal();
  143. }
  144.  
  145. /////////////////////////////////////////////////////////////////////////////
  146. // CDiffApp commands
  147.