// SPDX-License-Identifier: GPLv3-or-later WITH Appstore-exception // Copyright (C) 2021 Jesse Chappell #include "OptionsView.h" class PaulxstretchOptionsTabbedComponent : public TabbedComponent { public: PaulxstretchOptionsTabbedComponent(TabbedButtonBar::Orientation orientation, OptionsView & editor_) : TabbedComponent(orientation), editor(editor_) { } void currentTabChanged (int newCurrentTabIndex, const String& newCurrentTabName) override { editor.optionsTabChanged(newCurrentTabIndex); } protected: OptionsView & editor; }; enum { nameTextColourId = 0x1002830, selectedColourId = 0x1002840, separatorColourId = 0x1002850, }; OptionsView::OptionsView(PaulstretchpluginAudioProcessor& proc, std::function getaudiodevicemanager) : Component(), getAudioDeviceManager(getaudiodevicemanager), processor(proc), smallLNF(14), sonoSliderLNF(13) { setColour (nameTextColourId, Colour::fromFloatRGBA(1.0f, 1.0f, 1.0f, 0.9f)); setColour (selectedColourId, Colour::fromFloatRGBA(0.0f, 0.4f, 0.8f, 0.5f)); setColour (separatorColourId, Colour::fromFloatRGBA(0.3f, 0.3f, 0.3f, 0.3f)); sonoSliderLNF.textJustification = Justification::centredRight; sonoSliderLNF.sliderTextJustification = Justification::centredRight; mOptionsComponent = std::make_unique(); mSettingsTab = std::make_unique(TabbedButtonBar::Orientation::TabsAtTop); mSettingsTab->setTabBarDepth(36); mSettingsTab->setOutline(0); mSettingsTab->getTabbedButtonBar().setMinimumTabScaleFactor(0.1f); //mSettingsTab->addComponentListener(this); mOptionsLoadFileWithPluginButton = std::make_unique(TRANS("Load file with plugin state")); mOptionsLoadFileWithPluginButton->addListener(this); mOptionsLoadFileWithPluginButton->onClick = [this] () { toggleBool(processor.m_load_file_with_state); }; mOptionsPlayWithTransportButton = std::make_unique(TRANS("Play when host transport running")); mOptionsPlayWithTransportButton->onClick = [this] () { toggleBool(processor.m_play_when_host_plays); }; mOptionsCaptureWithTransportButton = std::make_unique(TRANS("Capture when host transport running")); mOptionsCaptureWithTransportButton->onClick = [this] () { toggleBool(processor.m_capture_when_host_plays); }; mOptionsRestorePlayStateButton = std::make_unique(TRANS("Restore playing state")); mOptionsRestorePlayStateButton->onClick = [this] () { toggleBool(processor.m_restore_playstate); }; mOptionsMutePassthroughWhenCaptureButton = std::make_unique(TRANS("Mute passthrough while capturing")); mOptionsMutePassthroughWhenCaptureButton->onClick = [this] () { toggleBool(processor.m_mute_while_capturing); }; mOptionsMuteProcessedWhenCaptureButton = std::make_unique(TRANS("Mute processed audio output while capturing")); mOptionsMuteProcessedWhenCaptureButton->onClick = [this] () { toggleBool(processor.m_mute_processed_while_capturing); }; mOptionsSaveCaptureToDiskButton = std::make_unique(TRANS("Save captured audio to disk")); mOptionsSaveCaptureToDiskButton->onClick = [this] () { toggleBool(processor.m_save_captured_audio); }; mOptionsEndRecordingAfterMaxButton = std::make_unique(TRANS("End recording after capturing max length")); mOptionsEndRecordingAfterMaxButton->onClick = [this] () { toggleBool(processor.m_auto_finish_record); }; mOptionsSliderSnapToMouseButton = std::make_unique(TRANS("Sliders jump to position")); mOptionsSliderSnapToMouseButton->onClick = [this] () { toggleBool(processor.m_use_jumpsliders); if (updateSliderSnap) updateSliderSnap(); }; mOptionsShowTechnicalInfoButton = std::make_unique(TRANS("Show technical info in waveform")); mOptionsShowTechnicalInfoButton->onClick = [this] () { toggleBool(processor.m_show_technical_info); }; mRecFormatChoice = std::make_unique(); mRecFormatChoice->addChoiceListener(this); mRecFormatChoice->addItem(TRANS("FLAC"), PaulstretchpluginAudioProcessor::FileFormatFLAC); mRecFormatChoice->addItem(TRANS("WAV"), PaulstretchpluginAudioProcessor::FileFormatWAV); mRecFormatChoice->addItem(TRANS("OGG"), PaulstretchpluginAudioProcessor::FileFormatOGG); mRecBitsChoice = std::make_unique(); mRecBitsChoice->addChoiceListener(this); mRecBitsChoice->addItem(TRANS("16 bit"), 16); mRecBitsChoice->addItem(TRANS("24 bit"), 24); mRecBitsChoice->addItem(TRANS("32 bit"), 32); mRecFormatStaticLabel = std::make_unique