@@ -132,13 +132,6 @@ void GODrawstop::Save(GOConfigWriter &cfg) {
132
132
GOButtonControl::Save (cfg);
133
133
}
134
134
135
- void GODrawstop::SetButtonState (bool on) {
136
- if (IsEngaged () == on)
137
- return ;
138
- Display (on);
139
- SetDrawStopState (on);
140
- }
141
-
142
135
void GODrawstop::Reset () {
143
136
if (IsReadOnly ())
144
137
return ;
@@ -147,21 +140,35 @@ void GODrawstop::Reset() {
147
140
SetButtonState (m_GCState > 0 ? true : false );
148
141
}
149
142
150
- void GODrawstop::SetDrawStopState (bool on) {
151
- if (IsActive () == on)
152
- return ;
153
- if (IsReadOnly ()) {
154
- Display (on);
143
+ void GODrawstop::SetInternalState (bool on, const wxString &stateName) {
144
+ bool &internalState = m_InternalStates[stateName];
145
+
146
+ if (internalState != on) {
147
+ internalState = on;
148
+
149
+ bool resState = false ;
150
+
151
+ for (const auto &intState : m_InternalStates)
152
+ resState = resState || intState.second ;
153
+ if (m_ActiveState != resState) {
154
+ Display (resState);
155
+ // must be before calling m_ControlledDrawstops[i]->Update();
156
+ m_ActiveState = resState;
157
+ OnDrawstopStateChanged (resState);
158
+ for (auto *pDrawstop : m_ControlledDrawstops)
159
+ pDrawstop->Update (); // reads m_ActiveState
160
+ }
155
161
}
156
- m_ActiveState = on;
157
- OnDrawstopStateChanged (on);
158
- for (unsigned i = 0 ; i < m_ControlledDrawstops.size (); i++)
159
- m_ControlledDrawstops[i]->Update ();
160
162
}
161
163
162
- void GODrawstop::SetCombinationState (bool on) {
164
+ void GODrawstop::SetButtonState (bool on) {
165
+ if (IsEngaged () != on)
166
+ SetDrawStopState (on);
167
+ }
168
+
169
+ void GODrawstop::SetCombinationState (bool on, const wxString &stateName) {
163
170
if (!IsReadOnly ())
164
- SetButtonState (on);
171
+ SetInternalState (on, stateName );
165
172
}
166
173
167
174
void GODrawstop::StartPlayback () {
0 commit comments