From 343acdd2331215c2086010950cc1ecbdee15e396 Mon Sep 17 00:00:00 2001 From: George Reales Date: Tue, 2 Jun 2020 12:13:45 +0200 Subject: [PATCH] Background SVG --- Source/PluginGui.cpp | 500 +++++++++++++++++++++++++++++++++++++++---- Source/PluginGui.h | 12 +- 2 files changed, 471 insertions(+), 41 deletions(-) diff --git a/Source/PluginGui.cpp b/Source/PluginGui.cpp index 21c5cdf..9ca748c 100644 --- a/Source/PluginGui.cpp +++ b/Source/PluginGui.cpp @@ -163,15 +163,15 @@ void PluginGui::setRecordButtonState(bool recording) { PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) { //[Constructor_pre] You can add your own custom stuff here.. - + //[/Constructor_pre] groupComponent2.reset (new GroupComponent ("new group", TRANS("Carrier"))); addAndMakeVisible (groupComponent2.get()); groupComponent2->setTextLabelPosition (Justification::centredLeft); - groupComponent2->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent2->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + groupComponent2->setColour (GroupComponent::outlineColourId, Colour (0x00007f00)); + groupComponent2->setColour (GroupComponent::textColourId, Colour (0x00007f00)); groupComponent2->setBounds (440, 88, 408, 344); @@ -179,8 +179,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) TRANS("Channels"))); addAndMakeVisible (groupComponent4.get()); groupComponent4->setTextLabelPosition (Justification::centredLeft); - groupComponent4->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent4->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + groupComponent4->setColour (GroupComponent::outlineColourId, Colour (0x00007f00)); + groupComponent4->setColour (GroupComponent::textColourId, Colour (0x00007f00)); groupComponent4->setBounds (16, 8, 832, 64); @@ -188,8 +188,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) TRANS("Percussion"))); addAndMakeVisible (groupComponent11.get()); groupComponent11->setTextLabelPosition (Justification::centredLeft); - groupComponent11->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent11->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + groupComponent11->setColour (GroupComponent::outlineColourId, Colour (0x00007f00)); + groupComponent11->setColour (GroupComponent::textColourId, Colour (0x00007f00)); groupComponent11->setBounds (496, 440, 192, 120); @@ -197,8 +197,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) TRANS("Algorithm"))); addAndMakeVisible (groupComponent10.get()); groupComponent10->setTextLabelPosition (Justification::centredLeft); - groupComponent10->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent10->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + groupComponent10->setColour (GroupComponent::outlineColourId, Colour (0x00007f00)); + groupComponent10->setColour (GroupComponent::textColourId, Colour (0x00007f00)); groupComponent10->setBounds (280, 440, 200, 120); @@ -206,8 +206,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) TRANS("File"))); addAndMakeVisible (groupComponent9.get()); groupComponent9->setTextLabelPosition (Justification::centredLeft); - groupComponent9->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent9->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + groupComponent9->setColour (GroupComponent::outlineColourId, Colour (0x00007f00)); + groupComponent9->setColour (GroupComponent::textColourId, Colour (0x00007f00)); groupComponent9->setBounds (704, 440, 144, 120); @@ -215,8 +215,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) TRANS("Modulator"))); addAndMakeVisible (groupComponent.get()); groupComponent->setTextLabelPosition (Justification::centredLeft); - groupComponent->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + groupComponent->setColour (GroupComponent::outlineColourId, Colour (0x00007f00)); + groupComponent->setColour (GroupComponent::textColourId, Colour (0x00007f00)); groupComponent->setBounds (16, 88, 408, 344); @@ -798,8 +798,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) TRANS("Effect depth"))); addAndMakeVisible (groupComponent3.get()); groupComponent3->setTextLabelPosition (Justification::centredLeft); - groupComponent3->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent3->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + groupComponent3->setColour (GroupComponent::outlineColourId, Colour (0x00007f00)); + groupComponent3->setColour (GroupComponent::textColourId, Colour (0x00007f00)); groupComponent3->setBounds (16, 440, 248, 120); @@ -2044,6 +2044,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) nextButton->setBounds (800, 472, 24, 24); + drawable1 = Drawable::createFromImageData (gui_svg, gui_svgSize); //[UserPreSize] oplLookAndFeel.reset(new OPLLookAndFeel()); @@ -2370,13 +2371,18 @@ PluginGui::~PluginGui() dbLabel8 = nullptr; previousButton = nullptr; nextButton = nullptr; + drawable1 = nullptr; + + + //[Destructor]. You can add your own custom destruction code here.. + oplLookAndFeel = nullptr; for (unsigned int i = 0; i < channels.size(); ++i) { channels[i].reset(); } - + channelButtonLookAndFeel = nullptr; - //[Destructor]. You can add your own custom destruction code here.. + //[/Destructor] } @@ -2388,6 +2394,17 @@ void PluginGui::paint (Graphics& g) g.fillAll (Colours::black); + { + int x = 0, y = 0, width = proportionOfWidth (1.0000f), height = proportionOfHeight (1.0000f); + //[UserPaintCustomArguments] Customize the painting arguments here.. + //[/UserPaintCustomArguments] + g.setColour (Colours::black); + jassert (drawable1 != nullptr); + if (drawable1 != nullptr) + drawable1->drawWithin (g, Rectangle (x, y, width, height).toFloat(), + RectanglePlacement::stretchToFit, 1.000f); + } + //[UserPaint] Add your own custom painting code here.. //[/UserPaint] } @@ -2760,7 +2777,7 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked) else if (buttonThatWasClicked == loadButton.get()) { //[UserButtonCode_loadButton] -- add your button handler code here.. - + if (!showLoadMenu()){ loadBrowserFile(); } @@ -3041,10 +3058,10 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked) loadBrowserFile(); } } - + } bool PluginGui::loadBrowserFile(){ - + FileChooser browser("Select SBI instrument file", instrumentLoadDirectory, #ifdef JUCE_IOS @@ -3093,14 +3110,14 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked) } else { this->loadBrowserFile(); } - + } // No select, return true to ignore the popup menu else{ return; } }); - + } return hasFile; } @@ -3119,27 +3136,29 @@ BEGIN_JUCER_METADATA - + + + + virtualName="" explicitFocusOrder="0" pos="440 88 408 344" outlinecol="7f00" + textcol="7f00" title="Carrier" textpos="33"/> + virtualName="" explicitFocusOrder="0" pos="16 8 832 64" outlinecol="7f00" + textcol="7f00" title="Channels" textpos="33"/> + virtualName="" explicitFocusOrder="0" pos="496 440 192 120" outlinecol="7f00" + textcol="7f00" title="Percussion" textpos="33"/> + virtualName="" explicitFocusOrder="0" pos="280 440 200 120" outlinecol="7f00" + textcol="7f00" title="Algorithm" textpos="33"/> + virtualName="" explicitFocusOrder="0" pos="704 440 144 120" outlinecol="7f00" + textcol="7f00" title="File" textpos="33"/> + virtualName="" explicitFocusOrder="0" pos="16 88 408 344" outlinecol="7f00" + textcol="7f00" title="Modulator" textpos="33"/> @@ -3403,8 +3422,8 @@ BEGIN_JUCER_METADATA fontname="Default font" fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="36"/> + virtualName="" explicitFocusOrder="0" pos="16 440 248 120" outlinecol="7f00" + textcol="7f00" title="Effect depth" textpos="33"/> oplLookAndFeel; + std::unique_ptr channelButtonLookAndFeel; + //[/UserVariables] //============================================================================== @@ -307,8 +313,8 @@ private: std::unique_ptr