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

    This file contains the basic framework code for a JUCE plugin editor.

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

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

//==============================================================================
Test2AudioProcessorEditor::Test2AudioProcessorEditor(Test2AudioProcessor &p)
    : AudioProcessorEditor(&p), processor(p)
{
  // Make sure that before the constructor has finished, you've set the
  // editor's size to whatever you need it to be.

  // m_flogger = std::unique_ptr<juce::FileLogger>(juce::FileLogger::createDateStampedLogger("foo", "mylog", ".txt", "Welcome to plugin"));
  setResizable(true, true);
  setSize(400, 300);
}

Test2AudioProcessorEditor::~Test2AudioProcessorEditor()
{
}

//==============================================================================
void Test2AudioProcessorEditor::paint(juce::Graphics &g)
{
  // (Our component is opaque, so we must completely fill the background with a solid colour)
  g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));

  g.setColour(juce::Colours::white);
  g.setFont(15.0f);
  g.drawFittedText("Hello Per 10 !", getLocalBounds(), juce::Justification::centred, 1);
  g.drawFittedText("Hello Per 10 !", getLocalBounds(), juce::Justification::centred, 1);
  if (processor.m_flogger)
    processor.m_flogger->logMessage("paint called");
}

void Test2AudioProcessorEditor::resized()
{
  // This is generally where you'll want to lay out the positions of any
  // subcomponents in your editor..

  auto bounds = getLocalBounds();

  if (processor.m_flogger)
    processor.m_flogger->logMessage(bounds.toString());
}