2
0
Fork 0

Preliminary preset bar implementation

This commit is contained in:
George Reales 2021-04-27 09:46:19 +02:00
parent baafdc8fc0
commit 65b7e2275f
6 changed files with 400 additions and 6 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<JUCERPROJECT id="mxW328" name="OB-Xd" projectType="audioplug" version="2.3.0"
<JUCERPROJECT id="mxW328" name="OB-Xd" projectType="audioplug" version="2.4.0"
bundleIdentifier="com.discoDSP.Obxd" includeBinaryInAppConfig="1"
pluginName="OB-Xd" pluginDesc="Emulation of famous OB-X, OB-Xa and OB-8 synths"
pluginManufacturer="discoDSP" pluginManufacturerCode="DDSP" pluginCode="Obxd"
@ -17,6 +17,8 @@
<MAINGROUP id="NZ3n4V" name="OB-Xd">
<GROUP id="{90740217-84AB-FD0D-FBC4-CA9EA2C68D5E}" name="Source">
<GROUP id="{BD020CFA-798B-F1A1-A6C7-7559BD467248}" name="Components">
<FILE id="XnxhrR" name="PresetBar.h" compile="0" resource="0" file="Source/Components/PresetBar.h"/>
<FILE id="GHGyel" name="PresetBar.cpp" compile="1" resource="0" file="Source/Components/PresetBar.cpp"/>
<FILE id="qhLBZY" name="SetPresetNameWindow.cpp" compile="1" resource="0"
file="Source/Components/SetPresetNameWindow.cpp"/>
<FILE id="ysasLl" name="SetPresetNameWindow.h" compile="0" resource="0"
@ -26,6 +28,8 @@
<FILE id="nnY63W" name="appicon.png" compile="0" resource="1" file="Source/Images/appicon.png"/>
<FILE id="kwaOoZ" name="main.png" compile="0" resource="1" file="Source/Images/main.png"/>
<FILE id="l84SVW" name="menu.png" compile="0" resource="1" file="Source/Images/menu.png"/>
<FILE id="NKGY6X" name="presetnavigation.svg" compile="0" resource="1"
file="Source/Images/presetnavigation.svg"/>
</GROUP>
<GROUP id="{6995BDF2-263F-3CA7-8CA4-4E21F325477A}" name="Gui">
<FILE id="zJoidp" name="ButtonList.h" compile="0" resource="0" file="Source/Gui/ButtonList.h"/>
@ -76,7 +80,7 @@
stripLocalSymbols="0" linkTimeOptimisation="0"/>
<CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="OB-Xd"
stripLocalSymbols="1" linkTimeOptimisation="1" osxCompatibility="10.9 SDK"
enablePluginBinaryCopyStep="0" usePrecompiledHeaderFile="1"/>
enablePluginBinaryCopyStep="1"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_opengl" path="Modules"/>
@ -124,7 +128,8 @@
<CONFIGURATION isDebug="1" name="Debug" targetName="OB-Xd" headerPath="../../Modules/asiosdk2.3.2/common"
useRuntimeLibDLL="0" enablePluginBinaryCopyStep="1"/>
<CONFIGURATION isDebug="0" name="Release64" useRuntimeLibDLL="0" winArchitecture="x64"
targetName="OB-Xd" headerPath="../../Modules/asiosdk2.3.2/common"/>
targetName="OB-Xd" headerPath="../../Modules/asiosdk2.3.2/common"
enablePluginBinaryCopyStep="1"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_opengl" path="Modules"/>

View file

