andrewm@0: /* andrewm@0: ============================================================================== andrewm@0: andrewm@0: This is an automatically generated GUI class created by the Introjucer! andrewm@0: andrewm@0: Be careful when adding custom code to these files, as only the code within andrewm@0: the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded andrewm@0: and re-saved. andrewm@0: andrewm@0: Created with Introjucer version: 3.1.0 andrewm@0: andrewm@0: ------------------------------------------------------------------------------ andrewm@0: andrewm@0: The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" andrewm@0: Copyright 2004-13 by Raw Material Software Ltd. andrewm@0: andrewm@0: ============================================================================== andrewm@0: */ andrewm@0: andrewm@0: //[Headers] You can add your own extra header files here... andrewm@0: #include "PluginProcessor.h" andrewm@0: //[/Headers] andrewm@0: andrewm@0: #include "PluginEditor.h" andrewm@0: andrewm@0: andrewm@0: //[MiscUserDefs] You can add your own user definitions and misc code here... andrewm@0: andrewm@0: //LookAndFeelCustom* DistortionAudioProcessorEditor::customLookAndFeel = NULL; andrewm@0: andrewm@0: //[/MiscUserDefs] andrewm@0: andrewm@0: //============================================================================== andrewm@0: DistortionAudioProcessorEditor::DistortionAudioProcessorEditor (DistortionAudioProcessor* ownerFilter) andrewm@0: : AudioProcessorEditor (ownerFilter) andrewm@0: { andrewm@0: addAndMakeVisible (resetButton = new TextButton ("on off button")); andrewm@0: resetButton->setButtonText (TRANS("RESET")); andrewm@0: resetButton->addListener (this); andrewm@0: resetButton->setColour (TextButton::buttonColourId, Colour (0xffad8585)); andrewm@0: resetButton->setColour (TextButton::buttonOnColourId, Colours::red); andrewm@0: andrewm@0: addAndMakeVisible (gainSlider = new Slider ("new slider")); andrewm@0: gainSlider->setRange (-24, 24, 0.01); andrewm@0: gainSlider->setSliderStyle (Slider::RotaryHorizontalVerticalDrag); andrewm@0: gainSlider->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20); andrewm@0: gainSlider->setColour (Slider::rotarySliderFillColourId, Colour (0x7fffffff)); andrewm@0: gainSlider->setColour (Slider::textBoxTextColourId, Colours::white); andrewm@0: gainSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00ffffff)); andrewm@0: gainSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00808080)); andrewm@0: gainSlider->addListener (this); andrewm@0: andrewm@0: addAndMakeVisible (typeComboBox = new ComboBox ("new combo box")); andrewm@0: typeComboBox->setEditableText (false); andrewm@0: typeComboBox->setJustificationType (Justification::centredLeft); andrewm@0: typeComboBox->setTextWhenNothingSelected (String::empty); andrewm@0: typeComboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); andrewm@0: typeComboBox->addItem (TRANS("Hard clipping"), 1); andrewm@0: typeComboBox->addItem (TRANS("Soft clipping (poly)"), 2); andrewm@0: typeComboBox->addItem (TRANS("Soft clipping (exp)"), 3); andrewm@0: typeComboBox->addItem (TRANS("Full-wave rectifier"), 4); andrewm@0: typeComboBox->addItem (TRANS("Half-wave rectifier"), 5); andrewm@0: typeComboBox->addListener (this); andrewm@0: andrewm@0: andrewm@0: //[UserPreSize] andrewm@0: addAndMakeVisible (resizer = new ResizableCornerComponent (this, &resizeLimits)); andrewm@0: resizeLimits.setSizeLimits (150, 150, 850, 290); andrewm@0: //[/UserPreSize] andrewm@0: andrewm@0: setSize (280, 320); andrewm@0: andrewm@0: andrewm@0: //[Constructor] You can add your own custom stuff here.. andrewm@0: andrewm@0: UpdateInterfaceValues(); andrewm@0: andrewm@0: //************************************ SET LOOKANDFEEL ********************************** andrewm@0: // if( customLookAndFeel == NULL ) andrewm@0: // { andrewm@0: // customLookAndFeel = new LookAndFeelCustom(); andrewm@0: // LookAndFeel::setDefaultLookAndFeel (/*&*/customLookAndFeel); andrewm@0: // } andrewm@0: andrewm@0: //*************************************************************************************** andrewm@0: andrewm@0: startTimer (50); andrewm@0: andrewm@0: //[/Constructor] andrewm@0: } andrewm@0: andrewm@0: DistortionAudioProcessorEditor::~DistortionAudioProcessorEditor() andrewm@0: { andrewm@0: //[Destructor_pre]. You can add your own custom destruction code here.. andrewm@0: //[/Destructor_pre] andrewm@0: andrewm@0: resetButton = nullptr; andrewm@0: gainSlider = nullptr; andrewm@0: typeComboBox = nullptr; andrewm@0: andrewm@0: andrewm@0: //[Destructor]. You can add your own custom destruction code here.. andrewm@0: andrewm@0: //[/Destructor] andrewm@0: } andrewm@0: andrewm@0: //============================================================================== andrewm@0: void DistortionAudioProcessorEditor::paint (Graphics& g) andrewm@0: { andrewm@0: //[UserPrePaint] Add your own custom painting code here.. andrewm@0: //[/UserPrePaint] andrewm@0: andrewm@0: g.fillAll (Colour (0xff880909)); andrewm@0: andrewm@0: g.setColour (Colours::red); andrewm@0: g.fillEllipse (96.0f, 158.0f, 88.0f, 88.0f); andrewm@0: andrewm@0: g.setColour (Colour (0xff2c333b)); andrewm@0: g.fillEllipse (112.0f, 174.0f, 56.0f, 56.0f); andrewm@0: andrewm@0: g.setColour (Colour (0xff650000)); andrewm@0: g.fillRoundedRectangle (54.0f, 6.0f, 175.0f, 37.0f, 10.000f); andrewm@0: andrewm@0: g.setColour (Colours::white); andrewm@0: g.setFont (Font (Font::getDefaultMonospacedFontName(), 22.30f, Font::bold)); andrewm@0: g.drawText (TRANS("distortion"), andrewm@0: 6, 13, 277, 24, andrewm@0: Justification::centredTop, true); andrewm@0: andrewm@0: g.setColour (Colours::white); andrewm@0: g.setFont (Font (Font::getDefaultMonospacedFontName(), 15.00f, Font::plain)); andrewm@0: g.drawText (TRANS("GAIN"), andrewm@0: 3, 133, 275, 30, andrewm@0: Justification::centred, true); andrewm@0: andrewm@0: //[UserPaint] Add your own custom painting code here.. andrewm@0: andrewm@0: // Knob bounds andrewm@0: g.setColour (Colours::white); andrewm@0: g.setFont (Font (Font::getDefaultMonospacedFontName(), 11.00f, Font::plain)); andrewm@0: g.drawText (String(gainSlider->getMinimum()), andrewm@0: 59, 229, 54, 30, andrewm@0: Justification::centredRight, true); andrewm@0: andrewm@0: g.setColour (Colours::white); andrewm@0: g.setFont (Font (Font::getDefaultMonospacedFontName(), 11.00f, Font::plain)); andrewm@0: g.drawText (String(gainSlider->getMaximum()), andrewm@0: 168, 229, 54, 30, andrewm@0: Justification::centredLeft, true); andrewm@0: andrewm@0: // Version number andrewm@0: String str("v "); andrewm@0: str.append(JucePlugin_VersionString, 4); andrewm@0: g.setColour (Colours::white); andrewm@0: g.setFont (Font (Font::getDefaultMonospacedFontName(), 11.00f, Font::plain)); andrewm@0: g.drawText (str, andrewm@0: 189, 37, 54, 30, andrewm@0: Justification::centredLeft, true); andrewm@0: andrewm@0: //[/UserPaint] andrewm@0: } andrewm@0: andrewm@0: void DistortionAudioProcessorEditor::resized() andrewm@0: { andrewm@0: resetButton->setBounds (236, 5, 39, 23); andrewm@0: gainSlider->setBounds (58, 162, 164, 102); andrewm@0: typeComboBox->setBounds (69, 77, 150, 24); andrewm@0: //[UserResized] Add your own custom resize handling here.. andrewm@0: getProcessor()->_lastUIWidth = getWidth(); andrewm@0: getProcessor()->_lastUIHeight = getHeight(); andrewm@0: //[/UserResized] andrewm@0: } andrewm@0: andrewm@0: void DistortionAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked) andrewm@0: { andrewm@0: //[UserbuttonClicked_Pre] andrewm@0: DistortionAudioProcessor* ourProcessor = getProcessor(); andrewm@0: andrewm@0: //[/UserbuttonClicked_Pre] andrewm@0: andrewm@0: if (buttonThatWasClicked == resetButton) andrewm@0: { andrewm@0: //[UserButtonCode_resetButton] -- add your button handler code here.. andrewm@0: ourProcessor->Reset(); andrewm@0: //[/UserButtonCode_resetButton] andrewm@0: } andrewm@0: andrewm@0: //[UserbuttonClicked_Post] andrewm@0: UpdateInterfaceValues(); andrewm@0: //[/UserbuttonClicked_Post] andrewm@0: } andrewm@0: andrewm@0: void DistortionAudioProcessorEditor::sliderValueChanged (Slider* sliderThatWasMoved) andrewm@0: { andrewm@0: //[UsersliderValueChanged_Pre] andrewm@0: DistortionAudioProcessor* ourProcessor = getProcessor(); andrewm@0: //[/UsersliderValueChanged_Pre] andrewm@0: andrewm@0: if (sliderThatWasMoved == gainSlider) andrewm@0: { andrewm@0: //[UserSliderCode_gainSlider] -- add your slider handling code here.. andrewm@0: ourProcessor->SetGainIndB(gainSlider->getValue()); andrewm@0: //[/UserSliderCode_gainSlider] andrewm@0: } andrewm@0: andrewm@0: //[UsersliderValueChanged_Post] andrewm@0: //[/UsersliderValueChanged_Post] andrewm@0: } andrewm@0: andrewm@0: void DistortionAudioProcessorEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) andrewm@0: { andrewm@0: //[UsercomboBoxChanged_Pre] andrewm@0: DistortionAudioProcessor* ourProcessor = getProcessor(); andrewm@0: //[/UsercomboBoxChanged_Pre] andrewm@0: andrewm@0: if (comboBoxThatHasChanged == typeComboBox) andrewm@0: { andrewm@0: //[UserComboBoxCode_typeComboBox] -- add your combo box handling code here.. andrewm@0: ourProcessor->SetType((DistortionAudioProcessor::Types) typeComboBox->getSelectedItemIndex()); andrewm@0: //[/UserComboBoxCode_typeComboBox] andrewm@0: } andrewm@0: andrewm@0: //[UsercomboBoxChanged_Post] andrewm@0: //[/UsercomboBoxChanged_Post] andrewm@0: } andrewm@0: andrewm@0: andrewm@0: andrewm@0: //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... andrewm@0: void DistortionAudioProcessorEditor::SetComboBoxActivity(ComboBox * comboBox, bool active) andrewm@0: { andrewm@0: if (active){ andrewm@0: comboBox->setColour(ComboBox::backgroundColourId, Colours::white); andrewm@0: }else{ andrewm@0: comboBox->setColour(ComboBox::backgroundColourId, Colours::grey); andrewm@0: } andrewm@0: } andrewm@0: andrewm@0: void DistortionAudioProcessorEditor::SetSliderActivity(Slider * slider, bool active) andrewm@0: { andrewm@0: if (active){ andrewm@0: slider->setColour (Slider::rotarySliderFillColourId, Colour (0xffff5c00)); andrewm@0: slider->addListener (this); andrewm@0: }else{ andrewm@0: slider->setColour (Slider::rotarySliderFillColourId, Colours::grey); andrewm@0: slider->removeListener(this); andrewm@0: } andrewm@0: } andrewm@0: andrewm@0: void DistortionAudioProcessorEditor::UpdateInterfaceValues() andrewm@0: { andrewm@0: DistortionAudioProcessor* ourProcessor = getProcessor(); andrewm@0: andrewm@0: // Update Sliders andrewm@0: gainSlider ->setValue(ourProcessor->_gainIndB,dontSendNotification); andrewm@0: typeComboBox->setItemEnabled((int) ourProcessor->GetType(), true); andrewm@0: } andrewm@0: andrewm@0: // This timer periodically checks whether any of the parameters have changed... andrewm@0: void DistortionAudioProcessorEditor::timerCallback() andrewm@0: { andrewm@0: //DistortionAudioProcessor* ourProcessor = getProcessor(); andrewm@0: andrewm@0: andrewm@0: } andrewm@0: andrewm@0: //[/MiscUserCode] andrewm@0: andrewm@0: andrewm@0: //============================================================================== andrewm@0: #if 0 andrewm@0: /* -- Introjucer information section -- andrewm@0: andrewm@0: This is where the Introjucer stores the metadata that describe this GUI layout, so andrewm@0: make changes in here at your peril! andrewm@0: andrewm@0: BEGIN_JUCER_METADATA andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: END_JUCER_METADATA andrewm@0: */ andrewm@0: #endif andrewm@0: andrewm@0: andrewm@0: //[EndFile] You can add extra defines here... andrewm@0: //[/EndFile]