From 7315658ffda7e01824f37c0bd966f2488ee63460 Mon Sep 17 00:00:00 2001 From: Vincenzo Sicurella Date: Mon, 15 Jan 2024 04:05:34 -0500 Subject: [PATCH] simplify inherited LumatoneState constructors --- .../data/application_state.cpp | 6 +++--- .../data/application_state.h | 2 +- .../data/lumatone_state.cpp | 4 ++-- .../lumatone_editor_library/data/lumatone_state.h | 2 +- .../device/lumatone_controller.cpp | 15 ++------------- .../device/lumatone_controller.h | 2 +- 6 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Source/lumatone_editor_library/data/application_state.cpp b/Source/lumatone_editor_library/data/application_state.cpp index 806ec825..f4bb2726 100644 --- a/Source/lumatone_editor_library/data/application_state.cpp +++ b/Source/lumatone_editor_library/data/application_state.cpp @@ -22,7 +22,7 @@ LumatoneApplicationState::LumatoneApplicationState(juce::String nameIn, Lumatone : LumatoneState(nameIn, stateIn, undoManagerIn) { layoutContext = std::make_shared(*mappingData); - controller = std::make_shared(*this, driverIn, undoManagerIn); + controller = std::make_shared(*this, driverIn); colourModel = std::make_shared(); editorListeners.reset(new juce::ListenerList()); @@ -41,8 +41,8 @@ LumatoneApplicationState::LumatoneApplicationState(juce::String nameIn, Lumatone // loadStateProperties(state); // } -LumatoneApplicationState::LumatoneApplicationState(juce::String nameIn, const LumatoneApplicationState &stateIn, juce::UndoManager *undoManagerIn) - : LumatoneState(nameIn, (const LumatoneState&)stateIn, undoManagerIn) +LumatoneApplicationState::LumatoneApplicationState(juce::String nameIn, const LumatoneApplicationState &stateIn) + : LumatoneState(nameIn, (const LumatoneState&)stateIn) , layoutContext(stateIn.layoutContext) , controller(stateIn.controller) , colourModel(stateIn.colourModel) diff --git a/Source/lumatone_editor_library/data/application_state.h b/Source/lumatone_editor_library/data/application_state.h index fdaed05f..45178e92 100644 --- a/Source/lumatone_editor_library/data/application_state.h +++ b/Source/lumatone_editor_library/data/application_state.h @@ -54,7 +54,7 @@ class LumatoneApplicationState : public LumatoneState { public: LumatoneApplicationState(juce::String nameIn, LumatoneFirmwareDriver& driverIn, juce::ValueTree stateIn=juce::ValueTree(), juce::UndoManager* undoManager=nullptr); - LumatoneApplicationState(juce::String nameIn, const LumatoneApplicationState& stateIn, juce::UndoManager* undoManager=nullptr); + LumatoneApplicationState(juce::String nameIn, const LumatoneApplicationState& stateIn); virtual ~LumatoneApplicationState(); diff --git a/Source/lumatone_editor_library/data/lumatone_state.cpp b/Source/lumatone_editor_library/data/lumatone_state.cpp index 775b7a81..4cde442f 100644 --- a/Source/lumatone_editor_library/data/lumatone_state.cpp +++ b/Source/lumatone_editor_library/data/lumatone_state.cpp @@ -39,8 +39,8 @@ LumatoneState::LumatoneState(juce::String nameIn, juce::ValueTree stateIn, juce: state.appendChild(layoutState, nullptr); } -LumatoneState::LumatoneState(juce::String nameIn, const LumatoneState& stateToCopy, juce::UndoManager* undoManagerIn) - : LumatoneState(nameIn, stateToCopy.state, undoManagerIn) +LumatoneState::LumatoneState(juce::String nameIn, const LumatoneState& stateToCopy) + : LumatoneState(nameIn, stateToCopy.state, stateToCopy.undoManager) { mappingData = stateToCopy.mappingData; midiKeyMap = stateToCopy.midiKeyMap; diff --git a/Source/lumatone_editor_library/data/lumatone_state.h b/Source/lumatone_editor_library/data/lumatone_state.h index e6141ca3..7fd32bcd 100644 --- a/Source/lumatone_editor_library/data/lumatone_state.h +++ b/Source/lumatone_editor_library/data/lumatone_state.h @@ -40,7 +40,7 @@ class LumatoneState : public LumatoneStateBase public: LumatoneState(juce::String nameIn, juce::ValueTree stateIn=juce::ValueTree(), juce::UndoManager* undoManager=nullptr); - LumatoneState(juce::String nameIn, const LumatoneState& stateToCopy, juce::UndoManager* undoManagerIn=nullptr); + LumatoneState(juce::String nameIn, const LumatoneState& stateToCopy); virtual ~LumatoneState() override; diff --git a/Source/lumatone_editor_library/device/lumatone_controller.cpp b/Source/lumatone_editor_library/device/lumatone_controller.cpp index b2e67be2..1ca01739 100644 --- a/Source/lumatone_editor_library/device/lumatone_controller.cpp +++ b/Source/lumatone_editor_library/device/lumatone_controller.cpp @@ -15,8 +15,8 @@ #include "../lumatone_midi_driver/lumatone_midi_driver.h" #include "../listeners/editor_listener.h" -LumatoneController::LumatoneController(const LumatoneApplicationState& stateIn, LumatoneFirmwareDriver& firmwareDriverIn, juce::UndoManager* undoManager) - : LumatoneApplicationState("LumatoneController", stateIn, undoManager) +LumatoneController::LumatoneController(const LumatoneApplicationState& stateIn, LumatoneFirmwareDriver& firmwareDriverIn) + : LumatoneApplicationState("LumatoneController", stateIn) , LumatoneApplicationMidiController(stateIn, firmwareDriverIn) , firmwareDriver(firmwareDriverIn) , updateBuffer(firmwareDriverIn, stateIn) @@ -645,17 +645,6 @@ void LumatoneController::onConnectionConfirmed() statusListeners->call(&LumatoneEditor::StatusListener::connectionStateChanged, ConnectionState::ONLINE); } -// bool LumatoneController::loadLayoutFromFile(const juce::File& file) -// { -// const bool loaded = LumatoneState::loadLayoutFromFile(file); -// if (loaded) -// { -// sendCompleteMapping(*mappingData, true, false); -// } - -// return loaded; -// } - void LumatoneController::handleStatePropertyChange(juce::ValueTree stateIn, const juce::Identifier &property) { LumatoneApplicationState::handleStatePropertyChange(stateIn, property); diff --git a/Source/lumatone_editor_library/device/lumatone_controller.h b/Source/lumatone_editor_library/device/lumatone_controller.h index a3025e78..323636dc 100644 --- a/Source/lumatone_editor_library/device/lumatone_controller.h +++ b/Source/lumatone_editor_library/device/lumatone_controller.h @@ -34,7 +34,7 @@ class LumatoneController : private LumatoneApplicationState { public: - LumatoneController(const LumatoneApplicationState& stateIn, LumatoneFirmwareDriver& firmwareDriverIn, juce::UndoManager* undoManager); + LumatoneController(const LumatoneApplicationState& stateIn, LumatoneFirmwareDriver& firmwareDriverIn); ~LumatoneController() override; juce::ValueTree loadStateProperties(juce::ValueTree stateIn) override;