home *** CD-ROM | disk | FTP | other *** search
/ VRML Tools for 3D Cyberspace / VRML_Tools_For_3D_Cyberspace.iso / amber / demos / framed / mfc20 / framed.cpp < prev    next >
C/C++ Source or Header  |  1996-07-01  |  4KB  |  154 lines

  1. // framed.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "framed.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "framedoc.h"
  9. #include "framevw.h"
  10.  
  11. #include "amber.hpp"
  12.  
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char BASED_CODE THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CFramedApp
  20.  
  21. BEGIN_MESSAGE_MAP(CFramedApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CFramedApp)
  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. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CFramedApp construction
  34.  
  35. CFramedApp::CFramedApp()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CFramedApp object
  43.  
  44. CFramedApp theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CFramedApp initialization
  48.  
  49. BOOL CFramedApp::InitInstance()
  50. {
  51.     // Standard initialization
  52.     // If you are not using these features and wish to reduce the size
  53.     //  of your final executable, you should remove from the following
  54.     //  the specific initialization routines you do not need.
  55.  
  56.     amber = new amberClass();
  57.     universeClass *univ = new universeClass();
  58.  
  59.     Enable3dControls();
  60.  
  61.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  62.  
  63.     // Register the application's document templates.  Document templates
  64.     //  serve as the connection between documents, frame windows and views.
  65.  
  66.     CSingleDocTemplate* pDocTemplate;
  67.     pDocTemplate = new CSingleDocTemplate(
  68.         IDR_MAINFRAME,
  69.         RUNTIME_CLASS(CFramedDoc),
  70.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  71.         RUNTIME_CLASS(CFramedView));
  72.     AddDocTemplate(pDocTemplate);
  73.  
  74.     // Enable DDE Execute open
  75.     EnableShellOpen();
  76.     RegisterShellFileTypes();
  77.  
  78.     // simple command line parsing
  79.     if (m_lpCmdLine[0] == '\0')
  80.     {
  81.         // create a new (empty) document
  82.         OnFileNew();
  83.     }
  84.     else
  85.     {
  86.         // open an existing document
  87.         OpenDocumentFile(m_lpCmdLine);
  88.     }
  89.  
  90.     // Enable drag/drop open
  91.     m_pMainWnd->DragAcceptFiles();
  92.  
  93.     return TRUE;
  94. }
  95.  
  96. /////////////////////////////////////////////////////////////////////////////
  97. // CAboutDlg dialog used for App About
  98.  
  99. class CAboutDlg : public CDialog
  100. {
  101. public:
  102.     CAboutDlg();
  103.  
  104. // Dialog Data
  105.     //{{AFX_DATA(CAboutDlg)
  106.     enum { IDD = IDD_ABOUTBOX };
  107.     //}}AFX_DATA
  108.  
  109. // Implementation
  110. protected:
  111.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  112.     //{{AFX_MSG(CAboutDlg)
  113.         // No message handlers
  114.     //}}AFX_MSG
  115.     DECLARE_MESSAGE_MAP()
  116. };
  117.  
  118. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  119. {
  120.     //{{AFX_DATA_INIT(CAboutDlg)
  121.     //}}AFX_DATA_INIT
  122. }
  123.  
  124. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  125. {
  126.     CDialog::DoDataExchange(pDX);
  127.     //{{AFX_DATA_MAP(CAboutDlg)
  128.     //}}AFX_DATA_MAP
  129. }
  130.  
  131. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  132.     //{{AFX_MSG_MAP(CAboutDlg)
  133.         // No message handlers
  134.     //}}AFX_MSG_MAP
  135. END_MESSAGE_MAP()
  136.  
  137. // App command to run the dialog
  138. void CFramedApp::OnAppAbout()
  139. {
  140.     CAboutDlg aboutDlg;
  141.     aboutDlg.DoModal();
  142. }
  143.  
  144. /////////////////////////////////////////////////////////////////////////////
  145. // CFramedApp commands
  146.  
  147. int CFramedApp::ExitInstance() 
  148. {
  149.     // TODO: Add your specialized code here and/or call the base class
  150.     delete amber;
  151.  
  152.     return CWinApp::ExitInstance();
  153. }
  154.