MIDITrail をピカピカにする。鍵盤方向自動切替・多ポート・歌詞対応等
Revision | 0a0ec4b3cd59ec39a89b1737f712e62dba5a52fa (tree) |
---|---|
Zeit | 2016-12-24 01:16:52 |
Autor | yoshy <yoshy@user...> |
Commiter | yoshy |
[UPGRADE] original 1.2.2
@@ -1,5 +1,5 @@ | ||
1 | 1 | |
2 | -Copyright (c) 2010-2014, WADA Masashi <yknk@users.sourceforge.jp> | |
2 | +Copyright (c) 2010-2016, WADA Masashi <yknk@users.osdn.me> | |
3 | 3 | All rights reserved. |
4 | 4 | |
5 | 5 | Redistribution and use in source and binary forms, with or without |
@@ -70,11 +70,12 @@ BEGIN | ||
70 | 70 | MENUITEM "Piano Roll Rain", IDM_VIEW_PIANOROLLRAIN |
71 | 71 | MENUITEM "Piano Roll Rain 2D", IDM_VIEW_PIANOROLLRAIN2D |
72 | 72 | MENUITEM SEPARATOR |
73 | - MENUITEM "Piano keyboard", IDM_ENABLE_PIANOKEYBOARD | |
73 | + MENUITEM "Piano Keyboard", IDM_ENABLE_PIANOKEYBOARD | |
74 | 74 | MENUITEM "Ripple", IDM_ENABLE_RIPPLE |
75 | 75 | MENUITEM "Pitch Bend Motion", IDM_ENABLE_PITCHBEND |
76 | 76 | MENUITEM "Stars", IDM_ENABLE_STARS |
77 | 77 | MENUITEM "Counter", IDM_ENABLE_COUNTER |
78 | + MENUITEM "Background Image", IDM_ENABLE_BACKGROUNDIMAGE | |
78 | 79 | MENUITEM SEPARATOR |
79 | 80 | MENUITEM "Auto save viewpoint", 32838 |
80 | 81 | MENUITEM SEPARATOR |
@@ -151,15 +152,20 @@ BEGIN | ||
151 | 152 | PUSHBUTTON "Cancel",IDCANCEL,228,198,50,14 |
152 | 153 | END |
153 | 154 | |
154 | -IDD_WINDOWSIZE_CFG DIALOGEX 0, 0, 160, 183 | |
155 | +IDD_WINDOWSIZE_CFG DIALOGEX 0, 0, 256, 183 | |
155 | 156 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU |
156 | 157 | CAPTION "Window size configuration" |
157 | 158 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 |
158 | 159 | BEGIN |
159 | - LISTBOX IDC_WINDOWSIZE_LIST,12,18,138,138,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP | |
160 | - DEFPUSHBUTTON "OK",IDOK,42,162,50,14 | |
161 | - PUSHBUTTON "Cancel",IDCANCEL,96,162,50,14 | |
162 | 160 | LTEXT "Window size",IDC_STATIC,12,6,84,8 |
161 | + LISTBOX IDC_WINDOWSIZE_LIST,12,18,96,138,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP | |
162 | + LTEXT "Width",IDC_STATIC,126,24,48,8 | |
163 | + EDITTEXT IDC_EDIT_WIDTH,126,36,48,12,ES_AUTOHSCROLL | ES_NUMBER | |
164 | + LTEXT "Height",IDC_STATIC,186,24,48,8 | |
165 | + EDITTEXT IDC_EDIT_HEIGHT,186,36,48,12,ES_AUTOHSCROLL | ES_NUMBER | |
166 | + CONTROL "Apply to the view area",IDC_CHECK_APPLY_TO_VIEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,66,120,10 | |
167 | + DEFPUSHBUTTON "OK",IDOK,138,162,50,14 | |
168 | + PUSHBUTTON "Cancel",IDCANCEL,192,162,50,14 | |
163 | 169 | END |
164 | 170 | |
165 | 171 | IDD_HOWTOVIEW DIALOGEX 0, 0, 412, 291 |
@@ -175,15 +181,18 @@ BEGIN | ||
175 | 181 | PUSHBUTTON "Close",IDC_BTN_CLOSE,346,267,54,14 |
176 | 182 | END |
177 | 183 | |
178 | -IDD_GRAPHIC_CFG DIALOGEX 0, 0, 178, 75 | |
184 | +IDD_GRAPHIC_CFG DIALOGEX 0, 0, 280, 111 | |
179 | 185 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU |
180 | 186 | CAPTION "Graphic configuration" |
181 | 187 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 |
182 | 188 | BEGIN |
183 | - DEFPUSHBUTTON "OK",IDOK,60,54,50,14 | |
184 | - PUSHBUTTON "Cancel",IDCANCEL,114,54,50,14 | |
185 | 189 | LTEXT "Anti-aliasing",IDC_STATIC,18,20,54,8 |
186 | 190 | COMBOBOX IDC_COMBO_MULTISAMPLETYPE,72,18,78,54,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
191 | + LTEXT "Background image file path",IDC_STATIC,18,42,126,8 | |
192 | + EDITTEXT IDC_EDIT_IMAGE_FILE_PATH,18,54,222,12,ES_AUTOHSCROLL | |
193 | + PUSHBUTTON "...",IDC_BTN_BROWSE,240,53,25,14 | |
194 | + DEFPUSHBUTTON "OK",IDOK,162,84,50,14 | |
195 | + PUSHBUTTON "Cancel",IDCANCEL,216,84,50,14 | |
187 | 196 | END |
188 | 197 | |
189 | 198 | IDD_MIDIIN_CFG DIALOGEX 0, 0, 304, 99 |
@@ -227,7 +236,7 @@ BEGIN | ||
227 | 236 | IDD_WINDOWSIZE_CFG, DIALOG |
228 | 237 | BEGIN |
229 | 238 | LEFTMARGIN, 7 |
230 | - RIGHTMARGIN, 153 | |
239 | + RIGHTMARGIN, 249 | |
231 | 240 | TOPMARGIN, 7 |
232 | 241 | BOTTOMMARGIN, 176 |
233 | 242 | END |
@@ -243,9 +252,9 @@ BEGIN | ||
243 | 252 | IDD_GRAPHIC_CFG, DIALOG |
244 | 253 | BEGIN |
245 | 254 | LEFTMARGIN, 7 |
246 | - RIGHTMARGIN, 171 | |
255 | + RIGHTMARGIN, 273 | |
247 | 256 | TOPMARGIN, 7 |
248 | - BOTTOMMARGIN, 68 | |
257 | + BOTTOMMARGIN, 104 | |
249 | 258 | END |
250 | 259 | |
251 | 260 | IDD_MIDIIN_CFG, DIALOG |
@@ -435,6 +435,14 @@ | ||
435 | 435 | Name="SceneObject" |
436 | 436 | > |
437 | 437 | <File |
438 | + RelativePath=".\MTBackgroundImage.cpp" | |
439 | + > | |
440 | + </File> | |
441 | + <File | |
442 | + RelativePath=".\MTBackgroundImage.h" | |
443 | + > | |
444 | + </File> | |
445 | + <File | |
438 | 446 | RelativePath=".\MTDashboard.cpp" |
439 | 447 | > |
440 | 448 | </File> |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // MIDITrail アプリケーションクラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -73,6 +73,7 @@ MIDITrailApp::MIDITrailApp(void) | ||
73 | 73 | m_isEnableStars = true; |
74 | 74 | m_isEnableCounter = true; |
75 | 75 | m_isEnableFileName = false; |
76 | + m_isEnableBackgroundImage = true; | |
76 | 77 | |
77 | 78 | //シーン種別 |
78 | 79 | m_SceneType = Title; |
@@ -417,6 +418,7 @@ int MIDITrailApp::_SetWindowSize() | ||
417 | 418 | int height = 0; |
418 | 419 | RECT wrect, crect; |
419 | 420 | int ww, wh, cw, ch, framew, frameh; |
421 | + int applyToViewArea = 0; | |
420 | 422 | |
421 | 423 | //ユーザ選択ウィンドウサイズ取得 |
422 | 424 | result = m_ViewConf.SetCurSection(_T("WindowSize")); |
@@ -425,6 +427,8 @@ int MIDITrailApp::_SetWindowSize() | ||
425 | 427 | if (result != 0) goto EXIT; |
426 | 428 | result = m_ViewConf.GetInt(_T("Height"), &height, 0); |
427 | 429 | if (result != 0) goto EXIT; |
430 | + result = m_ViewConf.GetInt(_T("ApplyToViewArea"), &applyToViewArea, 0); | |
431 | + if (result != 0) goto EXIT; | |
428 | 432 | |
429 | 433 | //初回起動時のウィンドウサイズ |
430 | 434 | if ((width <= 0) || (height <= 0)) { |
@@ -446,10 +450,11 @@ int MIDITrailApp::_SetWindowSize() | ||
446 | 450 | framew = ww - cw; |
447 | 451 | frameh = wh - ch; |
448 | 452 | |
449 | - //フルスクリーンモードでなければ枠を含めたサイズとする | |
450 | - //TODO: フルスクリーンモード対応 | |
451 | - framew = 0; | |
452 | - frameh = 0; | |
453 | + //描画領域に指定サイズを適用する場合 | |
454 | + if (applyToViewArea != 0) { | |
455 | + width = width + framew; | |
456 | + height = height + frameh; | |
457 | + } | |
453 | 458 | |
454 | 459 | //ウィンドウサイズ変更 |
455 | 460 | bresult = SetWindowPos( |
@@ -457,8 +462,8 @@ int MIDITrailApp::_SetWindowSize() | ||
457 | 462 | HWND_TOP, //配置順序:Zオーダー先頭 |
458 | 463 | 0, //横方向の位置 |
459 | 464 | 0, //縦方向の位置 |
460 | - width + framew, //幅 | |
461 | - height + frameh,//高さ | |
465 | + width, //幅 | |
466 | + height, //高さ | |
462 | 467 | SWP_NOMOVE //ウィンドウ位置指定 |
463 | 468 | ); |
464 | 469 | if (!bresult) { |
@@ -661,6 +666,11 @@ LRESULT MIDITrailApp::_WndProcImpl( | ||
661 | 666 | result = _OnMenuEnableEffect(MTScene::EffectCounter); |
662 | 667 | if (result != 0) goto EXIT; |
663 | 668 | break; |
669 | + case IDM_ENABLE_BACKGROUNDIMAGE: | |
670 | + //表示効果:背景画像 | |
671 | + result = _OnMenuEnableEffect(MTScene::EffectBackgroundImage); | |
672 | + if (result != 0) goto EXIT; | |
673 | + break; | |
664 | 674 | case IDM_WINDOWSIZE: |
665 | 675 | //ウィンドウサイズ設定 |
666 | 676 | result = _OnMenuWindowSize(); |
@@ -1213,6 +1223,9 @@ int MIDITrailApp::_OnMenuEnableEffect( | ||
1213 | 1223 | case MTScene::EffectCounter: |
1214 | 1224 | m_isEnableCounter = m_isEnableCounter ? false : true; |
1215 | 1225 | break; |
1226 | + case MTScene::EffectBackgroundImage: | |
1227 | + m_isEnableBackgroundImage = m_isEnableBackgroundImage ? false : true; | |
1228 | + break; | |
1216 | 1229 | default: |
1217 | 1230 | break; |
1218 | 1231 | } |
@@ -1236,7 +1249,7 @@ int MIDITrailApp::_OnMenuWindowSize() | ||
1236 | 1249 | if (result != 0) goto EXIT; |
1237 | 1250 | |
1238 | 1251 | //変更された場合はウィンドウサイズを更新 |
1239 | - if (m_WindowSizeCfgDlg.IsCahnged()) { | |
1252 | + if (m_WindowSizeCfgDlg.IsChanged()) { | |
1240 | 1253 | result = _ChangeWindowSize(); |
1241 | 1254 | if (result != 0) goto EXIT; |
1242 | 1255 | } |
@@ -1297,7 +1310,7 @@ int MIDITrailApp::_OnMenuOptionGraphic() | ||
1297 | 1310 | if (result != 0) goto EXIT; |
1298 | 1311 | |
1299 | 1312 | //変更された場合はレンダラとシーンオブジェクトを再生成 |
1300 | - if (m_GraphicCfgDlg.IsCahnged()) { | |
1313 | + if (m_GraphicCfgDlg.IsChanged()) { | |
1301 | 1314 | result = _LoadGraphicConf(); |
1302 | 1315 | if (result != 0) goto EXIT; |
1303 | 1316 | result = _ChangeWindowSize(); |
@@ -1987,6 +2000,7 @@ int MIDITrailApp::_ChangeMenuStyle() | ||
1987 | 2000 | IDM_ENABLE_PITCHBEND, |
1988 | 2001 | IDM_ENABLE_STARS, |
1989 | 2002 | IDM_ENABLE_COUNTER, |
2003 | + IDM_ENABLE_BACKGROUNDIMAGE, | |
1990 | 2004 | IDM_WINDOWSIZE, |
1991 | 2005 | IDM_OPTION_MIDIOUT, |
1992 | 2006 | IDM_OPTION_MIDIIN, |
@@ -2022,6 +2036,7 @@ int MIDITrailApp::_ChangeMenuStyle() | ||
2022 | 2036 | { MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED }, //IDM_ENABLE_PITCHBEND |
2023 | 2037 | { MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED }, //IDM_ENABLE_STARS |
2024 | 2038 | { MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED }, //IDM_ENABLE_COUNTER |
2039 | + { MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED, MF_ENABLED }, //IDM_ENABLE_BACKGROUNDIMAGE | |
2025 | 2040 | { MF_ENABLED, MF_ENABLED, MF_GRAYED, MF_GRAYED, MF_ENABLED, MF_GRAYED }, //IDM_WINDOWSIZE |
2026 | 2041 | { MF_ENABLED, MF_ENABLED, MF_GRAYED, MF_GRAYED, MF_ENABLED, MF_GRAYED }, //IDM_OPTION_MIDIOUT |
2027 | 2042 | { MF_ENABLED, MF_ENABLED, MF_GRAYED, MF_GRAYED, MF_ENABLED, MF_GRAYED }, //IDM_OPTION_MIDIIN |
@@ -2635,6 +2650,9 @@ int MIDITrailApp::_UpdateMenuCheckmark() | ||
2635 | 2650 | //カウンタ表示 |
2636 | 2651 | _CheckMenuItem(IDM_ENABLE_COUNTER, m_isEnableCounter); |
2637 | 2652 | |
2653 | + //背景画像表示 | |
2654 | + _CheckMenuItem(IDM_ENABLE_BACKGROUNDIMAGE, m_isEnableBackgroundImage); | |
2655 | + | |
2638 | 2656 | //自動視点保存 |
2639 | 2657 | _CheckMenuItem(IDM_AUTO_SAVE_VIEWPOINT, m_isAutoSaveViewpoint); |
2640 | 2658 |
@@ -2676,6 +2694,7 @@ void MIDITrailApp::_UpdateEffect() | ||
2676 | 2694 | m_pScene->SetEffect(MTScene::EffectStars, m_isEnableStars); |
2677 | 2695 | m_pScene->SetEffect(MTScene::EffectCounter, m_isEnableCounter); |
2678 | 2696 | m_pScene->SetEffect(MTScene::EffectFileName, m_isEnableFileName); |
2697 | + m_pScene->SetEffect(MTScene::EffectBackgroundImage, m_isEnableBackgroundImage); | |
2679 | 2698 | } |
2680 | 2699 | return; |
2681 | 2700 | } |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // MIDITrail アプリケーションクラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -43,7 +43,7 @@ using namespace SMIDILib; | ||
43 | 43 | #define WM_FILEPATH_POSTED (WM_USER + 100) |
44 | 44 | |
45 | 45 | //メニュースタイル制御 |
46 | -#define MT_MENU_NUM (30) | |
46 | +#define MT_MENU_NUM (31) | |
47 | 47 | #define MT_PLAYSTATUS_NUM (6) |
48 | 48 | |
49 | 49 | //デバイスロスト警告メッセージ |
@@ -178,6 +178,7 @@ private: | ||
178 | 178 | bool m_isEnableStars; |
179 | 179 | bool m_isEnableCounter; |
180 | 180 | bool m_isEnableFileName; |
181 | + bool m_isEnableBackgroundImage; | |
181 | 182 | |
182 | 183 | //シーン種別 |
183 | 184 | SceneType m_SceneType; |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // MIDITrail バージョン定義 |
6 | 6 | // |
7 | -// Copyright (C) 2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2014-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -16,10 +16,10 @@ | ||
16 | 16 | //****************************************************************************** |
17 | 17 | |
18 | 18 | //バージョン文字列 |
19 | -#define MIDITRAIL_VERSION_STRING_X86 _T("Version 1.2.1b") | |
20 | -#define MIDITRAIL_VERSION_STRING_X64 _T("Version 1.2.1b (x64)") | |
19 | +#define MIDITRAIL_VERSION_STRING_X86 _T("Version 1.2.2 (32bit)") | |
20 | +#define MIDITRAIL_VERSION_STRING_X64 _T("Version 1.2.2 (64bit)") | |
21 | 21 | |
22 | 22 | //コピーライト |
23 | -#define MIDITRAIL_COPYRIGHT _T("Copyright (C) 2010-2014 WADA Masashi"); | |
23 | +#define MIDITRAIL_COPYRIGHT _T("Copyright (C) 2010-2016 WADA Masashi"); | |
24 | 24 | |
25 | 25 |
@@ -0,0 +1,371 @@ | ||
1 | +//****************************************************************************** | |
2 | +// | |
3 | +// MIDITrail / MTBackgroundImage | |
4 | +// | |
5 | +// 背景画像描画クラス | |
6 | +// | |
7 | +// Copyright (C) 2016 WADA Masashi. All Rights Reserved. | |
8 | +// | |
9 | +//****************************************************************************** | |
10 | + | |
11 | +#include "StdAfx.h" | |
12 | +#include "shlwapi.h" | |
13 | +#include "MTParam.h" | |
14 | +#include "MTConfFile.h" | |
15 | +#include "MTBackgroundImage.h" | |
16 | + | |
17 | + | |
18 | +//****************************************************************************** | |
19 | +// コンストラクタ | |
20 | +//****************************************************************************** | |
21 | +MTBackgroundImage::MTBackgroundImage(void) | |
22 | +{ | |
23 | + m_pTexture = NULL; | |
24 | + ZeroMemory(&m_ImgInfo, sizeof(D3DXIMAGE_INFO)); | |
25 | + m_hWnd = NULL; | |
26 | + m_isEnable = true; | |
27 | + m_isFilterLinear = true; | |
28 | +} | |
29 | + | |
30 | +//****************************************************************************** | |
31 | +// デストラクタ | |
32 | +//****************************************************************************** | |
33 | +MTBackgroundImage::~MTBackgroundImage(void) | |
34 | +{ | |
35 | + Release(); | |
36 | +} | |
37 | + | |
38 | +//****************************************************************************** | |
39 | +// 背景画像生成 | |
40 | +//****************************************************************************** | |
41 | +int MTBackgroundImage::Create( | |
42 | + LPDIRECT3DDEVICE9 pD3DDevice, | |
43 | + HWND hWnd | |
44 | + ) | |
45 | +{ | |
46 | + int result = 0; | |
47 | + unsigned long vertexNum = 0; | |
48 | + unsigned long indexNum = 0; | |
49 | + MTBACKGROUNDIMAGE_VERTEX* pVertex = NULL; | |
50 | + unsigned long* pIndex = NULL; | |
51 | + | |
52 | + Release(); | |
53 | + | |
54 | + m_hWnd = hWnd; | |
55 | + | |
56 | + //設定ファイル初期化 | |
57 | + result = _InitConfFile(); | |
58 | + if (result != 0) goto EXIT; | |
59 | + | |
60 | + //テクスチャ読み込み | |
61 | + result = _LoadTexture(pD3DDevice); | |
62 | + if (result != 0) goto EXIT; | |
63 | + | |
64 | + //テクスチャを生成しなかった場合は何もしない | |
65 | + if (m_pTexture == NULL) goto EXIT; | |
66 | + | |
67 | + //プリミティブ初期化 | |
68 | + result = m_Primitive.Initialize( | |
69 | + sizeof(MTBACKGROUNDIMAGE_VERTEX), //頂点サイズ | |
70 | + _GetFVFFormat(), //頂点FVFフォーマット | |
71 | + D3DPT_TRIANGLESTRIP //プリミティブ種別 | |
72 | + ); | |
73 | + if (result != 0) goto EXIT; | |
74 | + | |
75 | + //頂点バッファ生成 | |
76 | + vertexNum = 4; | |
77 | + result = m_Primitive.CreateVertexBuffer(pD3DDevice, vertexNum); | |
78 | + if (result != 0) goto EXIT; | |
79 | + | |
80 | + //インデックスバッファ生成 | |
81 | + indexNum = 4; | |
82 | + result = m_Primitive.CreateIndexBuffer(pD3DDevice, indexNum); | |
83 | + if (result != 0) goto EXIT; | |
84 | + | |
85 | + //バッファのロック | |
86 | + result = m_Primitive.LockVertex((void**)&pVertex); | |
87 | + if (result != 0) goto EXIT; | |
88 | + result = m_Primitive.LockIndex(&pIndex); | |
89 | + if (result != 0) goto EXIT; | |
90 | + | |
91 | + //バッファに頂点とインデックスを書き込む | |
92 | + result = _CreateVertexOfBackground( | |
93 | + pVertex, //頂点バッファ書き込み位置 | |
94 | + pIndex //インデックスバッファ書き込み位置 | |
95 | + ); | |
96 | + if (result != 0) goto EXIT; | |
97 | + | |
98 | + //バッファのロック解除 | |
99 | + result = m_Primitive.UnlockVertex(); | |
100 | + if (result != 0) goto EXIT; | |
101 | + result = m_Primitive.UnlockIndex(); | |
102 | + if (result != 0) goto EXIT; | |
103 | + | |
104 | +EXIT:; | |
105 | + return result; | |
106 | +} | |
107 | + | |
108 | +//****************************************************************************** | |
109 | +// 描画 | |
110 | +//****************************************************************************** | |
111 | +int MTBackgroundImage::Draw( | |
112 | + LPDIRECT3DDEVICE9 pD3DDevice | |
113 | + ) | |
114 | +{ | |
115 | + int result = 0; | |
116 | + DWORD value = 0; | |
117 | + | |
118 | + if (!m_isEnable) goto EXIT; | |
119 | + if (m_pTexture == NULL) goto EXIT; | |
120 | + | |
121 | + //Zバッファを一時的に無効化する | |
122 | + pD3DDevice->GetRenderState(D3DRS_ZENABLE, &value); | |
123 | + pD3DDevice->SetRenderState(D3DRS_ZENABLE, FALSE); | |
124 | + | |
125 | + //テクスチャステージ設定 | |
126 | + // カラー演算:引数1を使用 引数1:テクスチャ | |
127 | + pD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); | |
128 | + pD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); | |
129 | + // アルファ演算:引数1を使用 引数1:テクスチャ | |
130 | + pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); | |
131 | + pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); | |
132 | + | |
133 | + //テクスチャフィルタ | |
134 | + if (m_isFilterLinear) { | |
135 | + pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); | |
136 | + pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); | |
137 | + } | |
138 | + else { | |
139 | + //ピクセル等倍で描画する場合ボケないようにする | |
140 | + pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT); | |
141 | + pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT); | |
142 | + } | |
143 | + | |
144 | + //描画 | |
145 | + result = m_Primitive.Draw(pD3DDevice, m_pTexture); | |
146 | + if (result != 0) goto EXIT; | |
147 | + | |
148 | + //Zバッファ有効化状態を戻す | |
149 | + pD3DDevice->SetRenderState(D3DRS_ZENABLE, value); | |
150 | + | |
151 | +EXIT:; | |
152 | + return result; | |
153 | +} | |
154 | + | |
155 | +//****************************************************************************** | |
156 | +// 解放 | |
157 | +//****************************************************************************** | |
158 | +void MTBackgroundImage::Release() | |
159 | +{ | |
160 | + m_Primitive.Release(); | |
161 | + | |
162 | + if (m_pTexture != NULL) { | |
163 | + m_pTexture->Release(); | |
164 | + m_pTexture = NULL; | |
165 | + } | |
166 | +} | |
167 | + | |
168 | +//****************************************************************************** | |
169 | +// 背景画像頂点生成 | |
170 | +//****************************************************************************** | |
171 | +int MTBackgroundImage::_CreateVertexOfBackground( | |
172 | + MTBACKGROUNDIMAGE_VERTEX* pVertex, | |
173 | + unsigned long* pIndex | |
174 | + ) | |
175 | +{ | |
176 | + int result = 0; | |
177 | + BOOL bresult = 0; | |
178 | + RECT rect; | |
179 | + unsigned long i = 0; | |
180 | + unsigned long cw = 0; | |
181 | + unsigned long ch = 0; | |
182 | + float ratio_cwh = 0.0f; | |
183 | + float ratio_iwh = 0.0f; | |
184 | + float x1 = 0.0f; | |
185 | + float x2 = 0.0f; | |
186 | + float y1 = 0.0f; | |
187 | + float y2 = 0.0f; | |
188 | + | |
189 | + //クライアント領域のサイズを取得 | |
190 | + bresult = GetClientRect(m_hWnd, &rect); | |
191 | + if (!bresult) { | |
192 | + result = YN_SET_ERR("Windows API error.", GetLastError(), 0); | |
193 | + goto EXIT; | |
194 | + } | |
195 | + cw = rect.right - rect.left; | |
196 | + ch = rect.bottom - rect.top; | |
197 | + | |
198 | + ratio_cwh = (float)cw / (float)ch; | |
199 | + ratio_iwh = (float)m_ImgInfo.Width / (float)m_ImgInfo.Height; | |
200 | + | |
201 | + // クライアント領域より画像の方が横長の場合 | |
202 | + // |----- cw -----| | |
203 | + // ---0--------------+-- +x | |
204 | + // | | | | |
205 | + // | +--------------+ | |
206 | + // ch | image | | |
207 | + // | +--------------+ | |
208 | + // | | | | |
209 | + // ---+--------------+ | |
210 | + // | | |
211 | + // +y | |
212 | + if (ratio_cwh < ratio_iwh) { | |
213 | + x1 = 0.0f; | |
214 | + x2 = (float)cw; | |
215 | + y1 = ((float)ch - ((float)cw / ratio_iwh)) / 2.0f; | |
216 | + y2 = (float)ch - y1; | |
217 | + | |
218 | + //ピクセル等倍で描画する場合はリニアフィルタを解除してボケないようにする | |
219 | + if (cw == m_ImgInfo.Width) { | |
220 | + m_isFilterLinear = false; | |
221 | + } | |
222 | + } | |
223 | + // クライアント領域より画像の方が縦長の場合 | |
224 | + // |----- cw -----| | |
225 | + // ---0--+--------+--+-- +x | |
226 | + // | | | | | | |
227 | + // | | | | | | |
228 | + // ch | | image | | | |
229 | + // | | | | | | |
230 | + // | | | | | | |
231 | + // ---+--+--------+--+ | |
232 | + // | | |
233 | + // +y | |
234 | + else { | |
235 | + x1 = ((float)cw - ((float)ch * ratio_iwh)) / 2.0f; | |
236 | + x2 = (float)cw - x1 - 1.0f; | |
237 | + y1 = 0.0f; | |
238 | + y2 = (float)ch - 1.0f; | |
239 | + | |
240 | + //ピクセル等倍で描画する場合はリニアフィルタを解除してボケないようにする | |
241 | + if (ch == m_ImgInfo.Height) { | |
242 | + m_isFilterLinear = false; | |
243 | + } | |
244 | + } | |
245 | + | |
246 | + //ピクセル等倍で描画する場合を想定して座標を調整 | |
247 | + x1 -= 0.5f; | |
248 | + x2 -= 0.5f; | |
249 | + y1 -= 0.5f; | |
250 | + y2 -= 0.5f; | |
251 | + | |
252 | + //頂点座標 | |
253 | + pVertex[0].p = D3DXVECTOR3(x1, y1, 0.0f); | |
254 | + pVertex[1].p = D3DXVECTOR3(x2, y1, 0.0f); | |
255 | + pVertex[2].p = D3DXVECTOR3(x1, y2, 0.0f); | |
256 | + pVertex[3].p = D3DXVECTOR3(x2, y2, 0.0f); | |
257 | + | |
258 | + //各頂点のディフューズ色 | |
259 | + for (i = 0; i < 4; i++) { | |
260 | + //各頂点の除算数 | |
261 | + pVertex[i].rhw = 1.0f; | |
262 | + //各頂点のディフューズ色 | |
263 | + pVertex[i].c = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); | |
264 | + } | |
265 | + | |
266 | + //各頂点のテクスチャ座標 | |
267 | + pVertex[0].t = D3DXVECTOR2(0.0f, 0.0f); | |
268 | + pVertex[1].t = D3DXVECTOR2(1.0f, 0.0f); | |
269 | + pVertex[2].t = D3DXVECTOR2(0.0f, 1.0f); | |
270 | + pVertex[3].t = D3DXVECTOR2(1.0f, 1.0f); | |
271 | + | |
272 | + //インデックス:TRIANGLESTRIP | |
273 | + pIndex[0] = 0; | |
274 | + pIndex[1] = 1; | |
275 | + pIndex[2] = 2; | |
276 | + pIndex[3] = 3; | |
277 | + | |
278 | +EXIT:; | |
279 | + return result; | |
280 | +} | |
281 | + | |
282 | +//****************************************************************************** | |
283 | +// 設定ファイル初期化 | |
284 | +//****************************************************************************** | |
285 | +int MTBackgroundImage::_InitConfFile() | |
286 | +{ | |
287 | + int result = 0; | |
288 | + TCHAR userConfFilePath[_MAX_PATH] = {_T('\0')}; | |
289 | + | |
290 | + result = YNPathUtil::GetAppDataDirPath(userConfFilePath, _MAX_PATH); | |
291 | + if (result != 0) goto EXIT; | |
292 | + | |
293 | + _tcscat_s(userConfFilePath, _MAX_PATH, MT_USER_CONFFILE_DIR); | |
294 | + _tcscat_s(userConfFilePath, _MAX_PATH, MT_USER_CONFFILE_GRAPHIC); | |
295 | + | |
296 | + result = m_ConfFile.Initialize(userConfFilePath); | |
297 | + if (result != 0) goto EXIT; | |
298 | + | |
299 | +EXIT:; | |
300 | + return result; | |
301 | +} | |
302 | + | |
303 | +//****************************************************************************** | |
304 | +// テクスチャ画像読み込み | |
305 | +//****************************************************************************** | |
306 | +int MTBackgroundImage::_LoadTexture( | |
307 | + LPDIRECT3DDEVICE9 pD3DDevice | |
308 | + ) | |
309 | +{ | |
310 | + int result = 0; | |
311 | + HRESULT hresult = D3D_OK; | |
312 | + TCHAR imageFilePath[_MAX_PATH] = {_T('\0')}; | |
313 | + | |
314 | + //ビットマップファイル名 | |
315 | + result = m_ConfFile.SetCurSection(_T("Background-image")); | |
316 | + if (result != 0) goto EXIT; | |
317 | + result = m_ConfFile.GetStr(_T("ImageFilePath"), imageFilePath, _MAX_PATH, _T("")); | |
318 | + if (result != 0) goto EXIT; | |
319 | + | |
320 | + //ファイル未指定なら何もしない | |
321 | + if (_tcslen(imageFilePath) == 0) goto EXIT; | |
322 | + | |
323 | + //ファイルが存在しない場合は何もしない | |
324 | + if (!PathFileExists(imageFilePath)) goto EXIT; | |
325 | + | |
326 | + //読み込む画像の縦横サイズを取得しておく | |
327 | + hresult = D3DXGetImageInfoFromFile(imageFilePath, &m_ImgInfo); | |
328 | + if (FAILED(hresult)) { | |
329 | + result = YN_SET_ERR("DirectX API error.", hresult, 0); | |
330 | + goto EXIT; | |
331 | + } | |
332 | + | |
333 | + //テクスチャ画像として読み込み | |
334 | + // ピクセル等倍で描画する場合にボケないようにするため | |
335 | + // 画像サイズを指定して読み込み | |
336 | + hresult = D3DXCreateTextureFromFileEx( | |
337 | + pD3DDevice, //デバイス | |
338 | + imageFilePath, //ファイルパス | |
339 | + m_ImgInfo.Width, //幅(ピクセル):直接指定 | |
340 | + m_ImgInfo.Height, //高さ(ピクセル):直接指定 | |
341 | + 1, //ミップレベル | |
342 | + 0, //使用方法 | |
343 | + D3DFMT_A8R8G8B8, //ピクセルフォーマット | |
344 | + D3DPOOL_MANAGED, //テクスチャ配置先メモリクラス | |
345 | + D3DX_FILTER_NONE, //フィルタリング指定 | |
346 | + D3DX_FILTER_NONE, //フィルタリング指定(ミップ) | |
347 | + 0xFF000000, //透明色の指定:不透明黒 | |
348 | + NULL, //ソースイメージ情報 | |
349 | + NULL, //256色パレット | |
350 | + &m_pTexture //作成されたテクスチャオブジェクト | |
351 | + ); | |
352 | + if (FAILED(hresult)) { | |
353 | + result = YN_SET_ERR("DirectX API error.", hresult, 0); | |
354 | + goto EXIT; | |
355 | + } | |
356 | + | |
357 | +EXIT:; | |
358 | + return result; | |
359 | +} | |
360 | + | |
361 | +//****************************************************************************** | |
362 | +// 表示設定 | |
363 | +//****************************************************************************** | |
364 | +void MTBackgroundImage::SetEnable( | |
365 | + bool isEnable | |
366 | + ) | |
367 | +{ | |
368 | + m_isEnable = isEnable; | |
369 | +} | |
370 | + | |
371 | + |
@@ -0,0 +1,88 @@ | ||
1 | +//****************************************************************************** | |
2 | +// | |
3 | +// MIDITrail / MTBackgroundImage | |
4 | +// | |
5 | +// 背景画像描画クラス | |
6 | +// | |
7 | +// Copyright (C) 2016 WADA Masashi. All Rights Reserved. | |
8 | +// | |
9 | +//****************************************************************************** | |
10 | + | |
11 | +// MEMO: | |
12 | +// 背景画像を描画する。 | |
13 | +// 画像ファイルは .bmp .dds .dib .jpg .png .tga を指定可能。 | |
14 | +// (D3DXCreateTextureFromFile がサポートしている画像) | |
15 | + | |
16 | +#pragma once | |
17 | + | |
18 | +#include <d3d9.h> | |
19 | +#include <d3dx9.h> | |
20 | +#include "YNBaseLib.h" | |
21 | +#include "DXPrimitive.h" | |
22 | + | |
23 | +using namespace YNBaseLib; | |
24 | + | |
25 | + | |
26 | +//****************************************************************************** | |
27 | +// 背景画像描画クラス | |
28 | +//****************************************************************************** | |
29 | +class MTBackgroundImage | |
30 | +{ | |
31 | +public: | |
32 | + | |
33 | + //コンストラクタ/デストラクタ | |
34 | + MTBackgroundImage(void); | |
35 | + virtual ~MTBackgroundImage(void); | |
36 | + | |
37 | + //生成 | |
38 | + int Create(LPDIRECT3DDEVICE9 pD3DDevice, HWND hWnd); | |
39 | + | |
40 | + //描画 | |
41 | + int Draw(LPDIRECT3DDEVICE9 pD3DDevice); | |
42 | + | |
43 | + //解放 | |
44 | + void Release(); | |
45 | + | |
46 | + //リセット | |
47 | + void Reset(); | |
48 | + | |
49 | + //表示設定 | |
50 | + void SetEnable(bool isEnable); | |
51 | + | |
52 | +private: | |
53 | + | |
54 | + HWND m_hWnd; | |
55 | + DXPrimitive m_Primitive; | |
56 | + LPDIRECT3DTEXTURE9 m_pTexture; | |
57 | + D3DXIMAGE_INFO m_ImgInfo; | |
58 | + bool m_isEnable; | |
59 | + bool m_isFilterLinear; | |
60 | + | |
61 | + //設定ファイル | |
62 | + YNConfFile m_ConfFile; | |
63 | + | |
64 | + //頂点バッファ構造体 | |
65 | + struct MTBACKGROUNDIMAGE_VERTEX { | |
66 | + D3DXVECTOR3 p; //頂点座標 | |
67 | + float rhw; //除算数 | |
68 | + DWORD c; //ディフューズ色 | |
69 | + D3DXVECTOR2 t; //テクスチャ画像位置 | |
70 | + }; | |
71 | + | |
72 | + //頂点バッファFVFフォーマット | |
73 | + DWORD _GetFVFFormat(){ return (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1); } | |
74 | + | |
75 | + //頂点生成 | |
76 | + int _CreateVertexOfBackground( | |
77 | + MTBACKGROUNDIMAGE_VERTEX* pVertex, | |
78 | + unsigned long* pIbIndex | |
79 | + ); | |
80 | + | |
81 | + //設定ファイル初期化 | |
82 | + int _InitConfFile(); | |
83 | + | |
84 | + //テクスチャ画像読み込み | |
85 | + int _LoadTexture(LPDIRECT3DDEVICE9 pD3DDevice); | |
86 | + | |
87 | +}; | |
88 | + |
@@ -4,12 +4,13 @@ | ||
4 | 4 | // |
5 | 5 | // グラフィック設定ダイアログクラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 | |
11 | 11 | #include "StdAfx.h" |
12 | 12 | #include "resource.h" |
13 | +#include "Commdlg.h" | |
13 | 14 | #include "MTParam.h" |
14 | 15 | #include "MTGraphicCfgDlg.h" |
15 | 16 |
@@ -27,8 +28,12 @@ MTGraphicCfgDlg::MTGraphicCfgDlg(void) | ||
27 | 28 | unsigned long type = 0; |
28 | 29 | |
29 | 30 | m_pThis = this; |
31 | + m_hWnd = NULL; | |
30 | 32 | m_MultiSampleType = 0; |
31 | - m_isCahnged = false; | |
33 | + m_hComboMultiSampleType = NULL; | |
34 | + m_hEditImageFilePath = NULL; | |
35 | + m_ImageFilePath[0] = _T('\0'); | |
36 | + m_isChanged = false; | |
32 | 37 | |
33 | 38 | for (type = 0; type < DX_MULTI_SAMPLE_TYPE_MAX; type++) { |
34 | 39 | m_MultSampleTypeSupport[type] = false; |
@@ -42,7 +47,6 @@ MTGraphicCfgDlg::MTGraphicCfgDlg(void) | ||
42 | 47 | //****************************************************************************** |
43 | 48 | MTGraphicCfgDlg::~MTGraphicCfgDlg(void) |
44 | 49 | { |
45 | - m_hComboMultiSampleType = NULL; | |
46 | 50 | } |
47 | 51 | |
48 | 52 | //****************************************************************************** |
@@ -85,6 +89,10 @@ INT_PTR MTGraphicCfgDlg::_WndProcImpl( | ||
85 | 89 | EndDialog(hDlg, LOWORD(wParam)); |
86 | 90 | bresult = TRUE; |
87 | 91 | } |
92 | + else if (LOWORD(wParam) == IDC_BTN_BROWSE) { | |
93 | + result = _OnBtnBrowse(); | |
94 | + if (result != 0) goto EXIT; | |
95 | + } | |
88 | 96 | break; |
89 | 97 | } |
90 | 98 |
@@ -153,7 +161,8 @@ int MTGraphicCfgDlg::_OnInitDlg( | ||
153 | 161 | { |
154 | 162 | int result = 0; |
155 | 163 | |
156 | - m_isCahnged = false; | |
164 | + m_hWnd = hDlg; | |
165 | + m_isChanged = false; | |
157 | 166 | |
158 | 167 | //設定ファイル初期化 |
159 | 168 | result = _InitConfFile(); |
@@ -168,6 +177,11 @@ int MTGraphicCfgDlg::_OnInitDlg( | ||
168 | 177 | result = _InitComboMultiSampleType(m_hComboMultiSampleType, m_MultiSampleType); |
169 | 178 | if (result != 0) goto EXIT; |
170 | 179 | |
180 | + //背景画像ファイルパス初期化 | |
181 | + m_hEditImageFilePath = GetDlgItem(hDlg, IDC_EDIT_IMAGE_FILE_PATH); | |
182 | + result = _InitBackgroundImageFilePath(); | |
183 | + if (result != 0) goto EXIT; | |
184 | + | |
171 | 185 | EXIT:; |
172 | 186 | return result; |
173 | 187 | } |
@@ -201,6 +215,7 @@ int MTGraphicCfgDlg::_LoadConf() | ||
201 | 215 | int result = 0; |
202 | 216 | int multiSampleType = 0; |
203 | 217 | |
218 | + //アンチエイリアス設定値取得 | |
204 | 219 | result = m_ConfFile.SetCurSection(_T("Anti-aliasing")); |
205 | 220 | if (result != 0) goto EXIT; |
206 | 221 |
@@ -220,6 +235,13 @@ int MTGraphicCfgDlg::_LoadConf() | ||
220 | 235 | m_MultiSampleType = 0; |
221 | 236 | } |
222 | 237 | |
238 | + //背景画像ファイルパス設定値取得 | |
239 | + result = m_ConfFile.SetCurSection(_T("Background-image")); | |
240 | + if (result != 0) goto EXIT; | |
241 | + | |
242 | + result = m_ConfFile.GetStr(_T("ImageFilePath"), m_ImageFilePath, _MAX_PATH, _T("")); | |
243 | + if (result != 0) goto EXIT; | |
244 | + | |
223 | 245 | EXIT:; |
224 | 246 | return result; |
225 | 247 | } |
@@ -306,14 +328,38 @@ EXIT:; | ||
306 | 328 | } |
307 | 329 | |
308 | 330 | //****************************************************************************** |
309 | -// デバイス選択情報保存 | |
331 | +// 背景画像ファイルパス初期化 | |
332 | +//****************************************************************************** | |
333 | +int MTGraphicCfgDlg::_InitBackgroundImageFilePath() | |
334 | +{ | |
335 | + int result = 0; | |
336 | + BOOL bresult = FALSE; | |
337 | + | |
338 | + //エディットボックスに入力可能最大文字数を設定 | |
339 | + SendMessage(m_hEditImageFilePath, EM_SETLIMITTEXT, (WPARAM)_MAX_PATH, 0); | |
340 | + | |
341 | + //エディットボックスにファイルパスを設定 | |
342 | + bresult = SetWindowText(m_hEditImageFilePath, m_ImageFilePath); | |
343 | + if (!bresult) { | |
344 | + result = YN_SET_ERR("Windows API error.", GetLastError(), 0); | |
345 | + goto EXIT; | |
346 | + } | |
347 | + | |
348 | +EXIT:; | |
349 | + return result; | |
350 | +} | |
351 | + | |
352 | +//****************************************************************************** | |
353 | +// 設定情報保存 | |
310 | 354 | //****************************************************************************** |
311 | 355 | int MTGraphicCfgDlg::_Save() |
312 | 356 | { |
313 | 357 | int result = 0; |
358 | + int apiresult = 0; | |
314 | 359 | LRESULT lresult = 0; |
315 | 360 | unsigned long selectedIndex = 0; |
316 | 361 | unsigned long selectedMultiSampleType = 0; |
362 | + TCHAR filePath[_MAX_PATH] = {_T('\0')}; | |
317 | 363 | |
318 | 364 | //選択項目のインデックスを取得 |
319 | 365 | lresult = SendMessage(m_hComboMultiSampleType, CB_GETCURSEL, 0, 0); |
@@ -331,17 +377,37 @@ int MTGraphicCfgDlg::_Save() | ||
331 | 377 | } |
332 | 378 | selectedMultiSampleType = (unsigned long)lresult; |
333 | 379 | |
334 | - //設定保存 | |
380 | + //アンチエイリアス設定保存 | |
335 | 381 | result = m_ConfFile.SetCurSection(_T("Anti-aliasing")); |
336 | 382 | if (result != 0) goto EXIT; |
337 | 383 | result = m_ConfFile.SetInt(_T("MultiSampleType"), selectedMultiSampleType); |
338 | 384 | if (result != 0) goto EXIT; |
339 | 385 | |
386 | + //変更確認 | |
340 | 387 | if (m_MultiSampleType != selectedMultiSampleType) { |
341 | - m_isCahnged = true; | |
388 | + m_isChanged = true; | |
342 | 389 | } |
343 | 390 | m_MultiSampleType = selectedMultiSampleType; |
344 | 391 | |
392 | + //背景画像ファイルパスをエディットボックスから取得 | |
393 | + apiresult = GetWindowText(m_hEditImageFilePath, filePath, _MAX_PATH); | |
394 | + if (apiresult == 0) { | |
395 | + //テキスト無しまたはウィンドウハンドル無効の場合 | |
396 | + filePath[0] = _T('\0'); | |
397 | + } | |
398 | + | |
399 | + //背景画像ファイルパス設定保存 | |
400 | + result = m_ConfFile.SetCurSection(_T("Background-image")); | |
401 | + if (result != 0) goto EXIT; | |
402 | + result = m_ConfFile.SetStr(_T("ImageFilePath"), filePath); | |
403 | + if (result != 0) goto EXIT; | |
404 | + | |
405 | + //変更確認 | |
406 | + if (_tcscmp(m_ImageFilePath, filePath) != 0) { | |
407 | + m_isChanged = true; | |
408 | + } | |
409 | + _tcscpy_s(m_ImageFilePath, _MAX_PATH, filePath); | |
410 | + | |
345 | 411 | EXIT:; |
346 | 412 | return result; |
347 | 413 | } |
@@ -349,9 +415,78 @@ EXIT:; | ||
349 | 415 | //****************************************************************************** |
350 | 416 | // パラメータ変更確認 |
351 | 417 | //****************************************************************************** |
352 | -bool MTGraphicCfgDlg::IsCahnged() | |
418 | +bool MTGraphicCfgDlg::IsChanged() | |
353 | 419 | { |
354 | - return m_isCahnged; | |
420 | + return m_isChanged; | |
355 | 421 | } |
356 | 422 | |
423 | +//****************************************************************************** | |
424 | +// 背景画像ファイルパス ブラウズボタン押下 | |
425 | +//****************************************************************************** | |
426 | +int MTGraphicCfgDlg::_OnBtnBrowse() | |
427 | +{ | |
428 | + int result = 0; | |
429 | + BOOL bresult = FALSE; | |
430 | + TCHAR filePath[_MAX_PATH] = {_T('\0')}; | |
431 | + bool isSelected = false; | |
432 | + | |
433 | + //ファイル選択ダイアログ表示 | |
434 | + result = _SelectImageFile(filePath, _MAX_PATH, &isSelected); | |
435 | + if (result != 0) goto EXIT; | |
436 | + | |
437 | + //ファイル未選択の場合は何もしない | |
438 | + if (!isSelected) goto EXIT; | |
439 | + | |
440 | + //エディットボックスにファイルパスを設定 | |
441 | + bresult = SetWindowText(m_hEditImageFilePath, filePath); | |
442 | + if (!bresult) { | |
443 | + result = YN_SET_ERR("Windows API error.", GetLastError(), 0); | |
444 | + goto EXIT; | |
445 | + } | |
446 | + | |
447 | +EXIT:; | |
448 | + return result; | |
449 | +} | |
450 | + | |
451 | +//****************************************************************************** | |
452 | +// 画像ファイル選択 | |
453 | +//****************************************************************************** | |
454 | +int MTGraphicCfgDlg::_SelectImageFile( | |
455 | + TCHAR* pFilePath, | |
456 | + unsigned long bufSize, | |
457 | + bool* pIsSelected | |
458 | + ) | |
459 | +{ | |
460 | + int result = 0; | |
461 | + BOOL apiresult = FALSE; | |
462 | + OPENFILENAME ofn; | |
463 | + | |
464 | + if ((pFilePath == NULL) || (bufSize == 0) || (pIsSelected ==NULL)) { | |
465 | + result = YN_SET_ERR("Program error.", 0, 0); | |
466 | + goto EXIT; | |
467 | + } | |
468 | + | |
469 | + pFilePath[0] = _T('\0'); | |
470 | + ZeroMemory(&ofn, sizeof(OPENFILENAME)); | |
471 | + ofn.lStructSize = sizeof(OPENFILENAME); | |
472 | + ofn.hwndOwner = m_hWnd; | |
473 | + ofn.lpstrFilter = _T("Image file (*.jpg *.png *.bmp)\0*.jpg;*.png;*.bmp\0"); | |
474 | + ofn.lpstrFile = pFilePath; | |
475 | + ofn.nMaxFile = bufSize; | |
476 | + ofn.lpstrTitle = _T("Select image file."); | |
477 | + ofn.Flags = OFN_FILEMUSTEXIST; //OFN_HIDEREADONLY | |
478 | + | |
479 | + //ファイル選択ダイアログ表示 | |
480 | + apiresult = GetOpenFileName(&ofn); | |
481 | + if (!apiresult) { | |
482 | + //キャンセルまたはエラー発生:エラーはチェックしない | |
483 | + *pIsSelected = false; | |
484 | + goto EXIT; | |
485 | + } | |
486 | + | |
487 | + *pIsSelected = true; | |
488 | + | |
489 | +EXIT:; | |
490 | + return result; | |
491 | +} | |
357 | 492 |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // グラフィック設定ダイアログクラス |
6 | 6 | // |
7 | -// Copyright (C) 2010 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -41,7 +41,7 @@ public: | ||
41 | 41 | int Show(HWND hParentWnd); |
42 | 42 | |
43 | 43 | //パラメータ変更確認 |
44 | - bool IsCahnged(); | |
44 | + bool IsChanged(); | |
45 | 45 | |
46 | 46 | private: |
47 | 47 |
@@ -51,6 +51,9 @@ private: | ||
51 | 51 | //アプリケーションインスタンス |
52 | 52 | HINSTANCE m_hInstance; |
53 | 53 | |
54 | + //ウィンドウハンドル | |
55 | + HWND m_hWnd; | |
56 | + | |
54 | 57 | //設定ファイル |
55 | 58 | YNConfFile m_ConfFile; |
56 | 59 |
@@ -58,11 +61,17 @@ private: | ||
58 | 61 | HWND m_hComboMultiSampleType; |
59 | 62 | bool m_MultSampleTypeSupport[DX_MULTI_SAMPLE_TYPE_MAX+1]; |
60 | 63 | |
64 | + //背景画像ファイルパスエディットボックスのウィンドウハンドル | |
65 | + HWND m_hEditImageFilePath; | |
66 | + | |
61 | 67 | //アンチエイリアシング設定 |
62 | 68 | unsigned long m_MultiSampleType; |
63 | 69 | |
70 | + //背景画像ファイルパス | |
71 | + TCHAR m_ImageFilePath[_MAX_PATH]; | |
72 | + | |
64 | 73 | //更新フラグ |
65 | - bool m_isCahnged; | |
74 | + bool m_isChanged; | |
66 | 75 | |
67 | 76 | //ウィンドウプロシージャ |
68 | 77 | static INT_PTR CALLBACK _WndProc(HWND, UINT, WPARAM, LPARAM); |
@@ -80,9 +89,18 @@ private: | ||
80 | 89 | //デバイス選択コンボボックス初期化 |
81 | 90 | int _InitComboMultiSampleType(HWND hCombo, unsigned long selMultiSampleType); |
82 | 91 | |
92 | + //背景画像ファイルパス初期化 | |
93 | + int _InitBackgroundImageFilePath(); | |
94 | + | |
83 | 95 | //保存処理 |
84 | 96 | int _Save(); |
85 | 97 | |
98 | + //背景画像ファイルパスブラウズボタン押下 | |
99 | + int _OnBtnBrowse(); | |
100 | + | |
101 | + //画像ファイル選択 | |
102 | + int _SelectImageFile(TCHAR* pFilePath, unsigned long bufSize, bool* pIsSelected); | |
103 | + | |
86 | 104 | }; |
87 | 105 | |
88 | 106 |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // MIDITrail シーン基底クラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -33,6 +33,7 @@ public: | ||
33 | 33 | EffectPitchBend, |
34 | 34 | EffectStars, |
35 | 35 | EffectCounter, |
36 | + EffectBackgroundImage, | |
36 | 37 | EffectFileName |
37 | 38 | }; |
38 | 39 |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ピアノロール3Dシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -142,6 +142,10 @@ int MTScenePianoRoll3D::Create( | ||
142 | 142 | result = m_MeshCtrl.Create(pD3DDevice, GetName()); |
143 | 143 | if (result != 0) goto EXIT; |
144 | 144 | |
145 | + //背景画像生成 | |
146 | + result = m_BackgroundImage.Create(pD3DDevice, hWnd); | |
147 | + if (result != 0) goto EXIT; | |
148 | + | |
145 | 149 | //---------------------------------- |
146 | 150 | // レンダリングステート |
147 | 151 | //---------------------------------- |
@@ -246,6 +250,10 @@ int MTScenePianoRoll3D::Draw( | ||
246 | 250 | result = Transform(pD3DDevice); |
247 | 251 | if (result != 0) goto EXIT; |
248 | 252 | |
253 | + //背景画像描画 | |
254 | + result = m_BackgroundImage.Draw(pD3DDevice); | |
255 | + if (result != 0) goto EXIT; | |
256 | + | |
249 | 257 | //グリッドボックス描画 |
250 | 258 | result = m_GridBox.Draw(pD3DDevice); |
251 | 259 | if (result != 0) goto EXIT; |
@@ -295,6 +303,7 @@ void MTScenePianoRoll3D::Release() | ||
295 | 303 | m_TimeIndicator.Release(); |
296 | 304 | m_NoteRipple.Release(); |
297 | 305 | m_MeshCtrl.Release(); |
306 | + m_BackgroundImage.Release(); | |
298 | 307 | } |
299 | 308 | |
300 | 309 | //****************************************************************************** |
@@ -663,6 +672,9 @@ void MTScenePianoRoll3D::SetEffect( | ||
663 | 672 | case EffectFileName: |
664 | 673 | m_Dashboard.SetEnableFileName(isEnable); |
665 | 674 | break; |
675 | + case EffectBackgroundImage: | |
676 | + m_BackgroundImage.SetEnable(isEnable); | |
677 | + break; | |
666 | 678 | default: |
667 | 679 | break; |
668 | 680 | } |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ピアノロール3Dシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -25,6 +25,7 @@ | ||
25 | 25 | #include "MTStars.h" |
26 | 26 | #include "MTTimeIndicator.h" |
27 | 27 | #include "MTMeshCtrl.h" |
28 | +#include "MTBackgroundImage.h" | |
28 | 29 | #include "SMIDILib.h" |
29 | 30 | |
30 | 31 | using namespace SMIDILib; |
@@ -119,6 +120,7 @@ private: | ||
119 | 120 | MTStars m_Stars; |
120 | 121 | MTTimeIndicator m_TimeIndicator; |
121 | 122 | MTMeshCtrl m_MeshCtrl; |
123 | + MTBackgroundImage m_BackgroundImage; | |
122 | 124 | |
123 | 125 | //マウス視線移動モード |
124 | 126 | bool m_IsMouseCamMode; |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ライブモニタ用ピアノロール3Dシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2012-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2012-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -140,7 +140,11 @@ int MTScenePianoRoll3DLive::Create( | ||
140 | 140 | //メッシュ制御生成 |
141 | 141 | result = m_MeshCtrl.Create(pD3DDevice, GetName()); |
142 | 142 | if (result != 0) goto EXIT; |
143 | - | |
143 | + | |
144 | + //背景画像生成 | |
145 | + result = m_BackgroundImage.Create(pD3DDevice, hWnd); | |
146 | + if (result != 0) goto EXIT; | |
147 | + | |
144 | 148 | //---------------------------------- |
145 | 149 | // レンダリングステート |
146 | 150 | //---------------------------------- |
@@ -245,6 +249,10 @@ int MTScenePianoRoll3DLive::Draw( | ||
245 | 249 | result = Transform(pD3DDevice); |
246 | 250 | if (result != 0) goto EXIT; |
247 | 251 | |
252 | + //背景画像描画 | |
253 | + result = m_BackgroundImage.Draw(pD3DDevice); | |
254 | + if (result != 0) goto EXIT; | |
255 | + | |
248 | 256 | //グリッドボックス描画 |
249 | 257 | result = m_GridBoxLive.Draw(pD3DDevice); |
250 | 258 | if (result != 0) goto EXIT; |
@@ -294,6 +302,7 @@ void MTScenePianoRoll3DLive::Release() | ||
294 | 302 | m_TimeIndicator.Release(); |
295 | 303 | m_NoteRipple.Release(); |
296 | 304 | m_MeshCtrl.Release(); |
305 | + m_BackgroundImage.Release(); | |
297 | 306 | } |
298 | 307 | |
299 | 308 | //****************************************************************************** |
@@ -640,6 +649,9 @@ void MTScenePianoRoll3DLive::SetEffect( | ||
640 | 649 | case EffectCounter: |
641 | 650 | m_DashboardLive.SetEnable(isEnable); |
642 | 651 | break; |
652 | + case EffectBackgroundImage: | |
653 | + m_BackgroundImage.SetEnable(isEnable); | |
654 | + break; | |
643 | 655 | default: |
644 | 656 | break; |
645 | 657 | } |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ライブモニタ用ピアノロール3Dシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2012-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2012-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -25,6 +25,7 @@ | ||
25 | 25 | #include "MTStars.h" |
26 | 26 | #include "MTTimeIndicator.h" |
27 | 27 | #include "MTMeshCtrl.h" |
28 | +#include "MTBackgroundImage.h" | |
28 | 29 | #include "SMIDILib.h" |
29 | 30 | |
30 | 31 | using namespace SMIDILib; |
@@ -116,6 +117,7 @@ private: | ||
116 | 117 | MTStars m_Stars; |
117 | 118 | MTTimeIndicator m_TimeIndicator; |
118 | 119 | MTMeshCtrl m_MeshCtrl; |
120 | + MTBackgroundImage m_BackgroundImage; | |
119 | 121 | |
120 | 122 | //マウス視線移動モード |
121 | 123 | bool m_IsMouseCamMode; |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ピアノロールレインシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -137,6 +137,10 @@ int MTScenePianoRollRain::Create( | ||
137 | 137 | result = m_MeshCtrl.Create(pD3DDevice, GetName()); |
138 | 138 | if (result != 0) goto EXIT; |
139 | 139 | |
140 | + //背景画像生成 | |
141 | + result = m_BackgroundImage.Create(pD3DDevice, hWnd); | |
142 | + if (result != 0) goto EXIT; | |
143 | + | |
140 | 144 | //---------------------------------- |
141 | 145 | // レンダリングステート |
142 | 146 | //---------------------------------- |
@@ -233,6 +237,10 @@ int MTScenePianoRollRain::Draw( | ||
233 | 237 | result = Transform(pD3DDevice); |
234 | 238 | if (result != 0) goto EXIT; |
235 | 239 | |
240 | + //背景画像描画 | |
241 | + result = m_BackgroundImage.Draw(pD3DDevice); | |
242 | + if (result != 0) goto EXIT; | |
243 | + | |
236 | 244 | //ピアノキーボード描画 |
237 | 245 | result = m_PianoKeyboardCtrl.Draw(pD3DDevice); |
238 | 246 | if (result != 0) goto EXIT; |
@@ -267,6 +275,7 @@ void MTScenePianoRollRain::Release() | ||
267 | 275 | m_Dashboard.Release(); |
268 | 276 | m_Stars.Release(); |
269 | 277 | m_MeshCtrl.Release(); |
278 | + m_BackgroundImage.Release(); | |
270 | 279 | } |
271 | 280 | |
272 | 281 | //****************************************************************************** |
@@ -620,6 +629,9 @@ void MTScenePianoRollRain::SetEffect( | ||
620 | 629 | case EffectFileName: |
621 | 630 | m_Dashboard.SetEnableFileName(isEnable); |
622 | 631 | break; |
632 | + case EffectBackgroundImage: | |
633 | + m_BackgroundImage.SetEnable(isEnable); | |
634 | + break; | |
623 | 635 | default: |
624 | 636 | break; |
625 | 637 | } |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ピアノロールレインシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -21,6 +21,7 @@ | ||
21 | 21 | #include "MTDashboard.h" |
22 | 22 | #include "MTNotePitchBend.h" |
23 | 23 | #include "MTMeshCtrl.h" |
24 | +#include "MTBackgroundImage.h" | |
24 | 25 | #include "SMIDILib.h" |
25 | 26 | |
26 | 27 | using namespace SMIDILib; |
@@ -115,6 +116,7 @@ private: | ||
115 | 116 | MTNotePitchBend m_NotePitchBend; |
116 | 117 | MTDashboard m_Dashboard; |
117 | 118 | MTMeshCtrl m_MeshCtrl; |
119 | + MTBackgroundImage m_BackgroundImage; | |
118 | 120 | |
119 | 121 | //マウス視線移動モード |
120 | 122 | bool m_IsMouseCamMode; |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ライブモニタ用ピアノロールレインシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2012-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2012-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -136,7 +136,11 @@ int MTScenePianoRollRainLive::Create( | ||
136 | 136 | //メッシュ制御生成 |
137 | 137 | result = m_MeshCtrl.Create(pD3DDevice, GetName()); |
138 | 138 | if (result != 0) goto EXIT; |
139 | - | |
139 | + | |
140 | + //背景画像生成 | |
141 | + result = m_BackgroundImage.Create(pD3DDevice, hWnd); | |
142 | + if (result != 0) goto EXIT; | |
143 | + | |
140 | 144 | //---------------------------------- |
141 | 145 | // レンダリングステート |
142 | 146 | //---------------------------------- |
@@ -233,6 +237,10 @@ int MTScenePianoRollRainLive::Draw( | ||
233 | 237 | result = Transform(pD3DDevice); |
234 | 238 | if (result != 0) goto EXIT; |
235 | 239 | |
240 | + //背景画像描画 | |
241 | + result = m_BackgroundImage.Draw(pD3DDevice); | |
242 | + if (result != 0) goto EXIT; | |
243 | + | |
236 | 244 | //ピアノキーボード描画 |
237 | 245 | result = m_PianoKeyboardCtrlLive.Draw(pD3DDevice); |
238 | 246 | if (result != 0) goto EXIT; |
@@ -267,6 +275,7 @@ void MTScenePianoRollRainLive::Release() | ||
267 | 275 | m_DashboardLive.Release(); |
268 | 276 | m_Stars.Release(); |
269 | 277 | m_MeshCtrl.Release(); |
278 | + m_BackgroundImage.Release(); | |
270 | 279 | } |
271 | 280 | |
272 | 281 | //****************************************************************************** |
@@ -600,6 +609,9 @@ void MTScenePianoRollRainLive::SetEffect( | ||
600 | 609 | case EffectCounter: |
601 | 610 | m_DashboardLive.SetEnable(isEnable); |
602 | 611 | break; |
612 | + case EffectBackgroundImage: | |
613 | + m_BackgroundImage.SetEnable(isEnable); | |
614 | + break; | |
603 | 615 | default: |
604 | 616 | break; |
605 | 617 | } |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ライブモニタ用ピアノロールレインシーン描画クラス |
6 | 6 | // |
7 | -// Copyright (C) 2012-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2012-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -21,6 +21,7 @@ | ||
21 | 21 | #include "MTDashboardLive.h" |
22 | 22 | #include "MTNotePitchBend.h" |
23 | 23 | #include "MTMeshCtrl.h" |
24 | +#include "MTBackgroundImage.h" | |
24 | 25 | #include "SMIDILib.h" |
25 | 26 | |
26 | 27 | using namespace SMIDILib; |
@@ -112,7 +113,8 @@ private: | ||
112 | 113 | MTNotePitchBend m_NotePitchBend; |
113 | 114 | MTDashboardLive m_DashboardLive; |
114 | 115 | MTMeshCtrl m_MeshCtrl; |
115 | - | |
116 | + MTBackgroundImage m_BackgroundImage; | |
117 | + | |
116 | 118 | //マウス視線移動モード |
117 | 119 | bool m_IsMouseCamMode; |
118 | 120 |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ウィンドウサイズ設定ダイアログクラス |
6 | 6 | // |
7 | -// Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -24,6 +24,10 @@ MTWindowSizeCfgDlg* MTWindowSizeCfgDlg::m_pThis = NULL; | ||
24 | 24 | MTWindowSizeCfgDlg::MTWindowSizeCfgDlg(void) |
25 | 25 | { |
26 | 26 | m_pThis = this; |
27 | + m_hSizeList = NULL; | |
28 | + m_hEditWidth = NULL; | |
29 | + m_hEditHeight = NULL; | |
30 | + m_hCheckApplyToView = NULL; | |
27 | 31 | m_isSaved = false; |
28 | 32 | } |
29 | 33 |
@@ -75,6 +79,14 @@ INT_PTR MTWindowSizeCfgDlg::_WndProcImpl( | ||
75 | 79 | EndDialog(hDlg, LOWORD(wParam)); |
76 | 80 | bresult = TRUE; |
77 | 81 | } |
82 | + //リストボックス | |
83 | + else if (LOWORD(wParam) == IDC_WINDOWSIZE_LIST) { | |
84 | + //選択状態変化 | |
85 | + if (HIWORD(wParam) == LBN_SELCHANGE){ | |
86 | + result = _OnSizeListChanged(); | |
87 | + if (result != 0) goto EXIT; | |
88 | + } | |
89 | + } | |
78 | 90 | break; |
79 | 91 | } |
80 | 92 |
@@ -124,7 +136,7 @@ EXIT:; | ||
124 | 136 | //****************************************************************************** |
125 | 137 | // 変更確認 |
126 | 138 | //****************************************************************************** |
127 | -bool MTWindowSizeCfgDlg::IsCahnged() | |
139 | +bool MTWindowSizeCfgDlg::IsChanged() | |
128 | 140 | { |
129 | 141 | //本当は値の変化を確認すべき |
130 | 142 | return m_isSaved; |
@@ -143,11 +155,20 @@ int MTWindowSizeCfgDlg::_OnInitDlg( | ||
143 | 155 | result = _InitConfFile(); |
144 | 156 | if (result != 0) goto EXIT; |
145 | 157 | |
146 | - //ウィンドウサイズ選択コンボボックス初期化 | |
158 | + //ウィンドウハンドル取得 | |
147 | 159 | m_hSizeList = GetDlgItem(hDlg, IDC_WINDOWSIZE_LIST); |
160 | + m_hEditWidth = GetDlgItem(hDlg, IDC_EDIT_WIDTH); | |
161 | + m_hEditHeight = GetDlgItem(hDlg, IDC_EDIT_HEIGHT); | |
162 | + m_hCheckApplyToView = GetDlgItem(hDlg, IDC_CHECK_APPLY_TO_VIEW); | |
163 | + | |
164 | + //ウィンドウサイズ選択コンボボックス初期化 | |
148 | 165 | result = _InitSizeList(); |
149 | 166 | if (result != 0) goto EXIT; |
150 | 167 | |
168 | + //ウィンドウサイズエディットボックス初期化 | |
169 | + result = _InitSizeEditbox(); | |
170 | + if (result != 0) goto EXIT; | |
171 | + | |
151 | 172 | EXIT:; |
152 | 173 | return result; |
153 | 174 | } |
@@ -194,10 +215,8 @@ int MTWindowSizeCfgDlg::_InitSizeList() | ||
194 | 215 | MTWindowSizeList::iterator itr; |
195 | 216 | bool isExist = false; |
196 | 217 | |
197 | - //ユーザ選択ウィンドウサイズ取得 | |
198 | - result = m_ConfFile.GetInt(_T("Width"), &curWidth, 0); | |
199 | - if (result != 0) goto EXIT; | |
200 | - result = m_ConfFile.GetInt(_T("Height"), &curHeight, 0); | |
218 | + //ウィンドウサイズ取得 | |
219 | + result = _GetConfWindowSize(&curWidth, &curHeight); | |
201 | 220 | if (result != 0) goto EXIT; |
202 | 221 | |
203 | 222 | m_SizeList.clear(); |
@@ -252,28 +271,164 @@ int MTWindowSizeCfgDlg::_InitSizeList() | ||
252 | 271 | } |
253 | 272 | } |
254 | 273 | |
255 | - //一覧に前回設定値が見つからなかった場合はリストの先頭を選択状態とする | |
256 | - if (selectedIndex < 0) { | |
257 | - selectedIndex = 0; | |
274 | + //リスト一致するサイズが見つかった場合は選択状態にする | |
275 | + if (selectedIndex >= 0) { | |
276 | + lresult = SendMessage(m_hSizeList, LB_SETCURSEL, selectedIndex, 0); | |
277 | + if (lresult == LB_ERR) { | |
278 | + result = YN_SET_ERR("Windows API error.", GetLastError(), selectedIndex); | |
279 | + goto EXIT; | |
280 | + } | |
258 | 281 | } |
259 | 282 | |
260 | - //選択状態設定 | |
261 | - lresult = SendMessage(m_hSizeList, LB_SETCURSEL, selectedIndex, 0); | |
262 | - if (lresult == LB_ERR) { | |
263 | - result = YN_SET_ERR("Windows API error.", GetLastError(), selectedIndex); | |
283 | +EXIT:; | |
284 | + return result; | |
285 | +} | |
286 | + | |
287 | +//****************************************************************************** | |
288 | +// ウィンドウサイズエディットボックス初期化 | |
289 | +//****************************************************************************** | |
290 | +int MTWindowSizeCfgDlg::_InitSizeEditbox() | |
291 | +{ | |
292 | + int result = 0; | |
293 | + LRESULT lresult = 0; | |
294 | + int width = 0; | |
295 | + int height = 0; | |
296 | + int maxsize = 0; | |
297 | + int applyToViewArea = 0; | |
298 | + | |
299 | + //ウィンドウサイズ取得 | |
300 | + result = _GetConfWindowSize(&width, &height); | |
301 | + if (result != 0) goto EXIT; | |
302 | + | |
303 | + //入力可能最大文字数を設定:5桁 99,999まで | |
304 | + maxsize = sizeof(TCHAR) * MT_WINDOW_SIZE_CHAR_MAX; | |
305 | + SendMessage(m_hEditWidth, EM_SETLIMITTEXT, (WPARAM)maxsize, 0); | |
306 | + SendMessage(m_hEditHeight, EM_SETLIMITTEXT, (WPARAM)maxsize, 0); | |
307 | + | |
308 | + //エディットボックスにウィンドウサイズの数値文字列を設定 | |
309 | + result = _UpdateSizeEditBox(width, height); | |
310 | + if (result != 0) goto EXIT; | |
311 | + | |
312 | + //ビュー領域適用フラグ取得 | |
313 | + result = m_ConfFile.GetInt(_T("ApplyToViewArea"), &applyToViewArea, 0); | |
314 | + if (result != 0) goto EXIT; | |
315 | + | |
316 | + //ビュー領域適用チェックボックス初期化 | |
317 | + if (applyToViewArea == 0) { | |
318 | + SendMessage(m_hCheckApplyToView, BM_SETCHECK, BST_UNCHECKED, 0); | |
319 | + } | |
320 | + else { | |
321 | + SendMessage(m_hCheckApplyToView, BM_SETCHECK, BST_CHECKED, 0); | |
322 | + } | |
323 | + | |
324 | +EXIT:; | |
325 | + return result; | |
326 | +} | |
327 | + | |
328 | +//****************************************************************************** | |
329 | +// ウィンドウサイズ設定値取得 | |
330 | +//****************************************************************************** | |
331 | +int MTWindowSizeCfgDlg::_GetConfWindowSize( | |
332 | + int* pWidth, | |
333 | + int* pHeight | |
334 | + ) | |
335 | +{ | |
336 | + int result = 0; | |
337 | + int width = 0; | |
338 | + int height = 0; | |
339 | + | |
340 | + if ((pHeight == NULL) || (pHeight == NULL)) { | |
341 | + result = YN_SET_ERR("Program error.", 0, 0); | |
264 | 342 | goto EXIT; |
265 | 343 | } |
266 | 344 | |
345 | + //ウィンドウサイズ設定値取得 | |
346 | + result = m_ConfFile.GetInt(_T("Width"), &width, 0); | |
347 | + if (result != 0) goto EXIT; | |
348 | + result = m_ConfFile.GetInt(_T("Height"), &height, 0); | |
349 | + if (result != 0) goto EXIT; | |
350 | + | |
351 | + //サイズが異常な場合は初回起動時のウィンドウサイズに更新 | |
352 | + if ((width <= 0) | |
353 | + || (height <= 0) | |
354 | + || (width > MT_WINDOW_SIZE_MAX) | |
355 | + || (height > MT_WINDOW_SIZE_MAX)) { | |
356 | + width = 800; | |
357 | + height = 600; | |
358 | + } | |
359 | + | |
360 | + *pWidth = width; | |
361 | + *pHeight = height; | |
362 | + | |
267 | 363 | EXIT:; |
268 | 364 | return result; |
269 | 365 | } |
270 | 366 | |
271 | 367 | //****************************************************************************** |
272 | -// デバイス選択情報保存 | |
368 | +// ウィンドウサイズ情報保存 | |
273 | 369 | //****************************************************************************** |
274 | 370 | int MTWindowSizeCfgDlg::_Save() |
275 | 371 | { |
276 | 372 | int result = 0; |
373 | + int apiresult = 0; | |
374 | + LRESULT lresult = 0; | |
375 | + int width = 0; | |
376 | + int height = 0; | |
377 | + int applyToViewArea = 0; | |
378 | + TCHAR str[32] = {_T('\0')}; | |
379 | + | |
380 | + //幅 | |
381 | + apiresult = GetWindowText(m_hEditWidth, str, 32); | |
382 | + if (apiresult == 0) { | |
383 | + //テキスト無しまたはウィンドウハンドル無効の場合 | |
384 | + width = 0; | |
385 | + } | |
386 | + else { | |
387 | + width = _tstoi(str); | |
388 | + } | |
389 | + | |
390 | + //高さ | |
391 | + apiresult = GetWindowText(m_hEditHeight, str, 32); | |
392 | + if (apiresult == 0) { | |
393 | + //テキスト無しまたはウィンドウハンドル無効の場合 | |
394 | + height = 0; | |
395 | + } | |
396 | + else { | |
397 | + height = _tstoi(str); | |
398 | + } | |
399 | + | |
400 | + //クリッピング | |
401 | + if (width < MT_WINDOW_SIZE_MIN) { | |
402 | + width = MT_WINDOW_SIZE_MIN; | |
403 | + } | |
404 | + if (height < MT_WINDOW_SIZE_MIN) { | |
405 | + height = MT_WINDOW_SIZE_MIN; | |
406 | + } | |
407 | + | |
408 | + //設定保存 | |
409 | + result = m_ConfFile.SetInt(_T("Width"), width); | |
410 | + if (result != 0) goto EXIT; | |
411 | + result = m_ConfFile.SetInt(_T("Height"), height); | |
412 | + if (result != 0) goto EXIT; | |
413 | + | |
414 | + //ビュー領域適用チェックボックス設定保存 | |
415 | + lresult = SendMessage(m_hCheckApplyToView, BM_GETCHECK, 0, 0); | |
416 | + if (lresult == BST_CHECKED) { | |
417 | + applyToViewArea = 1; | |
418 | + } | |
419 | + result = m_ConfFile.SetInt(_T("ApplyToViewArea"), applyToViewArea); | |
420 | + if (result != 0) goto EXIT; | |
421 | + | |
422 | +EXIT:; | |
423 | + return result; | |
424 | +} | |
425 | + | |
426 | +//****************************************************************************** | |
427 | +// ウィンドウサイズリストボックス選択状態変化 | |
428 | +//****************************************************************************** | |
429 | +int MTWindowSizeCfgDlg::_OnSizeListChanged() | |
430 | +{ | |
431 | + int result = 0; | |
277 | 432 | LRESULT lresult = 0; |
278 | 433 | int selectedIndex = 0; |
279 | 434 | MTWindowSizeItem item; |
@@ -281,23 +436,58 @@ int MTWindowSizeCfgDlg::_Save() | ||
281 | 436 | |
282 | 437 | //選択項目のインデックスを取得 |
283 | 438 | lresult = SendMessage(m_hSizeList, LB_GETCURSEL, 0, 0); |
284 | - if ((lresult == LB_ERR) || (lresult < 0)) { | |
439 | + if (lresult == LB_ERR) { | |
440 | + //未選択の場合は何もしない | |
441 | + goto EXIT; | |
442 | + } | |
443 | + else if (lresult < 0) { | |
285 | 444 | result = YN_SET_ERR("Windows API error.", GetLastError(), (DWORD64)m_hSizeList); |
286 | 445 | goto EXIT; |
287 | 446 | } |
288 | - selectedIndex = (unsigned long)lresult; | |
289 | 447 | |
448 | + //選択サイズ取得 | |
449 | + selectedIndex = (unsigned long)lresult; | |
290 | 450 | itr = m_SizeList.begin(); |
291 | 451 | advance(itr, selectedIndex); |
292 | 452 | item = *itr; |
293 | 453 | |
294 | - //設定保存 | |
295 | - result = m_ConfFile.SetInt(_T("Width"), item.width); | |
296 | - if (result != 0) goto EXIT; | |
297 | - result = m_ConfFile.SetInt(_T("Height"), item.height); | |
454 | + //エディットボックスにウィンドウサイズの数値文字列を設定 | |
455 | + result = _UpdateSizeEditBox(item.width, item.height); | |
298 | 456 | if (result != 0) goto EXIT; |
299 | 457 | |
300 | 458 | EXIT:; |
301 | 459 | return result; |
302 | 460 | } |
303 | 461 | |
462 | +//****************************************************************************** | |
463 | +// ウィンドウサイズエディットボックス更新 | |
464 | +//****************************************************************************** | |
465 | +int MTWindowSizeCfgDlg::_UpdateSizeEditBox( | |
466 | + int width, | |
467 | + int height | |
468 | + ) | |
469 | +{ | |
470 | + int result = 0; | |
471 | + BOOL bresult = FALSE; | |
472 | + TCHAR str[32] = {_T('\0')}; | |
473 | + | |
474 | + //幅 | |
475 | + _stprintf_s(str, 32, _T("%d"), width); | |
476 | + bresult = SetWindowText(m_hEditWidth, str); | |
477 | + if (!bresult) { | |
478 | + result = YN_SET_ERR("Windows API error.", GetLastError(), width); | |
479 | + goto EXIT; | |
480 | + } | |
481 | + | |
482 | + //高さ | |
483 | + _stprintf_s(str, 32, _T("%d"), height); | |
484 | + bresult = SetWindowText(m_hEditHeight, str); | |
485 | + if (!bresult) { | |
486 | + result = YN_SET_ERR("Windows API error.", GetLastError(), height); | |
487 | + goto EXIT; | |
488 | + } | |
489 | + | |
490 | +EXIT:; | |
491 | + return result; | |
492 | +} | |
493 | + |
@@ -4,7 +4,7 @@ | ||
4 | 4 | // |
5 | 5 | // ウィンドウサイズ設定ダイアログクラス |
6 | 6 | // |
7 | -// Copyright (C) 2010 WADA Masashi. All Rights Reserved. | |
7 | +// Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
8 | 8 | // |
9 | 9 | //****************************************************************************** |
10 | 10 |
@@ -18,6 +18,20 @@ using namespace YNBaseLib; | ||
18 | 18 | |
19 | 19 | |
20 | 20 | //****************************************************************************** |
21 | +//ウィンドウサイズ設定ダイアログクラス パラメタ定義 | |
22 | +//****************************************************************************** | |
23 | + | |
24 | +//ウィンドウサイズ設定最小値 | |
25 | +#define MT_WINDOW_SIZE_MIN 200 | |
26 | + | |
27 | +//ウィンドウサイズ設定最大値 | |
28 | +#define MT_WINDOW_SIZE_MAX 99999 | |
29 | + | |
30 | +//ウィンドウサイズ文字数最大値:99999→5桁 | |
31 | +#define MT_WINDOW_SIZE_CHAR_MAX 5 | |
32 | + | |
33 | + | |
34 | +//****************************************************************************** | |
21 | 35 | //ウィンドウサイズ設定ダイアログクラス |
22 | 36 | //****************************************************************************** |
23 | 37 | class MTWindowSizeCfgDlg |
@@ -32,7 +46,7 @@ public: | ||
32 | 46 | int Show(HWND hParentWnd); |
33 | 47 | |
34 | 48 | //変更確認 |
35 | - bool IsCahnged(); | |
49 | + bool IsChanged(); | |
36 | 50 | |
37 | 51 | private: |
38 | 52 |
@@ -57,6 +71,13 @@ private: | ||
57 | 71 | //ウィンドウサイズリスト |
58 | 72 | MTWindowSizeList m_SizeList; |
59 | 73 | |
74 | + //ウィンドウサイズエディットボックスウィンドウハンドル | |
75 | + HWND m_hEditWidth; | |
76 | + HWND m_hEditHeight; | |
77 | + | |
78 | + //ビュー領域適用チェックボックスウィンドウハンドル | |
79 | + HWND m_hCheckApplyToView; | |
80 | + | |
60 | 81 | //設定ファイル |
61 | 82 | YNConfFile m_ConfFile; |
62 | 83 |
@@ -73,11 +94,23 @@ private: | ||
73 | 94 | //設定ファイル初期化 |
74 | 95 | int _InitConfFile(); |
75 | 96 | |
76 | - //ウィンドウサイズ選択コンボボックス初期化 | |
97 | + //ウィンドウサイズ選択リストボックス初期化 | |
77 | 98 | int _InitSizeList(); |
78 | 99 | |
100 | + //ウィンドウサイズエディットボックス初期化 | |
101 | + int _InitSizeEditbox(); | |
102 | + | |
103 | + //ウィンドウサイズ取得 | |
104 | + int _GetConfWindowSize(int* pWidth, int* pHeight); | |
105 | + | |
79 | 106 | //保存処理 |
80 | 107 | int _Save(); |
81 | 108 | |
109 | + //ウィンドウサイズリストボックス選択状態変化 | |
110 | + int _OnSizeListChanged(); | |
111 | + | |
112 | + //ウィンドウサイズエディットボックス更新 | |
113 | + int _UpdateSizeEditBox(int width, int height); | |
114 | + | |
82 | 115 | }; |
83 | 116 |
@@ -33,6 +33,11 @@ | ||
33 | 33 | #define IDC_CHECK_MIDITHRU 1016 |
34 | 34 | #define IDC_TEXT_VERSION 1017 |
35 | 35 | #define IDC_TEXT_COPYRIGHT 1018 |
36 | +#define IDC_CHECK_APPLY_TO_VIEW 1019 | |
37 | +#define IDC_EDIT_WIDTH 1020 | |
38 | +#define IDC_EDIT_HEIGHT 1021 | |
39 | +#define IDC_EDIT_IMAGE_FILE_PATH 1022 | |
40 | +#define IDC_BTN_BROWSE 1023 | |
36 | 41 | #define IDM_OPEN_FILE 32771 |
37 | 42 | #define IDM_PLAY 32772 |
38 | 43 | #define IDM_STOP 32773 |
@@ -61,6 +66,7 @@ | ||
61 | 66 | #define IDM_STOP_MONITORING 32836 |
62 | 67 | #define IDM_AUTO_SAVE_VIEWPOINT 32838 |
63 | 68 | #define IDM_VIEW_PIANOROLLRAIN2D 32840 |
69 | +#define IDM_ENABLE_BACKGROUNDIMAGE 32842 | |
64 | 70 | #define IDC_STATIC -1 |
65 | 71 | |
66 | 72 | // Next default values for new objects |
@@ -69,8 +75,8 @@ | ||
69 | 75 | #ifndef APSTUDIO_READONLY_SYMBOLS |
70 | 76 | #define _APS_NO_MFC 1 |
71 | 77 | #define _APS_NEXT_RESOURCE_VALUE 134 |
72 | -#define _APS_NEXT_COMMAND_VALUE 32841 | |
73 | -#define _APS_NEXT_CONTROL_VALUE 1019 | |
78 | +#define _APS_NEXT_COMMAND_VALUE 32843 | |
79 | +#define _APS_NEXT_CONTROL_VALUE 1024 | |
74 | 80 | #define _APS_NEXT_SYMED_VALUE 110 |
75 | 81 | #endif |
76 | 82 | #endif |
@@ -1,11 +1,11 @@ | ||
1 | 1 | ****************************************************************************** |
2 | 2 | |
3 | - MIDITrail source code Ver.1.2.1b for Windows | |
3 | + MIDITrail source code Ver.1.2.2 for Windows | |
4 | 4 | |
5 | - Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
5 | + Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
6 | 6 | |
7 | - Web : http://sourceforge.jp/projects/miditrail/ | |
8 | - Mail: yknk@users.sourceforge.jp | |
7 | + Web : https://osdn.jp/projects/miditrail/ | |
8 | + Mail: yknk@users.osdn.me | |
9 | 9 | |
10 | 10 | ****************************************************************************** |
11 | 11 |
@@ -1,11 +1,11 @@ | ||
1 | 1 | ****************************************************************************** |
2 | 2 | |
3 | - MIDITrail ソースコード Ver.1.2.1b for Windows | |
3 | + MIDITrail ソースコード Ver.1.2.2 for Windows | |
4 | 4 | |
5 | - Copyright (C) 2010-2014 WADA Masashi. All Rights Reserved. | |
5 | + Copyright (C) 2010-2016 WADA Masashi. All Rights Reserved. | |
6 | 6 | |
7 | - Web : http://sourceforge.jp/projects/miditrail/ | |
8 | - Mail: yknk@users.sourceforge.jp | |
7 | + Web : https://osdn.jp/projects/miditrail/ | |
8 | + Mail: yknk@users.osdn.me | |
9 | 9 | |
10 | 10 | ****************************************************************************** |
11 | 11 |