/*
  ==============================================================================

    This file was auto-generated by the Introjucer!

    It contains the basic framework code for a JUCE plugin editor.

  ==============================================================================
*/

#include "PluginProcessor.h"
#include "PluginEditor.h"

using namespace gin;

//==============================================================================
PluginEditor::PluginEditor (PluginProcessor& p)
    : gin::ProcessorEditor (p), proc (p)
{
    for (auto pp : p.getPluginParameters())
    {
        ParamComponent* pc;
        
        if (pp->isOnOff())
            pc = new Switch (pp);
        else
            pc = new Knob (pp);

        addAndMakeVisible (pc);
        controls.add (pc);
    }
    
    setGridSize (6, 1);
}

PluginEditor::~PluginEditor()
{
}

//==============================================================================
void PluginEditor::resized()
{
    gin::ProcessorEditor::resized();
    
    componentForId (PARAM_GAIN_L)->setBounds (getGridArea (1, 0));
    componentForId (PARAM_GAIN_S)->setBounds (getGridArea (2, 0));
    componentForId (PARAM_GAIN_R)->setBounds (getGridArea (3, 0));
    componentForId (PARAM_CLIP)->setBounds (getGridArea (4, 0));
}
