diff --git a/Source/lumatone_editor_library/data/application_state.cpp b/Source/lumatone_editor_library/data/application_state.cpp index 95a1fcb..96fd346 100644 --- a/Source/lumatone_editor_library/data/application_state.cpp +++ b/Source/lumatone_editor_library/data/application_state.cpp @@ -549,6 +549,18 @@ void LumatoneApplicationState::Controller::removeSelectedKey(int keyNum) } } +void LumatoneApplicationState::Controller::updatedSelectedKeys() +{ + juce::Array updatedKeys; + for (const MappedLumatoneKey& key : *appState.selectedKeys) + { + updatedKeys.add(MappedLumatoneKey(appState.getKey(key.boardIndex, key.keyIndex), key.boardIndex, key.keyIndex)); + } + + appState.selectedKeys->swapWith(updatedKeys); + appState.editorListeners->call(&LumatoneEditor::EditorListener::selectionChanged); +} + bool LumatoneApplicationState::Controller::performAction(LumatoneAction *action, bool undoable, bool newTransaction) { return appState.performLumatoneAction(action, undoable, newTransaction); diff --git a/Source/lumatone_editor_library/data/application_state.h b/Source/lumatone_editor_library/data/application_state.h index 4107488..fe925e5 100644 --- a/Source/lumatone_editor_library/data/application_state.h +++ b/Source/lumatone_editor_library/data/application_state.h @@ -79,6 +79,7 @@ class LumatoneApplicationState : public LumatoneState // App Methods const juce::Array* getSelectedKeys() const; + void updateSelecetdKeys(); // Context Methods bool isContextSet() const { return contextIsSet; } @@ -184,6 +185,12 @@ class LumatoneApplicationState : public LumatoneState void addSelectedKey(int keyNum); void removeSelectedKey(int keyNum); + protected: + + void updatedSelectedKeys(); + + public: + virtual bool performAction(LumatoneAction* action, bool undoable=true, bool newTransaction=true); protected: