-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindEvent.cpp
229 lines (192 loc) · 5.54 KB
/
FindEvent.cpp
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
217
218
219
220
221
222
223
224
225
226
227
228
229
// FindEvent.cpp : implementation file
//
#include "stdafx.h"
#include "MidiGlassApp.h"
#include "FindEvent.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CFindEvent, CMWDialog)
//
////////////////////////////////////////////////////////////////////////
// CFindEvent dialog
//
////////////////////////////////////////////////////////////////////////
CFindEvent::CFindEvent(CWnd* pParent /*=NULL*/) : CMWDialog(CFindEvent::IDD, pParent)
{
//{{AFX_DATA_INIT(CFindEvent)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
void CFindEvent::DoDataExchange(CDataExchange* pDX)
{
CMWDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFindEvent)
DDX_Control(pDX, IDC_V2_TO, m_V2_To);
DDX_Control(pDX, IDC_V2_FROM, m_V2_From);
DDX_Control(pDX, IDC_SPIN_V2_TO, m_Spin_V2_To);
DDX_Control(pDX, IDC_SPIN_V2_FROM, m_Spin_V2_From);
DDX_Control(pDX, IDC_V1_TO, m_V1_To);
DDX_Control(pDX, IDC_V1_FROM, m_V1_From);
DDX_Control(pDX, IDC_SPIN_V1_TO, m_Spin_V1_To);
DDX_Control(pDX, IDC_SPIN_V1_FROM, m_Spin_V1_From);
DDX_Control(pDX, IDC_CONTROLLER_COMBO, m_Controller_Combo);
DDX_Control(pDX, IDC_PROGRAM_COMBO, m_Program_Combo);
DDX_Control(pDX, IDC_EVENT_COMBO, m_Event_Combo);
//}}AFX_DATA_MAP
}
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CFindEvent, CMWDialog)
//{{AFX_MSG_MAP(CFindEvent)
ON_CBN_SELCHANGE(IDC_EVENT_COMBO, OnSelchangeEventCombo)
ON_CBN_SELENDOK(IDC_EVENT_COMBO, OnSelendokEventCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
BOOL CFindEvent::OnInitDialog()
{
CMWDialog::OnInitDialog();
//
m_Event_Combo.ResetContent ( );
m_Program_Combo.ResetContent ( );
m_Program_Combo.AddString ( "" );
m_Controller_Combo.ResetContent ( );
m_Controller_Combo.AddString ( "" );
m_Program_Combo.SetCurSel ( 0 );
m_Program_Combo.EnableWindow ( FALSE );
m_Controller_Combo.SetCurSel ( 0 );
m_Controller_Combo.EnableWindow ( FALSE );
m_Spin_V1_From.SetRange ( 0, 255 );
m_Spin_V1_From.SetPos ( 0 );
m_Spin_V1_To.SetRange ( 0, 255 );
m_Spin_V1_To.SetPos ( 255 );
m_Spin_V2_From.SetRange ( 0, 255 );
m_Spin_V2_From.SetPos ( 0 );
m_Spin_V2_To.SetRange ( 0, 255 );
m_Spin_V2_To.SetPos ( 255 );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
void CFindEvent::OnOK()
{
//
CMainFrame *hMainFrame;
hMainFrame = dynamic_cast< CMainFrame * >( GetParent() );
hMainFrame = dynamic_cast< CMainFrame * >( AfxGetMainWnd( ) );
if ( hMainFrame == NULL )
{
CMWDialog::OnOK();
return;
}
// Set the string selected
CString strEvent;
CString strProgram;
CString strController;
if ( m_Event_Combo.GetCurSel ( ) >= 0 )
{
m_Event_Combo.GetLBText ( m_Event_Combo.GetCurSel ( ), strEvent );
}
else
{
strEvent = "";
}
if ( m_Program_Combo.GetCurSel ( ) >= 0 )
{
m_Program_Combo.GetLBText ( m_Program_Combo.GetCurSel ( ), strProgram );
}
else
{
strProgram = "";
}
if ( m_Controller_Combo.GetCurSel ( ) >= 0 )
{
m_Controller_Combo.GetLBText ( m_Controller_Combo.GetCurSel ( ), strController );
}
else
{
strController = "";
}
int V1_From = m_Spin_V1_From.GetPos ( );
int V1_To = m_Spin_V1_To.GetPos ( );
int V2_From = m_Spin_V2_From.GetPos ( );
int V2_To = m_Spin_V2_To.GetPos ( );
hMainFrame->SetSearchInfo ( strEvent, strProgram, strController, V1_From, V1_To, V2_From, V2_To );
CMWDialog::OnOK();
}
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
void CFindEvent::OnSelchangeEventCombo()
{
//
EnableDisable ( );
}
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
void CFindEvent::OnSelendokEventCombo()
{
//
EnableDisable ( );
}
//
////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
void CFindEvent::EnableDisable()
{
unsigned iEventIndex;
int iCurSel;
CMidiClass classTemp;
CString strCurSel;
iCurSel = m_Event_Combo.GetCurSel ( );
if ( iCurSel >= 0 )
{
m_Event_Combo.GetLBText ( iCurSel, strCurSel );
iEventIndex = classTemp.SearchClassEventText ( strCurSel );
if ( iEventIndex == MIDI_EVENT_PARAMETER )
{
m_Program_Combo.SetCurSel ( 0 );
m_Program_Combo.EnableWindow ( FALSE );
m_Controller_Combo.EnableWindow ( TRUE );
}
else if ( iEventIndex == MIDI_EVENT_PROGRAM )
{
m_Controller_Combo.SetCurSel ( 0 );
m_Controller_Combo.EnableWindow ( FALSE );
m_Program_Combo.EnableWindow ( TRUE );
}
else
{
m_Program_Combo.SetCurSel ( 0 );
m_Program_Combo.EnableWindow ( FALSE );
m_Controller_Combo.SetCurSel ( 0 );
m_Controller_Combo.EnableWindow ( FALSE );
}
}
else
{
m_Program_Combo.SetCurSel ( 0 );
m_Program_Combo.EnableWindow ( FALSE );
m_Controller_Combo.SetCurSel ( 0 );
m_Controller_Combo.EnableWindow ( FALSE );
}
}