Fixes and enhancements
Added program popup menu on Preset Bar Added MENU Help version and open PDF manual Streamlined MENU display
This commit is contained in:
parent
4103dfbd87
commit
79bee00420
3 changed files with 78 additions and 16 deletions
|
@ -34,7 +34,7 @@ PresetBar::PresetBar (ObxdAudioProcessorEditor &gui)
|
||||||
//[Constructor_pre] You can add your own custom stuff here..
|
//[Constructor_pre] You can add your own custom stuff here..
|
||||||
//[/Constructor_pre]
|
//[/Constructor_pre]
|
||||||
|
|
||||||
presetNameLb.reset (new juce::Label ("new label",
|
presetNameLb.reset (new CustomLabel ("new label",
|
||||||
TRANS("---\n")));
|
TRANS("---\n")));
|
||||||
addAndMakeVisible (presetNameLb.get());
|
addAndMakeVisible (presetNameLb.get());
|
||||||
presetNameLb->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
|
presetNameLb->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
|
||||||
|
@ -70,13 +70,16 @@ PresetBar::PresetBar (ObxdAudioProcessorEditor &gui)
|
||||||
drawable1 = juce::Drawable::createFromImageData (presetnavigation_svg, presetnavigation_svgSize);
|
drawable1 = juce::Drawable::createFromImageData (presetnavigation_svg, presetnavigation_svgSize);
|
||||||
|
|
||||||
//[UserPreSize]
|
//[UserPreSize]
|
||||||
|
presetNameLb->leftClicked = [this](juce::Point<int> pos){
|
||||||
|
this->leftClicked(pos);
|
||||||
|
};
|
||||||
//[/UserPreSize]
|
//[/UserPreSize]
|
||||||
|
|
||||||
setSize (471, 40);
|
setSize (471, 40);
|
||||||
|
|
||||||
|
|
||||||
//[Constructor] You can add your own custom stuff here..
|
//[Constructor] You can add your own custom stuff here..
|
||||||
startTimer(500);
|
startTimer(50);
|
||||||
//[/Constructor]
|
//[/Constructor]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,12 +139,14 @@ void PresetBar::buttonClicked (juce::Button* buttonThatWasClicked)
|
||||||
{
|
{
|
||||||
//[UserButtonCode_previousBtn] -- add your button handler code here..
|
//[UserButtonCode_previousBtn] -- add your button handler code here..
|
||||||
editor.prevProgram();
|
editor.prevProgram();
|
||||||
|
//update();
|
||||||
//[/UserButtonCode_previousBtn]
|
//[/UserButtonCode_previousBtn]
|
||||||
}
|
}
|
||||||
else if (buttonThatWasClicked == nextBtn.get())
|
else if (buttonThatWasClicked == nextBtn.get())
|
||||||
{
|
{
|
||||||
//[UserButtonCode_nextBtn] -- add your button handler code here..
|
//[UserButtonCode_nextBtn] -- add your button handler code here..
|
||||||
editor.nextProgram();
|
editor.nextProgram();
|
||||||
|
//update();
|
||||||
//[/UserButtonCode_nextBtn]
|
//[/UserButtonCode_nextBtn]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,19 @@
|
||||||
//[Headers] -- You can add your own extra header files here --
|
//[Headers] -- You can add your own extra header files here --
|
||||||
#include <JuceHeader.h>
|
#include <JuceHeader.h>
|
||||||
class ObxdAudioProcessorEditor;
|
class ObxdAudioProcessorEditor;
|
||||||
|
class CustomLabel: public juce::Label {
|
||||||
|
public:
|
||||||
|
CustomLabel (const String& componentName = String(),
|
||||||
|
const String& labelText = String()): juce::Label(componentName, labelText) {
|
||||||
|
|
||||||
|
}
|
||||||
|
std::function<void(juce::Point<int> pos)> leftClicked;
|
||||||
|
void mouseDown (const MouseEvent& event) override {
|
||||||
|
if (this->getBounds().contains(event.getMouseDownPosition()) && event.mods.isLeftButtonDown()){
|
||||||
|
leftClicked(event.getMouseDownPosition());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
//[/Headers]
|
//[/Headers]
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,6 +60,9 @@ public:
|
||||||
//[UserMethods] -- You can add your own custom methods in this section.
|
//[UserMethods] -- You can add your own custom methods in this section.
|
||||||
void timerCallback() override;
|
void timerCallback() override;
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|
||||||
|
std::function<void(juce::Point<int> &pos)> leftClicked;
|
||||||
//[/UserMethods]
|
//[/UserMethods]
|
||||||
|
|
||||||
void paint (juce::Graphics& g) override;
|
void paint (juce::Graphics& g) override;
|
||||||
|
@ -64,7 +80,7 @@ private:
|
||||||
//[/UserVariables]
|
//[/UserVariables]
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
std::unique_ptr<juce::Label> presetNameLb;
|
std::unique_ptr<CustomLabel> presetNameLb;
|
||||||
std::unique_ptr<juce::ImageButton> previousBtn;
|
std::unique_ptr<juce::ImageButton> previousBtn;
|
||||||
std::unique_ptr<juce::ImageButton> nextBtn;
|
std::unique_ptr<juce::ImageButton> nextBtn;
|
||||||
std::unique_ptr<juce::Drawable> drawable1;
|
std::unique_ptr<juce::Drawable> drawable1;
|
||||||
|
|
|
@ -13,6 +13,19 @@ It contains the basic startup code for a Juce application.
|
||||||
#include "Gui/ImageButton.h"
|
#include "Gui/ImageButton.h"
|
||||||
// #include "GUI/BinaryData.h"
|
// #include "GUI/BinaryData.h"
|
||||||
|
|
||||||
|
void openInPdf(const File &file)
|
||||||
|
{
|
||||||
|
#if WINDOWS
|
||||||
|
ShellExecuteW(NULL, L"open",
|
||||||
|
file.getFullPathName().toWideCharPointer(),
|
||||||
|
file.getFullPathName().toWideCharPointer(),
|
||||||
|
NULL, SW_SHOWNORMAL);
|
||||||
|
#endif
|
||||||
|
#if __APPLE__ || LINUX
|
||||||
|
file.startAsProcess();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFilter)
|
ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFilter)
|
||||||
: AudioProcessorEditor (&ownerFilter), ScalableComponent(&ownerFilter), processor (ownerFilter),
|
: AudioProcessorEditor (&ownerFilter), ScalableComponent(&ownerFilter), processor (ownerFilter),
|
||||||
|
@ -70,7 +83,7 @@ ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFil
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//scaleFactorChanged();
|
scaleFactorChanged();
|
||||||
//repaint();
|
//repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,8 +144,6 @@ void ObxdAudioProcessorEditor::resized() {
|
||||||
else if (dynamic_cast<ImageButton*>(mappingComps[name])){
|
else if (dynamic_cast<ImageButton*>(mappingComps[name])){
|
||||||
mappingComps[name]->setBounds(transformBounds(x, y, w, h));
|
mappingComps[name]->setBounds(transformBounds(x, y, w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,7 +524,24 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
|
||||||
presetBar.reset(new PresetBar(*this));
|
presetBar.reset(new PresetBar(*this));
|
||||||
addAndMakeVisible(*presetBar);
|
addAndMakeVisible(*presetBar);
|
||||||
presetBar->setVisible(processor.getShowPresetBar());
|
presetBar->setVisible(processor.getShowPresetBar());
|
||||||
updatePresetBar(false);
|
presetBar->leftClicked = [this](juce::Point<int> &pos){
|
||||||
|
PopupMenu menu;
|
||||||
|
for (int i = 0; i < processor.getNumPrograms(); ++i)
|
||||||
|
{
|
||||||
|
menu.addItem (i + progStart + 1,
|
||||||
|
processor.getProgramName (i),
|
||||||
|
true,
|
||||||
|
i == processor.getCurrentProgram());
|
||||||
|
}
|
||||||
|
int result = menu.showAt (Rectangle<int> (pos.getX(), pos.getY(), 1, 1));
|
||||||
|
|
||||||
|
if (result >= (progStart + 1) && result <= (progStart + processor.getNumPrograms())){
|
||||||
|
result -= 1;
|
||||||
|
result -= progStart;
|
||||||
|
processor.setCurrentProgram (result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
resized();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare data
|
// Prepare data
|
||||||
|
@ -746,7 +774,7 @@ void ObxdAudioProcessorEditor::createMenu ()
|
||||||
PopupMenu bankMenu;
|
PopupMenu bankMenu;
|
||||||
PopupMenu skinMenu;
|
PopupMenu skinMenu;
|
||||||
PopupMenu fileMenu;
|
PopupMenu fileMenu;
|
||||||
PopupMenu viewMenu;
|
//PopupMenu viewMenu;
|
||||||
PopupMenu midiMenu;
|
PopupMenu midiMenu;
|
||||||
skins = processor.getSkinFiles();
|
skins = processor.getSkinFiles();
|
||||||
banks = processor.getBankFiles();
|
banks = processor.getBankFiles();
|
||||||
|
@ -816,6 +844,8 @@ void ObxdAudioProcessorEditor::createMenu ()
|
||||||
|
|
||||||
menu->addSubMenu("Programs", progMenu);
|
menu->addSubMenu("Programs", progMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu->addItem(progStart + 1000, "Preset Bar", true, processor.showPresetBar);
|
||||||
|
|
||||||
{
|
{
|
||||||
const String currentBank = processor.getCurrentBankFile().getFileName();
|
const String currentBank = processor.getCurrentBankFile().getFileName();
|
||||||
|
@ -831,6 +861,7 @@ void ObxdAudioProcessorEditor::createMenu ()
|
||||||
|
|
||||||
menu->addSubMenu ("Banks", bankMenu);
|
menu->addSubMenu ("Banks", bankMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < skins.size(); ++i)
|
for (int i = 0; i < skins.size(); ++i)
|
||||||
|
@ -845,8 +876,8 @@ void ObxdAudioProcessorEditor::createMenu ()
|
||||||
menu->addSubMenu ("Themes", skinMenu);
|
menu->addSubMenu ("Themes", skinMenu);
|
||||||
// About // menu.addItem(1, String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2), false);
|
// About // menu.addItem(1, String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2), false);
|
||||||
}
|
}
|
||||||
viewMenu.addItem(progStart + 1000, "Preset Bar", true, processor.showPresetBar);
|
|
||||||
menu->addSubMenu ("View", viewMenu);
|
//menu->addSubMenu ("View", viewMenu);
|
||||||
menuMidiNum = progStart +2000;
|
menuMidiNum = progStart +2000;
|
||||||
createMidi(menuMidiNum, midiMenu);
|
createMidi(menuMidiNum, midiMenu);
|
||||||
menu->addSubMenu ("MIDI", midiMenu);
|
menu->addSubMenu ("MIDI", midiMenu);
|
||||||
|
@ -858,6 +889,13 @@ void ObxdAudioProcessorEditor::createMenu ()
|
||||||
scaleMenu.addItem(menuScaleNum+1, "1.5x", true, getScaleFactor() == 1.5f);
|
scaleMenu.addItem(menuScaleNum+1, "1.5x", true, getScaleFactor() == 1.5f);
|
||||||
scaleMenu.addItem(menuScaleNum+2, "2x", true, getScaleFactor() == 2.0f);
|
scaleMenu.addItem(menuScaleNum+2, "2x", true, getScaleFactor() == 2.0f);
|
||||||
menu->addSubMenu("GUI Size", scaleMenu, true);
|
menu->addSubMenu("GUI Size", scaleMenu, true);
|
||||||
|
|
||||||
|
|
||||||
|
PopupMenu helpMenu;
|
||||||
|
String version = String("Release ") + String(JucePlugin_VersionString).dropLastCharacters(2);
|
||||||
|
helpMenu.addItem(menuScaleNum+3, version, false);
|
||||||
|
helpMenu.addItem(menuScaleNum+4, "Manual", true);
|
||||||
|
menu->addSubMenu("Help", helpMenu, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObxdAudioProcessorEditor::createMidi(int menuNo, PopupMenu &menuMidi) {
|
void ObxdAudioProcessorEditor::createMidi(int menuNo, PopupMenu &menuMidi) {
|
||||||
|
@ -946,7 +984,7 @@ void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos)
|
||||||
else if (result == progStart + 1000){
|
else if (result == progStart + 1000){
|
||||||
processor.setShowPresetBar(!processor.getShowPresetBar());
|
processor.setShowPresetBar(!processor.getShowPresetBar());
|
||||||
//createMenu();
|
//createMenu();
|
||||||
updatePresetBar();
|
updatePresetBar(true);
|
||||||
}
|
}
|
||||||
else if (result >= menuScaleNum){
|
else if (result >= menuScaleNum){
|
||||||
|
|
||||||
|
@ -962,6 +1000,10 @@ void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos)
|
||||||
ScalableComponent::setScaleFactor(2.0f, isHighResolutionDisplay());
|
ScalableComponent::setScaleFactor(2.0f, isHighResolutionDisplay());
|
||||||
processor.setGuiSize(4);
|
processor.setGuiSize(4);
|
||||||
}
|
}
|
||||||
|
else if (result == menuScaleNum+4) {
|
||||||
|
File manualFile = processor.getDocumentFolder().getChildFile("OB-Xd Manual.pdf");
|
||||||
|
openInPdf(manualFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (result >= menuMidiNum){
|
else if (result >= menuMidiNum){
|
||||||
unsigned int selected_idx = result - menuMidiNum;
|
unsigned int selected_idx = result - menuMidiNum;
|
||||||
|
@ -983,19 +1025,18 @@ void ObxdAudioProcessorEditor::updatePresetBar(bool resize){
|
||||||
|
|
||||||
if (processor.getShowPresetBar()) {
|
if (processor.getShowPresetBar()) {
|
||||||
if (resize) {
|
if (resize) {
|
||||||
this->setSize(this->getWidth(), this->getHeight() + 40);
|
this->setSize(this->getWidth(), this->getHeight() + presetBar->getHeight());
|
||||||
}
|
}
|
||||||
presetBar->setVisible(true);
|
presetBar->setVisible(true);
|
||||||
|
presetBar->update();
|
||||||
|
presetBar->setBounds((getWidth() - presetBar->getWidth()) / 2, getHeight() -presetBar->getHeight(), presetBar->getWidth(), presetBar->getHeight());
|
||||||
}
|
}
|
||||||
else if (presetBar->isVisible()) {
|
else if (presetBar->isVisible()) {
|
||||||
if (resize) {
|
if (resize) {
|
||||||
this->setSize(this->getWidth(), this->getHeight() - 40);
|
this->setSize(this->getWidth(), this->getHeight() - presetBar->getHeight());
|
||||||
}
|
}
|
||||||
presetBar->setVisible(false);
|
presetBar->setVisible(false);
|
||||||
}
|
}
|
||||||
presetBar->update();
|
|
||||||
|
|
||||||
presetBar->setBounds((getWidth() - presetBar->getWidth()) / 2, getHeight() -40, presetBar->getWidth(), presetBar->getHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObxdAudioProcessorEditor::MenuActionCallback(int action){
|
void ObxdAudioProcessorEditor::MenuActionCallback(int action){
|
||||||
|
|
Loading…
Reference in a new issue