From 325d43bfaaf8eed552bedeb2f4d4418fb617d58a Mon Sep 17 00:00:00 2001 From: asb2m10 Date: Sun, 11 Aug 2024 17:35:08 -0400 Subject: [PATCH] WIP Accessibility --- Source/CartManager.cpp | 20 +++++++++++++++----- Source/CartManager.h | 1 + Source/OperatorEditor.cpp | 4 ++++ Source/PluginEditor.cpp | 4 ++++ Source/PluginEditor.h | 3 ++- Source/PluginParam.h | 3 +++ Source/ProgramListBox.cpp | 1 + Source/ProgramListBox.h | 15 +++++++++++++++ libs/JUCE | 2 +- libs/MTS-ESP | 2 +- libs/clap-juce-extensions | 2 +- libs/tuning-library | 2 +- libs/vst3sdk | 2 +- 13 files changed, 50 insertions(+), 11 deletions(-) diff --git a/Source/CartManager.cpp b/Source/CartManager.cpp index 1c32a5a6..6c09a692 100644 --- a/Source/CartManager.cpp +++ b/Source/CartManager.cpp @@ -121,11 +121,11 @@ CartManager::CartManager(DexedAudioProcessorEditor *editor) : Component("CartMan mainWindow = editor; cartDir = DexedAudioProcessor::dexedCartDir; - activeCart.reset(new ProgramListBox("activepgm", 8)); + activeCart.reset(new ProgramListBox("Active Programs Selector", 8)); addAndMakeVisible(activeCart.get()); activeCart->addListener(this); - browserCart.reset(new ProgramListBox("browserpgm", 2)); + browserCart.reset(new ProgramListBox("Browser Programs Selector", 2)); addAndMakeVisible(browserCart.get()); browserCart->addListener(this); @@ -140,6 +140,7 @@ CartManager::CartManager(DexedAudioProcessorEditor *editor) : Component("CartMan cartBrowser->addKeyListener(this); addAndMakeVisible(cartBrowser.get()); + cartBrowser->setTitle("Cartridge file browser"); cartBrowser->setDragAndDropDescription("Sysex Browser"); cartBrowser->addListener(this); @@ -234,8 +235,7 @@ void CartManager::programSelected(ProgramListBox *source, int pos) { void CartManager::buttonClicked(juce::Button *buttonThatWasClicked) { if ( buttonThatWasClicked == closeButton.get() ) { - mainWindow->startTimer(100); - getParentComponent()->setVisible(false); + hideCartridgeManager(); return; } @@ -411,8 +411,13 @@ void CartManager::initialFocus() { cartBrowser->grabKeyboardFocus(); } +void CartManager::hideCartridgeManager() { + mainWindow->startTimer(100); + getParentComponent()->setVisible(false); +} + bool CartManager::keyPressed(const KeyPress& key, Component* originatingComponent) { - if ( key.getKeyCode() == 13 ) { + if ( key.getKeyCode() == KeyPress::returnKey ) { File file = cartBrowser->getSelectedFile(); if ( file.isDirectory() ) return true; @@ -420,6 +425,11 @@ bool CartManager::keyPressed(const KeyPress& key, Component* originatingComponen activeCart->setCartridge(mainWindow->processor->currentCart); return true; } + if ( key.getKeyCode() == KeyPress::escapeKey ) { + hideCartridgeManager(); + return true; + } + return false; } diff --git a/Source/CartManager.h b/Source/CartManager.h index a5019379..38c28699 100644 --- a/Source/CartManager.h +++ b/Source/CartManager.h @@ -109,6 +109,7 @@ class CartManager : public Component, public Button::Listener, public DragAndDr virtual bool keyPressed(const KeyPress& key, Component* originatingComponent) override; void initialFocus(); + void hideCartridgeManager(); std::unique_ptr createFocusTraverser() override; }; diff --git a/Source/OperatorEditor.cpp b/Source/OperatorEditor.cpp index d2270849..6345978d 100644 --- a/Source/OperatorEditor.cpp +++ b/Source/OperatorEditor.cpp @@ -314,6 +314,10 @@ OperatorEditor::OperatorEditor () background = lookAndFeel->imageOperator; + opSwitch->setTitle("Operator switch"); + kbdLeftCurve->setTitle("Keyboard Left Curve"); + kbdRightCurve->setTitle("Keyboard Right Curve"); + //[/Constructor] } diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 582f83f5..99d4b0e7 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -115,6 +115,10 @@ void DexedAudioProcessorEditor::cartShow() { cartManager.initialFocus(); } +std::unique_ptr DexedAudioProcessorEditor::createFocusTraverser() { + return std::make_unique(); +} + void DexedAudioProcessorEditor::loadCart(File file) { Cartridge cart; diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index b380f9ad..e9ec245e 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -65,7 +65,8 @@ class DexedAudioProcessorEditor : public AudioProcessorEditor, public ComboBox: virtual bool isInterestedInFileDrag (const StringArray &files) override; virtual void filesDropped (const StringArray &files, int x, int y ) override; - + std::unique_ptr createFocusTraverser() override; + static const int WINDOW_SIZE_X = 866; static const int WINDOW_SIZE_Y = 674; }; diff --git a/Source/PluginParam.h b/Source/PluginParam.h index bc07742e..c814c3ad 100644 --- a/Source/PluginParam.h +++ b/Source/PluginParam.h @@ -23,6 +23,9 @@ #include "../JuceLibraryCode/JuceHeader.h" +#include +#include + class DexedAudioProcessor; class Ctrl : public Slider::Listener, public Button::Listener, public ComboBox::Listener, public MouseListener { diff --git a/Source/ProgramListBox.cpp b/Source/ProgramListBox.cpp index 635f6b1b..083aa4c2 100644 --- a/Source/ProgramListBox.cpp +++ b/Source/ProgramListBox.cpp @@ -31,6 +31,7 @@ ProgramListBox::ProgramListBox(const String name, int numCols) : Component(name) dragCandidate = -1; readOnly = false; programNames.clear(); + setTitle(name); setWantsKeyboardFocus(true); addKeyListener(this); } diff --git a/Source/ProgramListBox.h b/Source/ProgramListBox.h index 4aa831ed..d8ef95f1 100644 --- a/Source/ProgramListBox.h +++ b/Source/ProgramListBox.h @@ -69,6 +69,21 @@ class ProgramListBox : public Component, public DragAndDropTarget, public KeyLis void itemDropped(const SourceDetails& dragSourceDetails) override; bool keyPressed (const KeyPress& key, Component* originatingComponent) override; + + struct ProgramListBoxAH : public juce::AccessibilityHandler { + explicit ProgramListBoxAH(ProgramListBox *s): od(s), juce::AccessibilityHandler(*s, juce::AccessibilityRole::table, + juce::AccessibilityActions().addAction(juce::AccessibilityActionType::focus, + [this]() { })) { + } + + ProgramListBox *od; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ProgramListBoxAH); + }; + + + std::unique_ptr< AccessibilityHandler > createAccessibilityHandler(ProgramListBox *programListBox) { + return std::make_unique(programListBox); + } }; diff --git a/libs/JUCE b/libs/JUCE index d054f0d1..22df0d22 160000 --- a/libs/JUCE +++ b/libs/JUCE @@ -1 +1 @@ -Subproject commit d054f0d14dcac387aebda44ce5d792b5e7a625b3 +Subproject commit 22df0d2266007bccb25d6ed52b9907f60d04e971 diff --git a/libs/MTS-ESP b/libs/MTS-ESP index 514ed958..803c3aab 160000 --- a/libs/MTS-ESP +++ b/libs/MTS-ESP @@ -1 +1 @@ -Subproject commit 514ed958b38e5ab501999f902a2427ebe6232a78 +Subproject commit 803c3aab3d43dfaea430a1084ab31b606f5cd72c diff --git a/libs/clap-juce-extensions b/libs/clap-juce-extensions index 4491bc30..2c23b918 160000 --- a/libs/clap-juce-extensions +++ b/libs/clap-juce-extensions @@ -1 +1 @@ -Subproject commit 4491bc30223cecf8ff495de943510863b71a7a81 +Subproject commit 2c23b918828ba5fbc5fcb4c95d3a046fbf7e9285 diff --git a/libs/tuning-library b/libs/tuning-library index 601c0eab..3bbe9514 160000 --- a/libs/tuning-library +++ b/libs/tuning-library @@ -1 +1 @@ -Subproject commit 601c0eabff31fff8a543b49d3e48073f338f413c +Subproject commit 3bbe9514816e1ae674c207b09e9f20eea4df372a diff --git a/libs/vst3sdk b/libs/vst3sdk index e9895dc9..56e4b2a6 160000 --- a/libs/vst3sdk +++ b/libs/vst3sdk @@ -1 +1 @@ -Subproject commit e9895dc9ef20bedd93a0fde5ad664bc8b56d4338 +Subproject commit 56e4b2a644be164c5d324e8bc9de55b964b0f102