From 6ab33531170a1e06aeb8e708d2802eceef12f57c Mon Sep 17 00:00:00 2001 From: George Reales Date: Fri, 24 Apr 2020 08:15:00 +0200 Subject: [PATCH] Added GUI menu item --- .../OB-Xd/Skins/discoDSP Blue/coords.xml | 1 + .../OB-Xd/Skins/discoDSP Blue/menu.png | Bin 0 -> 12061 bytes .../OB-Xd/Skins/discoDSP Classic/coords.xml | 1 + .../OB-Xd/Skins/discoDSP Classic/menu.png | Bin 0 -> 12061 bytes .../OB-Xd/Skins/discoDSP Grey/coords.xml | 1 + .../OB-Xd/Skins/discoDSP Grey/menu.png | Bin 0 -> 12061 bytes Source/PluginEditor.cpp | 312 +++++++++++++----- Source/PluginEditor.h | 18 +- 8 files changed, 243 insertions(+), 90 deletions(-) create mode 100644 Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/menu.png create mode 100644 Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/menu.png create mode 100644 Documents/discoDSP/OB-Xd/Skins/discoDSP Grey/menu.png diff --git a/Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/coords.xml b/Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/coords.xml index 4f5a4e2..94e3016 100644 --- a/Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/coords.xml +++ b/Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/coords.xml @@ -1,6 +1,7 @@ + diff --git a/Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/menu.png b/Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..d1fcc71054cbc2ecbfc35aa71c3a324bd125911c GIT binary patch literal 12061 zcmeHNXH-+$*4+rwn@AA>rI$#r(jlQ&fnb8DG$9~jK)KQcgLLsyL^?rG=|uzyhN7Ve zNEMLYqzhc&Niitx3;N#o^Zk2c+;K0HnO`50K@6yivnb1odJN}(gOy&bjcmz>3K5`VHHj9;9p$iU zJf*Ks#nYY>O&J%5dCXxY$@qwVgl1mgd0g0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oxzX#X^PyR9z zSV`oV)G*;j6u%5%y<_G~`eXqTb3Sf#i6?&bM&w73eL>zA$5{A#VI=2Yo7w4Y>2~(N zUYc3KkCQD~z5j1{C#e9iLHdjGxbc1`j!il!RN;Q# zG6&Y87XSYY5Pk3;{eMJ0+$RSoa&S5Z$v-bRy+tjCasR?Ura9#BJh*@JqUS+^f7bDk NvA%^~In?pt{{dI>tgHY4 literal 0 HcmV?d00001 diff --git a/Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/coords.xml b/Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/coords.xml index e6b676f..d9442e3 100644 --- a/Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/coords.xml +++ b/Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/coords.xml @@ -1,6 +1,7 @@ + diff --git a/Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/menu.png b/Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..d1fcc71054cbc2ecbfc35aa71c3a324bd125911c GIT binary patch literal 12061 zcmeHNXH-+$*4+rwn@AA>rI$#r(jlQ&fnb8DG$9~jK)KQcgLLsyL^?rG=|uzyhN7Ve zNEMLYqzhc&Niitx3;N#o^Zk2c+;K0HnO`50K@6yivnb1odJN}(gOy&bjcmz>3K5`VHHj9;9p$iU zJf*Ks#nYY>O&J%5dCXxY$@qwVgl1mgd0g0w=tmuUGeIvrhw6!o-G|k~T1%x{*s5L{ z0xe^Tk%E;HhOr2G?$npCwwBhJd1;+cdSP$CN?Ub9;O>DC1=tPI(6}H-pm_%<{0A6l z0l_?zAj=zd#IgcSze<4#ry%$yUNoh}umhdIIA}i5F`&R;(?o4R4i#|hba9>om!yEB z*n`CZfWhvj2T=g~rve-lIf;P(v}?2;a90PVy_X;91EefqcQb8K1tU^G))?Vt1S)C( zp@)^B63{XNS*z#>2|yJD9NUG2{6Tm+U^m!AXnea+&bkC4c`Ch9123$qA8Jo4r~6-cuh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DSP Grey/coords.xml index 4f5a4e2..94e3016 100644 --- a/Documents/discoDSP/OB-Xd/Skins/discoDSP Grey/coords.xml +++ b/Documents/discoDSP/OB-Xd/Skins/discoDSP Grey/coords.xml @@ -1,6 +1,7 @@ + diff --git a/Documents/discoDSP/OB-Xd/Skins/discoDSP Grey/menu.png b/Documents/discoDSP/OB-Xd/Skins/discoDSP Grey/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..d1fcc71054cbc2ecbfc35aa71c3a324bd125911c GIT binary patch literal 12061 zcmeHNXH-+$*4+rwn@AA>rI$#r(jlQ&fnb8DG$9~jK)KQcgLLsyL^?rG=|uzyhN7Ve zNEMLYqzhc&Niitx3;N#o^Zk2c+;K0HnO`50K@6yivnb1odJN}(gOy&bjcmz>3K5`VHHj9;9p$iU zJf*Ks#nYY>O&J%5dCXxY$@qwVgl1mgd0g0w=tmuUGeIvrhw6!o-G|k~T1%x{*s5L{ z0xe^Tk%E;HhOr2G?$npCwwBhJd1;+cdSP$CN?Ub9;O>DC1=tPI(6}H-pm_%<{0A6l z0l_?zAj=zd#IgcSze<4#ry%$yUNoh}umhdIIA}i5F`&R;(?o4R4i#|hba9>om!yEB z*n`CZfWhvj2T=g~rve-lIf;P(v}?2;a90PVy_X;91EefqcQb8K1tU^G))?Vt1S)C( zp@)^B63{XNS*z#>2|yJD9NUG2{6Tm+U^m!AXnea+&bkC4c`Ch9123$qA8Jo4r~6-cuh5 zIy=uDF7%do>i{t08`5_uDN}V8qfU+SI(#m&PUU``A?FWbtXn0EPBq9`9z$$-ANxi> zHvvC7x-dUKV$uS&cj`a{AEKHZ2#AAQKSDJ2i9283%?gLgUkf#)+WpehwQZKi+xvtr z+<9U#-f+K$;b@<4K(NKw8IOdp&snkg#OY-`-jdG~jDbFp_#o1MbYpf}a*tALS_xF# z)S?JVlq$UDLiycPj1}oim?Z+RS%+@?EKW;_aSxm6^*h?oJ}}G?0T?&qCq4jN*Ate8 zcT{P&(E^~C6AG!&<=JjLBT1m2F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SESnJ76+)mKs`N)WAL>6;p3Dz%EW+O5)Vc3p!=EYkRvDX*$Dq+I#- zt#{M=YgPZAS+pv3~_NjTIBYSHapXQ^vM<>80hu{AR1l4(AARwb04w3DL8LG!=D zuZRyrXev>z2)Fm$F&(NYCD|9c*Se}Y#uHSsHl7`=u{E*HJi+Bfnj)n5kc$naH&rV& zd;-Sl=QvJYh`dZ)s`2&_4&pUvS+a&mEe~lB4K()*z24aIu(6uLbCtoCejy@wbz*q! znk7=kZo1m(XC#(KizDVyIr}(QD#wEn@d^J0o+xz3`}B#YZ;DD<@Hcwh`rVcnr=+s& znNx~W7gL#UGmVbDVVb`DW^L!Y{6)V(2)*AgL{P;FrOtVLfcZpzj1oIc1g>NMxsv{MBo%}ZhT$KT z_5J2>*Mja@LwZ+r-7_~g8q#|J_>#3TyiU*l%O-d{a~Sz$0rBYHLpsoxzX#X^PyR9z zSV`oV)G*;j6u%5%y<_G~`eXqTb3Sf#i6?&bM&w73eL>zA$5{A#VI=2Yo7w4Y>2~(N zUYc3KkCQD~z5j1{C#e9iLHdjGxbc1`j!il!RN;Q# zG6&Y87XSYY5Pk3;{eMJ0+$RSoa&S5Z$v-bRy+tjCasR?Ura9#BJh*@JqUS+^f7bDk NvA%^~In?pt{{dI>tgHY4 literal 0 HcmV?d00001 diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index f984b53..ba40346 100755 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -26,6 +26,7 @@ ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFil } void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){ + imageButtons.clear(); ownerFilter.removeChangeListener (this); //File coords("/Users/jimmy/Downloads/coords.xml"); skinFolder = ownerFilter.getCurrentSkinFolder(); @@ -151,6 +152,11 @@ void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){ //if (legatoSwitch) legatoSwitch->setVisible(false); legatoSwitch = addList (x, y, w, h, ownerFilter, LEGATOMODE, "Legato", ImageCache::getFromFile(skinFolder.getChildFile("legato.png"))); } + if (name == "menu") + { + addMenu (x, y, d, + ImageCache::getFromFile (skinFolder.getChildFile ("menu.png"))); + } //DBG(" Name: " << name << " X: " <addChoice (String (i)); - voiceSwitch ->setValue(ownerFilter.getParameter(VOICE_COUNT),dontSendNotification); +// voiceSwitch ->setValue(ownerFilter.getParameter(VOICE_COUNT),dontSendNotification); } } if (legatoSwitch) { @@ -171,8 +177,18 @@ void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){ legatoSwitch->addChoice ("Keep Filter Envelope"); legatoSwitch->addChoice ("Keep Amplitude Envelope"); legatoSwitch->addChoice ("Retrig"); - legatoSwitch ->setValue(ownerFilter.getParameter(LEGATOMODE),dontSendNotification); +// legatoSwitch ->setValue(ownerFilter.getParameter(LEGATOMODE),dontSendNotification); } + buttonListAttachments.add (new ButtonList::ButtonListAttachment (ownerFilter.getPluginState(), + ownerFilter.getEngineParameterId (VOICE_COUNT), + *voiceSwitch)); + + buttonListAttachments.add (new ButtonList::ButtonListAttachment (ownerFilter.getPluginState(), + ownerFilter.getEngineParameterId (LEGATOMODE), + *legatoSwitch)); + + // Testing: Please delete the line below when coords.xml is updated with menu +// addMenu (10, 10, 40, ImageCache::getFromFile (skinFolder.getChildFile ("menu.png"))); ownerFilter.addChangeListener (this); repaint(); @@ -292,6 +308,28 @@ TooglableButton* ObxdAudioProcessorEditor::addButton (int x, int y, int w, int h return button; } +void ObxdAudioProcessorEditor::addMenu (int x, int y, int d, const Image& image) +{ + ImageButton* imageButton; + imageButtons.add (imageButton = new ImageButton()); + imageButton->setBounds (x, y, d, d); + imageButton->setImages (false, + true, + true, + image, + 1.0f, // menu transparency + Colour(), + image, + 1.0f, // menu hover transparency + Colour(), + image, + 0.3f, // menu click transparency + Colour()); + + imageButton->addListener (this); + addAndMakeVisible (imageButton); +} + void ObxdAudioProcessorEditor::rebuildComponents (ObxdAudioProcessor& ownerFilter) { skinFolder = ownerFilter.getCurrentSkinFolder(); @@ -420,9 +458,116 @@ void ObxdAudioProcessorEditor::rebuildComponents (ObxdAudioProcessor& ownerFilte repaint(); } -//void ObxdAudioProcessorEditor::buttonClicked(Button * b) -//{ -//} +void ObxdAudioProcessorEditor::createMenu (const Point pos) +{ + PopupMenu menu; + PopupMenu progMenu; + PopupMenu bankMenu; + PopupMenu skinMenu; + + + Array skins; + const Array& banks = processor.getBankFiles(); + + int progStart = 2000; + + { + for (int i = 0; i < processor.getNumPrograms(); ++i) + { + progMenu.addItem (i + progStart + 1, + processor.getProgramName (i), + true, + i == processor.getCurrentProgram()); + } + + menu.addSubMenu("Programs", progMenu); + } + + int bankStart = 1000; + + { + const String currentBank = processor.getCurrentBankFile().getFileName(); + + for (int i = 0; i < banks.size(); ++i) + { + const File bank = banks.getUnchecked (i); + bankMenu.addItem (i + bankStart + 1, + bank.getFileNameWithoutExtension(), + true, + bank.getFileName() == currentBank); + } + + menu.addSubMenu ("Banks", bankMenu); + } + + int skinStart = 0; + + { + DirectoryIterator it (processor.getSkinFolder(), false, "*", File::findDirectories); + + while (it.next()) + { + skins.addUsingDefaultSort (it.getFile()); + } + + for (int i = 0; i < skins.size(); ++i) + { + const File skin = skins.getUnchecked (i); + skinMenu.addItem (i + skinStart + 1, + skin.getFileName(), + true, + skin.getFileName() == skinFolder.getFileName()); + } + + menu.addSubMenu ("Skins", skinMenu); + } + + //const Point pos = e.getMouseDownScreenPosition(); + + int result = menu.showAt (Rectangle (pos.getX(), pos.getY(), 1, 1)); + + if (result >= (skinStart + 1) && result <= (skinStart + skins.size())) + { + result -= 1; + result -= skinStart; + + const File newSkinFolder = skins.getUnchecked (result); + processor.setCurrentSkinFolder (newSkinFolder.getFileName()); + + //rebuildComponents (processor); + clean(); + loadSkin (processor); + } + else if (result >= (bankStart + 1) && result <= (bankStart + banks.size())) + { + result -= 1; + result -= bankStart; + + const File bankFile = banks.getUnchecked(result); + processor.loadFromFXBFile (bankFile); + } + else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms())) + { + result -= 1; + result -= progStart; + processor.setCurrentProgram (result); + } +} + +void ObxdAudioProcessorEditor::buttonClicked (Button* b) +{ + auto imageButton = dynamic_cast (b); + + if (imageButton == imageButtons[0]) + { + auto x = imageButton->getScreenX(); + auto y = imageButton->getScreenY(); + auto dx = imageButton->getWidth(); + auto pos = Point (x, y + dx); + + createMenu (pos); + } +} //void ObxdAudioProcessorEditor::comboBoxChanged (ComboBox* cb) //{ @@ -457,87 +602,88 @@ void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source repaint(); } -void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e) +void ObxdAudioProcessorEditor::mouseUp (const MouseEvent& e) { if (e.mods.isRightButtonDown() || e.mods.isCommandDown()) { - PopupMenu menu; - PopupMenu skinMenu; - PopupMenu bankMenu; - PopupMenu progMenu; - - Array skins; - const Array& banks = processor.getBankFiles(); - - int skinStart = 0; - { - DirectoryIterator it(processor.getSkinFolder(), false, "*", File::findDirectories); - while (it.next()) - { - skins.addUsingDefaultSort(it.getFile()); - } - - for (int i = 0; i < skins.size(); ++i) - { - const File skin = skins.getUnchecked(i); - skinMenu.addItem(i + skinStart + 1, skin.getFileName(), true, skin.getFileName() == skinFolder.getFileName()); - } - - menu.addSubMenu("Skins", skinMenu); - } - - int bankStart = 1000; - { - const String currentBank = processor.getCurrentBankFile().getFileName(); - - for (int i = 0; i < banks.size(); ++i) - { - const File bank = banks.getUnchecked(i); - bankMenu.addItem(i + bankStart + 1, bank.getFileNameWithoutExtension(), true, bank.getFileName() == currentBank); - } - - menu.addSubMenu("Banks", bankMenu); - } - - int progStart = 2000; - { - for (int i = 0; i < processor.getNumPrograms(); ++i) - { - progMenu.addItem(i + progStart + 1, processor.getProgramName(i), true, i == processor.getCurrentProgram()); - } - - menu.addSubMenu("Programs", progMenu); - } - - const Point pos = e.getMouseDownScreenPosition(); - - int result = menu.showAt(Rectangle(pos.getX(), pos.getY(), 1, 1)); - if (result >= (skinStart + 1) && result <= (skinStart + skins.size())) - { - result -= 1; - result -= skinStart; - - const File newSkinFolder = skins.getUnchecked(result); - processor.setCurrentSkinFolder(newSkinFolder.getFileName()); - - //rebuildComponents (processor); - clean(); - loadSkin(processor); - } - else if (result >= (bankStart + 1) && result <= (bankStart + banks.size())) - { - result -= 1; - result -= bankStart; - - const File bankFile = banks.getUnchecked(result); - processor.loadFromFXBFile (bankFile); - } - else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms())) - { - result -= 1; - result -= progStart; - processor.setCurrentProgram (result); - } + createMenu (e.getMouseDownScreenPosition()); +// PopupMenu menu; +// PopupMenu skinMenu; +// PopupMenu bankMenu; +// PopupMenu progMenu; +// +// Array skins; +// const Array& banks = processor.getBankFiles(); +// +// int skinStart = 0; +// { +// DirectoryIterator it(processor.getSkinFolder(), false, "*", File::findDirectories); +// while (it.next()) +// { +// skins.addUsingDefaultSort(it.getFile()); +// } +// +// for (int i = 0; i < skins.size(); ++i) +// { +// const File skin = skins.getUnchecked(i); +// skinMenu.addItem(i + skinStart + 1, skin.getFileName(), true, skin.getFileName() == skinFolder.getFileName()); +// } +// +// menu.addSubMenu("Skins", skinMenu); +// } +// +// int bankStart = 1000; +// { +// const String currentBank = processor.getCurrentBankFile().getFileName(); +// +// for (int i = 0; i < banks.size(); ++i) +// { +// const File bank = banks.getUnchecked(i); +// bankMenu.addItem(i + bankStart + 1, bank.getFileNameWithoutExtension(), true, bank.getFileName() == currentBank); +// } +// +// menu.addSubMenu("Banks", bankMenu); +// } +// +// int progStart = 2000; +// { +// for (int i = 0; i < processor.getNumPrograms(); ++i) +// { +// progMenu.addItem(i + progStart + 1, processor.getProgramName(i), true, i == processor.getCurrentProgram()); +// } +// +// menu.addSubMenu("Programs", progMenu); +// } +// +// const Point pos = e.getMouseDownScreenPosition(); +// +// int result = menu.showAt(Rectangle(pos.getX(), pos.getY(), 1, 1)); +// if (result >= (skinStart + 1) && result <= (skinStart + skins.size())) +// { +// result -= 1; +// result -= skinStart; +// +// const File newSkinFolder = skins.getUnchecked(result); +// processor.setCurrentSkinFolder(newSkinFolder.getFileName()); +// +// //rebuildComponents (processor); +// clean(); +// loadSkin(processor); +// } +// else if (result >= (bankStart + 1) && result <= (bankStart + banks.size())) +// { +// result -= 1; +// result -= bankStart; +// +// const File bankFile = banks.getUnchecked(result); +// processor.loadFromFXBFile (bankFile); +// } +// else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms())) +// { +// result -= 1; +// result -= progStart; +// processor.setCurrentProgram (result); +// } } } diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 64845e0..335ecfb 100755 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -22,12 +22,12 @@ //============================================================================== /** */ -class ObxdAudioProcessorEditor : public AudioProcessorEditor, -// public AudioProcessorListener, - public ChangeListener//, -// public Slider::Listener, -// public Button::Listener, -// public ComboBox::Listener +class ObxdAudioProcessorEditor : public AudioProcessorEditor +// , public AudioProcessorListener + , public ChangeListener +// , public Slider::Listener + , public Button::Listener +// , public ComboBox::Listener { public: ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter); @@ -39,13 +39,15 @@ public: //============================================================================== void changeListenerCallback (ChangeBroadcaster* source) override; + void buttonClicked (Button *) override; private: Knob* addKnob (int x, int y, int d, ObxdAudioProcessor& filter, int parameter, String name, float defval); void placeLabel (int x, int y, String text); TooglableButton* addButton (int x, int y, int w, int h, ObxdAudioProcessor& filter, int parameter, String name); ButtonList* addList(int x, int y, int w, int h, ObxdAudioProcessor& filter, int parameter, String name, Image img); - //Menu* addMenu (int x, int y); + void addMenu (int x, int y, int d, const Image&); + void createMenu (const Point); void clean(); void rebuildComponents (ObxdAudioProcessor&); @@ -133,6 +135,8 @@ private: OwnedArray knobAttachments; OwnedArray toggleAttachments; OwnedArray buttonListAttachments; + + OwnedArray imageButtons; }; #endif // PLUGINEDITOR_H_INCLUDED