forked from GrandOrgue/grandorgue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGOLabelControl.cpp
81 lines (62 loc) · 2.27 KB
/
GOLabelControl.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
/*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
* License GPL-2.0 or later
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
*/
#include "GOLabelControl.h"
#include <wx/intl.h>
#include "GODocument.h"
#include "GOOrganController.h"
#include "config/GOConfig.h"
GOLabelControl::GOLabelControl(GOOrganController *organController)
: GOMidiObject(*organController),
m_Name(),
m_Content(),
m_OrganController(organController),
m_sender(*organController, MIDI_SEND_LABEL) {
m_OrganController->RegisterMidiConfigurator(this);
m_OrganController->RegisterSoundStateHandler(this);
}
GOLabelControl::~GOLabelControl() {}
void GOLabelControl::Init(GOConfigReader &cfg, wxString group, wxString name) {
m_OrganController->RegisterSaveableObject(this);
m_group = group;
m_Name = name;
m_sender.Load(cfg, m_group, m_OrganController->GetSettings().GetMidiMap());
}
void GOLabelControl::Load(GOConfigReader &cfg, wxString group, wxString name) {
m_OrganController->RegisterSaveableObject(this);
m_group = group;
m_Name = name;
m_sender.Load(cfg, m_group, m_OrganController->GetSettings().GetMidiMap());
}
void GOLabelControl::Save(GOConfigWriter &cfg) {
m_sender.Save(cfg, m_group, m_OrganController->GetSettings().GetMidiMap());
}
const wxString &GOLabelControl::GetContent() { return m_Content; }
void GOLabelControl::SetContent(wxString name) {
m_Content = name;
m_sender.SetLabel(m_Content);
m_OrganController->SendControlChanged(this);
}
void GOLabelControl::AbortPlayback() {
m_sender.SetLabel(wxEmptyString);
m_sender.SetName(wxEmptyString);
}
void GOLabelControl::PreparePlayback() { m_sender.SetName(m_Name); }
void GOLabelControl::PrepareRecording() { m_sender.SetLabel(m_Content); }
const wxString WX_MIDI_TYPE_CODE = wxT("Label");
const wxString WX_MIDI_TYPE = _("Label");
const wxString &GOLabelControl::GetMidiTypeCode() const {
return WX_MIDI_TYPE_CODE;
}
const wxString &GOLabelControl::GetMidiType() const { return WX_MIDI_TYPE; }
wxString GOLabelControl::GetElementStatus() { return m_Content; }
std::vector<wxString> GOLabelControl::GetElementActions() {
std::vector<wxString> actions;
return actions;
}
void GOLabelControl::TriggerElementActions(unsigned no) {
// Never called
}