Skip to content

Commit 96b40c7

Browse files
authored
Made inner types GOMidiShortcutPattern (#2099)
1 parent 50657d3 commit 96b40c7

7 files changed

+32
-31
lines changed

src/grandorgue/control/GOButtonControl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ GOButtonControl::GOButtonControl(
2424
r_OrganModel(organModel),
2525
m_midi(organModel, midi_type),
2626
m_sender(organModel, MIDI_SEND_BUTTON),
27-
m_shortcut(KEY_RECV_BUTTON),
27+
m_shortcut(GOMidiShortcutReceiver::KEY_RECV_BUTTON),
2828
m_Pushbutton(pushbutton),
2929
m_Displayed(false),
3030
m_Name(),
@@ -80,7 +80,7 @@ void GOButtonControl::HandleKey(int key) {
8080
if (m_ReadOnly)
8181
return;
8282
switch (m_shortcut.Match(key)) {
83-
case KEY_MATCH:
83+
case GOMidiShortcutReceiver::KEY_MATCH:
8484
Push();
8585
break;
8686

src/grandorgue/control/GOLabelControl.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#include "GODocument.h"
1616

1717
GOLabelControl::GOLabelControl(GOOrganModel &organModel)
18-
: GOMidiConfigurator(organModel),
18+
: GOMidiObject(organModel),
19+
r_OrganModel(organModel),
1920
m_Name(),
2021
m_Content(),
2122
m_sender(organModel, MIDI_SEND_LABEL) {

src/grandorgue/gui/dialogs/midi-event/GOMidiEventKeyTab.cpp

+5-4
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-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -32,8 +32,9 @@ GOMidiEventKeyTab::GOMidiEventKeyTab(
3232
wxBoxSizer *sizer = new wxStaticBoxSizer(
3333
wxVERTICAL,
3434
this,
35-
m_key.GetType() == KEY_RECV_ENCLOSURE ? _("&Plus-Shortcut:")
36-
: _("&Shortcut:"));
35+
m_key.GetType() == GOMidiShortcutPattern::KEY_RECV_ENCLOSURE
36+
? _("&Plus-Shortcut:")
37+
: _("&Shortcut:"));
3738
m_keyselect = new wxChoice(this, ID_KEY_SELECT);
3839
sizer->Add(m_keyselect, 1, wxEXPAND);
3940

@@ -43,7 +44,7 @@ GOMidiEventKeyTab::GOMidiEventKeyTab(
4344

4445
topSizer->Add(sizer, 0, wxALL | wxEXPAND, 6);
4546

46-
if (m_key.GetType() == KEY_RECV_ENCLOSURE) {
47+
if (m_key.GetType() == GOMidiShortcutPattern::KEY_RECV_ENCLOSURE) {
4748
sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("&Minus-Shortcut:"));
4849
m_keyminusselect = new wxChoice(this, ID_MINUS_KEY_SELECT);
4950
sizer->Add(m_keyminusselect, 1, wxEXPAND);

src/grandorgue/midi/GOMidiShortcutPattern.h

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
77

88
#ifndef GOMIDISHORTCUTPATTERN_H
99
#define GOMIDISHORTCUTPATTERN_H
1010

11-
typedef enum {
12-
KEY_RECV_BUTTON,
13-
KEY_RECV_ENCLOSURE,
14-
} KEY_RECEIVER_TYPE;
15-
16-
typedef enum {
17-
KEY_MATCH_NONE,
18-
KEY_MATCH,
19-
KEY_MATCH_MINUS,
20-
} KEY_MATCH_TYPE;
21-
2211
class GOMidiShortcutPattern {
12+
public:
13+
enum ReceiverType {
14+
KEY_RECV_BUTTON,
15+
KEY_RECV_ENCLOSURE,
16+
};
17+
enum MatchType {
18+
KEY_MATCH_NONE,
19+
KEY_MATCH,
20+
KEY_MATCH_MINUS,
21+
};
22+
2323
protected:
24-
KEY_RECEIVER_TYPE m_type;
24+
ReceiverType m_type;
2525
unsigned m_ShortcutKey = 0;
2626
unsigned m_MinusKey = 0;
2727

2828
public:
29-
GOMidiShortcutPattern(KEY_RECEIVER_TYPE type) : m_type(type) {}
29+
GOMidiShortcutPattern(ReceiverType type) : m_type(type) {}
3030
virtual ~GOMidiShortcutPattern() {}
3131

32-
KEY_RECEIVER_TYPE GetType() const { return m_type; }
32+
ReceiverType GetType() const { return m_type; }
3333

3434
unsigned GetShortcut() const { return m_ShortcutKey; }
3535
void SetShortcut(unsigned key) { m_ShortcutKey = key; }

src/grandorgue/midi/GOMidiShortcutReceiver.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-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -33,7 +33,7 @@ void GOMidiShortcutReceiver::Save(GOConfigWriter &cfg, wxString group) {
3333
}
3434
}
3535

36-
KEY_MATCH_TYPE GOMidiShortcutReceiver::Match(unsigned key) {
36+
GOMidiShortcutReceiver::MatchType GOMidiShortcutReceiver::Match(unsigned key) {
3737
if (m_ShortcutKey == key)
3838
return KEY_MATCH;
3939
if (m_MinusKey == key)

src/grandorgue/midi/GOMidiShortcutReceiver.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -17,13 +17,12 @@ class GOConfigWriter;
1717

1818
class GOMidiShortcutReceiver : public GOMidiShortcutPattern {
1919
public:
20-
GOMidiShortcutReceiver(KEY_RECEIVER_TYPE type)
21-
: GOMidiShortcutPattern(type) {}
20+
GOMidiShortcutReceiver(ReceiverType type) : GOMidiShortcutPattern(type) {}
2221

2322
void Load(GOConfigReader &cfg, wxString group);
2423
void Save(GOConfigWriter &cfg, wxString group);
2524

26-
KEY_MATCH_TYPE Match(unsigned key);
25+
MatchType Match(unsigned key);
2726

2827
bool RenewFrom(const GOMidiShortcutPattern &newPattern);
2928
};

src/grandorgue/model/GOEnclosure.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GOEnclosure::GOEnclosure(GOOrganModel &organModel)
2121
r_MidiMap(organModel.GetConfig().GetMidiMap()),
2222
m_midi(organModel, MIDI_RECV_ENCLOSURE),
2323
m_sender(organModel, MIDI_SEND_ENCLOSURE),
24-
m_shortcut(KEY_RECV_ENCLOSURE),
24+
m_shortcut(GOMidiShortcutReceiver::KEY_RECV_ENCLOSURE),
2525
m_Name(),
2626
m_DefaultAmpMinimumLevel(0),
2727
m_MIDIInputNumber(0),
@@ -118,11 +118,11 @@ void GOEnclosure::ProcessMidi(const GOMidiEvent &event) {
118118

119119
void GOEnclosure::HandleKey(int key) {
120120
switch (m_shortcut.Match(key)) {
121-
case KEY_MATCH:
121+
case GOMidiShortcutReceiver::KEY_MATCH:
122122
SetIntMidiValue(m_MIDIValue + 8);
123123
break;
124124

125-
case KEY_MATCH_MINUS:
125+
case GOMidiShortcutReceiver::KEY_MATCH_MINUS:
126126
SetIntMidiValue(m_MIDIValue - 8);
127127
break;
128128
default:

0 commit comments

Comments
 (0)