Skip to content

Commit

Permalink
reset file, changes, and undo history on importing a layout
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Aug 10, 2024
1 parent 80d8b19 commit 49a72ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
//==============================================================================
MainContentComponent::MainContentComponent(const LumatoneEditorState& stateIn, juce::ApplicationCommandManager* commandManager)
: LumatoneEditorState("MainComponent", stateIn)
, LumatoneEditorState::Controller(*this)
, copiedSubBoardData(std::make_unique<LumatoneBoard>())
{
setName("MainContentComponent");
Expand Down Expand Up @@ -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++)
Expand Down
5 changes: 5 additions & 0 deletions Source/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49a72ab

Please sign in to comment.