2018-02-27 08:25:20 +08:00
|
|
|
//
|
|
|
|
// Created by Alex Birch on 01/10/2017.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-09-07 14:04:35 +08:00
|
|
|
#include <JuceHeader.h>
|
2018-02-27 08:25:20 +08:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2019-07-14 21:19:27 +08:00
|
|
|
class Pill
|
2019-07-15 02:31:05 +08:00
|
|
|
: public Component
|
|
|
|
, public Button::Listener
|
2019-07-14 21:19:27 +08:00
|
|
|
{
|
2018-02-27 08:25:20 +08:00
|
|
|
public:
|
2019-07-14 21:19:27 +08:00
|
|
|
Pill(
|
|
|
|
AudioProcessorValueTreeState& valueTreeState,
|
|
|
|
int bank,
|
|
|
|
bool isFirst,
|
|
|
|
bool isLast
|
2018-02-27 08:25:20 +08:00
|
|
|
);
|
2019-07-14 21:19:27 +08:00
|
|
|
~Pill();
|
|
|
|
|
2019-07-21 22:04:19 +08:00
|
|
|
void buttonClicked(Button* button) override;
|
2019-07-14 21:19:27 +08:00
|
|
|
|
2019-07-15 02:31:05 +08:00
|
|
|
void resized() override;
|
|
|
|
void paint(Graphics& g) override;
|
|
|
|
|
2019-07-21 22:04:19 +08:00
|
|
|
void bankChanged(int bank);
|
2019-07-14 21:19:27 +08:00
|
|
|
private:
|
|
|
|
|
|
|
|
AudioProcessorValueTreeState& valueTreeState;
|
|
|
|
int bank;
|
|
|
|
TextButton textButton;
|
2018-02-27 08:25:20 +08:00
|
|
|
|
2019-07-14 21:19:27 +08:00
|
|
|
friend class Pills;
|
2019-07-15 00:22:36 +08:00
|
|
|
};
|
2019-07-14 21:19:27 +08:00
|
|
|
|
|
|
|
class Pills
|
|
|
|
: public Component
|
|
|
|
, public ValueTree::Listener
|
2019-07-21 22:04:19 +08:00
|
|
|
, public AudioProcessorValueTreeState::Listener
|
2019-07-14 21:19:27 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Pills(
|
|
|
|
AudioProcessorValueTreeState& valueTreeState
|
2018-02-27 08:25:20 +08:00
|
|
|
);
|
2019-07-14 21:19:27 +08:00
|
|
|
~Pills();
|
2019-07-29 06:17:19 +08:00
|
|
|
|
2018-02-27 08:25:20 +08:00
|
|
|
void cycle(bool right);
|
|
|
|
|
2019-07-21 22:04:19 +08:00
|
|
|
virtual void parameterChanged (const String& parameterID, float newValue) override;
|
|
|
|
|
2019-07-14 21:19:27 +08:00
|
|
|
virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
|
|
|
|
const Identifier& property) override;
|
|
|
|
inline virtual void valueTreeChildAdded (ValueTree& parentTree,
|
|
|
|
ValueTree& childWhichHasBeenAdded) override {};
|
|
|
|
inline virtual void valueTreeChildRemoved (ValueTree& parentTree,
|
|
|
|
ValueTree& childWhichHasBeenRemoved,
|
|
|
|
int indexFromWhichChildWasRemoved) override {};
|
|
|
|
inline virtual void valueTreeChildOrderChanged (ValueTree& parentTreeWhoseChildrenHaveMoved,
|
|
|
|
int oldIndex, int newIndex) override {};
|
|
|
|
inline virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) override {};
|
|
|
|
inline virtual void valueTreeRedirected (ValueTree& treeWhichHasBeenChanged) override {};
|
2018-02-27 08:25:20 +08:00
|
|
|
private:
|
2019-07-14 21:19:27 +08:00
|
|
|
void loadModelFrom(ValueTree& banks);
|
|
|
|
|
|
|
|
AudioProcessorValueTreeState& valueTreeState;
|
2018-02-27 08:25:20 +08:00
|
|
|
|
2019-07-14 21:19:27 +08:00
|
|
|
vector<unique_ptr<Pill>> pills;
|
2018-02-27 08:25:20 +08:00
|
|
|
Button *selected;
|
|
|
|
|
2019-07-21 22:04:19 +08:00
|
|
|
void updatePillToggleStates();
|
|
|
|
|
2018-02-27 08:25:20 +08:00
|
|
|
void populate(int initiallySelectedItem);
|
|
|
|
void resized() override;
|
|
|
|
void paint(Graphics& g) override;
|
|
|
|
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pills)
|
2019-07-15 00:22:36 +08:00
|
|
|
};
|