Skip to content

Commit

Permalink
implement multi-select for type, note, and channel
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Jul 11, 2024
1 parent d2b52c1 commit 59d5a8f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
36 changes: 29 additions & 7 deletions Source/mapping_editors/MultiSelectControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
#include "../LumatoneEditorLookAndFeel.h"

#include "../colour_view_component.h"
#include "../actions/KeySelectionControlActions.h"
#include "../components/RangedControl.h"
#include "../lumatone_editor_library/palettes/colour_edit_textbox.h"

MultiSelectControls::MultiSelectControls(const LumatoneEditorState& stateIn)
: LumatoneEditorState("MultiSelectControls", stateIn)
, LumatoneEditorState::Controller(static_cast<LumatoneEditorState&>(*this))
, juce::Component("MultiSelectControls")
{
lblMultiSelect = std::make_unique<juce::Label>("lblMultiSelect", "Multi-Select");
Expand All @@ -40,20 +42,40 @@ MultiSelectControls::MultiSelectControls(const LumatoneEditorState& stateIn)
keyTypeCombo->addItem (juce::translate("Continuous controller"), 2);
keyTypeCombo->addItem (juce::translate("Lumatouch"), 3);
keyTypeCombo->addItem (juce::translate("Disabled"), 4);
keyTypeCombo->onChange = [&]()
{
LumatoneKeyPropertyData properties;
properties.useType = true;
properties.type = LumatoneKeyType(keyTypeCombo->getSelectedId());

auto matchingKeyCoords = getMappingData()->getKeysWithProperties(properties);
performAction(SetKeySelectionAction::NewSetKeySelectionActionByCoords(*this, matchingKeyCoords));
};
addAndMakeVisible(keyTypeCombo.get());

noteInput = std::make_unique<RangedControl>("noteInputSelect", 0, 127, RangedControl::Style::DropdownBox);
noteInput->setTooltip (juce::translate("MIDI note or MIDI controller no. (for key type \'continuous controller\')"));
// noteInput->setRange (0, 127, 1);
// noteInput->setSliderStyle (juce::Slider::IncDecButtons);
// noteInput->setTextBoxStyle (juce::Slider::TextBoxLeft, false, 56, 20);
// noteInput->addListener (this);
noteInput->setValueChangedCallback([&]()
{
LumatoneKeyPropertyData properties;
properties.useNote = true;
properties.note = noteInput->getValue();

auto matchingKeyCoords = getMappingData()->getKeysWithProperties(properties);
performAction(SetKeySelectionAction::NewSetKeySelectionActionByCoords(*this, matchingKeyCoords));
});
addAndMakeVisible(noteInput.get());

channelInput = std::make_unique<RangedControl>("channelInputSelect", 1, 16, RangedControl::Style::DropdownBox);
// channelInput->setRange (1, 16, 1);
// channelInput->setSliderStyle (juce::Slider::IncDecButtons);
// channelInput->setTextBoxStyle (juce::Slider::TextBoxLeft, false, 56, 20);
channelInput->setValueChangedCallback([&]()
{
LumatoneKeyPropertyData properties;
properties.useChannel = true;
properties.channel = channelInput->getValue();

auto matchingKeyCoords = getMappingData()->getKeysWithProperties(properties);
performAction(SetKeySelectionAction::NewSetKeySelectionActionByCoords(*this, matchingKeyCoords));
});
addAndMakeVisible(channelInput.get());

lblColour = std::make_unique<juce::Label>("lblColour", "Colour");
Expand Down
1 change: 1 addition & 0 deletions Source/mapping_editors/MultiSelectControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ColourTextEditor;
class RangedControl;

class MultiSelectControls : public LumatoneEditorState
, public LumatoneEditorState::Controller
, public juce::Component
{
public:
Expand Down

0 comments on commit 59d5a8f

Please sign in to comment.