From 67b91b2c0bac59f1a4786570e081a79ff9677b8b Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Fri, 3 Mar 2023 15:46:37 -0500 Subject: [PATCH] Alias Editor Accesibility Tweaks 1. The CustomEdit has the right "size" so it works in tab traversal 2. The Menu/Right Bracket callbacks all work 3. Enter on CustomEdit butto activated Closes #6822 --- .../gui/widgets/OscillatorWaveformDisplay.cpp | 30 +++++++++++++++++-- .../gui/widgets/OscillatorWaveformDisplay.h | 1 + 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.cpp b/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.cpp index 10f65a1d9c9..3b77d97c31c 100644 --- a/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.cpp +++ b/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.cpp @@ -98,7 +98,7 @@ OscillatorWaveformDisplay::OscillatorWaveformDisplay() ol = std::make_unique>( this, customEditor ? "Close Custom Editor" : "Open Custom Editor", juce::AccessibilityRole::button); - + ol->setWantsKeyboardFocus(true); addChildComponent(*ol); ol->onPress = [this](OscillatorWaveformDisplay *d) { @@ -115,6 +115,21 @@ OscillatorWaveformDisplay::OscillatorWaveformDisplay() d->customEditorAccOverlay->setTitle("Open Custom Editor"); } }; + ol->onReturnKey = [this](OscillatorWaveformDisplay *d) { + if (customEditor) + { + hideCustomEditor(); + d->customEditorAccOverlay->setDescription("Close Custom Editor"); + d->customEditorAccOverlay->setTitle("Close Custom Editor"); + } + else + { + showCustomEditor(); + d->customEditorAccOverlay->setDescription("Open Custom Editor"); + d->customEditorAccOverlay->setTitle("Open Custom Editor"); + } + return true; + }; customEditorAccOverlay = std::move(ol); } @@ -403,7 +418,13 @@ void OscillatorWaveformDisplay::resized() menuOverlays[2]->setBounds(rightJog.toNearestInt()); waveTableName = wtr.withTrimmedRight(wtbheight).withTrimmedLeft(wtbheight); menuOverlays[0]->setBounds(waveTableName.toNearestInt()); - customEditorAccOverlay->setBounds(wtl.toNearestInt()); + + customEditorBox = getLocalBounds() + .withTop(getHeight() - wtbheight) + .withRight(60) + .withTrimmedBottom(1) + .toFloat(); + customEditorAccOverlay->setBounds(customEditorBox.toNearestInt()); } void OscillatorWaveformDisplay::repaintIfIdIsInRange(int id) @@ -1579,6 +1600,11 @@ struct AliasAdditiveEditor : public juce::Component, repaint(); }; + q->onMenuKey = [this](auto *t) { + parent->createAliasOptionsMenu(); + return true; + }; + addAndMakeVisible(*q); sliderAccOverlays[i] = std::move(q); diff --git a/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.h b/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.h index dd5fe009dfa..f1d6031e518 100644 --- a/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.h +++ b/src/surge-xt/gui/widgets/OscillatorWaveformDisplay.h @@ -23,6 +23,7 @@ #include "juce_gui_basics/juce_gui_basics.h" #include "Oscillator.h" +#include "AccessibleHelpers.h" class SurgeStorage; class SurgeGUIEditor;