From 4ebb01da9a56aa48c13a3f6674a197e294a99551 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Tue, 14 Jan 2025 20:37:39 +0300 Subject: [PATCH] Eliminated usage of GOOrganController from GOLabelControl --- src/grandorgue/GOAudioRecorder.cpp | 4 +-- src/grandorgue/GOMetronome.cpp | 6 ++-- src/grandorgue/GOOrganController.cpp | 6 ++-- .../combinations/GODivisionalSetter.cpp | 4 +-- src/grandorgue/combinations/GOSetter.cpp | 12 ++++---- src/grandorgue/combinations/GOSetter.h | 5 ++-- src/grandorgue/control/GOLabelControl.cpp | 28 +++++++++---------- src/grandorgue/control/GOLabelControl.h | 6 ++-- src/grandorgue/midi/GOMidiPlayer.cpp | 4 +-- src/grandorgue/midi/GOMidiRecorder.cpp | 4 +-- 10 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/grandorgue/GOAudioRecorder.cpp b/src/grandorgue/GOAudioRecorder.cpp index 849b2ad3b..9f032289c 100644 --- a/src/grandorgue/GOAudioRecorder.cpp +++ b/src/grandorgue/GOAudioRecorder.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -45,7 +45,7 @@ const struct GOElementCreator::ButtonDefinitionEntry *GOAudioRecorder:: GOAudioRecorder::GOAudioRecorder(GOOrganController *organController) : m_OrganController(organController), m_recorder(NULL), - m_RecordingTime(organController), + m_RecordingTime(*organController), m_RecordSeconds(0), m_Filename(), m_DoRename(false) { diff --git a/src/grandorgue/GOMetronome.cpp b/src/grandorgue/GOMetronome.cpp index 794a05b55..d1a6bbfdb 100644 --- a/src/grandorgue/GOMetronome.cpp +++ b/src/grandorgue/GOMetronome.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -53,8 +53,8 @@ GOMetronome::GOMetronome(GOOrganController *organController) m_MeasureLength(4), m_Pos(0), m_Running(false), - m_BPMDisplay(organController), - m_MeasureDisplay(organController), + m_BPMDisplay(*organController), + m_MeasureDisplay(*organController), m_rank(NULL), m_StopID(0) { CreateButtons(*m_OrganController); diff --git a/src/grandorgue/GOOrganController.cpp b/src/grandorgue/GOOrganController.cpp index d7d45585c..6d2f02cb5 100644 --- a/src/grandorgue/GOOrganController.cpp +++ b/src/grandorgue/GOOrganController.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -122,8 +122,8 @@ GOOrganController::GOOrganController( m_SampleSetId1(0), m_SampleSetId2(0), m_bitmaps(nullptr), - m_PitchLabel(this), - m_TemperamentLabel(this), + m_PitchLabel(*this), + m_TemperamentLabel(*this), m_MainWindowData(this, wxT("MainWindow")) { if (isAppInitialized) { // Load here objects that needs App (wx) to be loaded diff --git a/src/grandorgue/combinations/GODivisionalSetter.cpp b/src/grandorgue/combinations/GODivisionalSetter.cpp index 2cfe218c7..dddb7de94 100644 --- a/src/grandorgue/combinations/GODivisionalSetter.cpp +++ b/src/grandorgue/combinations/GODivisionalSetter.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -119,7 +119,7 @@ GODivisionalSetter::GODivisionalSetter( organController->RegisterCombinationButtonSet(this); for (unsigned manualN = 0; manualN < m_NManuals; manualN++) { m_manualBanks.push_back(0); - m_BankLabels.push_back(new GOLabelControl(organController)); + m_BankLabels.push_back(new GOLabelControl(*organController)); m_DivisionalMaps.emplace_back(); } } diff --git a/src/grandorgue/combinations/GOSetter.cpp b/src/grandorgue/combinations/GOSetter.cpp index 05f7cab4a..3a34792ba 100644 --- a/src/grandorgue/combinations/GOSetter.cpp +++ b/src/grandorgue/combinations/GOSetter.cpp @@ -299,12 +299,12 @@ GOSetter::GOSetter(GOOrganController *organController) m_framegeneral(0), m_general(0), m_crescendo(0), - m_CurrFileDisplay(organController), - m_PosDisplay(organController), - m_BankDisplay(organController), - m_CrescendoDisplay(organController), - m_TransposeDisplay(organController), - m_NameDisplay(organController), + m_CurrFileDisplay(*organController), + m_PosDisplay(*organController), + m_BankDisplay(*organController), + m_CrescendoDisplay(*organController), + m_TransposeDisplay(*organController), + m_NameDisplay(*organController), m_CrescendoCtrl(*organController) { CreateButtons(*m_OrganController); diff --git a/src/grandorgue/combinations/GOSetter.h b/src/grandorgue/combinations/GOSetter.h index def8dc0cd..0eb8bca9f 100644 --- a/src/grandorgue/combinations/GOSetter.h +++ b/src/grandorgue/combinations/GOSetter.h @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -28,8 +28,9 @@ #define N_CRESCENDOS 4 -class GOGeneralCombination; class GODivisionalCombination; +class GOGeneralCombination; +class GOOrganController; class GOSetter : private GOSoundStateHandler, private GOCombinationButtonSet, diff --git a/src/grandorgue/control/GOLabelControl.cpp b/src/grandorgue/control/GOLabelControl.cpp index 95375354d..092e663f0 100644 --- a/src/grandorgue/control/GOLabelControl.cpp +++ b/src/grandorgue/control/GOLabelControl.cpp @@ -9,38 +9,38 @@ #include -#include "GODocument.h" -#include "GOOrganController.h" #include "config/GOConfig.h" +#include "model/GOOrganModel.h" + +#include "GODocument.h" -GOLabelControl::GOLabelControl(GOOrganController *organController) - : GOMidiObject(*organController), +GOLabelControl::GOLabelControl(GOOrganModel &organModel) + : GOMidiConfigurator(organModel), m_Name(), m_Content(), - m_OrganController(organController), - m_sender(*organController, MIDI_SEND_LABEL) { - m_OrganController->RegisterMidiConfigurator(this); - m_OrganController->RegisterSoundStateHandler(this); + m_sender(organModel, MIDI_SEND_LABEL) { + r_OrganModel.RegisterMidiConfigurator(this); + r_OrganModel.RegisterSoundStateHandler(this); } GOLabelControl::~GOLabelControl() {} void GOLabelControl::Init(GOConfigReader &cfg, wxString group, wxString name) { - m_OrganController->RegisterSaveableObject(this); + r_OrganModel.RegisterSaveableObject(this); m_group = group; m_Name = name; - m_sender.Load(cfg, m_group, m_OrganController->GetSettings().GetMidiMap()); + m_sender.Load(cfg, m_group, r_OrganModel.GetConfig().GetMidiMap()); } void GOLabelControl::Load(GOConfigReader &cfg, wxString group, wxString name) { - m_OrganController->RegisterSaveableObject(this); + r_OrganModel.RegisterSaveableObject(this); m_group = group; m_Name = name; - m_sender.Load(cfg, m_group, m_OrganController->GetSettings().GetMidiMap()); + m_sender.Load(cfg, m_group, r_OrganModel.GetConfig().GetMidiMap()); } void GOLabelControl::Save(GOConfigWriter &cfg) { - m_sender.Save(cfg, m_group, m_OrganController->GetSettings().GetMidiMap()); + m_sender.Save(cfg, m_group, r_OrganModel.GetConfig().GetMidiMap()); } const wxString &GOLabelControl::GetContent() { return m_Content; } @@ -48,7 +48,7 @@ const wxString &GOLabelControl::GetContent() { return m_Content; } void GOLabelControl::SetContent(wxString name) { m_Content = name; m_sender.SetLabel(m_Content); - m_OrganController->SendControlChanged(this); + r_OrganModel.SendControlChanged(this); } void GOLabelControl::AbortPlayback() { diff --git a/src/grandorgue/control/GOLabelControl.h b/src/grandorgue/control/GOLabelControl.h index 3d5753a35..731b3dd47 100644 --- a/src/grandorgue/control/GOLabelControl.h +++ b/src/grandorgue/control/GOLabelControl.h @@ -19,17 +19,17 @@ class GOConfigReader; class GOConfigWriter; -class GOOrganController; +class GOOrganModel; class GOLabelControl : public GOControl, private GOSaveableObject, private GOSoundStateHandler, public GOMidiObject { protected: + GOOrganModel &r_OrganModel; wxString m_Name; wxString m_Content; wxString m_group; - GOOrganController *m_OrganController; GOMidiSender m_sender; void Save(GOConfigWriter &cfg) override; @@ -39,7 +39,7 @@ class GOLabelControl : public GOControl, void PrepareRecording() override; public: - GOLabelControl(GOOrganController *organController); + GOLabelControl(GOOrganModel &organModel); virtual ~GOLabelControl(); void Init(GOConfigReader &cfg, wxString group, wxString name); void Load(GOConfigReader &cfg, wxString group, wxString name); diff --git a/src/grandorgue/midi/GOMidiPlayer.cpp b/src/grandorgue/midi/GOMidiPlayer.cpp index 857f5faf1..a16e1b977 100644 --- a/src/grandorgue/midi/GOMidiPlayer.cpp +++ b/src/grandorgue/midi/GOMidiPlayer.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -50,7 +50,7 @@ GOMidiPlayer::GOMidiPlayer(GOOrganController *organController) r_timer(*organController->GetTimer()), p_midi(nullptr), m_content(), - m_PlayingTime(organController), + m_PlayingTime(*organController), m_Start(0), m_PlayingSeconds(0), m_Speed(1), diff --git a/src/grandorgue/midi/GOMidiRecorder.cpp b/src/grandorgue/midi/GOMidiRecorder.cpp index 7b30a4195..20a4f4836 100644 --- a/src/grandorgue/midi/GOMidiRecorder.cpp +++ b/src/grandorgue/midi/GOMidiRecorder.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -49,7 +49,7 @@ const struct GOElementCreator::ButtonDefinitionEntry *GOMidiRecorder:: GOMidiRecorder::GOMidiRecorder(GOOrganController *organController) : m_OrganController(organController), m_Map(organController->GetSettings().GetMidiMap()), - m_RecordingTime(organController), + m_RecordingTime(*organController), m_RecordSeconds(0), m_NextChannel(0), m_NextNRPN(0),