@ -0,0 +1,253 @@
/*
==============================================================================
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 "PresetBar.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
PresetBar::PresetBar (ObxdAudioProcessorEditor &gui)
: editor(gui)
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
presetNameLb.reset (new juce::Label ("new label",
TRANS("---\n")));
addAndMakeVisible (presetNameLb.get());
presetNameLb->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
presetNameLb->setJustificationType (juce::Justification::centred);
presetNameLb->setEditable (false, false, false);
presetNameLb->setColour (juce::TextEditor::textColourId, juce::Colours::black);
presetNameLb->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000));
presetNameLb->setBounds (24, 8, 368, 24);
previousBtn.reset (new juce::ImageButton ("new button"));
addAndMakeVisible (previousBtn.get());
previousBtn->setButtonText (juce::String());
previousBtn->addListener (this);
previousBtn->setImages (false, true, true,
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000));
previousBtn->setBounds (407, 8, 20, 24);
nextBtn.reset (new juce::ImageButton ("new button"));
addAndMakeVisible (nextBtn.get());
nextBtn->setButtonText (juce::String());
nextBtn->addListener (this);
nextBtn->setImages (false, true, true,
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000),
juce::Image(), 1.000f, juce::Colour (0x00000000));
nextBtn->setBounds (435, 8, 20, 24);
drawable1 = juce::Drawable::createFromImageData (presetnavigation_svg, presetnavigation_svgSize);
//[UserPreSize]
//[/UserPreSize]
setSize (471, 40);
//[Constructor] You can add your own custom stuff here..
startTimer(500);
//[/Constructor]
}
PresetBar::~PresetBar()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
presetNameLb = nullptr;
previousBtn = nullptr;
nextBtn = nullptr;
drawable1 = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void PresetBar::paint (juce::Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.fillAll (juce::Colours::black);
{
int x = 0, y = 0, width = 471, height = 40;
//[UserPaintCustomArguments] Customize the painting arguments here..
//[/UserPaintCustomArguments]
g.setColour (juce::Colours::black);
jassert (drawable1 != nullptr);
if (drawable1 != nullptr)
drawable1->drawWithin (g, juce::Rectangle<int> (x, y, width, height).toFloat(),
juce::RectanglePlacement::centred, 1.000f);
}
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void PresetBar::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void PresetBar::buttonClicked (juce::Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == previousBtn.get())
{
//[UserButtonCode_previousBtn] -- add your button handler code here..
editor.prevProgram();
//[/UserButtonCode_previousBtn]
}
else if (buttonThatWasClicked == nextBtn.get())
{
//[UserButtonCode_nextBtn] -- add your button handler code here..
editor.nextProgram();
//[/UserButtonCode_nextBtn]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void PresetBar::timerCallback() {
update();
}
void PresetBar::update(){
presetNameLb->setText(editor.getCurrentProgramName(), NotificationType::dontSendNotification);
}
//[/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
<JUCER_COMPONENT documentType="Component" className="PresetBar" componentName=""
parentClasses="public juce::Component, public Timer" constructorParams="ObxdAudioProcessorEditor &amp;gui"
variableInitialisers="editor(gui)" snapPixels="8" snapActive="1"
snapShown="1" overlayOpacity="0.330" fixedSize="1" initialWidth="471"
initialHeight="40">
<BACKGROUND backgroundColour="ff000000">
<IMAGE pos="0 0 471 40" resource="presetnavigation_svg" opacity="1.0"
mode="1"/>
</BACKGROUND>
<LABEL name="new label" id="3debca48aa2294c8" memberName="presetNameLb"
virtualName="" explicitFocusOrder="0" pos="24 8 368 24" edTextCol="ff000000"
edBkgCol="0" labelText="---&#10;" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="36"/>
<IMAGEBUTTON name="new button" id="ecc6403235eead2" memberName="previousBtn"
virtualName="" explicitFocusOrder="0" pos="407 8 20 24" buttonText=""
connectedEdges="0" needsCallback="1" radioGroupId="0" keepProportions="1"
resourceNormal="" opacityNormal="1.0" colourNormal="0" resourceOver=""
opacityOver="1.0" colourOver="0" resourceDown="" opacityDown="1.0"
colourDown="0"/>
<IMAGEBUTTON name="new button" id="fab648fbebd2d318" memberName="nextBtn"
virtualName="" explicitFocusOrder="0" pos="435 8 20 24" buttonText=""
connectedEdges="0" needsCallback="1" radioGroupId="0" keepProportions="1"
resourceNormal="" opacityNormal="1.0" colourNormal="0" resourceOver=""
opacityOver="1.0" colourOver="0" resourceDown="" opacityDown="1.0"
colourDown="0"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//==============================================================================
// Binary resources - be careful not to edit any of these sections!
// JUCER_RESOURCE: presetnavigation_svg, 2220, "../Images/presetnavigation.svg"
static const unsigned char resource_PresetBar_presetnavigation_svg[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101,110,99,111,100,105,110,103,61,34,85,84,70,45,56,34,32,
115,116,97,110,100,97,108,111,110,101,61,34,110,111,34,63,62,10,60,33,68,79,67,84,89,80,69,32,115,118,103,32,80,85,66,76,73,67,32,34,45,47,47,87,51,67,47,47,68,84,68,32,83,86,71,32,49,46,49,47,47,69,78,
34,32,34,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,71,114,97,112,104,105,99,115,47,83,86,71,47,49,46,49,47,68,84,68,47,115,118,103,49,49,46,100,116,100,34,62,10,60,115,118,103,32,
119,105,100,116,104,61,34,49,48,48,37,34,32,104,101,105,103,104,116,61,34,49,48,48,37,34,32,118,105,101,119,66,111,120,61,34,48,32,48,32,52,55,49,32,51,57,34,32,118,101,114,115,105,111,110,61,34,49,46,
49,34,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,50,48,48,48,47,115,118,103,34,32,120,109,108,110,115,58,120,108,105,110,107,61,34,104,116,116,112,58,
47,47,119,119,119,46,119,51,46,111,114,103,47,49,57,57,57,47,120,108,105,110,107,34,32,120,109,108,58,115,112,97,99,101,61,34,112,114,101,115,101,114,118,101,34,32,120,109,108,110,115,58,115,101,114,105,
102,61,34,104,116,116,112,58,47,47,119,119,119,46,115,101,114,105,102,46,99,111,109,47,34,32,115,116,121,108,101,61,34,102,105,108,108,45,114,117,108,101,58,101,118,101,110,111,100,100,59,99,108,105,112,
45,114,117,108,101,58,101,118,101,110,111,100,100,59,115,116,114,111,107,101,45,108,105,110,101,106,111,105,110,58,114,111,117,110,100,59,115,116,114,111,107,101,45,109,105,116,101,114,108,105,109,105,
116,58,50,59,34,62,10,32,32,32,32,60,114,101,99,116,32,120,61,34,48,34,32,121,61,34,48,34,32,119,105,100,116,104,61,34,52,55,49,34,32,104,101,105,103,104,116,61,34,51,57,34,47,62,10,32,32,32,32,60,103,
32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,105,120,40,49,44,48,44,48,44,49,46,48,50,57,52,49,44,48,44,45,48,46,48,53,56,56,50,51,53,41,34,62,10,32,32,32,32,32,32,32,32,60,112,97,116,104,
32,100,61,34,77,52,54,53,44,49,48,46,53,67,52,54,53,44,53,46,56,48,57,32,52,54,49,46,48,55,57,44,50,32,52,53,54,46,50,53,44,50,76,49,50,46,55,53,44,50,67,55,46,57,50,49,44,50,32,52,44,53,46,56,48,57,32,
52,44,49,48,46,53,76,52,44,50,55,46,53,67,52,44,51,50,46,49,57,49,32,55,46,57,50,49,44,51,54,32,49,50,46,55,53,44,51,54,76,52,53,54,46,50,53,44,51,54,67,52,54,49,46,48,55,57,44,51,54,32,52,54,53,44,51,
50,46,49,57,49,32,52,54,53,44,50,55,46,53,76,52,54,53,44,49,48,46,53,90,34,32,115,116,121,108,101,61,34,102,105,108,108,58,114,103,98,40,49,50,49,44,49,50,49,44,49,50,49,41,59,34,47,62,10,32,32,32,32,
60,47,103,62,10,32,32,32,32,60,112,97,116,104,32,100,61,34,77,51,57,56,44,57,46,50,48,53,67,51,57,56,44,55,46,52,51,54,32,51,57,54,46,53,54,52,44,54,32,51,57,52,46,55,57,53,44,54,76,50,52,46,50,48,53,
44,54,67,50,50,46,52,51,54,44,54,32,50,49,44,55,46,52,51,54,32,50,49,44,57,46,50,48,53,76,50,49,44,50,57,46,55,57,53,67,50,49,44,51,49,46,53,54,52,32,50,50,46,52,51,54,44,51,51,32,50,52,46,50,48,53,44,
51,51,76,51,57,52,46,55,57,53,44,51,51,67,51,57,54,46,53,54,52,44,51,51,32,51,57,56,44,51,49,46,53,54,52,32,51,57,56,44,50,57,46,55,57,53,76,51,57,56,44,57,46,50,48,53,90,34,47,62,10,32,32,32,32,60,103,
32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,105,120,40,49,44,48,44,48,44,49,44,49,44,49,53,46,52,49,57,49,41,34,62,10,32,32,32,32,32,32,32,32,60,103,32,116,114,97,110,115,102,111,114,109,
61,34,109,97,116,114,105,120,40,51,54,44,48,44,48,44,51,54,44,52,48,54,46,54,50,49,44,49,55,46,50,54,52,53,41,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,112,97,116,104,32,100,61,34,77,48,46,52,50,
53,44,45,48,46,49,53,54,67,48,46,52,51,53,44,45,48,46,49,52,55,32,48,46,52,51,57,44,45,48,46,49,51,53,32,48,46,52,51,57,44,45,48,46,49,50,50,67,48,46,52,51,57,44,45,48,46,49,48,57,32,48,46,52,51,53,44,
45,48,46,48,57,55,32,48,46,52,50,53,44,45,48,46,48,56,56,67,48,46,52,49,53,44,45,48,46,48,55,56,32,48,46,52,48,52,44,45,48,46,48,55,51,32,48,46,51,57,49,44,45,48,46,48,55,51,67,48,46,51,55,55,44,45,48,
46,48,55,51,32,48,46,51,54,54,44,45,48,46,48,55,56,32,48,46,51,53,54,44,45,48,46,48,56,55,76,48,46,49,49,50,44,45,48,46,51,51,50,67,48,46,49,48,50,44,45,48,46,51,52,49,32,48,46,48,57,56,44,45,48,46,51,
53,51,32,48,46,48,57,56,44,45,48,46,51,54,54,67,48,46,48,57,56,44,45,48,46,51,56,32,48,46,49,48,51,44,45,48,46,51,57,49,32,48,46,49,49,50,44,45,48,46,52,48,49,76,48,46,51,53,54,44,45,48,46,54,52,53,67,
48,46,51,54,54,44,45,48,46,54,53,52,32,48,46,51,55,55,44,45,48,46,54,53,57,32,48,46,51,57,49,44,45,48,46,54,53,57,67,48,46,52,48,52,44,45,48,46,54,53,57,32,48,46,52,49,53,44,45,48,46,54,53,52,32,48,46,
52,50,53,44,45,48,46,54,52,53,67,48,46,52,51,53,44,45,48,46,54,51,53,32,48,46,52,51,57,44,45,48,46,54,50,52,32,48,46,52,51,57,44,45,48,46,54,49,67,48,46,52,51,57,44,45,48,46,53,57,55,32,48,46,52,51,53,
44,45,48,46,53,56,53,32,48,46,52,50,53,44,45,48,46,53,55,54,76,48,46,50,49,53,44,45,48,46,51,54,54,76,48,46,52,50,53,44,45,48,46,49,53,54,90,34,32,115,116,121,108,101,61,34,102,105,108,108,45,114,117,
108,101,58,110,111,110,122,101,114,111,59,34,47,62,10,32,32,32,32,32,32,32,32,60,47,103,62,10,32,32,32,32,60,47,103,62,10,32,32,32,32,60,103,32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,
105,120,40,49,44,48,44,48,44,49,44,50,56,44,49,53,46,52,49,57,49,41,34,62,10,32,32,32,32,32,32,32,32,60,103,32,116,114,97,110,115,102,111,114,109,61,34,109,97,116,114,105,120,40,51,54,44,48,44,48,44,51,
54,44,52,48,54,46,54,50,49,44,49,55,46,50,54,52,53,41,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,112,97,116,104,32,100,61,34,77,48,46,51,50,50,44,45,48,46,51,54,54,76,48,46,49,49,50,44,45,48,46,53,
55,54,67,48,46,49,48,51,44,45,48,46,53,56,53,32,48,46,48,57,56,44,45,48,46,53,57,55,32,48,46,48,57,56,44,45,48,46,54,49,67,48,46,48,57,56,44,45,48,46,54,50,52,32,48,46,49,48,50,44,45,48,46,54,51,53,32,
48,46,49,49,50,44,45,48,46,54,52,53,67,48,46,49,50,50,44,45,48,46,54,53,52,32,48,46,49,51,51,44,45,48,46,54,53,57,32,48,46,49,52,54,44,45,48,46,54,53,57,67,48,46,49,54,44,45,48,46,54,53,57,32,48,46,49,
55,49,44,45,48,46,54,53,52,32,48,46,49,56,49,44,45,48,46,54,52,53,76,48,46,52,50,53,44,45,48,46,52,48,49,67,48,46,52,51,53,44,45,48,46,51,57,49,32,48,46,52,51,57,44,45,48,46,51,56,32,48,46,52,51,57,44,
45,48,46,51,54,54,67,48,46,52,51,57,44,45,48,46,51,53,51,32,48,46,52,51,53,44,45,48,46,51,52,49,32,48,46,52,50,53,44,45,48,46,51,51,50,76,48,46,49,56,49,44,45,48,46,48,56,55,67,48,46,49,55,49,44,45,48,
46,48,55,56,32,48,46,49,54,44,45,48,46,48,55,51,32,48,46,49,52,54,44,45,48,46,48,55,51,67,48,46,49,51,51,44,45,48,46,48,55,51,32,48,46,49,50,50,44,45,48,46,48,55,56,32,48,46,49,49,50,44,45,48,46,48,56,
56,67,48,46,49,48,50,44,45,48,46,48,57,55,32,48,46,48,57,56,44,45,48,46,49,48,57,32,48,46,48,57,56,44,45,48,46,49,50,50,67,48,46,48,57,56,44,45,48,46,49,51,53,32,48,46,49,48,51,44,45,48,46,49,52,55,32,
48,46,49,49,50,44,45,48,46,49,53,54,76,48,46,51,50,50,44,45,48,46,51,54,54,90,34,32,115,116,121,108,101,61,34,102,105,108,108,45,114,117,108,101,58,110,111,110,122,101,114,111,59,34,47,62,10,32,32,32,
32,32,32,32,32,60,47,103,62,10,32,32,32,32,60,47,103,62,10,60,47,115,118,103,62,10,0,0};
const char* PresetBar::presetnavigation_svg = (const char*) resource_PresetBar_presetnavigation_svg;
const int PresetBar::presetnavigation_svgSize = 2220;
//[EndFile] You can add extra defines here...
//[/EndFile]

View file

@ -0,0 +1,79 @@
/*
==============================================================================
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.
==============================================================================
*/
#pragma once
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
class ObxdAudioProcessorEditor;
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Projucer.
Describe your class and how it works here!
//[/Comments]
*/
class PresetBar : public juce::Component,
public Timer,
public juce::Button::Listener
{
public:
//==============================================================================
PresetBar (ObxdAudioProcessorEditor &gui);
~PresetBar() override;
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
void timerCallback() override;
void update();
//[/UserMethods]
void paint (juce::Graphics& g) override;
void resized() override;
void buttonClicked (juce::Button* buttonThatWasClicked) override;
// Binary resources:
static const char* presetnavigation_svg;
static const int presetnavigation_svgSize;
private:
//[UserVariables] -- You can add your own custom variables in this section.
ObxdAudioProcessorEditor &editor;
//[/UserVariables]
//==============================================================================
std::unique_ptr<juce::Label> presetNameLb;
std::unique_ptr<juce::ImageButton> previousBtn;
std::unique_ptr<juce::ImageButton> nextBtn;
std::unique_ptr<juce::Drawable> drawable1;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PresetBar)
};
//[EndFile] You can add extra defines here...
//[/EndFile]

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 471 39" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<rect x="0" y="0" width="471" height="39"/>
<g transform="matrix(1,0,0,1.02941,0,-0.0588235)">
<path d="M465,10.5C465,5.809 461.079,2 456.25,2L12.75,2C7.921,2 4,5.809 4,10.5L4,27.5C4,32.191 7.921,36 12.75,36L456.25,36C461.079,36 465,32.191 465,27.5L465,10.5Z" style="fill:rgb(121,121,121);"/>
</g>
<path d="M398,9.205C398,7.436 396.564,6 394.795,6L24.205,6C22.436,6 21,7.436 21,9.205L21,29.795C21,31.564 22.436,33 24.205,33L394.795,33C396.564,33 398,31.564 398,29.795L398,9.205Z"/>
<g transform="matrix(1,0,0,1,1,15.4191)">
<g transform="matrix(36,0,0,36,406.621,17.2645)">
<path d="M0.425,-0.156C0.435,-0.147 0.439,-0.135 0.439,-0.122C0.439,-0.109 0.435,-0.097 0.425,-0.088C0.415,-0.078 0.404,-0.073 0.391,-0.073C0.377,-0.073 0.366,-0.078 0.356,-0.087L0.112,-0.332C0.102,-0.341 0.098,-0.353 0.098,-0.366C0.098,-0.38 0.103,-0.391 0.112,-0.401L0.356,-0.645C0.366,-0.654 0.377,-0.659 0.391,-0.659C0.404,-0.659 0.415,-0.654 0.425,-0.645C0.435,-0.635 0.439,-0.624 0.439,-0.61C0.439,-0.597 0.435,-0.585 0.425,-0.576L0.215,-0.366L0.425,-0.156Z" style="fill-rule:nonzero;"/>
</g>
</g>
<g transform="matrix(1,0,0,1,28,15.4191)">
<g transform="matrix(36,0,0,36,406.621,17.2645)">
<path d="M0.322,-0.366L0.112,-0.576C0.103,-0.585 0.098,-0.597 0.098,-0.61C0.098,-0.624 0.102,-0.635 0.112,-0.645C0.122,-0.654 0.133,-0.659 0.146,-0.659C0.16,-0.659 0.171,-0.654 0.181,-0.645L0.425,-0.401C0.435,-0.391 0.439,-0.38 0.439,-0.366C0.439,-0.353 0.435,-0.341 0.425,-0.332L0.181,-0.087C0.171,-0.078 0.16,-0.073 0.146,-0.073C0.133,-0.073 0.122,-0.078 0.112,-0.088C0.102,-0.097 0.098,-0.109 0.098,-0.122C0.098,-0.135 0.103,-0.147 0.112,-0.156L0.322,-0.366Z" style="fill-rule:nonzero;"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -50,7 +50,11 @@ ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFil
#else
startTimer(100); // This will fix the issue
#endif
DBG("W: " <<getWidth() << " H:" << getHeight());
loadSkin (processor);
repaint();
updateFromHost();
@ -264,7 +268,15 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
}
createMenu();
ownerFilter.addChangeListener (this);
presetBar.reset(new PresetBar(*this));
addAndMakeVisible(*presetBar);
presetBar->setVisible(showPresetBar);
presetBar->setBounds(
(getWidth() - presetBar->getWidth())/2, getHeight(), presetBar->getWidth(), presetBar->getHeight());
updatePresetBar();
repaint();
}
ObxdAudioProcessorEditor::~ObxdAudioProcessorEditor()
@ -505,7 +517,7 @@ void ObxdAudioProcessorEditor::createMenu ()
menu->addSubMenu ("Themes", skinMenu);
// About // menu.addItem(1, String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2), false);
}
menu->addItem(progStart + 1000, "Preset Bar", true, false, Image());
popupMenus.add (menu);
}
@ -546,6 +558,25 @@ void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos)
else if (result < progStart){
MenuActionCallback(result);
}
else if (result == progStart + 1000){
this->showPresetBar = !this->showPresetBar;
updatePresetBar();
}
}
void ObxdAudioProcessorEditor::updatePresetBar(){
DBG(" H: " << getHeight() <<" W:" <<getWidth() << " CW:"<<presetBar->getWidth() << " CH" <<presetBar->getHeight() << " CX:" <<presetBar->getX() << " CY: " <<presetBar->getY());
if (this->showPresetBar){
this->setSize(this->getWidth(), this->getHeight() + 40);
presetBar->setVisible(true);
}
else if (presetBar->isVisible()) {
this->setSize(this->getWidth(), this->getHeight() - 40);
presetBar->setVisible(false);
}
presetBar->update();
}
void ObxdAudioProcessorEditor::MenuActionCallback(int action){

View file

@ -18,7 +18,7 @@
#include "Gui/TooglableButton.h"
#include "Gui/ButtonList.h"
#include "Components/SetPresetNameWindow.h"
#include "Components/PresetBar.h"
enum KeyPressCommandIDs
{
buttonNextProgram = 1,
@ -66,7 +66,10 @@ public:
void paint (Graphics& g) override;
void updateFromHost();
String getCurrentProgramName(){
return processor.getProgramName(processor.getCurrentProgram());
}
void updatePresetBar();
//==============================================================================
void changeListenerCallback (ChangeBroadcaster* source) override;
void buttonClicked (Button *) override;
@ -154,6 +157,7 @@ private:
void resultFromMenu (const Point<int>);
void clean();
void rebuildComponents (ObxdAudioProcessor&);
void loadSkin(ObxdAudioProcessor&);
//==============================================================================
@ -248,9 +252,12 @@ private:
int progStart;
int bankStart;
int skinStart;
bool showPresetBar = false;
Array<File> skins;
Array<File> banks;
std::unique_ptr<SetPresetNameWindow> setPresetNameWindow;
std::unique_ptr<PresetBar> presetBar;
std::unique_ptr<FileChooser> fileChooser;
// Command manager
ApplicationCommandManager commandManager;