Added GUI menu item
This commit is contained in:
parent
5155f0a921
commit
6ab3353117
8 changed files with 243 additions and 90 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<PROPERTIES>
|
<PROPERTIES>
|
||||||
<VALUE NAME="guisize" x="1440" y="450"/>
|
<VALUE NAME="guisize" x="1440" y="450"/>
|
||||||
|
<VALUE NAME="menu" x="14" y="25" d="20"/>
|
||||||
|
|
||||||
<!------- MANUAL ----->
|
<!------- MANUAL ----->
|
||||||
|
|
||||||
|
|
BIN
Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/menu.png
Normal file
BIN
Documents/discoDSP/OB-Xd/Skins/discoDSP Blue/menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<PROPERTIES>
|
<PROPERTIES>
|
||||||
<VALUE NAME="guisize" x="1087" y="442"/>
|
<VALUE NAME="guisize" x="1087" y="442"/>
|
||||||
|
<VALUE NAME="menu" x="28" y="30" d="20"/>
|
||||||
|
|
||||||
<!------- MASTER ----->
|
<!------- MASTER ----->
|
||||||
|
|
||||||
|
|
BIN
Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/menu.png
Normal file
BIN
Documents/discoDSP/OB-Xd/Skins/discoDSP Classic/menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<PROPERTIES>
|
<PROPERTIES>
|
||||||
<VALUE NAME="guisize" x="1440" y="450"/>
|
<VALUE NAME="guisize" x="1440" y="450"/>
|
||||||
|
<VALUE NAME="menu" x="14" y="25" d="20"/>
|
||||||
|
|
||||||
<!------- MANUAL ----->
|
<!------- MANUAL ----->
|
||||||
|
|
||||||
|
|
BIN
Documents/discoDSP/OB-Xd/Skins/discoDSP Grey/menu.png
Normal file
BIN
Documents/discoDSP/OB-Xd/Skins/discoDSP Grey/menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -26,6 +26,7 @@ ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFil
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){
|
void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){
|
||||||
|
imageButtons.clear();
|
||||||
ownerFilter.removeChangeListener (this);
|
ownerFilter.removeChangeListener (this);
|
||||||
//File coords("/Users/jimmy/Downloads/coords.xml");
|
//File coords("/Users/jimmy/Downloads/coords.xml");
|
||||||
skinFolder = ownerFilter.getCurrentSkinFolder();
|
skinFolder = ownerFilter.getCurrentSkinFolder();
|
||||||
|
@ -151,6 +152,11 @@ void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){
|
||||||
//if (legatoSwitch) legatoSwitch->setVisible(false);
|
//if (legatoSwitch) legatoSwitch->setVisible(false);
|
||||||
legatoSwitch = addList (x, y, w, h, ownerFilter, LEGATOMODE, "Legato", ImageCache::getFromFile(skinFolder.getChildFile("legato.png"))); }
|
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: " <<x <<" Y: "<<y);
|
//DBG(" Name: " << name << " X: " <<x <<" Y: "<<y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +169,7 @@ void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){
|
||||||
for (int i = 1; i <= 32; ++i)
|
for (int i = 1; i <= 32; ++i)
|
||||||
{
|
{
|
||||||
voiceSwitch->addChoice (String (i));
|
voiceSwitch->addChoice (String (i));
|
||||||
voiceSwitch ->setValue(ownerFilter.getParameter(VOICE_COUNT),dontSendNotification);
|
// voiceSwitch ->setValue(ownerFilter.getParameter(VOICE_COUNT),dontSendNotification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (legatoSwitch) {
|
if (legatoSwitch) {
|
||||||
|
@ -171,8 +177,18 @@ void ObxdAudioProcessorEditor::loadSkin(ObxdAudioProcessor& ownerFilter){
|
||||||
legatoSwitch->addChoice ("Keep Filter Envelope");
|
legatoSwitch->addChoice ("Keep Filter Envelope");
|
||||||
legatoSwitch->addChoice ("Keep Amplitude Envelope");
|
legatoSwitch->addChoice ("Keep Amplitude Envelope");
|
||||||
legatoSwitch->addChoice ("Retrig");
|
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);
|
ownerFilter.addChangeListener (this);
|
||||||
repaint();
|
repaint();
|
||||||
|
@ -292,6 +308,28 @@ TooglableButton* ObxdAudioProcessorEditor::addButton (int x, int y, int w, int h
|
||||||
return button;
|
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)
|
void ObxdAudioProcessorEditor::rebuildComponents (ObxdAudioProcessor& ownerFilter)
|
||||||
{
|
{
|
||||||
skinFolder = ownerFilter.getCurrentSkinFolder();
|
skinFolder = ownerFilter.getCurrentSkinFolder();
|
||||||
|
@ -420,9 +458,116 @@ void ObxdAudioProcessorEditor::rebuildComponents (ObxdAudioProcessor& ownerFilte
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void ObxdAudioProcessorEditor::buttonClicked(Button * b)
|
void ObxdAudioProcessorEditor::createMenu (const Point<int> pos)
|
||||||
//{
|
{
|
||||||
//}
|
PopupMenu menu;
|
||||||
|
PopupMenu progMenu;
|
||||||
|
PopupMenu bankMenu;
|
||||||
|
PopupMenu skinMenu;
|
||||||
|
|
||||||
|
|
||||||
|
Array<File> skins;
|
||||||
|
const Array<File>& 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<int> pos = e.getMouseDownScreenPosition();
|
||||||
|
|
||||||
|
int result = menu.showAt (Rectangle<int> (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<ImageButton*> (b);
|
||||||
|
|
||||||
|
if (imageButton == imageButtons[0])
|
||||||
|
{
|
||||||
|
auto x = imageButton->getScreenX();
|
||||||
|
auto y = imageButton->getScreenY();
|
||||||
|
auto dx = imageButton->getWidth();
|
||||||
|
auto pos = Point<int> (x, y + dx);
|
||||||
|
|
||||||
|
createMenu (pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//void ObxdAudioProcessorEditor::comboBoxChanged (ComboBox* cb)
|
//void ObxdAudioProcessorEditor::comboBoxChanged (ComboBox* cb)
|
||||||
//{
|
//{
|
||||||
|
@ -457,87 +602,88 @@ void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
|
void ObxdAudioProcessorEditor::mouseUp (const MouseEvent& e)
|
||||||
{
|
{
|
||||||
if (e.mods.isRightButtonDown() || e.mods.isCommandDown())
|
if (e.mods.isRightButtonDown() || e.mods.isCommandDown())
|
||||||
{
|
{
|
||||||
PopupMenu menu;
|
createMenu (e.getMouseDownScreenPosition());
|
||||||
PopupMenu skinMenu;
|
// PopupMenu menu;
|
||||||
PopupMenu bankMenu;
|
// PopupMenu skinMenu;
|
||||||
PopupMenu progMenu;
|
// PopupMenu bankMenu;
|
||||||
|
// PopupMenu progMenu;
|
||||||
Array<File> skins;
|
//
|
||||||
const Array<File>& banks = processor.getBankFiles();
|
// Array<File> skins;
|
||||||
|
// const Array<File>& banks = processor.getBankFiles();
|
||||||
int skinStart = 0;
|
//
|
||||||
{
|
// int skinStart = 0;
|
||||||
DirectoryIterator it(processor.getSkinFolder(), false, "*", File::findDirectories);
|
// {
|
||||||
while (it.next())
|
// DirectoryIterator it(processor.getSkinFolder(), false, "*", File::findDirectories);
|
||||||
{
|
// while (it.next())
|
||||||
skins.addUsingDefaultSort(it.getFile());
|
// {
|
||||||
}
|
// skins.addUsingDefaultSort(it.getFile());
|
||||||
|
// }
|
||||||
for (int i = 0; i < skins.size(); ++i)
|
//
|
||||||
{
|
// 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());
|
// const File skin = skins.getUnchecked(i);
|
||||||
}
|
// skinMenu.addItem(i + skinStart + 1, skin.getFileName(), true, skin.getFileName() == skinFolder.getFileName());
|
||||||
|
// }
|
||||||
menu.addSubMenu("Skins", skinMenu);
|
//
|
||||||
}
|
// menu.addSubMenu("Skins", skinMenu);
|
||||||
|
// }
|
||||||
int bankStart = 1000;
|
//
|
||||||
{
|
// int bankStart = 1000;
|
||||||
const String currentBank = processor.getCurrentBankFile().getFileName();
|
// {
|
||||||
|
// const String currentBank = processor.getCurrentBankFile().getFileName();
|
||||||
for (int i = 0; i < banks.size(); ++i)
|
//
|
||||||
{
|
// 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);
|
// const File bank = banks.getUnchecked(i);
|
||||||
}
|
// bankMenu.addItem(i + bankStart + 1, bank.getFileNameWithoutExtension(), true, bank.getFileName() == currentBank);
|
||||||
|
// }
|
||||||
menu.addSubMenu("Banks", bankMenu);
|
//
|
||||||
}
|
// menu.addSubMenu("Banks", bankMenu);
|
||||||
|
// }
|
||||||
int progStart = 2000;
|
//
|
||||||
{
|
// int progStart = 2000;
|
||||||
for (int i = 0; i < processor.getNumPrograms(); ++i)
|
// {
|
||||||
{
|
// for (int i = 0; i < processor.getNumPrograms(); ++i)
|
||||||
progMenu.addItem(i + progStart + 1, processor.getProgramName(i), true, i == processor.getCurrentProgram());
|
// {
|
||||||
}
|
// progMenu.addItem(i + progStart + 1, processor.getProgramName(i), true, i == processor.getCurrentProgram());
|
||||||
|
// }
|
||||||
menu.addSubMenu("Programs", progMenu);
|
//
|
||||||
}
|
// menu.addSubMenu("Programs", progMenu);
|
||||||
|
// }
|
||||||
const Point<int> pos = e.getMouseDownScreenPosition();
|
//
|
||||||
|
// const Point<int> pos = e.getMouseDownScreenPosition();
|
||||||
int result = menu.showAt(Rectangle<int>(pos.getX(), pos.getY(), 1, 1));
|
//
|
||||||
if (result >= (skinStart + 1) && result <= (skinStart + skins.size()))
|
// int result = menu.showAt(Rectangle<int>(pos.getX(), pos.getY(), 1, 1));
|
||||||
{
|
// if (result >= (skinStart + 1) && result <= (skinStart + skins.size()))
|
||||||
result -= 1;
|
// {
|
||||||
result -= skinStart;
|
// result -= 1;
|
||||||
|
// result -= skinStart;
|
||||||
const File newSkinFolder = skins.getUnchecked(result);
|
//
|
||||||
processor.setCurrentSkinFolder(newSkinFolder.getFileName());
|
// const File newSkinFolder = skins.getUnchecked(result);
|
||||||
|
// processor.setCurrentSkinFolder(newSkinFolder.getFileName());
|
||||||
//rebuildComponents (processor);
|
//
|
||||||
clean();
|
// //rebuildComponents (processor);
|
||||||
loadSkin(processor);
|
// clean();
|
||||||
}
|
// loadSkin(processor);
|
||||||
else if (result >= (bankStart + 1) && result <= (bankStart + banks.size()))
|
// }
|
||||||
{
|
// else if (result >= (bankStart + 1) && result <= (bankStart + banks.size()))
|
||||||
result -= 1;
|
// {
|
||||||
result -= bankStart;
|
// result -= 1;
|
||||||
|
// result -= bankStart;
|
||||||
const File bankFile = banks.getUnchecked(result);
|
//
|
||||||
processor.loadFromFXBFile (bankFile);
|
// const File bankFile = banks.getUnchecked(result);
|
||||||
}
|
// processor.loadFromFXBFile (bankFile);
|
||||||
else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms()))
|
// }
|
||||||
{
|
// else if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms()))
|
||||||
result -= 1;
|
// {
|
||||||
result -= progStart;
|
// result -= 1;
|
||||||
processor.setCurrentProgram (result);
|
// result -= progStart;
|
||||||
}
|
// processor.setCurrentProgram (result);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
class ObxdAudioProcessorEditor : public AudioProcessorEditor,
|
class ObxdAudioProcessorEditor : public AudioProcessorEditor
|
||||||
// public AudioProcessorListener,
|
// , public AudioProcessorListener
|
||||||
public ChangeListener//,
|
, public ChangeListener
|
||||||
// public Slider::Listener,
|
// , public Slider::Listener
|
||||||
// public Button::Listener,
|
, public Button::Listener
|
||||||
// public ComboBox::Listener
|
// , public ComboBox::Listener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
|
ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
|
||||||
|
@ -39,13 +39,15 @@ public:
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void changeListenerCallback (ChangeBroadcaster* source) override;
|
void changeListenerCallback (ChangeBroadcaster* source) override;
|
||||||
|
void buttonClicked (Button *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Knob* addKnob (int x, int y, int d, ObxdAudioProcessor& filter, int parameter, String name, float defval);
|
Knob* addKnob (int x, int y, int d, ObxdAudioProcessor& filter, int parameter, String name, float defval);
|
||||||
void placeLabel (int x, int y, String text);
|
void placeLabel (int x, int y, String text);
|
||||||
TooglableButton* addButton (int x, int y, int w, int h, ObxdAudioProcessor& filter, int parameter, String name);
|
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);
|
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<int>);
|
||||||
void clean();
|
void clean();
|
||||||
|
|
||||||
void rebuildComponents (ObxdAudioProcessor&);
|
void rebuildComponents (ObxdAudioProcessor&);
|
||||||
|
@ -133,6 +135,8 @@ private:
|
||||||
OwnedArray<Knob::KnobAttachment> knobAttachments;
|
OwnedArray<Knob::KnobAttachment> knobAttachments;
|
||||||
OwnedArray<TooglableButton::ToggleAttachment> toggleAttachments;
|
OwnedArray<TooglableButton::ToggleAttachment> toggleAttachments;
|
||||||
OwnedArray<ButtonList::ButtonListAttachment> buttonListAttachments;
|
OwnedArray<ButtonList::ButtonListAttachment> buttonListAttachments;
|
||||||
|
|
||||||
|
OwnedArray<ImageButton> imageButtons;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLUGINEDITOR_H_INCLUDED
|
#endif // PLUGINEDITOR_H_INCLUDED
|
||||||
|
|
Loading…
Reference in a new issue