diff --git a/Source/LumatoneMenu.cpp b/Source/LumatoneMenu.cpp index 4e765d7..8045684 100644 --- a/Source/LumatoneMenu.cpp +++ b/Source/LumatoneMenu.cpp @@ -35,7 +35,7 @@ namespace Lumatone { menu.addCommandItem(theManager, saveSysExMappingAs); menu.addCommandItem(theManager, resetSysExMapping); menu.addCommandItem(theManager, importSysExMapping); - + menu.addSeparator(); PopupMenu recentFilesMenu; @@ -50,6 +50,8 @@ namespace Lumatone { void MainMenuModel::createEditMenu(PopupMenu& menu) { + menu.addCommandItem(theManager, selectAll); + menu.addCommandItem(theManager, selectNone); menu.addCommandItem(theManager, deleteOctaveBoard); menu.addCommandItem(theManager, copyOctaveBoard); menu.addCommandItem(theManager, pasteOctaveBoard); diff --git a/Source/LumatoneMenu.h b/Source/LumatoneMenu.h index 28eb690..78458c6 100644 --- a/Source/LumatoneMenu.h +++ b/Source/LumatoneMenu.h @@ -23,6 +23,9 @@ namespace Lumatone { resetSysExMapping = 0x200013, importSysExMapping = 0x200014, + selectAll = 0x200020, + selectNone = 0x200021, + deleteOctaveBoard = 0x200100, copyOctaveBoard = 0x200101, pasteOctaveBoard = 0x200102, diff --git a/Source/Main.cpp b/Source/Main.cpp index cec988f..8e6460e 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -18,6 +18,8 @@ #include "LumatoneEditorLookAndFeel.h" +#include "./actions/KeySelectionControlActions.h" + #include "./lumatone_editor_library/device/lumatone_controller.h" #include "./lumatone_editor_library/device/activity_monitor.h" #include "./lumatone_editor_library/graphics/view_constants.h" @@ -227,6 +229,9 @@ void TerpstraSysExApplication::getAllCommands(Array & commands) Lumatone::Menu::commandIDs::resetSysExMapping, Lumatone::Menu::commandIDs::importSysExMapping, + Lumatone::Menu::commandIDs::selectAll, + Lumatone::Menu::commandIDs::selectNone, + Lumatone::Menu::commandIDs::deleteOctaveBoard, Lumatone::Menu::commandIDs::copyOctaveBoard, Lumatone::Menu::commandIDs::pasteOctaveBoard, @@ -262,7 +267,7 @@ void TerpstraSysExApplication::getCommandInfo(CommandID commandID, ApplicationCo case Lumatone::Menu::commandIDs::saveSysExMappingAs: result.setInfo("Save mapping as...", "Save the current mapping to new file", "File", 0); - result.addDefaultKeypress('a', ModifierKeys::commandModifier); + result.addDefaultKeypress('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier); break; case Lumatone::Menu::commandIDs::resetSysExMapping: @@ -277,6 +282,17 @@ void TerpstraSysExApplication::getCommandInfo(CommandID commandID, ApplicationCo result.setActive(false); break; + case Lumatone::Menu::commandIDs::selectAll: + result.setInfo("Select All", "Select All Keys", "Edit", 0); + result.addDefaultKeypress('a', ModifierKeys::ctrlModifier); + break; + + case Lumatone::Menu::commandIDs::selectNone: + result.setInfo("Select None", "Reset key selection status", "Edit", 0); + result.addDefaultKeypress(KeyPress::escapeKey, ModifierKeys::noModifiers); + result.addDefaultKeypress('a', ModifierKeys::ctrlModifier | ModifierKeys::altModifier); + break; + case Lumatone::Menu::commandIDs::deleteOctaveBoard: result.setInfo("Delete", "Delete section data", "Edit", 0); result.addDefaultKeypress(KeyPress::deleteKey, ModifierKeys::noModifiers); @@ -362,6 +378,11 @@ bool TerpstraSysExApplication::perform(const InvocationInfo& info) case Lumatone::Menu::commandIDs::importSysExMapping: return onRequestDeviceConfig(); + case Lumatone::Menu::commandIDs::selectAll: + return selectAllKeys(); + case Lumatone::Menu::commandIDs::selectNone: + return resetKeySelection(); + case Lumatone::Menu::commandIDs::deleteOctaveBoard: return deleteSubBoardData(); case Lumatone::Menu::commandIDs::copyOctaveBoard: @@ -449,6 +470,16 @@ bool TerpstraSysExApplication::saveCurrentFile(std::function return success; } +bool TerpstraSysExApplication::selectAllKeys() +{ + return performAction(new SetKeySelectionAction(state, state.getMappingData()->getAllKeysMapped())); +} + +bool TerpstraSysExApplication::resetKeySelection() +{ + return performAction(new SetKeySelectionAction(state, juce::Array())); +} + bool TerpstraSysExApplication::deleteSubBoardData() { return performAction(((MainContentComponent*)(mainWindow->getContentComponent()))->createDeleteCurrentSectionAction()); diff --git a/Source/Main.h b/Source/Main.h index e68a773..3f7ae1c 100644 --- a/Source/Main.h +++ b/Source/Main.h @@ -58,6 +58,9 @@ class TerpstraSysExApplication : public juce::JUCEApplication, private Lumatone //bool saveColourPalette(LumatoneEditorColourPalette& palette, juce::File pathToPalette=juce::File()); + bool selectAllKeys(); + bool resetKeySelection(); + bool deleteSubBoardData(); bool copySubBoardData(); bool pasteSubBoardData(); @@ -89,7 +92,7 @@ class TerpstraSysExApplication : public juce::JUCEApplication, private Lumatone LumatoneEditorState state; std::unique_ptr commandManager; - + MainContentComponent* mainComponent; std::unique_ptr mainWindow; std::unique_ptr dialogWindow;