Skip to content

Commit

Permalink
Accesibility: Tab Order is fine (#95)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
baconpaul authored Jan 6, 2025
1 parent 8377585 commit cee94f7
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/ui/dahdsr-components.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ template <typename Comp, typename PatchPart> 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();
Expand Down Expand Up @@ -82,6 +84,12 @@ template <typename Comp, typename PatchPart> 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<int> layoutDAHDSRAt(int x, int y)
Expand Down
9 changes: 9 additions & 0 deletions src/ui/lfo-components.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ template <typename Comp, typename Patch> 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<jcmp::Label>();
Expand Down Expand Up @@ -69,6 +71,13 @@ template <typename Comp, typename Patch> 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<int> layoutLFOAt(int x, int y, int extraWidth = 0)
Expand Down
2 changes: 2 additions & 0 deletions src/ui/macro-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<jcmp::Label>();
labels[i]->setText("Macro " + std::to_string(i + 1));
addAndMakeVisible(*labels[i]);
Expand Down
4 changes: 4 additions & 0 deletions src/ui/main-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<jcmp::Label>();
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<jcmp::Label>();
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<jcmp::Label>();
tunLabel->setText("Tune");
Expand All @@ -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<KnobHighlight>();
addChildComponent(*highlight);
Expand Down
8 changes: 8 additions & 0 deletions src/ui/matrix-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down Expand Up @@ -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<KnobHighlight>();
Expand Down
6 changes: 6 additions & 0 deletions src/ui/mixer-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -55,6 +57,10 @@ MixerPanel::MixerPanel(SixSinesEditor &e) : jcmp::NamedPanel("Mixer"), HasEditor
panLabels[i] = std::make_unique<jcmp::Label>();
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<KnobHighlight>();
Expand Down
6 changes: 6 additions & 0 deletions src/ui/modulation-components.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ template <typename Comp, typename Patch> 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<jcmp::RuledLabel>();
Expand Down Expand Up @@ -81,6 +83,10 @@ template <typename Comp, typename Patch> 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);
}
}

Expand Down
12 changes: 11 additions & 1 deletion src/ui/six-sines-editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void()> 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(
Expand Down Expand Up @@ -111,6 +113,13 @@ SixSinesEditor::SixSinesEditor(Synth::audioToUIQueue_t &atou, Synth::uiToAudioQu
playModeSubPanel = std::make_unique<PlayModeSubPanel>(*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();
Expand All @@ -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<std::mutex> grd(sixSinesLookAndFeelSetupMutex);
Expand Down
5 changes: 5 additions & 0 deletions src/ui/source-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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<jcmp::Label>();
labels[i]->setText("Op " + std::to_string(i + 1) + " Ratio");
addAndMakeVisible(*labels[i]);
Expand Down

0 comments on commit cee94f7

Please sign in to comment.