home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n08 / sketchsc.exe / SKETCH.CPP < prev    next >
C/C++ Source or Header  |  1995-08-01  |  4KB  |  157 lines

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