commit
a4fcb10e10
3 changed files with 107 additions and 4 deletions
Binary file not shown.
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
|
@ -23,6 +23,23 @@ ObxdAudioProcessorEditor::ObxdAudioProcessorEditor (ObxdAudioProcessor& ownerFil
|
||||||
banks (processor.getBankFiles())
|
banks (processor.getBankFiles())
|
||||||
{
|
{
|
||||||
// skinFolder = ownerFilter.getCurrentSkinFolder(); // initialized above
|
// skinFolder = ownerFilter.getCurrentSkinFolder(); // initialized above
|
||||||
|
commandManager.registerAllCommandsForTarget(this);
|
||||||
|
commandManager.setFirstCommandTarget(this);
|
||||||
|
|
||||||
|
// reset KeyPressMappingSet
|
||||||
|
commandManager.getKeyMappings()->resetToDefaultMappings();
|
||||||
|
|
||||||
|
// having set up the default key-mappings, you might now want to load the last set
|
||||||
|
// of mappings that the user configured.
|
||||||
|
//commandManager.getKeyMappings()->restoreFromXml(lastSavedKeyMappingsXML);
|
||||||
|
|
||||||
|
// Now tell our top-level window to send any keypresses that arrive to the
|
||||||
|
// KeyPressMappingSet, which will use them to invoke the appropriate commands.
|
||||||
|
//addKeyListener(commandManager.getKeyMappings());
|
||||||
|
getTopLevelComponent()->addKeyListener (commandManager.getKeyMappings());
|
||||||
|
|
||||||
|
//Timer::callAfterDelay (100, [this] { this->grabKeyboardFocus(); }); // ensure that key presses are sent to the KeyPressTarget object
|
||||||
|
startTimer(100);
|
||||||
loadSkin (processor);
|
loadSkin (processor);
|
||||||
repaint();
|
repaint();
|
||||||
|
|
||||||
|
@ -47,9 +64,15 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (coords.createInputStream())
|
||||||
|
|
||||||
XmlDocument skin (coords);
|
XmlDocument skin (coords);
|
||||||
auto doc = skin.getDocumentElement();
|
auto doc = skin.getDocumentElement();
|
||||||
if (doc) {
|
if (!doc) {
|
||||||
|
notLoadSkin = true;
|
||||||
|
setSize (1440, 450);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
if (doc->getTagName() == "PROPERTIES"){
|
if (doc->getTagName() == "PROPERTIES"){
|
||||||
|
|
||||||
|
@ -483,7 +506,7 @@ void ObxdAudioProcessorEditor::updateFromHost() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set to unlearn to false
|
// Set to unlearn to false
|
||||||
if ( midiUnlearnButton->getToggleState()) {
|
if ( midiUnlearnButton && midiUnlearnButton->getToggleState()) {
|
||||||
midiUnlearnButton->setToggleState(false, NotificationType:: sendNotification);
|
midiUnlearnButton->setToggleState(false, NotificationType:: sendNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +534,7 @@ void ObxdAudioProcessorEditor::paint(Graphics& g)
|
||||||
const File mainFile(skinFolder.getChildFile("main@2x.png"));
|
const File mainFile(skinFolder.getChildFile("main@2x.png"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (skinFolder.exists() && mainFile.exists())
|
if (!notLoadSkin && skinFolder.exists() && mainFile.exists())
|
||||||
{
|
{
|
||||||
|
|
||||||
const Image image = ImageCache::getFromFile(mainFile);
|
const Image image = ImageCache::getFromFile(mainFile);
|
||||||
|
|
|
@ -18,7 +18,14 @@
|
||||||
#include "Gui/TooglableButton.h"
|
#include "Gui/TooglableButton.h"
|
||||||
#include "Gui/ButtonList.h"
|
#include "Gui/ButtonList.h"
|
||||||
|
|
||||||
|
enum KeyPressCommandIDs
|
||||||
|
{
|
||||||
|
buttonNextProgram = 1,
|
||||||
|
buttonPrevProgram,
|
||||||
|
buttonPadNextProgram,
|
||||||
|
buttonPadPrevProgram,
|
||||||
|
|
||||||
|
};
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -28,6 +35,9 @@ class ObxdAudioProcessorEditor : public AudioProcessorEditor
|
||||||
// , public Slider::Listener
|
// , public Slider::Listener
|
||||||
, public Button::Listener
|
, public Button::Listener
|
||||||
// , public ComboBox::Listener
|
// , public ComboBox::Listener
|
||||||
|
, public ApplicationCommandTarget
|
||||||
|
, public Timer
|
||||||
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
|
ObxdAudioProcessorEditor(ObxdAudioProcessor& ownerFilter);
|
||||||
|
@ -42,7 +52,73 @@ public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void changeListenerCallback (ChangeBroadcaster* source) override;
|
void changeListenerCallback (ChangeBroadcaster* source) override;
|
||||||
void buttonClicked (Button *) override;
|
void buttonClicked (Button *) override;
|
||||||
|
//bool keyPressed(const KeyPress & press) override;
|
||||||
|
void timerCallback() override {
|
||||||
|
this->grabKeyboardFocus();
|
||||||
|
}
|
||||||
|
ApplicationCommandTarget* getNextCommandTarget() override {
|
||||||
|
return nullptr;
|
||||||
|
};
|
||||||
|
void getAllCommands (Array<CommandID>& commands) override {
|
||||||
|
Array<CommandID> ids { KeyPressCommandIDs::buttonNextProgram, KeyPressCommandIDs::buttonPrevProgram,
|
||||||
|
KeyPressCommandIDs::buttonPadNextProgram, KeyPressCommandIDs::buttonPadPrevProgram
|
||||||
|
};
|
||||||
|
|
||||||
|
commands.addArray (ids);
|
||||||
|
};
|
||||||
|
void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) override {
|
||||||
|
switch (commandID)
|
||||||
|
{
|
||||||
|
case KeyPressCommandIDs::buttonNextProgram:
|
||||||
|
result.setInfo ("Move up", "Move the button + ", "Button", 0);
|
||||||
|
result.addDefaultKeypress ('+', 0);
|
||||||
|
result.setActive (true);
|
||||||
|
break;
|
||||||
|
case KeyPressCommandIDs::buttonPrevProgram:
|
||||||
|
result.setInfo ("Move right", "Move the button - ", "Button", 0);
|
||||||
|
result.addDefaultKeypress ('-', 0);
|
||||||
|
result.setActive (true);
|
||||||
|
break;
|
||||||
|
case KeyPressCommandIDs::buttonPadNextProgram:
|
||||||
|
result.setInfo ("Move down", "Move the button Pad + ", "Button", 0);
|
||||||
|
result.addDefaultKeypress (KeyPress::numberPadAdd, 0);
|
||||||
|
result.setActive (true);
|
||||||
|
break;
|
||||||
|
case KeyPressCommandIDs::buttonPadPrevProgram:
|
||||||
|
result.setInfo ("Move left", "Move the button Pad -", "Button", 0);
|
||||||
|
result.addDefaultKeypress (KeyPress::numberPadSubtract, 0);
|
||||||
|
result.setActive (true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
bool perform (const InvocationInfo& info) override {
|
||||||
|
|
||||||
|
switch (info.commandID)
|
||||||
|
{
|
||||||
|
case KeyPressCommandIDs::buttonNextProgram:
|
||||||
|
case KeyPressCommandIDs::buttonPadNextProgram:
|
||||||
|
nextProgram();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KeyPressCommandIDs::buttonPrevProgram:
|
||||||
|
case KeyPressCommandIDs::buttonPadPrevProgram:
|
||||||
|
prevProgram();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};/*
|
||||||
|
bool keyPressed (const KeyPress& key,
|
||||||
|
Component* originatingComponent) override {
|
||||||
|
DBG("--- " << key.getKeyCode());
|
||||||
|
|
||||||
|
};*/
|
||||||
|
|
||||||
|
void nextProgram();
|
||||||
|
void prevProgram();
|
||||||
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);
|
||||||
|
@ -143,11 +219,15 @@ private:
|
||||||
|
|
||||||
OwnedArray<PopupMenu> popupMenus;
|
OwnedArray<PopupMenu> popupMenus;
|
||||||
|
|
||||||
|
bool notLoadSkin = false;
|
||||||
int progStart;
|
int progStart;
|
||||||
int bankStart;
|
int bankStart;
|
||||||
int skinStart;
|
int skinStart;
|
||||||
Array<File> skins;
|
Array<File> skins;
|
||||||
Array<File> banks;
|
Array<File> banks;
|
||||||
|
|
||||||
|
// Command manager
|
||||||
|
ApplicationCommandManager commandManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLUGINEDITOR_H_INCLUDED
|
#endif // PLUGINEDITOR_H_INCLUDED
|
||||||
|
|
Loading…
Reference in a new issue