1
1
/*
2
2
* Copyright 2006 Milan Digital Audio LLC
3
- * Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
3
+ * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
4
4
* License GPL-2.0 or later
5
5
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
6
6
*/
@@ -30,7 +30,6 @@ GODrawstop::GODrawstop(GOOrganModel &organModel)
30
30
m_Type(FUNCTION_INPUT),
31
31
m_GCState(0 ),
32
32
m_ActiveState(false ),
33
- m_CombinationState(false ),
34
33
m_ControlledDrawstops(),
35
34
m_ControllingDrawstops(),
36
35
m_IsToStoreInDivisional(false ),
@@ -133,38 +132,36 @@ void GODrawstop::Save(GOConfigWriter &cfg) {
133
132
GOButtonControl::Save (cfg);
134
133
}
135
134
136
- void GODrawstop::Set (bool on) {
135
+ void GODrawstop::SetButtonState (bool on) {
137
136
if (IsEngaged () == on)
138
137
return ;
139
138
Display (on);
140
- SetState (on);
139
+ SetDrawStopState (on);
141
140
}
142
141
143
142
void GODrawstop::Reset () {
144
143
if (IsReadOnly ())
145
144
return ;
146
145
if (m_GCState < 0 )
147
146
return ;
148
- Set (m_GCState > 0 ? true : false );
147
+ SetButtonState (m_GCState > 0 ? true : false );
149
148
}
150
149
151
- void GODrawstop::SetState (bool on) {
150
+ void GODrawstop::SetDrawStopState (bool on) {
152
151
if (IsActive () == on)
153
152
return ;
154
153
if (IsReadOnly ()) {
155
154
Display (on);
156
155
}
157
156
m_ActiveState = on;
158
- ChangeState (on);
157
+ OnDrawstopStateChanged (on);
159
158
for (unsigned i = 0 ; i < m_ControlledDrawstops.size (); i++)
160
159
m_ControlledDrawstops[i]->Update ();
161
160
}
162
161
163
- void GODrawstop::SetCombination (bool on) {
164
- if (IsReadOnly ())
165
- return ;
166
- m_CombinationState = on;
167
- Set (on);
162
+ void GODrawstop::SetCombinationState (bool on) {
163
+ if (!IsReadOnly ())
164
+ SetButtonState (on);
168
165
}
169
166
170
167
void GODrawstop::StartPlayback () {
@@ -176,7 +173,7 @@ void GODrawstop::Update() {
176
173
bool state;
177
174
switch (m_Type) {
178
175
case FUNCTION_INPUT:
179
- SetState (IsEngaged ());
176
+ SetDrawStopState (IsEngaged ());
180
177
break ;
181
178
182
179
case FUNCTION_AND:
@@ -185,9 +182,9 @@ void GODrawstop::Update() {
185
182
for (unsigned i = 0 ; i < m_ControllingDrawstops.size (); i++)
186
183
state = state && m_ControllingDrawstops[i]->IsActive ();
187
184
if (m_Type == FUNCTION_NAND)
188
- SetState (!state);
185
+ SetDrawStopState (!state);
189
186
else
190
- SetState (state);
187
+ SetDrawStopState (state);
191
188
break ;
192
189
193
190
case FUNCTION_OR:
@@ -196,21 +193,21 @@ void GODrawstop::Update() {
196
193
for (unsigned i = 0 ; i < m_ControllingDrawstops.size (); i++)
197
194
state = state || m_ControllingDrawstops[i]->IsActive ();
198
195
if (m_Type == FUNCTION_NOR)
199
- SetState (!state);
196
+ SetDrawStopState (!state);
200
197
else
201
- SetState (state);
198
+ SetDrawStopState (state);
202
199
break ;
203
200
204
201
case FUNCTION_XOR:
205
202
state = false ;
206
203
for (unsigned i = 0 ; i < m_ControllingDrawstops.size (); i++)
207
204
state = state != m_ControllingDrawstops[i]->IsActive ();
208
- SetState (state);
205
+ SetDrawStopState (state);
209
206
break ;
210
207
211
208
case FUNCTION_NOT:
212
209
state = m_ControllingDrawstops[0 ]->IsActive ();
213
- SetState (!state);
210
+ SetDrawStopState (!state);
214
211
break ;
215
212
}
216
213
}
0 commit comments