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(
|
2019-07-15 00:22:36 +08:00
|
|
|
AudioProcessorValueTreeState& valueTreeState
|
2019-07-07 07:22:47 +08:00
|
|
|
)
|
|
|
|
: valueTreeState{valueTreeState}
|
2019-07-15 00:22:36 +08:00
|
|
|
, banks{valueTreeState}
|
|
|
|
, presetTable{valueTreeState}
|
2018-02-27 08:25:20 +08:00
|
|
|
{
|
2019-07-15 00:22:36 +08:00
|
|
|
|
|
|
|
presetTable.setWantsKeyboardFocus(false);
|
2018-02-27 08:25:20 +08:00
|
|
|
|
|
|
|
addAndMakeVisible(presetTable);
|
|
|
|
|
|
|
|
addAndMakeVisible(banks);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TablesComponent::resized() {
|
|
|
|
Rectangle<int> r (getLocalBounds());
|
2019-07-15 00:22:36 +08:00
|
|
|
banks.setBounds (r.removeFromTop(27).reduced(5,0));
|
2018-02-27 08:25:20 +08:00
|
|
|
|
2019-07-15 00:22:36 +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) {
|
2019-07-15 00:22:36 +08:00
|
|
|
banks.cycle(key.getKeyCode() == KeyPress::rightKey);
|
2018-02-27 08:25:20 +08:00
|
|
|
return true;
|
|
|
|
}
|
2019-07-15 00:22:36 +08:00
|
|
|
return presetTable.keyPressed(key);
|
2018-02-27 08:25:20 +08:00
|
|
|
}
|