// SPDX-License-Identifier: GPLv3-or-later WITH Appstore-exception // Copyright (C) 2021 Jesse Chappell #pragma once #include "JuceHeader.h" #include "PluginProcessor.h" #include "CustomLookAndFeel.h" #include "SonoChoiceButton.h" #include "GenericItemChooser.h" class OptionsView : public Component, public Button::Listener, public SonoChoiceButton::Listener, public GenericItemChooser::Listener, public TextEditor::Listener, public MultiTimer { public: OptionsView(PaulstretchpluginAudioProcessor& proc, std::function getaudiodevicemanager); virtual ~OptionsView(); class Listener { public: virtual ~Listener() {} virtual void optionsChanged(OptionsView *comp) {} }; void addListener(Listener * listener) { listeners.add(listener); } void removeListener(Listener * listener) { listeners.remove(listener); } void timerCallback(int timerid) override; void buttonClicked (Button* buttonThatWasClicked) override; void choiceButtonSelected(SonoChoiceButton *comp, int index, int ident) override; void textEditorReturnKeyPressed (TextEditor&) override; void textEditorEscapeKeyPressed (TextEditor&) override; void textEditorTextChanged (TextEditor&) override; void textEditorFocusLost (TextEditor&) override; juce::Rectangle getMinimumContentBounds() const; juce::Rectangle getPreferredContentBounds() const; void grabInitialFocus(); void updateState(bool ignorecheck=false); void paint(Graphics & g) override; void resized() override; void showPopTip(const String & message, int timeoutMs, Component * target, int maxwidth=100); void optionsTabChanged (int newCurrentTabIndex); void showAudioTab(); void showOptionsTab(); void showAboutTab(); void showWarnings(); std::function getAudioDeviceManager; // = []() { return 0; }; std::function updateSliderSnap; // = []() { return 0; }; std::function updateKeybindings; // = []() { return 0; }; std::function saveSettingsIfNeeded; // = []() { return 0; }; protected: void configEditor(TextEditor *editor, bool passwd = false); void configLabel(Label *label, bool val=false); void configLevelSlider(Slider *); void chooseRecDirBrowser(); void createAbout(); PaulstretchpluginAudioProcessor& processor; CustomBigTextLookAndFeel smallLNF; CustomBigTextLookAndFeel sonoSliderLNF; ListenerList listeners; std::unique_ptr mAudioDeviceSelector; std::unique_ptr mAudioOptionsViewport; std::unique_ptr mOtherOptionsViewport; std::unique_ptr mRecordOptionsViewport; std::unique_ptr mOptionsComponent; std::unique_ptr mAboutViewport; std::unique_ptr