0024002: Overall code and build procedure refactoring - samples
[occt.git] / samples / mfc / standard / 04_Viewer3d / src / Viewer3dApp.cpp
1 // Viewer3dApp.cpp : Defines the class behaviors for the application.
2 //
3
4 #include "stdafx.h"
5 #include "Viewer3dApp.h"
6
7 #include <OCC_MainFrame.h>
8 #include <OCC_3dChildFrame.h>
9 #include "Viewer3dDoc.h"
10 #include "Viewer3dView.h"
11
12 /////////////////////////////////////////////////////////////////////////////
13 // CViewer3dApp
14
15 BEGIN_MESSAGE_MAP(CViewer3dApp, CWinApp)
16         //{{AFX_MSG_MAP(CViewer3dApp)
17         ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
18                 // NOTE - the ClassWizard will add and remove mapping macros here.
19                 //    DO NOT EDIT what you see in these blocks of generated code!
20         //}}AFX_MSG_MAP
21         // Standard file based document commands
22         ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
23         ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
24 END_MESSAGE_MAP()
25
26 /////////////////////////////////////////////////////////////////////////////
27 // CViewer3dApp construction
28
29 CViewer3dApp::CViewer3dApp() : OCC_App()
30 {
31   SampleName = "Viewer3d"; //for about dialog
32   SetSamplePath (L"..\\..\\03_Viewer3d");
33 }
34
35 /////////////////////////////////////////////////////////////////////////////
36 // The one and only CViewer3dApp object
37
38 CViewer3dApp theApp;
39
40 /////////////////////////////////////////////////////////////////////////////
41 // CViewer3dApp initialization
42
43 BOOL CViewer3dApp::InitInstance()
44 {
45         AfxEnableControlContainer();
46
47         // Standard initialization
48         // If you are not using these features and wish to reduce the size
49         //  of your final executable, you should remove from the following
50         //  the specific initialization routines you do not need.
51
52         // Change the registry key under which our settings are stored.
53         // You should modify this string to be something appropriate
54         // such as the name of your company or organization.
55         SetRegistryKey(_T("Local AppWizard-Generated Applications"));
56
57         LoadStdProfileSettings();  // Load standard INI file options (including MRU)
58
59         // Register the application's document templates.  Document templates
60         //  serve as the connection between documents, frame windows and views.
61
62         CMultiDocTemplate* pDocTemplate;
63         pDocTemplate = new CMultiDocTemplate(
64                 IDR_3DTYPE,
65                 RUNTIME_CLASS(CViewer3dDoc),
66                 RUNTIME_CLASS(OCC_3dChildFrame), // custom MDI child frame
67                 RUNTIME_CLASS(CViewer3dView));
68         AddDocTemplate(pDocTemplate);
69
70         // create main MDI Frame window
71         OCC_MainFrame* pMainFrame = new OCC_MainFrame(with_AIS_TB);
72         if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
73                 return FALSE;
74         m_pMainWnd = pMainFrame;
75
76         // Parse command line for standard shell commands, DDE, file open
77         CCommandLineInfo cmdInfo;
78         ParseCommandLine(cmdInfo);
79
80         // Dispatch commands specified on the command line
81         if (!ProcessShellCommand(cmdInfo))
82                 return FALSE;
83
84         // The main window has been initialized, so show and update it.
85         pMainFrame->ShowWindow(m_nCmdShow);
86         pMainFrame->UpdateWindow();
87
88         return TRUE;
89 }
90
91
92 /////////////////////////////////////////////////////////////////////////////
93 // CViewer3dApp commands