juicysfplugin/Source/TablesComponent.cpp

40 lines
876 B
C++
Raw Permalink Normal View History

2018-02-27 08:25:20 +08:00
//
// Created by Alex Birch on 17/09/2017.
//
#include "TablesComponent.h"
using namespace std;
using namespace placeholders;
TablesComponent::TablesComponent(
AudioProcessorValueTreeState& valueTreeState
)
: valueTreeState{valueTreeState}
, banks{valueTreeState}
, presetTable{valueTreeState}
2018-02-27 08:25:20 +08:00
{
presetTable.setWantsKeyboardFocus(false);
2018-02-27 08:25:20 +08:00
addAndMakeVisible(presetTable);
addAndMakeVisible(banks);
}
void TablesComponent::resized() {
Rectangle<int> r (getLocalBounds());
banks.setBounds (r.removeFromTop(27).reduced(5,0));
2018-02-27 08:25:20 +08:00
presetTable.setBounds (r);
2018-02-27 08:25:20 +08:00
}
bool TablesComponent::keyPressed(const KeyPress &key) {
if (key.getKeyCode() == KeyPress::leftKey
|| key.getKeyCode() == KeyPress::rightKey) {
banks.cycle(key.getKeyCode() == KeyPress::rightKey);
2018-02-27 08:25:20 +08:00
return true;
}
return presetTable.keyPressed(key);
2018-02-27 08:25:20 +08:00
}