Skip to content

Commit

Permalink
simplify inherited LumatoneState constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Jan 15, 2024
1 parent 198b7b2 commit 7315658
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Source/lumatone_editor_library/data/application_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LumatoneApplicationState::LumatoneApplicationState(juce::String nameIn, Lumatone
: LumatoneState(nameIn, stateIn, undoManagerIn)
{
layoutContext = std::make_shared<LumatoneContext>(*mappingData);
controller = std::make_shared<LumatoneController>(*this, driverIn, undoManagerIn);
controller = std::make_shared<LumatoneController>(*this, driverIn);
colourModel = std::make_shared<LumatoneColourModel>();

editorListeners.reset(new juce::ListenerList<LumatoneEditor::EditorListener>());
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/lumatone_editor_library/data/application_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions Source/lumatone_editor_library/data/lumatone_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/lumatone_editor_library/data/lumatone_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
15 changes: 2 additions & 13 deletions Source/lumatone_editor_library/device/lumatone_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7315658

Please sign in to comment.