diff --git a/.gitmodules b/.gitmodules index ddef9fe..3584032 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "JUCE"] path = JUCE url = https://github.com/juce-framework/JUCE/ - branch = master + branch = develop diff --git a/CMakeLists.txt b/CMakeLists.txt index 6943477..3bcdcb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ include(PamplejuceVersion) # This is the internal name of the project and the name of JUCE's shared code "target" # Note: This cannot have spaces (it may be 2023, but you can't have it all!) # Worry not, JUCE's PRODUCT_NAME can have spaces (and is DAWs display) -set(PROJECT_NAME "ZLTemplate") -set(PLUGIN_CODE "Temp") +set(PROJECT_NAME "ZLTest") +set(PLUGIN_CODE "Test") # Change me! # Worry not, JUCE's PRODUCT_NAME can have spaces (and is what DAWs will display) @@ -21,7 +21,7 @@ set(PLUGIN_CODE "Temp") # # set(PROJECT_NAME "MyPlugin_v${MAJOR_VERSION}") # Doing so enables major versions to show up in IDEs and DAWs as separate plugins # allowing you to change parameters and behavior without breaking existing user projects -set(PRODUCT_NAME "ZL Template") +set(PRODUCT_NAME "ZL Test") # Change me! Used for the MacOS bundle name and Installers set(COMPANY_NAME "ZL") diff --git a/source/PluginEditor.cpp b/source/PluginEditor.cpp index 4a09138..e05f669 100644 --- a/source/PluginEditor.cpp +++ b/source/PluginEditor.cpp @@ -4,31 +4,40 @@ PluginEditor::PluginEditor(PluginProcessor &p) : AudioProcessorEditor(&p), processorRef(p) { juce::ignoreUnused(processorRef); - addAndMakeVisible(inspectButton); - - // Make sure that before the constructor has finished, you've set the - // editor's size to whatever you need it to be. - setSize(400, 300); + setSize(400, 150); + getConstrainer()->setFixedAspectRatio(400.f / 150.f); + setResizable(true, p.wrapperType != PluginProcessor::wrapperType_AudioUnitv3); + startTimerHz(60); } PluginEditor::~PluginEditor() { + stopTimer(); } void PluginEditor::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)); - - auto area = getLocalBounds(); - g.setColour(juce::Colours::white); - g.setFont(16.0f); - auto helloWorld = juce::String("Hello from ") + PRODUCT_NAME_WITHOUT_VERSION + " v" - VERSION + " running in " + CMAKE_BUILD_TYPE; - g.drawText(helloWorld, area.removeFromTop(150), juce::Justification::centred, false); + const auto time = juce::Time::getCurrentTime(); + const auto timeString = time.toString(false, true, true, true); + g.setFont(getLocalBounds().toFloat().getHeight() * .5f); + + if (colourFlag == 0) { + g.fillAll(juce::Colours::white); + g.setColour(juce::Colours::black); + g.drawText(timeString, getLocalBounds(), juce::Justification::centred); + } else { + g.fillAll(juce::Colours::black); + g.setColour(juce::Colours::white); + g.drawText(timeString, getLocalBounds(), juce::Justification::centred); + } +} + +void PluginEditor::mouseDown(const juce::MouseEvent &event) { + juce::ignoreUnused(event); + colourFlag = 1 - colourFlag; } void PluginEditor::resized() { - // layout the positions of your child components here - auto area = getLocalBounds(); - area.removeFromBottom(50); - inspectButton.setBounds(getLocalBounds().withSizeKeepingCentre(100, 50)); +} + +void PluginEditor::timerCallback() { + repaint(); } diff --git a/source/PluginEditor.h b/source/PluginEditor.h index ef9689f..db1f53a 100644 --- a/source/PluginEditor.h +++ b/source/PluginEditor.h @@ -4,7 +4,8 @@ #include "BinaryData.h" //============================================================================== -class PluginEditor : public juce::AudioProcessorEditor { +class PluginEditor : public juce::AudioProcessorEditor, +juce::Timer { public: explicit PluginEditor(PluginProcessor &); @@ -15,10 +16,14 @@ class PluginEditor : public juce::AudioProcessorEditor { void resized() override; + void mouseDown(const juce::MouseEvent &event) override; + private: - // This reference is provided as a quick way for your editor to - // access the processor object that created it. PluginProcessor &processorRef; - juce::TextButton inspectButton{"Inspect the UI"}; + + int colourFlag = 0; + + void timerCallback() override; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginEditor) };