• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Windows Apps


コミットメタ情報

リビジョン1f95ce0cc83f8b0565a14ce4a8ff901332e4b926 (tree)
日時2014-06-17 06:19:10
作者oga <oga@mxg....>
コミッターoga

ログメッセージ

add SelectInst Dialogue

変更サマリ

差分

Binary files a/wkeyboard/Release/wkeyboard.exe and b/wkeyboard/Release/wkeyboard.exe differ
--- a/wkeyboard/SelectInst.cpp
+++ b/wkeyboard/SelectInst.cpp
@@ -4,6 +4,7 @@
44 #include "stdafx.h"
55 #include "wkeyboard.h"
66 #include "SelectInst.h"
7+#include "midilib.h"
78
89 #ifdef _DEBUG
910 #define new DEBUG_NEW
@@ -11,6 +12,46 @@
1112 static char THIS_FILE[] = __FILE__;
1213 #endif
1314
15+static int id_instname[MAX_CH] = {
16+ IDC_STATIC_1,
17+ IDC_STATIC_2,
18+ IDC_STATIC_3,
19+ IDC_STATIC_4,
20+ IDC_STATIC_5,
21+ IDC_STATIC_6,
22+ IDC_STATIC_7,
23+ IDC_STATIC_8,
24+ IDC_STATIC_9,
25+ IDC_STATIC_10,
26+ IDC_STATIC_11,
27+ IDC_STATIC_12,
28+ IDC_STATIC_13,
29+ IDC_STATIC_14,
30+ IDC_STATIC_15,
31+ IDC_STATIC_16
32+};
33+
34+static int id_checks[MAX_CH] = {
35+ IDC_CHECK1,
36+ IDC_CHECK2,
37+ IDC_CHECK3,
38+ IDC_CHECK4,
39+ IDC_CHECK5,
40+ IDC_CHECK6,
41+ IDC_CHECK7,
42+ IDC_CHECK8,
43+ IDC_CHECK9,
44+ IDC_CHECK10,
45+ IDC_CHECK11,
46+ IDC_CHECK12,
47+ IDC_CHECK13,
48+ IDC_CHECK14,
49+ IDC_CHECK15,
50+ IDC_CHECK16
51+};
52+
53+extern int push_color[]; // wkeyboardDlg.cpp
54+
1455 /////////////////////////////////////////////////////////////////////////////
1556 // CSelectInst ダイアログ
1657
@@ -36,6 +77,7 @@ void CSelectInst::DoDataExchange(CDataExchange* pDX)
3677 BEGIN_MESSAGE_MAP(CSelectInst, CDialog)
3778 //{{AFX_MSG_MAP(CSelectInst)
3879 ON_BN_CLICKED(IDC_CHECK_ALL, OnCheckAll)
80+ ON_WM_PAINT()
3981 //}}AFX_MSG_MAP
4082 END_MESSAGE_MAP()
4183
@@ -45,12 +87,26 @@ END_MESSAGE_MAP()
4587 void CSelectInst::OnCheckAll()
4688 {
4789 // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
90+ if (((CButton *)GetDlgItem(IDC_CHECK_ALL))->GetCheck() == TRUE) {
91+ AllCheck(TRUE);
92+ } else {
93+ AllCheck(FALSE);
94+ }
95+ //MessageBox("AllCheck");
4896
4997 }
5098
5199 void CSelectInst::OnOK()
52100 {
53101 // TODO: この位置にその他の検証用のコードを追加してください
102+ // set checkbox status
103+ for (int i = 0; i < MAX_CH; i++) {
104+ if (((CButton *)GetDlgItem(id_checks[i]))->GetCheck() == TRUE) {
105+ inst_tbl[i].disp = 1;
106+ } else {
107+ inst_tbl[i].disp = 0;
108+ }
109+ }
54110
55111 CDialog::OnOK();
56112 }
@@ -67,7 +123,56 @@ BOOL CSelectInst::OnInitDialog()
67123 CDialog::OnInitDialog();
68124
69125 // TODO: この位置に初期化の補足処理を追加してください
126+ int i;
127+ int num_chk = 0;
128+
129+ for (i = 0; i < MAX_CH; i++) {
130+ if (i == 9) {
131+ SetDlgItemText(id_instname[i], "Percussion");
132+ } else {
133+ SetDlgItemText(id_instname[i], prog_name[inst_tbl[i].instno]);
134+ }
135+ //pbr_ch[i] = new CBrush();
136+ //pbr_ch[i]->CreateSolidBrush(push_color[i]);
137+ if (inst_tbl[i].disp) {
138+ ((CButton *)GetDlgItem(id_checks[i]))->SetCheck(TRUE);
139+ ++num_chk;
140+ } else {
141+ ((CButton *)GetDlgItem(id_checks[i]))->SetCheck(FALSE);
142+ }
143+ }
144+ if (num_chk >= 16) {
145+ ((CButton *)GetDlgItem(IDC_CHECK_ALL))->SetCheck(TRUE);
146+ }
70147
71148 return TRUE; // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります
72149 // 例外: OCX プロパティ ページの戻り値は FALSE となります
73150 }
151+
152+void CSelectInst::AllCheck(BOOL sw)
153+{
154+ for (int i = 0; i < MAX_CH; i++) {
155+ ((CButton *)GetDlgItem(id_checks[i]))->SetCheck(sw);
156+ }
157+}
158+
159+
160+void CSelectInst::OnPaint()
161+{
162+ CPaintDC dc(this); // 描画用のデバイス コンテキスト
163+
164+ // TODO: この位置にメッセージ ハンドラ用のコードを追加してください
165+ CDC *pdc;
166+ CRect rect;
167+
168+ pdc = CWnd::GetDC();
169+
170+ for (int i = 0; i < MAX_CH; i++) {
171+ //pdc->SelectObject(pbr_ch[i]);
172+ rect.SetRect(65, 31+i*14, 95, 31+i*14+10);
173+ pdc->FillSolidRect(&rect, push_color[i]);
174+ }
175+
176+ // 描画用メッセージとして CDialog::OnPaint() を呼び出してはいけません
177+}
178+
--- a/wkeyboard/SelectInst.h
+++ b/wkeyboard/SelectInst.h
@@ -1,6 +1,8 @@
11 #if !defined(AFX_SELECTINST_H__B0E5F9B0_4B9D_47F9_96C6_3E91E82542F1__INCLUDED_)
22 #define AFX_SELECTINST_H__B0E5F9B0_4B9D_47F9_96C6_3E91E82542F1__INCLUDED_
33
4+#include "midilib.h"
5+
46 #if _MSC_VER > 1000
57 #pragma once
68 #endif // _MSC_VER > 1000
@@ -16,6 +18,7 @@ class CSelectInst : public CDialog
1618 public:
1719 CSelectInst(CWnd* pParent = NULL); // 標準のコンストラクタ
1820
21+
1922 // ダイアログ データ
2023 //{{AFX_DATA(CSelectInst)
2124 enum { IDD = IDD_SELINST_DLG };
@@ -32,13 +35,16 @@ public:
3235
3336 // インプリメンテーション
3437 protected:
35-
38+ CBrush *pbr_ch[MAX_CH];
39+ void AllCheck(BOOL sw);
40+
3641 // 生成されたメッセージ マップ関数
3742 //{{AFX_MSG(CSelectInst)
3843 afx_msg void OnCheckAll();
3944 virtual void OnOK();
4045 virtual void OnCancel();
4146 virtual BOOL OnInitDialog();
47+ afx_msg void OnPaint();
4248 //}}AFX_MSG
4349 DECLARE_MESSAGE_MAP()
4450 };
--- a/wkeyboard/midilib.c
+++ b/wkeyboard/midilib.c
@@ -82,7 +82,7 @@ typedef struct _mtck_t {
8282 /* V0.14-A end */
8383
8484 #define EOD (0xffffffff)
85-#define TICK 20 /* ms */
85+#define TICK 10 /* ms */
8686
8787 #define MS2DELTA(ms) (((ms) * hd_dtime)/(tempo/1000))
8888 #define MS2DELTA_ORG(ms) (((ms) * hd_dtime)/(orgtempo/1000)) /* V0.18-A */
@@ -305,7 +305,7 @@ typedef struct _midiinst {
305305 } MidiInst;
306306
307307 MidiInst minst;
308-insttbl_t inst_tbl[16]; /* Instrumetn Table V0.50-A */
308+insttbl_t inst_tbl[MAX_CH]; /* Instrumetn Table V0.50-A */
309309
310310 void dlog(char *str)
311311 {
@@ -1254,8 +1254,8 @@ int trknm;
12541254 playdat[trknm][idx*2] = delta_sum; /* Delta Time 累計で格納 */
12551255 playdat[trknm][idx*2+1] = MIDIMSG(cmd1, cmd2, cmd3);
12561256 ++idx;
1257- if (stat == 12) { /* program chane */
1258- inst_tbl[trkno].instno = cmd2;
1257+ if (stat == 12) { /* 0xCn program chane */
1258+ inst_tbl[ch].instno = cmd2;
12591259 }
12601260 }
12611261 #endif
@@ -1419,7 +1419,7 @@ void StopAllNotes()
14191419 int i;
14201420
14211421 dlog("StopAllNotes()\n");
1422- for (i = 0; i < 16; i++) { /* ch */
1422+ for (i = 0; i < MAX_CH; i++) { /* ch */
14231423 // All Notes Off (Bx 7B 00)
14241424 WinMidiShortMsg(&minst, MIDIMSG(0xB0+i, 0x7B, 0));
14251425 if (cb_func) (*cb_func)(MIDIMSG(0xB0+i, 0x7B, 0)); /* for update screen */
@@ -1435,7 +1435,7 @@ void InitInstruments()
14351435 int i;
14361436
14371437 dlog("InitInstruments()\n");
1438- for (i = 0; i < 16; i++) { /* ch */
1438+ for (i = 0; i < MAX_CH; i++) { /* ch */
14391439 WinMidiShortMsg(&minst, MIDIMSG(0xC0+i, 0x00, 0)); /* Set to Piano1 */
14401440 inst_tbl[i].instno = 0; /* Set to Piano1 */
14411441 }
@@ -1596,10 +1596,9 @@ rewind:
15961596 if (((wk & 0xf0) == 0x90) || ((wk & 0xf0) == 0x80)) {
15971597 /* note on/off */
15981598 if (inst_tbl[wk & 0x0f].play) {
1599- WinMidiShortMsg(&minst, wk); /* play & disp */
1600- if (cb_func) (*cb_func)(wk); /* for update screen */
1601- last_cb_tick = tick; /* 最後にcallbackしたtick値更新 V0.50-A */
1602- } else if (inst_tbl[wk & 0x0f].disp) {
1599+ WinMidiShortMsg(&minst, wk); /* play */
1600+ }
1601+ if (inst_tbl[wk & 0x0f].disp) {
16031602 /* disp only */
16041603 if (cb_func) (*cb_func)(wk); /* for update screen */
16051604 last_cb_tick = tick;
@@ -1813,7 +1812,7 @@ void MidiLibStart()
18131812 cb_func = NULL;
18141813
18151814 memset(&inst_tbl, 0, sizeof(inst_tbl));
1816- for (i = 0; i < 16; i++) {
1815+ for (i = 0; i < MAX_CH; i++) {
18171816 inst_tbl[i].disp = 1;
18181817 inst_tbl[i].play = 1;
18191818 }
--- a/wkeyboard/midilib.h
+++ b/wkeyboard/midilib.h
@@ -1,6 +1,8 @@
11 #ifndef _MIDILIB_INCLUDED_
22 #define _MIDILIB_INCLUDED_
33
4+#include <mmsystem.h>
5+
46 typedef unsigned int u_int;
57
68 typedef struct _playstat {
@@ -22,6 +24,9 @@ typedef struct _insttbl {
2224 /* callback func type */
2325 typedef void (*MIDICB)(unsigned int midicmd);
2426
27+/* defines */
28+#define MAX_CH 16
29+
2530 /* for MidiSetOpenMode() */
2631 #define MIDILIB_MODE_USEOPEN 0
2732 #define MIDILIB_MODE_NOOPEN 1
--- a/wkeyboard/wkeyboard.rc
+++ b/wkeyboard/wkeyboard.rc
@@ -90,7 +90,7 @@ STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
9090 WS_SYSMENU
9191 EXSTYLE WS_EX_APPWINDOW
9292 CAPTION "wkeyboard"
93-FONT 9, "MS Pゴシック"
93+FONT 9, "MS Pゴシック", 0, 0, 0x1
9494 BEGIN
9595 COMBOBOX IDC_COMBO1,7,1,90,115,CBS_DROPDOWNLIST | CBS_SORT |
9696 WS_VSCROLL | WS_TABSTOP
@@ -113,63 +113,63 @@ BEGIN
113113 PUSHBUTTON "Inst",IDC_BTN_SELINST,217,7,16,12
114114 END
115115
116-IDD_SELINST_DLG DIALOG DISCARDABLE 0, 0, 131, 192
116+IDD_SELINST_DLG DIALOG DISCARDABLE 0, 0, 131, 197
117117 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
118118 CAPTION "Select Instruments"
119119 FONT 9, "MS Pゴシック"
120120 BEGIN
121121 CONTROL "All",IDC_CHECK_ALL,"Button",BS_AUTOCHECKBOX |
122- WS_TABSTOP,7,7,24,10
122+ WS_TABSTOP,7,7,21,10
123123 CONTROL "1ch",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
124124 20,21,10
125125 CONTROL "2ch",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
126- 29,26,10
126+ 29,24,10
127127 CONTROL "3ch",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
128- 38,26,10
128+ 39,24,10
129129 CONTROL "4ch",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
130- 47,26,10
130+ 48,24,10
131131 CONTROL "5ch",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
132- 56,26,10
132+ 57,24,10
133133 CONTROL "6ch",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
134- 65,26,10
134+ 67,24,10
135135 CONTROL "7ch",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
136- 74,26,10
136+ 76,23,10
137137 CONTROL "8ch",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
138- 83,26,10
138+ 85,24,10
139139 CONTROL "9ch",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
140- 92,26,10
140+ 95,24,10
141141 CONTROL "10ch",IDC_CHECK10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
142- 7,101,30,10
142+ 7,104,26,10
143143 CONTROL "11ch",IDC_CHECK11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
144- 7,110,30,10
144+ 7,113,26,10
145145 CONTROL "12ch",IDC_CHECK12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
146- 7,119,30,10
146+ 7,123,27,10
147147 CONTROL "13ch",IDC_CHECK13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
148- 7,128,30,10
148+ 7,132,26,10
149149 CONTROL "14ch",IDC_CHECK14,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
150- 7,137,38,10
150+ 7,141,26,10
151151 CONTROL "15ch",IDC_CHECK15,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
152- 7,146,38,10
152+ 7,150,27,10
153153 CONTROL "16ch",IDC_CHECK16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
154- 7,155,38,10
155- DEFPUSHBUTTON "OK",IDOK,7,171,37,14
156- PUSHBUTTON "Cancel",IDCANCEL,45,171,37,14
154+ 7,160,27,10
155+ DEFPUSHBUTTON "OK",IDOK,7,176,37,14
156+ PUSHBUTTON "Cancel",IDCANCEL,45,176,37,14
157157 LTEXT "Instrument",IDC_STATIC_1,60,20,55,8
158158 LTEXT "Instrument",IDC_STATIC_2,60,29,55,8
159- LTEXT "Instrument",IDC_STATIC_3,60,38,55,8
160- LTEXT "Instrument",IDC_STATIC_4,60,47,55,8
161- LTEXT "Instrument",IDC_STATIC_5,60,56,55,8
162- LTEXT "Instrument",IDC_STATIC_6,60,65,55,8
163- LTEXT "Instrument",IDC_STATIC_7,60,74,55,8
164- LTEXT "Instrument",IDC_STATIC_8,60,83,55,8
165- LTEXT "Instrument",IDC_STATIC_9,60,92,55,8
166- LTEXT "Instrument",IDC_STATIC_10,60,101,55,8
167- LTEXT "Instrument",IDC_STATIC_11,60,110,55,8
168- LTEXT "Instrument",IDC_STATIC_12,60,119,55,8
169- LTEXT "Instrument",IDC_STATIC_13,60,128,55,8
170- LTEXT "Instrument",IDC_STATIC_14,60,137,55,8
171- LTEXT "Instrument",IDC_STATIC_15,60,146,55,8
172- LTEXT "Instrument",IDC_STATIC_16,60,155,55,8
159+ LTEXT "Instrument",IDC_STATIC_3,60,39,55,8
160+ LTEXT "Instrument",IDC_STATIC_4,60,48,55,8
161+ LTEXT "Instrument",IDC_STATIC_5,60,57,55,8
162+ LTEXT "Instrument",IDC_STATIC_6,60,67,55,8
163+ LTEXT "Instrument",IDC_STATIC_7,60,76,55,8
164+ LTEXT "Instrument",IDC_STATIC_8,60,85,55,8
165+ LTEXT "Instrument",IDC_STATIC_9,60,95,55,8
166+ LTEXT "Instrument",IDC_STATIC_10,60,104,55,8
167+ LTEXT "Instrument",IDC_STATIC_11,60,113,55,8
168+ LTEXT "Instrument",IDC_STATIC_12,60,123,55,8
169+ LTEXT "Instrument",IDC_STATIC_13,60,132,55,8
170+ LTEXT "Instrument",IDC_STATIC_14,60,141,55,8
171+ LTEXT "Instrument",IDC_STATIC_15,60,150,55,8
172+ LTEXT "Instrument",IDC_STATIC_16,60,160,55,8
173173 END
174174
175175
@@ -247,7 +247,7 @@ BEGIN
247247 LEFTMARGIN, 7
248248 RIGHTMARGIN, 124
249249 TOPMARGIN, 7
250- BOTTOMMARGIN, 185
250+ BOTTOMMARGIN, 190
251251 END
252252 END
253253 #endif // APSTUDIO_INVOKED