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