/* ============================================================================== This is an automatically generated GUI class created by the Projucer! 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 Projucer version: 6.0.8 ------------------------------------------------------------------------------ The Projucer is part of the JUCE library. Copyright (c) 2020 - Raw Material Software Limited. ============================================================================== */ //[Headers] You can add your own extra header files here... #include "PluginEditor.h" //[/Headers] #include "BasicParamsComponent.h" //[MiscUserDefs] You can add your own user definitions and misc code here... //[/MiscUserDefs] //============================================================================== BasicParamsComponent::BasicParamsComponent (Magical8bitPlug2AudioProcessor& p, Magical8bitPlug2AudioProcessorEditor& e) : processor(p),editor(e) { //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] polyLabel.reset (new juce::Label ("label", TRANS("Poly"))); addAndMakeVisible (polyLabel.get()); polyLabel->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); polyLabel->setJustificationType (juce::Justification::centredLeft); polyLabel->setEditable (false, false, false); polyLabel->setColour (juce::TextEditor::textColourId, juce::Colours::black); polyLabel->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); polyLabel->setBounds (232, 8, 40, 15); gainSlider.reset (new SliderComponent (p, "gain", "Gain")); addAndMakeVisible (gainSlider.get()); gainSlider->setName ("gain slider"); gainSlider->setBounds (0, 32, 380, 32); oscChoice.reset (new ChoiceComponent (p, "osc", "OSC Type")); addAndMakeVisible (oscChoice.get()); oscChoice->setName ("osc selector"); oscChoice->setBounds (0, 4, 224, 28); polyNumberInput.reset (new juce::Slider ("poly number input")); addAndMakeVisible (polyNumberInput.get()); polyNumberInput->setRange (0, 32, 1); polyNumberInput->setSliderStyle (juce::Slider::IncDecButtons); polyNumberInput->setTextBoxStyle (juce::Slider::TextBoxLeft, false, 30, 20); polyNumberInput->addListener (this); polyNumberInput->setBounds (268, 4, 86, 24); advancedSwitch.reset (new CheckBoxComponent (p, "isAdvancedPanelOpen_raw", "Advanced Options")); addAndMakeVisible (advancedSwitch.get()); advancedSwitch->setName ("advanced option switch"); colorSchemeChoice.reset (new ChoiceComponent (p, "colorScheme", "Color")); addAndMakeVisible (colorSchemeChoice.get()); colorSchemeChoice->setName ("color selector"); monoButton.reset (new juce::TextButton ("mono button")); addAndMakeVisible (monoButton.get()); monoButton->setButtonText (TRANS("mono")); monoButton->addListener (this); monoButton->setBounds (360, 4, 54, 24); //[UserPreSize] //[/UserPreSize] setSize (700, 64); //[Constructor] You can add your own custom stuff here.. oscChoice->setListener (this); advancedSwitch->setListener (this); colorSchemeChoice->setListener (this); colorSchemeChoice->setVisible (p.settingRefs.isAdvancedPanelOpen()); attc.reset (new SliderAttachment (p.parameters, "maxPoly", *polyNumberInput)); //[/Constructor] } BasicParamsComponent::~BasicParamsComponent() { //[Destructor_pre]. You can add your own custom destruction code here.. oscChoice->removeListener(); advancedSwitch->removeListener(); attc.reset(); //[/Destructor_pre] polyLabel = nullptr; gainSlider = nullptr; oscChoice = nullptr; polyNumberInput = nullptr; advancedSwitch = nullptr; colorSchemeChoice = nullptr; monoButton = nullptr; //[Destructor]. You can add your own custom destruction code here.. //[/Destructor] } //============================================================================== void BasicParamsComponent::paint (juce::Graphics& g) { //[UserPrePaint] Add your own custom painting code here.. //[/UserPrePaint] //[UserPaint] Add your own custom painting code here.. //[/UserPaint] } void BasicParamsComponent::resized() { //[UserPreResize] Add your own custom resize code here.. //[/UserPreResize] advancedSwitch->setBounds (getWidth() - 180, 4, 180, 28); colorSchemeChoice->setBounds (getWidth() - 4 - 185, 32, 185, 28); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } void BasicParamsComponent::sliderValueChanged (juce::Slider* sliderThatWasMoved) { //[UsersliderValueChanged_Pre] //[/UsersliderValueChanged_Pre] if (sliderThatWasMoved == polyNumberInput.get()) { //[UserSliderCode_polyNumberInput] -- add your slider handling code here.. processor.setupVoice(); editor.resizeWholePanel(); //[/UserSliderCode_polyNumberInput] } //[UsersliderValueChanged_Post] //[/UsersliderValueChanged_Post] } void BasicParamsComponent::buttonClicked (juce::Button* buttonThatWasClicked) { //[UserbuttonClicked_Pre] //[/UserbuttonClicked_Pre] if (buttonThatWasClicked == monoButton.get()) { //[UserButtonCode_monoButton] -- add your button handler code here.. polyNumberInput.get()->setValue(1); return; //[/UserButtonCode_monoButton] } //[UserbuttonClicked_Post] colorSchemeChoice->setVisible (buttonThatWasClicked->getToggleState()); editor.resizeWholePanel(); //[/UserbuttonClicked_Post] } //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... void BasicParamsComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged) { processor.setupVoice(); editor.resized(); printf ("setup voice!!\n"); } //[/MiscUserCode] //============================================================================== #if 0 /* -- Projucer information section -- This is where the Projucer 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]