Skip to content

Commit

Permalink
add select all and select none menu options
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Jul 18, 2024
1 parent e19b46d commit c5beb17
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Source/LumatoneMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace Lumatone {
menu.addCommandItem(theManager, saveSysExMappingAs);
menu.addCommandItem(theManager, resetSysExMapping);
menu.addCommandItem(theManager, importSysExMapping);

menu.addSeparator();

PopupMenu recentFilesMenu;
Expand All @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions Source/LumatoneMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace Lumatone {
resetSysExMapping = 0x200013,
importSysExMapping = 0x200014,

selectAll = 0x200020,
selectNone = 0x200021,

deleteOctaveBoard = 0x200100,
copyOctaveBoard = 0x200101,
pasteOctaveBoard = 0x200102,
Expand Down
33 changes: 32 additions & 1 deletion Source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -227,6 +229,9 @@ void TerpstraSysExApplication::getAllCommands(Array <CommandID>& 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,
Expand Down Expand Up @@ -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:
Expand All @@ -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);
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -449,6 +470,16 @@ bool TerpstraSysExApplication::saveCurrentFile(std::function<void(bool success)>
return success;
}

bool TerpstraSysExApplication::selectAllKeys()
{
return performAction(new SetKeySelectionAction(state, state.getMappingData()->getAllKeysMapped()));
}

bool TerpstraSysExApplication::resetKeySelection()
{
return performAction(new SetKeySelectionAction(state, juce::Array<MappedLumatoneKey>()));
}

bool TerpstraSysExApplication::deleteSubBoardData()
{
return performAction(((MainContentComponent*)(mainWindow->getContentComponent()))->createDeleteCurrentSectionAction());
Expand Down
5 changes: 4 additions & 1 deletion Source/Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -89,7 +92,7 @@ class TerpstraSysExApplication : public juce::JUCEApplication, private Lumatone
LumatoneEditorState state;

std::unique_ptr<ApplicationCommandManager> commandManager;

MainContentComponent* mainComponent;
std::unique_ptr<MainWindow> mainWindow;
std::unique_ptr<DialogWindow> dialogWindow;
Expand Down

0 comments on commit c5beb17

Please sign in to comment.