Skip to content

Commit

Permalink
WIP CartManager acessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
asb2m10 committed Aug 23, 2024
1 parent 9c14258 commit 2cef88f
Show file tree
Hide file tree
Showing 10 changed files with 299 additions and 135 deletions.
2 changes: 1 addition & 1 deletion Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ juce_add_plugin("${BaseTargetName}"
NEEDS_MIDI_INPUT TRUE
NEEDS_MIDI_OUTPUT TRUE
IS_MIDI_EFFECT FALSE
EDITOR_WANTS_KEYBOARD_FOCUS FALSE
EDITOR_WANTS_KEYBOARD_FOCUS TRUE
PLUGIN_MANUFACTURER_CODE DGSB
PLUGIN_CODE Dexd
FORMATS ${DEXED_JUCE_FORMATS}
Expand Down
12 changes: 6 additions & 6 deletions Source/CartManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,14 @@ void CartManager::updateCartFilename() {

void CartManager::programSelected(ProgramListBox *source, int pos) {
if ( source == activeCart.get() ) {
browserCart->setSelected(-1);
browserCart->setActive(-1);
mainWindow->processor->setCurrentProgram(pos);
mainWindow->processor->updateHostDisplay();
} else {
uint8_t unpackPgm[161];
source->getCurrentCart().unpackProgram(unpackPgm, pos);
activeCart->setSelected(-1);
browserCart->setSelected(pos);
activeCart->setActive(-1);
browserCart->setActive(pos);
repaint();
mainWindow->processor->updateProgramFromSysex((uint8_t *) unpackPgm);
mainWindow->processor->updateHostDisplay();
Expand Down Expand Up @@ -316,8 +316,8 @@ void CartManager::fileClicked(const File& file, const MouseEvent& e) {

void CartManager::setActiveProgram(int idx, String activeName) {
if ( activeCart->programNames[idx] == activeName ) {
activeCart->setSelected(idx);
browserCart->setSelected(-1);
activeCart->setActive(idx);
browserCart->setActive(-1);
}
activeCart->repaint();
}
Expand Down Expand Up @@ -347,7 +347,7 @@ void CartManager::selectionChanged() {
} else {
browserCart->readOnly = false;
}
browserCart->setSelected(-1);
browserCart->setActive(-1);
browserCart->setCartridge(browserSysex);
}

Expand Down
2 changes: 2 additions & 0 deletions Source/GlobalEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,15 @@ GlobalEditor::GlobalEditor ()
lfoType->addItem("SINE", 5);
lfoType->addItem("S&HOLD", 6);
lfoType->setImage(lookAndFeel->imageLFO);
lfoType->setTitle("LFO Waveform");

programs = programSelector.get();

background = lookAndFeel->imageGlobal;
imageLight = lookAndFeel->imageLight;
setTitle("Global Parameters");
setFocusContainerType(FocusContainerType::focusContainer);
setWantsKeyboardFocus(true);
aboutButton->setTitle("About DEXED");
//[/Constructor]
}
Expand Down
8 changes: 6 additions & 2 deletions Source/OperatorEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ OperatorEditor::OperatorEditor ()

light = lookAndFeel->imageLight;
Image tmp = lookAndFeel->imageScaling;

kbdLeftCurve->addItem("-LN", 1);
kbdLeftCurve->addItem("-EX", 2);
kbdLeftCurve->addItem("+EX", 3);
Expand All @@ -313,12 +313,12 @@ OperatorEditor::OperatorEditor ()
kbdRightCurve->setImage(tmp, posRight);

background = lookAndFeel->imageOperator;

opSwitch->setTitle("Operator switch");
opMode->setTitle("Operator Mode");
kbdLeftCurve->setTitle("Keyboard Left Curve");
kbdRightCurve->setTitle("Keyboard Right Curve");

setWantsKeyboardFocus(true);
//[/Constructor]
}

Expand Down Expand Up @@ -629,6 +629,10 @@ void OperatorEditor::mouseDown(const MouseEvent &event) {
}
}

void OperatorEditor::toggleOpSwitch() {
opSwitch->setToggleState(!opSwitch->getToggleState(), dontSendNotification);
}

//[/MiscUserCode]


Expand Down
1 change: 1 addition & 0 deletions Source/OperatorEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class OperatorEditor : public Component,
void updateDisplay();
void updateEnvPos(char pos);
void mouseDown(const MouseEvent& e) override;
void toggleOpSwitch();
//[/UserMethods]

void paint (juce::Graphics& g) override;
Expand Down
34 changes: 33 additions & 1 deletion Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DexedAudioProcessorEditor::DexedAudioProcessorEditor (DexedAudioProcessor* owner
cartManager(this)
{
setSize(WINDOW_SIZE_X, (ownerFilter->showKeyboard ? WINDOW_SIZE_Y : WINDOW_SIZE_Y - 94));

setExplicitFocusOrder(1);
processor = ownerFilter;

lookAndFeel->setDefaultLookAndFeel(lookAndFeel);
Expand Down Expand Up @@ -89,6 +89,7 @@ DexedAudioProcessorEditor::DexedAudioProcessorEditor (DexedAudioProcessor* owner
cartManagerCover.addChildComponent(&cartManager);
cartManager.setVisible(true);

addKeyListener(this);
updateUI();
startTimer(100);
}
Expand Down Expand Up @@ -516,3 +517,34 @@ void DexedAudioProcessorEditor::filesDropped (const StringArray &files, int x, i
"Related to file \'"+fn.toStdString()+"\', an unknown exception occured.");
};
}

bool DexedAudioProcessorEditor::keyPressed(const KeyPress& key, Component* originatingComponent) {
int keycode = key.getKeyCode();
ModifierKeys mods = key.getModifiers();

TRACE("key pressed: %d\n", keycode);

if ( (keycode >= '1' && keycode <= '6') && mods.isCtrlDown() ) {
int op = keycode - '1';

if ( mods.isShiftDown() ) {
operators[op].toggleOpSwitch();
return true;
}

operators[op].grabKeyboardFocus();
return true;
}

if ( keycode == 'G' && mods.isCtrlDown() ) {
global.grabKeyboardFocus();
return true;
}

if ( keycode == 'L' && mods.isCtrlDown() ) {
cartShow();
return true;
}

return false;
}
4 changes: 3 additions & 1 deletion Source/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/**
*/
class DexedAudioProcessorEditor : public AudioProcessorEditor, public ComboBox::Listener, public Timer,
public FileDragAndDropTarget {
public FileDragAndDropTarget, public KeyListener {
MidiKeyboardComponent midiKeyboard;
OperatorEditor operators[6];
Colour background;
Expand Down Expand Up @@ -67,6 +67,8 @@ class DexedAudioProcessorEditor : public AudioProcessorEditor, public ComboBox:
virtual void filesDropped (const StringArray &files, int x, int y ) override;
std::unique_ptr<ComponentTraverser> createFocusTraverser() override;

bool keyPressed(const KeyPress& key, Component* originatingComponent) override;

static const int WINDOW_SIZE_X = 866;
static const int WINDOW_SIZE_Y = 674;
};
Expand Down
1 change: 1 addition & 0 deletions Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ AudioProcessorEditor* DexedAudioProcessor::createEditor() {
setDpiScaleFactor(1.0);
else
setDpiScaleFactor(scaleFactor);

return editor;
}

Expand Down
Loading

0 comments on commit 2cef88f

Please sign in to comment.