-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModelViewer.cpp
More file actions
216 lines (159 loc) · 6.66 KB
/
ModelViewer.cpp
File metadata and controls
216 lines (159 loc) · 6.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// ModelViewer.cpp : アプリケーションのクラス動作を定義します。
//
#include "pch.h"
#include "framework.h"
#include "afxwinappex.h"
#include "afxdialogex.h"
#include "ModelViewer.h"
#include "MainFrm.h"
#include "ModelViewerDoc.h"
#include "ModelViewerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CModelViewerApp
BEGIN_MESSAGE_MAP(CModelViewerApp, CWinAppEx)
ON_COMMAND(ID_APP_ABOUT, &CModelViewerApp::OnAppAbout)
// 標準の印刷セットアップ コマンド
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinAppEx::OnFilePrintSetup)
END_MESSAGE_MAP()
// CModelViewerApp の構築
CModelViewerApp::CModelViewerApp() noexcept
{
m_bHiColorIcons = TRUE;
m_nAppLook = 0;
// 再起動マネージャーをサポートします
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS;
#ifdef _MANAGED
// アプリケーションが共通言語ランタイム サポート (/clr) を使用して作成されている場合:
// 1) この追加設定は、再起動マネージャー サポートが正常に機能するために必要です。
// 2) 作成するには、プロジェクトに System.Windows.Forms への参照を追加する必要があります。
System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException);
#endif
// TODO: 下のアプリケーション ID 文字列を一意の ID 文字列で置換します。推奨される
// 文字列の形式は CompanyName.ProductName.SubProduct.VersionInformation です
SetAppID(_T("ModelViewer.AppID.NoVersion"));
// TODO: この位置に構築用コードを追加してください。
// ここに InitInstance 中の重要な初期化処理をすべて記述してください。
}
// 唯一の CModelViewerApp オブジェクト
CModelViewerApp theApp;
// CModelViewerApp の初期化
BOOL CModelViewerApp::InitInstance()
{
// アプリケーション マニフェストが visual スタイルを有効にするために、
// ComCtl32.dll Version 6 以降の使用を指定する場合は、
// Windows XP に InitCommonControlsEx() が必要です。さもなければ、ウィンドウ作成はすべて失敗します。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// アプリケーションで使用するすべてのコモン コントロール クラスを含めるには、
// これを設定します。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinAppEx::InitInstance();
// OLE ライブラリを初期化します。
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction(FALSE);
// RichEdit コントロールを使用するには AfxInitRichEdit2() が必要です
// AfxInitRichEdit2();
// 標準初期化
// これらの機能を使わずに最終的な実行可能ファイルの
// サイズを縮小したい場合は、以下から不要な初期化
// ルーチンを削除してください。
// 設定が格納されているレジストリ キーを変更します。
// TODO: 会社名または組織名などの適切な文字列に
// この文字列を変更してください。
SetRegistryKey(_T("アプリケーション ウィザードで生成されたローカル アプリケーション"));
LoadStdProfileSettings(4); // 標準の INI ファイルのオプションをロードします (MRU を含む)
InitContextMenuManager();
InitKeyboardManager();
InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
// アプリケーション用のドキュメント テンプレートを登録します。ドキュメント テンプレート
// はドキュメント、フレーム ウィンドウとビューを結合するために機能します。
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CModelViewerDoc),
RUNTIME_CLASS(CMainFrame), // メイン SDI フレーム ウィンドウ
RUNTIME_CLASS(CModelViewerView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// DDE、file open など標準のシェル コマンドのコマンド ラインを解析します。
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// コマンド ラインで指定されたディスパッチ コマンドです。アプリケーションが
// /RegServer、/Register、/Unregserver または /Unregister で起動された場合、False を返します。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// メイン ウィンドウが初期化されたので、表示と更新を行います。
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
int CModelViewerApp::ExitInstance()
{
//TODO: 追加したリソースがある場合にはそれらも処理してください
AfxOleTerm(FALSE);
return CWinAppEx::ExitInstance();
}
// CModelViewerApp メッセージ ハンドラー
// アプリケーションのバージョン情報に使われる CAboutDlg ダイアログ
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg() noexcept;
// ダイアログ データ
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV サポート
// 実装
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// ダイアログを実行するためのアプリケーション コマンド
void CModelViewerApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
// CModelViewerApp のカスタマイズの読み込みと保存方法
void CModelViewerApp::PreLoadState()
{
BOOL bNameValid;
CString strName;
bNameValid = strName.LoadString(IDS_EDIT_MENU);
ASSERT(bNameValid);
GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT);
bNameValid = strName.LoadString(IDS_EXPLORER);
ASSERT(bNameValid);
GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EXPLORER);
}
void CModelViewerApp::LoadCustomState()
{
}
void CModelViewerApp::SaveCustomState()
{
}
// CModelViewerApp メッセージ ハンドラー