/* ============================================================================== This is an automatically generated GUI class created by the Introjucer! Be careful when adding custom code to these files, as only the code within the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. Created with Introjucer version: 3.1.0 ------------------------------------------------------------------------------ The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-13 by Raw Material Software Ltd. ============================================================================== */ //[Headers] You can add your own extra header files here... #include "TomatlLookAndFeel.h" #include //[/Headers] #include "PreferencesLayout.h" //[MiscUserDefs] You can add your own user definitions and misc code here... //[/MiscUserDefs] //============================================================================== PreferencesLayout::PreferencesLayout (AdmvAudioProcessor* plugin) : mParentProcessor(plugin) { addAndMakeVisible (mSpectroGroup = new GroupComponent ("new group", TRANS("Spectrometer"))); addAndMakeVisible (mGenericGroup = new GroupComponent ("new group", TRANS("Generic"))); addAndMakeVisible (mGonioGroup = new GroupComponent ("gonio group", TRANS("Goniometer"))); addAndMakeVisible (mGoniometerScaleModeBox = new ComboBox ("goniometer scale mode")); mGoniometerScaleModeBox->setEditableText (false); mGoniometerScaleModeBox->setJustificationType (Justification::centredLeft); mGoniometerScaleModeBox->setTextWhenNothingSelected (String()); mGoniometerScaleModeBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); mGoniometerScaleModeBox->addItem (TRANS("Auto"), 1); mGoniometerScaleModeBox->addItem (TRANS("Manual"), 2); mGoniometerScaleModeBox->addListener (this); addAndMakeVisible (mSpectroReleaseSlider = new Slider ("spectro release slider")); mSpectroReleaseSlider->setRange (0, 1000, 0); mSpectroReleaseSlider->setSliderStyle (Slider::LinearHorizontal); mSpectroReleaseSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); mSpectroReleaseSlider->addListener (this); addAndMakeVisible (mSpectroReleaseLabel = new Label ("spectro release label", TRANS("label text"))); mSpectroReleaseLabel->setFont (Font (15.00f, Font::plain)); mSpectroReleaseLabel->setJustificationType (Justification::centredLeft); mSpectroReleaseLabel->setEditable (false, false, false); mSpectroReleaseLabel->setColour (TextEditor::textColourId, Colours::black); mSpectroReleaseLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (mSpectrumFillModeBox = new ComboBox ("spectrum fill mode box")); mSpectrumFillModeBox->setEditableText (false); mSpectrumFillModeBox->setJustificationType (Justification::centredLeft); mSpectrumFillModeBox->setTextWhenNothingSelected (String()); mSpectrumFillModeBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); mSpectrumFillModeBox->addItem (TRANS("Semi-transparent"), 1); mSpectrumFillModeBox->addItem (TRANS("None"), 2); mSpectrumFillModeBox->addListener (this); addAndMakeVisible (mOutputModeBox = new ComboBox ("output mode box")); mOutputModeBox->setEditableText (false); mOutputModeBox->setJustificationType (Justification::centredLeft); mOutputModeBox->setTextWhenNothingSelected (String()); mOutputModeBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); mOutputModeBox->addItem (TRANS("No change"), 1); mOutputModeBox->addItem (TRANS("Mute all"), 2); mOutputModeBox->addListener (this); addAndMakeVisible (mGonioScaleReleaseSlider = new Slider ("goniometer scale release")); mGonioScaleReleaseSlider->setRange (0, 1000, 0); mGonioScaleReleaseSlider->setSliderStyle (Slider::LinearHorizontal); mGonioScaleReleaseSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); mGonioScaleReleaseSlider->addListener (this); addAndMakeVisible (mGonioScaleReleaseLabel = new Label ("goniometer scale release label", TRANS("label text"))); mGonioScaleReleaseLabel->setFont (Font (15.00f, Font::plain)); mGonioScaleReleaseLabel->setJustificationType (Justification::centredLeft); mGonioScaleReleaseLabel->setEditable (false, false, false); mGonioScaleReleaseLabel->setColour (TextEditor::textColourId, Colours::black); mGonioScaleReleaseLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (mGonioOptionLabel1 = new Label ("new label", TRANS("Scale mode:"))); mGonioOptionLabel1->setFont (Font (15.00f, Font::plain)); mGonioOptionLabel1->setJustificationType (Justification::centredLeft); mGonioOptionLabel1->setEditable (false, false, false); mGonioOptionLabel1->setColour (TextEditor::textColourId, Colours::black); mGonioOptionLabel1->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (mGonioOptionLabel2 = new Label ("new label", TRANS("Auto-scale release (ms):"))); mGonioOptionLabel2->setFont (Font (15.00f, Font::plain)); mGonioOptionLabel2->setJustificationType (Justification::centredLeft); mGonioOptionLabel2->setEditable (false, false, false); mGonioOptionLabel2->setColour (TextEditor::textColourId, Colours::black); mGonioOptionLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (mSpectroOptionLabel1 = new Label ("new label", TRANS("Spectrum fill:"))); mSpectroOptionLabel1->setFont (Font (15.00f, Font::plain)); mSpectroOptionLabel1->setJustificationType (Justification::centredLeft); mSpectroOptionLabel1->setEditable (false, false, false); mSpectroOptionLabel1->setColour (TextEditor::textColourId, Colours::black); mSpectroOptionLabel1->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (mSpectroOptionLabel2 = new Label ("new label", TRANS("Spectrum release speed (ms):"))); mSpectroOptionLabel2->setFont (Font (15.00f, Font::plain)); mSpectroOptionLabel2->setJustificationType (Justification::centredLeft); mSpectroOptionLabel2->setEditable (false, false, false); mSpectroOptionLabel2->setColour (TextEditor::textColourId, Colours::black); mSpectroOptionLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (mGenericOptionLabel1 = new Label ("new label", TRANS("Audio output:"))); mGenericOptionLabel1->setFont (Font (15.00f, Font::plain)); mGenericOptionLabel1->setJustificationType (Justification::centredLeft); mGenericOptionLabel1->setEditable (false, false, false); mGenericOptionLabel1->setColour (TextEditor::textColourId, Colours::black); mGenericOptionLabel1->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); //[UserPreSize] mSpectroReleaseBounds.mLow = 50; mSpectroReleaseBounds.mHigh = 10000; mGonioScaleReleaseBounds.mLow = 50; mGonioScaleReleaseBounds.mHigh = 10000; mGoniometerScaleModeBox->setSelectedItemIndex(mParentProcessor->getState().mManualGoniometerScale ? 1 : 0); mSpectrumFillModeBox->setSelectedItemIndex(mParentProcessor->getState().mSpectrumFillMode == AdmvPluginState::spectrumFillNone ? 1 : 0); mOutputModeBox->setSelectedItemIndex(mParentProcessor->getState().mOutputMode == AdmvPluginState::outputMute ? 1 : 0); double spectroReleaseSpeed = mParentProcessor->getState().mSpectrometerReleaseSpeed; if (spectroReleaseSpeed != std::numeric_limits::infinity()) { mSpectroReleaseSlider->setValue(mSpectroReleaseScale.scale(mSpectroReleaseSlider->getMaximum(), mSpectroReleaseBounds, spectroReleaseSpeed)); } else { mSpectroReleaseSlider->setValue(mSpectroReleaseSlider->getMaximum()); } setSpectroReleaseLabelText(spectroReleaseSpeed); double gonioReleaseSpeed = mParentProcessor->getState().mGoniometerScaleAttackRelease.second; mGonioScaleReleaseSlider->setValue(mGonioScaleReleaseScale.scale(mGonioScaleReleaseSlider->getMaximum(), mGonioScaleReleaseBounds, gonioReleaseSpeed)); mGonioScaleReleaseLabel->setText(juce::String((int)gonioReleaseSpeed), juce::dontSendNotification); //[/UserPreSize] setSize (528, 256); //[Constructor] You can add your own custom stuff here.. //[/Constructor] } PreferencesLayout::~PreferencesLayout() { //[Destructor_pre]. You can add your own custom destruction code here.. //[/Destructor_pre] mSpectroGroup = nullptr; mGenericGroup = nullptr; mGonioGroup = nullptr; mGoniometerScaleModeBox = nullptr; mSpectroReleaseSlider = nullptr; mSpectroReleaseLabel = nullptr; mSpectrumFillModeBox = nullptr; mOutputModeBox = nullptr; mGonioScaleReleaseSlider = nullptr; mGonioScaleReleaseLabel = nullptr; mGonioOptionLabel1 = nullptr; mGonioOptionLabel2 = nullptr; mSpectroOptionLabel1 = nullptr; mSpectroOptionLabel2 = nullptr; mGenericOptionLabel1 = nullptr; //[Destructor]. You can add your own custom destruction code here.. //[/Destructor] } //============================================================================== void PreferencesLayout::paint (Graphics& g) { //[UserPrePaint] Add your own custom painting code here.. //[/UserPrePaint] g.fillAll (Colours::white); //[UserPaint] Add your own custom painting code here.. g.fillAll(LookAndFeel::getDefaultLookAndFeel().findColour(TomatlLookAndFeel::defaultBackground)); //[/UserPaint] } void PreferencesLayout::resized() { mSpectroGroup->setBounds (0, 96, 528, 96); mGenericGroup->setBounds (0, 192, 528, 64); mGonioGroup->setBounds (0, 0, 528, 96); mGoniometerScaleModeBox->setBounds (264, 24, 150, 24); mSpectroReleaseSlider->setBounds (264, 152, 150, 24); mSpectroReleaseLabel->setBounds (416, 152, 88, 24); mSpectrumFillModeBox->setBounds (264, 120, 150, 24); mOutputModeBox->setBounds (264, 216, 150, 24); mGonioScaleReleaseSlider->setBounds (264, 56, 150, 24); mGonioScaleReleaseLabel->setBounds (416, 56, 72, 24); mGonioOptionLabel1->setBounds (16, 24, 168, 24); mGonioOptionLabel2->setBounds (16, 56, 239, 24); mSpectroOptionLabel1->setBounds (16, 120, 150, 24); mSpectroOptionLabel2->setBounds (16, 152, 207, 24); mGenericOptionLabel1->setBounds (16, 216, 150, 24); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } void PreferencesLayout::comboBoxChanged (ComboBox* comboBoxThatHasChanged) { //[UsercomboBoxChanged_Pre] //[/UsercomboBoxChanged_Pre] if (comboBoxThatHasChanged == mGoniometerScaleModeBox) { //[UserComboBoxCode_mGoniometerScaleModeBox] -- add your combo box handling code here.. mParentProcessor->setManualGonioScaleEnabled(comboBoxThatHasChanged->getSelectedItemIndex() == 1); //[/UserComboBoxCode_mGoniometerScaleModeBox] } else if (comboBoxThatHasChanged == mSpectrumFillModeBox) { //[UserComboBoxCode_mSpectrumFillModeBox] -- add your combo box handling code here.. mParentProcessor->setSpectroFillMode(comboBoxThatHasChanged->getSelectedItemIndex() == 0 ? AdmvPluginState::spectrumFillWithTransparency : AdmvPluginState::spectrumFillNone); //[/UserComboBoxCode_mSpectrumFillModeBox] } else if (comboBoxThatHasChanged == mOutputModeBox) { //[UserComboBoxCode_mOutputModeBox] -- add your combo box handling code here.. mParentProcessor->setOutputMode(comboBoxThatHasChanged->getSelectedItemIndex() == 0 ? AdmvPluginState::outputNoChange : AdmvPluginState::outputMute); //[/UserComboBoxCode_mOutputModeBox] } //[UsercomboBoxChanged_Post] //[/UsercomboBoxChanged_Post] } void PreferencesLayout::sliderValueChanged (Slider* sliderThatWasMoved) { //[UsersliderValueChanged_Pre] //[/UsersliderValueChanged_Pre] if (sliderThatWasMoved == mSpectroReleaseSlider) { //[UserSliderCode_mSpectroReleaseSlider] -- add your slider handling code here.. auto releaseSpeed = mSpectroReleaseScale.unscale(sliderThatWasMoved->getMaximum(), mSpectroReleaseBounds, sliderThatWasMoved->getValue()); mParentProcessor->setSpectroReleaseSpeed(releaseSpeed == mSpectroReleaseBounds.mHigh ? std::numeric_limits::infinity() : releaseSpeed); setSpectroReleaseLabelText(releaseSpeed); //[/UserSliderCode_mSpectroReleaseSlider] } else if (sliderThatWasMoved == mGonioScaleReleaseSlider) { //[UserSliderCode_mGonioScaleReleaseSlider] -- add your slider handling code here.. auto releaseSpeed = mGonioScaleReleaseScale.unscale(sliderThatWasMoved->getMaximum(), mGonioScaleReleaseBounds, sliderThatWasMoved->getValue()); mParentProcessor->setManualGonioScaleRelease(releaseSpeed); mGonioScaleReleaseLabel->setText(juce::String((int)releaseSpeed), juce::dontSendNotification); //[/UserSliderCode_mGonioScaleReleaseSlider] } //[UsersliderValueChanged_Post] //[/UsersliderValueChanged_Post] } //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... //[/MiscUserCode] //============================================================================== #if 0 /* -- Introjucer information section -- This is where the Introjucer stores the metadata that describe this GUI layout, so make changes in here at your peril! BEGIN_JUCER_METADATA END_JUCER_METADATA */ #endif //[EndFile] You can add extra defines here... //[/EndFile]