0023776: Redesign of MFC samples after V2d viewer removing
[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 }
33
34 /////////////////////////////////////////////////////////////////////////////
35 // The one and only CViewer3dApp object
36
37 CViewer3dApp theApp;
38
39 /////////////////////////////////////////////////////////////////////////////
40 // CViewer3dApp initialization
41
42 BOOL CViewer3dApp::InitInstance()
43 {
44         AfxEnableControlContainer();
45
46         // Standard initialization
47         // If you are not using these features and wish to reduce the size
48         //  of your final executable, you should remove from the following
49         //  the specific initialization routines you do not need.
50
51         // Change the registry key under which our settings are stored.
52         // You should modify this string to be something appropriate
53         // such as the name of your company or organization.
54         SetRegistryKey(_T("Local AppWizard-Generated Applications"));
55
56         LoadStdProfileSettings();  // Load standard INI file options (including MRU)
57
58         // Register the application's document templates.  Document templates
59         //  serve as the connection between documents, frame windows and views.
60
61         CMultiDocTemplate* pDocTemplate;
62         pDocTemplate = new CMultiDocTemplate(
63                 IDR_3DTYPE,
64                 RUNTIME_CLASS(CViewer3dDoc),
65                 RUNTIME_CLASS(OCC_3dChildFrame), // custom MDI child frame
66                 RUNTIME_CLASS(CViewer3dView));
67         AddDocTemplate(pDocTemplate);
68
69         // create main MDI Frame window
70         OCC_MainFrame* pMainFrame = new OCC_MainFrame(with_AIS_TB);
71         if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
72                 return FALSE;
73         m_pMainWnd = pMainFrame;
74
75         // Parse command line for standard shell commands, DDE, file open
76         CCommandLineInfo cmdInfo;
77         ParseCommandLine(cmdInfo);
78
79         // Dispatch commands specified on the command line
80         if (!ProcessShellCommand(cmdInfo))
81                 return FALSE;
82
83         // The main window has been initialized, so show and update it.
84         pMainFrame->ShowWindow(m_nCmdShow);
85         pMainFrame->UpdateWindow();
86
87         return TRUE;
88 }
89
90
91 /////////////////////////////////////////////////////////////////////////////
92 // CViewer3dApp commands