Skip to content

Commit c3108c4

Browse files
authored
Renamed some GOCombinationElement and GODrawStop methods (#2011)
1 parent 62aa3a9 commit c3108c4

19 files changed

+47
-48
lines changed

src/grandorgue/GOVirtualCouplerController.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void GOVirtualCouplerController::Load(
149149
bool isCoupleThrough = cfg.ReadBoolean(
150150
CMBSetting, pCoupleThrough->GetGroup(), WX_COUPLE_THROUGH, false, false);
151151

152-
pCoupleThrough->Set(isCoupleThrough);
152+
pCoupleThrough->SetButtonState(isCoupleThrough);
153153
}
154154
}
155155

src/grandorgue/combinations/GOSetter.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,9 @@ void GOSetter::OnCombinationsSaved(const wxString &yamlFile) {
996996

997997
void GOSetter::Update() {}
998998

999-
void GOSetter::SetterActive(bool on) { m_buttons[ID_SETTER_SET]->Set(on); }
999+
void GOSetter::SetterActive(bool on) {
1000+
m_buttons[ID_SETTER_SET]->SetButtonState(on);
1001+
}
10001002

10011003
void GOSetter::ToggleSetter() { m_buttons[ID_SETTER_SET]->Push(); }
10021004

src/grandorgue/combinations/model/GOCombination.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ bool GOCombination::Push(
454454
if (
455455
m_ElementStates[i] != BOOL3_DEFAULT
456456
&& (!extraSet || extraSet->find(i) == extraSet->end())) {
457-
r_ElementDefinitions[i].control->SetCombination(
457+
r_ElementDefinitions[i].control->SetCombinationState(
458458
to_bool(m_ElementStates[i]));
459459
used |= to_bool(m_ElementStates[i]);
460460
}

src/grandorgue/combinations/model/GOCombinationElement.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class GOCombinationElement {
1212
public:
1313
virtual bool GetCombinationState() const = 0;
14-
virtual void SetCombination(bool on) = 0;
14+
virtual void SetCombinationState(bool on) = 0;
1515
virtual bool IsControlledByUser() const = 0;
1616
};
1717

src/grandorgue/control/GOButtonControl.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -92,10 +92,10 @@ void GOButtonControl::HandleKey(int key) {
9292
void GOButtonControl::Push() {
9393
if (m_ReadOnly)
9494
return;
95-
Set(m_Engaged ^ true);
95+
SetButtonState(m_Engaged ^ true);
9696
}
9797

98-
void GOButtonControl::Set(bool on) {}
98+
void GOButtonControl::SetButtonState(bool on) {}
9999

100100
void GOButtonControl::AbortPlayback() {
101101
m_sender.SetDisplay(false);
@@ -121,12 +121,12 @@ void GOButtonControl::ProcessMidi(const GOMidiEvent &event) {
121121
if (m_Pushbutton)
122122
Push();
123123
else
124-
Set(true);
124+
SetButtonState(true);
125125
break;
126126

127127
case MIDI_MATCH_OFF:
128128
if (!m_Pushbutton)
129-
Set(false);
129+
SetButtonState(false);
130130
break;
131131

132132
default:

src/grandorgue/control/GOButtonControl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class GOButtonControl : public GOControl,
8181
bool IsPiston() const { return m_IsPiston; }
8282

8383
virtual void Push();
84-
virtual void Set(bool on);
84+
virtual void SetButtonState(bool on);
8585
virtual void Display(bool onoff);
8686
bool IsEngaged() const;
8787
bool DisplayInverted() const;

src/grandorgue/control/GOCallbackButtonControl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -26,7 +26,7 @@ void GOCallbackButtonControl::Push() {
2626
GOButtonControl::Push();
2727
}
2828

29-
void GOCallbackButtonControl::Set(bool on) {
29+
void GOCallbackButtonControl::SetButtonState(bool on) {
3030
if (IsEngaged() == on)
3131
return;
3232
m_callback->ButtonStateChanged(this, on);

src/grandorgue/control/GOCallbackButtonControl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GOCallbackButtonControl : public GOButtonControl {
2323
bool isPushbutton,
2424
bool isPiston = false);
2525
void Push(void) override;
26-
void Set(bool on) override;
26+
void SetButtonState(bool on) override;
2727

2828
const wxString &GetMidiTypeCode() const override;
2929
const wxString &GetMidiType() const override;

src/grandorgue/dialogs/GOStopsDialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void GOStopsDialog::OnElementChanging(wxCommandEvent &event) {
139139
= static_cast<GOCombinationElement *>(pCheck->GetClientData());
140140

141141
if (pE)
142-
pE->SetCombination(event.IsChecked());
142+
pE->SetCombinationState(event.IsChecked());
143143
}
144144

145145
void GOStopsDialog::ControlChanged(GOControl *pControl) {

src/grandorgue/model/GOCoupler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void GOCoupler::SetKey(
359359
ChangeKey(note, velocity);
360360
}
361361

362-
void GOCoupler::ChangeState(bool on) {
362+
void GOCoupler::OnDrawstopStateChanged(bool on) {
363363
if (m_UnisonOff)
364364
r_OrganModel.GetManual(m_SourceManual)->SetUnisonOff(on);
365365
else {

src/grandorgue/model/GOCoupler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class GOCoupler : public GODrawstop {
5151
void ChangeKey(int note, unsigned velocity);
5252
void SetOut(int note, unsigned velocity);
5353
unsigned GetInternalState(int note);
54-
void ChangeState(bool on) override;
54+
void OnDrawstopStateChanged(bool on) override;
5555
void SetupIsToStoreInCmb() override;
5656

5757
void PreparePlayback() override;

src/grandorgue/model/GODivisionalCoupler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GODivisionalCoupler : public GODrawstop {
2323
bool m_BiDirectionalCoupling;
2424
std::vector<unsigned> m_manuals;
2525

26-
void ChangeState(bool on) override {}
26+
void OnDrawstopStateChanged(bool on) override {}
2727
void SetupIsToStoreInCmb() override;
2828

2929
public:

src/grandorgue/model/GODrawStop.cpp

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -30,7 +30,6 @@ GODrawstop::GODrawstop(GOOrganModel &organModel)
3030
m_Type(FUNCTION_INPUT),
3131
m_GCState(0),
3232
m_ActiveState(false),
33-
m_CombinationState(false),
3433
m_ControlledDrawstops(),
3534
m_ControllingDrawstops(),
3635
m_IsToStoreInDivisional(false),
@@ -133,38 +132,36 @@ void GODrawstop::Save(GOConfigWriter &cfg) {
133132
GOButtonControl::Save(cfg);
134133
}
135134

136-
void GODrawstop::Set(bool on) {
135+
void GODrawstop::SetButtonState(bool on) {
137136
if (IsEngaged() == on)
138137
return;
139138
Display(on);
140-
SetState(on);
139+
SetDrawStopState(on);
141140
}
142141

143142
void GODrawstop::Reset() {
144143
if (IsReadOnly())
145144
return;
146145
if (m_GCState < 0)
147146
return;
148-
Set(m_GCState > 0 ? true : false);
147+
SetButtonState(m_GCState > 0 ? true : false);
149148
}
150149

151-
void GODrawstop::SetState(bool on) {
150+
void GODrawstop::SetDrawStopState(bool on) {
152151
if (IsActive() == on)
153152
return;
154153
if (IsReadOnly()) {
155154
Display(on);
156155
}
157156
m_ActiveState = on;
158-
ChangeState(on);
157+
OnDrawstopStateChanged(on);
159158
for (unsigned i = 0; i < m_ControlledDrawstops.size(); i++)
160159
m_ControlledDrawstops[i]->Update();
161160
}
162161

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);
168165
}
169166

170167
void GODrawstop::StartPlayback() {
@@ -176,7 +173,7 @@ void GODrawstop::Update() {
176173
bool state;
177174
switch (m_Type) {
178175
case FUNCTION_INPUT:
179-
SetState(IsEngaged());
176+
SetDrawStopState(IsEngaged());
180177
break;
181178

182179
case FUNCTION_AND:
@@ -185,9 +182,9 @@ void GODrawstop::Update() {
185182
for (unsigned i = 0; i < m_ControllingDrawstops.size(); i++)
186183
state = state && m_ControllingDrawstops[i]->IsActive();
187184
if (m_Type == FUNCTION_NAND)
188-
SetState(!state);
185+
SetDrawStopState(!state);
189186
else
190-
SetState(state);
187+
SetDrawStopState(state);
191188
break;
192189

193190
case FUNCTION_OR:
@@ -196,21 +193,21 @@ void GODrawstop::Update() {
196193
for (unsigned i = 0; i < m_ControllingDrawstops.size(); i++)
197194
state = state || m_ControllingDrawstops[i]->IsActive();
198195
if (m_Type == FUNCTION_NOR)
199-
SetState(!state);
196+
SetDrawStopState(!state);
200197
else
201-
SetState(state);
198+
SetDrawStopState(state);
202199
break;
203200

204201
case FUNCTION_XOR:
205202
state = false;
206203
for (unsigned i = 0; i < m_ControllingDrawstops.size(); i++)
207204
state = state != m_ControllingDrawstops[i]->IsActive();
208-
SetState(state);
205+
SetDrawStopState(state);
209206
break;
210207

211208
case FUNCTION_NOT:
212209
state = m_ControllingDrawstops[0]->IsActive();
213-
SetState(!state);
210+
SetDrawStopState(!state);
214211
break;
215212
}
216213
}

src/grandorgue/model/GODrawStop.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ class GODrawstop : public GOButtonControl, virtual public GOCombinationElement {
3030
GOFunctionType m_Type;
3131
int m_GCState;
3232
bool m_ActiveState;
33-
bool m_CombinationState;
3433
std::vector<GODrawstop *> m_ControlledDrawstops;
3534
std::vector<GODrawstop *> m_ControllingDrawstops;
3635

3736
bool IsControlledByUser() const override { return !IsReadOnly(); }
3837

38+
void SetDrawStopState(bool on);
39+
3940
protected:
4041
/*
4142
* m_IsToStoreInDivisional and m_IsToStoreInGeneral control whether the
@@ -50,8 +51,7 @@ class GODrawstop : public GOButtonControl, virtual public GOCombinationElement {
5051

5152
virtual void SetupIsToStoreInCmb();
5253

53-
void SetState(bool on);
54-
virtual void ChangeState(bool on) = 0;
54+
virtual void OnDrawstopStateChanged(bool on) = 0;
5555

5656
void Save(GOConfigWriter &cfg) override;
5757

@@ -68,10 +68,10 @@ class GODrawstop : public GOButtonControl, virtual public GOCombinationElement {
6868
void Init(GOConfigReader &cfg, wxString group, wxString name);
6969
void Load(GOConfigReader &cfg, wxString group);
7070
void RegisterControlled(GODrawstop *sw);
71-
virtual void Set(bool on) override;
71+
virtual void SetButtonState(bool on) override;
7272
virtual void Update();
7373
void Reset();
74-
void SetCombination(bool on) override;
74+
void SetCombinationState(bool on) override;
7575
};
7676

7777
#endif

src/grandorgue/model/GOStop.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void GOStop::SetKey(unsigned note, unsigned velocity) {
130130
SetRankKey(note, m_KeyVelocity[note]);
131131
}
132132

133-
void GOStop::ChangeState(bool on) {
133+
void GOStop::OnDrawstopStateChanged(bool on) {
134134
if (IsAuto()) {
135135
SetRankKey(0, on ? 0x7f : 0x00);
136136
} else {
@@ -143,7 +143,7 @@ GOStop::~GOStop(void) {}
143143

144144
void GOStop::AbortPlayback() {
145145
if (IsAuto())
146-
Set(false);
146+
SetButtonState(false);
147147
GOButtonControl::AbortPlayback();
148148
}
149149

src/grandorgue/model/GOStop.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GOStop : public GODrawstop {
3232
unsigned m_NumberOfAccessiblePipes;
3333

3434
void SetRankKey(unsigned key, unsigned velocity);
35-
void ChangeState(bool on) override;
35+
void OnDrawstopStateChanged(bool on) override;
3636

3737
void AbortPlayback() override;
3838
void PreparePlayback() override;

src/grandorgue/model/GOSwitch.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -19,7 +19,7 @@ class GOSwitch : public GODrawstop {
1919
unsigned m_IndexInManual = 0;
2020

2121
protected:
22-
void ChangeState(bool) override {}
22+
void OnDrawstopStateChanged(bool) override {}
2323

2424
public:
2525
GOSwitch(GOOrganModel &organModel) : GODrawstop(organModel) {}

src/grandorgue/model/GOTremulant.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void GOTremulant::InitSoundProvider(GOMemoryPool &pool) {
9191
}
9292
}
9393

94-
void GOTremulant::ChangeState(bool on) {
94+
void GOTremulant::OnDrawstopStateChanged(bool on) {
9595
if (m_TremulantType == GOSynthTrem) {
9696
GOSoundEngine *pSoundEngine = GetSoundEngine();
9797

src/grandorgue/model/GOTremulant.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class GOTremulant : public GODrawstop, private GOCacheObject {
3737
unsigned m_TremulantN;
3838

3939
void InitSoundProvider(GOMemoryPool &pool);
40-
void ChangeState(bool on) override;
40+
void OnDrawstopStateChanged(bool on) override;
4141
void SetupIsToStoreInCmb() override;
4242

4343
void Initialize() override;

0 commit comments

Comments
 (0)