Hi,
So I guess some of us use GenericAudioProcessorEditor during development.
One frustrating thing is the it is non-editable. clicks are only intercepts to set sliders. however being able to text-input during development is really valuable.
Something useful for folks who use GenericAudioProcessorEditor currently and want the text boxes editable without changing JUCE, you can also do this:
AudioProcessorEditor* MyPluginAudioProcessor::createEditor()
{
AudioProcessorEditor* result = new GenericAudioProcessorEditor (this);
for (auto& slider : ComponentTypeFinder<Slider> (result).instances)
slider->setTextBoxIsEditable (true);
return result;
}
Using the generally useful ComponentTypeFinder, attached here:
class ComponentWalker
{
public:
virtual ~ComponentWalker() {}
// Walk recursively iterates over all of the component's child components and their child components.
// Subclasses may override this, for example to setMouseDragSensitivity on all Sliders, etc.
//
// Overriders should call ComponentWalker::walk when they wish to resume walking child components.
virtual void walk (juce::Component*);
};
template<typename T>
class ComponentTypeFinder : public ComponentWalker
{
public:
juce::Array<T*> instances;
ComponentTypeFinder (juce::Component* component = nullptr)
{
if (component != nullptr)
walk (component);
}
void walk (juce::Component* component) override
{
if (T* const instance = dynamic_cast<T*> (component))
instances.add (instance);
ComponentWalker::walk (component);
}
};