From cee94f7bc088ddeceac391039364cc8628b1ea11 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 5 Jan 2025 23:39:39 -0500 Subject: [PATCH] Accesibility: Tab Order is fine (#95) Tab order is now explicit and reasponable. Just some jump navigations and knob select action buottons (which also solve ivans click things) to go and we are at 10 --- libs/sst/sst-jucegui | 2 +- src/ui/dahdsr-components.h | 8 ++++++++ src/ui/lfo-components.h | 9 +++++++++ src/ui/macro-panel.cpp | 2 ++ src/ui/main-panel.cpp | 4 ++++ src/ui/matrix-panel.cpp | 8 ++++++++ src/ui/mixer-panel.cpp | 6 ++++++ src/ui/modulation-components.h | 6 ++++++ src/ui/six-sines-editor.cpp | 12 +++++++++++- src/ui/source-panel.cpp | 5 +++++ 10 files changed, 60 insertions(+), 2 deletions(-) diff --git a/libs/sst/sst-jucegui b/libs/sst/sst-jucegui index d81a214..86e1174 160000 --- a/libs/sst/sst-jucegui +++ b/libs/sst/sst-jucegui @@ -1 +1 @@ -Subproject commit d81a2140a028e0a8c06db3e6a71fac797fa7a857 +Subproject commit 86e11743e239792772ad20e4b06bb2f8ee7b4d86 diff --git a/src/ui/dahdsr-components.h b/src/ui/dahdsr-components.h index 457839f..1ba967c 100644 --- a/src/ui/dahdsr-components.h +++ b/src/ui/dahdsr-components.h @@ -36,6 +36,8 @@ template struct DAHDSRComponents const PatchPart *patchPartPtr{nullptr}; // bit of a hack since refs arent mutable void setupDAHDSR(SixSinesEditor &e, const PatchPart &v) { + using kt_t = sst::jucegui::accessibility::KeyboardTraverser; + auto mk = [&e, this](auto id, auto idx, auto lb) { auto c = asComp(); @@ -82,6 +84,12 @@ template struct DAHDSRComponents }; patchPartPtr = &v; setTriggerLabel(); + + kt_t::assignTraversalIndex(triggerButton.get(), 40); + for (int i = 0; i < nels; ++i) + kt_t::assignTraversalIndex(slider[i].get(), 10 + i); + for (int i = 0; i < 3; ++i) + kt_t::assignTraversalIndex(shapes[i].get(), 20 + i); } juce::Rectangle layoutDAHDSRAt(int x, int y) diff --git a/src/ui/lfo-components.h b/src/ui/lfo-components.h index 9619367..f94a98a 100644 --- a/src/ui/lfo-components.h +++ b/src/ui/lfo-components.h @@ -33,6 +33,8 @@ template struct LFOComponents LFOComponents() {} void setupLFO(SixSinesEditor &e, const Patch &v) { + using kt_t = sst::jucegui::accessibility::KeyboardTraverser; + auto c = asComp(); createComponent(e, *c, v.lfoRate, rate, rateD); rateL = std::make_unique(); @@ -69,6 +71,13 @@ template struct LFOComponents c->addAndMakeVisible(*isEnv); rateD->setTemposyncPowerPartner(tempoSyncD.get()); + + kt_t::assignTraversalIndex(shape.get(), 200); + kt_t::assignTraversalIndex(bipolar.get(), 201); + kt_t::assignTraversalIndex(tempoSync.get(), 204); + kt_t::assignTraversalIndex(rate.get(), 203); + kt_t::assignTraversalIndex(deform.get(), 205); + kt_t::assignTraversalIndex(isEnv.get(), 211); } juce::Rectangle layoutLFOAt(int x, int y, int extraWidth = 0) diff --git a/src/ui/macro-panel.cpp b/src/ui/macro-panel.cpp index 1015971..af744b3 100644 --- a/src/ui/macro-panel.cpp +++ b/src/ui/macro-panel.cpp @@ -29,6 +29,8 @@ MacroPanel::MacroPanel(SixSinesEditor &e) : jcmp::NamedPanel("Macros"), HasEdito knobs[i]->setDrawLabel(false); addAndMakeVisible(*knobs[i]); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(knobs[i].get(), i + 1); + labels[i] = std::make_unique(); labels[i]->setText("Macro " + std::to_string(i + 1)); addAndMakeVisible(*labels[i]); diff --git a/src/ui/main-panel.cpp b/src/ui/main-panel.cpp index d8502ba..c2f4639 100644 --- a/src/ui/main-panel.cpp +++ b/src/ui/main-panel.cpp @@ -28,17 +28,20 @@ MainPanel::MainPanel(SixSinesEditor &e) : jcmp::NamedPanel("Main"), HasEditor(e) { createComponent(editor, *this, editor.patchCopy.output.level, lev, levData, 0); addAndMakeVisible(*lev); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(lev.get(), 1); levLabel = std::make_unique(); levLabel->setText("Level"); addAndMakeVisible(*levLabel); createComponent(editor, *this, editor.patchCopy.output.pan, pan, panData, 1); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(pan.get(), 2); addAndMakeVisible(*pan); panLabel = std::make_unique(); panLabel->setText("Pan"); addAndMakeVisible(*panLabel); createComponent(editor, *this, editor.patchCopy.output.fineTune, tun, tunData, 2); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(tun.get(), 3); addAndMakeVisible(*tun); tunLabel = std::make_unique(); tunLabel->setText("Tune"); @@ -62,6 +65,7 @@ MainPanel::MainPanel(SixSinesEditor &e) : jcmp::NamedPanel("Main"), HasEditor(e) beginEdit(3); } }; + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(playScreen, 4); highlight = std::make_unique(); addChildComponent(*highlight); diff --git a/src/ui/matrix-panel.cpp b/src/ui/matrix-panel.cpp index e468625..fd75f28 100644 --- a/src/ui/matrix-panel.cpp +++ b/src/ui/matrix-panel.cpp @@ -23,6 +23,8 @@ namespace baconpaul::six_sines::ui { MatrixPanel::MatrixPanel(SixSinesEditor &e) : jcmp::NamedPanel("Matrix"), HasEditor(e) { + using kt_t = sst::jucegui::accessibility::KeyboardTraverser; + auto &mn = editor.patchCopy.selfNodes; for (auto i = 0U; i < numOps; ++i) { @@ -49,6 +51,8 @@ MatrixPanel::MatrixPanel(SixSinesEditor &e) : jcmp::NamedPanel("Matrix"), HasEdi true); w->repaint(); }; + kt_t::assignTraversalIndex(Spower[i].get(), i * 50 + 47); + kt_t::assignTraversalIndex(Sknobs[i].get(), i * 50 + 48); } auto &mx = editor.patchCopy.matrixNodes; @@ -86,6 +90,10 @@ MatrixPanel::MatrixPanel(SixSinesEditor &e) : jcmp::NamedPanel("Matrix"), HasEdi true); w->repaint(); }; + + kt_t::assignTraversalIndex(Mpower[i].get(), ti * 50 + si * 5 + 1); + kt_t::assignTraversalIndex(Mpmrm[i].get(), ti * 50 + +si * 5 + 2); + kt_t::assignTraversalIndex(Mknobs[i].get(), ti * 50 + si * 5 + 3); } highlight = std::make_unique(); diff --git a/src/ui/mixer-panel.cpp b/src/ui/mixer-panel.cpp index 73c583e..7c2c0f1 100644 --- a/src/ui/mixer-panel.cpp +++ b/src/ui/mixer-panel.cpp @@ -23,6 +23,8 @@ namespace baconpaul::six_sines::ui { MixerPanel::MixerPanel(SixSinesEditor &e) : jcmp::NamedPanel("Mixer"), HasEditor(e) { + using kt_t = sst::jucegui::accessibility::KeyboardTraverser; + auto &mn = editor.patchCopy.mixerNodes; for (auto i = 0U; i < numOps; ++i) { @@ -55,6 +57,10 @@ MixerPanel::MixerPanel(SixSinesEditor &e) : jcmp::NamedPanel("Mixer"), HasEditor panLabels[i] = std::make_unique(); panLabels[i]->setText("Pan"); addAndMakeVisible(*panLabels[i]); + + kt_t::assignTraversalIndex(power[i].get(), i * 12 + 50); + kt_t::assignTraversalIndex(knobs[i].get(), i * 12 + 51); + kt_t::assignTraversalIndex(panKnobs[i].get(), i * 12 + 52); } highlight = std::make_unique(); diff --git a/src/ui/modulation-components.h b/src/ui/modulation-components.h index 1037096..48bf6d4 100644 --- a/src/ui/modulation-components.h +++ b/src/ui/modulation-components.h @@ -34,6 +34,8 @@ template struct ModulationComponents Patch *patchPtr{nullptr}; void setupModulation(SixSinesEditor &e, Patch &v) { + using kt_t = sst::jucegui::accessibility::KeyboardTraverser; + patchPtr = &v; auto c = asComp(); modTitleLab = std::make_unique(); @@ -81,6 +83,10 @@ template struct ModulationComponents c->addAndMakeVisible(*depthSlider[i]); c->addAndMakeVisible(*sourceMenu[i]); c->addAndMakeVisible(*targetMenu[i]); + + kt_t::assignTraversalIndex(sourceMenu[i].get(), i * 5 + 900); + kt_t::assignTraversalIndex(targetMenu[i].get(), i * 5 + 901); + kt_t::assignTraversalIndex(depthSlider[i].get(), i * 5 + 902); } } diff --git a/src/ui/six-sines-editor.cpp b/src/ui/six-sines-editor.cpp index 0858892..39d83c1 100644 --- a/src/ui/six-sines-editor.cpp +++ b/src/ui/six-sines-editor.cpp @@ -52,9 +52,11 @@ static constexpr sheet_t::Class PatchMenu("six-sines.patch-menu"); SixSinesEditor::SixSinesEditor(Synth::audioToUIQueue_t &atou, Synth::uiToAudioQueue_T &utoa, std::function fo) - : audioToUI(atou), uiToAudio(utoa), flushOperator(fo) + : jcmp::WindowPanel(true), audioToUI(atou), uiToAudio(utoa), flushOperator(fo) { + setTitle("Six Sines - an Audio Rate Modulation Synthesizer"); sst::jucegui::style::StyleSheet::initializeStyleSheets([]() {}); + sheet_t::addClass(PatchMenu).withBaseClass(jcmp::JogUpDownButton::Styles::styleClass); setStyle(sst::jucegui::style::StyleSheet::getBuiltInStyleSheet( @@ -111,6 +113,13 @@ SixSinesEditor::SixSinesEditor(Synth::audioToUIQueue_t &atou, Synth::uiToAudioQu playModeSubPanel = std::make_unique(*this); singlePanel->addChildComponent(*playModeSubPanel); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(sourcePanel.get(), 20000); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(mainPanel.get(), 30000); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(matrixPanel.get(), 40000); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(mixerPanel.get(), 50000); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(macroPanel.get(), 60000); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(singlePanel.get(), 70000); + auto startMsg = Synth::UIToAudioMsg{Synth::UIToAudioMsg::REQUEST_REFRESH}; uiToAudio.push(startMsg); flushOperator(); @@ -130,6 +139,7 @@ SixSinesEditor::SixSinesEditor(Synth::audioToUIQueue_t &atou, Synth::uiToAudioQu presetButton->onPopupMenu = [this]() { showPresetPopup(); }; addAndMakeVisible(*presetButton); setPatchNameDisplay(); + sst::jucegui::accessibility::KeyboardTraverser::assignTraversalIndex(presetButton.get(), 174); { std::lock_guard grd(sixSinesLookAndFeelSetupMutex); diff --git a/src/ui/source-panel.cpp b/src/ui/source-panel.cpp index a823734..2d7e676 100644 --- a/src/ui/source-panel.cpp +++ b/src/ui/source-panel.cpp @@ -17,12 +17,14 @@ #include "source-panel.h" #include "source-sub-panel.h" #include "ui-constants.h" +#include "sst/jucegui/accessibility/KeyboardTraverser.h" #include "knob-highlight.h" namespace baconpaul::six_sines::ui { SourcePanel::SourcePanel(SixSinesEditor &e) : jcmp::NamedPanel("Source"), HasEditor(e) { + using kt_t = sst::jucegui::accessibility::KeyboardTraverser; auto &mn = editor.patchCopy.sourceNodes; for (auto i = 0U; i < numOps; ++i) { @@ -35,6 +37,9 @@ SourcePanel::SourcePanel(SixSinesEditor &e) : jcmp::NamedPanel("Source"), HasEdi power[i]->setGlyph(sst::jucegui::components::GlyphPainter::POWER); addAndMakeVisible(*power[i]); + kt_t::assignTraversalIndex(power[i].get(), i * 5 + 20); + kt_t::assignTraversalIndex(knobs[i].get(), i * 5 + 21); + labels[i] = std::make_unique(); labels[i]->setText("Op " + std::to_string(i + 1) + " Ratio"); addAndMakeVisible(*labels[i]);