diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index 5705ac8..0ae4edb 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -33,6 +33,7 @@ //============================================================================== MainContentComponent::MainContentComponent(const LumatoneEditorState& stateIn, juce::ApplicationCommandManager* commandManager) : LumatoneEditorState("MainComponent", stateIn) + , LumatoneEditorState::Controller(*this) , copiedSubBoardData(std::make_unique()) { setName("MainContentComponent"); @@ -312,6 +313,13 @@ void MainContentComponent::connectionStateChanged(ConnectionState state) btnImportFile->setEnabled(state == ConnectionState::ONLINE); } +void MainContentComponent::layoutImported(const LumatoneLayout &mappingData) +{ + setCurrentFile(juce::File(), false); + undoManager->clearUndoHistory(); + setHasChangesToSave(false); +} + //void MainContentComponent::octaveColourConfigReceived(int octaveIndex, uint8 rgbFlag, const int* colourData) //{ // for (int keyIndex = 0; keyIndex < getOctaveBoardSize(); keyIndex++) diff --git a/Source/MainComponent.h b/Source/MainComponent.h index 107d953..1c790c8 100644 --- a/Source/MainComponent.h +++ b/Source/MainComponent.h @@ -14,6 +14,7 @@ #include "./lumatone_editor_library/data/lumatone_layout.h" #include "./lumatone_editor_library/listeners/status_listener.h" +#include "./lumatone_editor_library/listeners/editor_listener.h" #include "./lumatone_editor_library/lumatone_midi_driver/firmware_types.h" class LumatoneKeyboardComponent; @@ -32,7 +33,9 @@ class GlobalSettingsArea; */ class MainContentComponent : public juce::Component , public LumatoneEditorState + , public LumatoneEditorState::Controller , public LumatoneEditor::StatusListener + , public LumatoneEditor::EditorListener , public juce::ChangeListener , public juce::Button::Listener { @@ -71,6 +74,8 @@ class MainContentComponent : public juce::Component // Implementation of LumatoneEditor::StatusListener void connectionStateChanged(ConnectionState state) override; + // Implementation of LumatoneEditor::EditorListener + void layoutImported(const LumatoneLayout& mappingData) override; //============================================================================== // Implementation of LumatoneEditorState