1 /* -*- c++ -*-
2 FILE: MagicCube4d.cpp
3 RCS REVISION: $Revision: 1.8 $
4
5 COPYRIGHT: (c) 1999 -- 2003 Melinda Green, Don Hatch, and Jay Berkenbilt - Superliminal Software
6
7 LICENSE: Free to use and modify for non-commercial purposes as long as the
8 following conditions are adhered to:
9 1) Obvious credit for the source of this code and the designs it embodies
10 are clearly made, and
11 2) Ports and derived versions of 4D Magic Cube programs are not distributed
12 without the express written permission of the authors.
13
14 DESCRIPTION:
15 MagicCube4d.cpp : Defines the class behaviors for the application.
16 */
17
18 #include "Stdafx.h"
19 #include "MagicCube4d.h"
20
21 #include "MainFrm.h"
22 #include "MagicCube4dDoc.h"
23 #include "MagicCube4dView.h"
24 #include <assert.h>
25
26 #ifdef _DEBUG
27 #define new DEBUG_NEW
28 #undef THIS_FILE
29 static char THIS_FILE[] = __FILE__;
30 #endif
31
32 /////////////////////////////////////////////////////////////////////////////
33 // CMagicCube4dApp
34
BEGIN_MESSAGE_MAP(CMagicCube4dApp,CWinApp)35 BEGIN_MESSAGE_MAP(CMagicCube4dApp, CWinApp)
36 //{{AFX_MSG_MAP(CMagicCube4dApp)
37 ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
38 // NOTE - the ClassWizard will add and remove mapping macros here.
39 // DO NOT EDIT what you see in these blocks of generated code!
40 //}}AFX_MSG_MAP
41 // Standard file based document commands
42 ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
43 ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
44 END_MESSAGE_MAP()
45
46 /////////////////////////////////////////////////////////////////////////////
47 // CMagicCube4dApp construction
48
49 CMagicCube4dApp::CMagicCube4dApp()
50 {
51 // TODO: add construction code here,
52 // Place all significant initialization in InitInstance
53 }
54
55 /////////////////////////////////////////////////////////////////////////////
56 // The one and only CMagicCube4dApp object
57
58 CMagicCube4dApp theApp;
59
60 /////////////////////////////////////////////////////////////////////////////
61 // CMagicCube4dApp initialization
62
63 BOOL
InitInstance()64 CMagicCube4dApp::InitInstance()
65 {
66 // Standard initialization
67 // If you are not using these features and wish to reduce the size
68 // of your final executable, you should remove from the following
69 // the specific initialization routines you do not need.
70
71 #ifdef _AFXDLL
72 Enable3dControls(); // Call this when using MFC in a shared DLL
73 #else
74 Enable3dControlsStatic(); // Call this when linking to MFC statically
75 #endif
76
77 LoadStdProfileSettings(); // Load standard INI file options (including
78 // MRU)
79
80 // Register the application's document templates. Document templates
81 // serve as the connection between documents, frame windows and views.
82
83 CSingleDocTemplate* pDocTemplate;
84 pDocTemplate = new CSingleDocTemplate
85 (IDR_MAINFRAME,
86 RUNTIME_CLASS(CMagicCube4dDoc),
87 RUNTIME_CLASS(CMainFrame), // main SDI frame window
88 RUNTIME_CLASS(CMagicCube4dView));
89 AddDocTemplate(pDocTemplate);
90
91 // Parse command line for standard shell commands, DDE, file open
92 CCommandLineInfo cmdInfo;
93 ParseCommandLine(cmdInfo);
94
95 // Dispatch commands specified on the command line
96 if (!ProcessShellCommand(cmdInfo))
97 return FALSE;
98
99 return TRUE;
100 }
101
102 /////////////////////////////////////////////////////////////////////////////
103 // CAboutDlg dialog used for App About
104
105 class CAboutDlg : public CDialog
106 {
107 public:
108 CAboutDlg();
109
110 // Dialog Data
111 //{{AFX_DATA(CAboutDlg)
112 enum { IDD = IDD_ABOUTBOX };
113 //}}AFX_DATA
114
115 // ClassWizard generated virtual function overrides
116 // {{AFX_VIRTUAL(CAboutDlg)
117 protected:
118 virtual void
119 DoDataExchange(CDataExchange * pDX); // DDX/DDV support
120 // }}AFX_VIRTUAL
121
122 // Implementation
123 protected:
124 // {{AFX_MSG(CAboutDlg)
125 // No message handlers
126 //}}AFX_MSG
127 DECLARE_MESSAGE_MAP()
128 };
129
CAboutDlg()130 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
131 {
132 // {{AFX_DATA_INIT(CAboutDlg)
133 // }}AFX_DATA_INIT
134 }
135
136 void
DoDataExchange(CDataExchange * pDX)137 CAboutDlg::DoDataExchange(CDataExchange * pDX)
138 {
139 CDialog::DoDataExchange(pDX);
140 // {{AFX_DATA_MAP(CAboutDlg)
141 // }}AFX_DATA_MAP
142 }
143
BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)144 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
145 //{{AFX_MSG_MAP(CAboutDlg)
146 // No message handlers
147 //}}AFX_MSG_MAP
148 END_MESSAGE_MAP()
149
150 // App command to run the dialog
151 void
152 CMagicCube4dApp::OnAppAbout()
153 {
154 CAboutDlg aboutDlg;
155 aboutDlg.DoModal();
156 }
157
158 /////////////////////////////////////////////////////////////////////////////
159 // CMagicCube4dApp commands
160
161 BOOL
OnIdle(LONG lCount)162 CMagicCube4dApp::OnIdle(LONG lCount)
163 {
164 // TODO: Add your specialized code here and/or call the base class
165
166 // Let the base class do anything it may need to first
167 //
168 CWinApp::OnIdle(lCount);
169
170 // assert(m_pMainWnd &&
171 // m_pMainWnd->IsKindOf(RUNTIME_CLASS(CMagicCube4dWnd)));
172 CView *
173 pView = ((CFrameWnd *) m_pMainWnd)->GetActiveView();
174 assert(pView && pView->IsKindOf(RUNTIME_CLASS(CMagicCube4dView)));
175 CMagicCube4dView *
176 mcview = (CMagicCube4dView *) pView;
177
178 return mcview->Update3d();
179 }
180
181 // Local Variables:
182 // c-basic-offset: 4
183 // c-comment-only-line-offset: 0
184 // c-file-offsets: ((defun-block-intro . +) (block-open . 0) (substatement-open . 0) (statement-cont . +) (statement-case-open . +4) (arglist-intro . +) (arglist-close . +) (inline-open . 0))
185 // indent-tabs-mode: nil
186 // End:
187