Skip to content

Commit

Permalink
Alias Editor Accesibility Tweaks
Browse files Browse the repository at this point in the history
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 surge-synthesizer#6822
  • Loading branch information
baconpaul committed Mar 3, 2023
1 parent 6ad105a commit 67b91b2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/surge-xt/gui/widgets/OscillatorWaveformDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ OscillatorWaveformDisplay::OscillatorWaveformDisplay()
ol = std::make_unique<OverlayAsAccessibleButton<OscillatorWaveformDisplay>>(
this, customEditor ? "Close Custom Editor" : "Open Custom Editor",
juce::AccessibilityRole::button);

ol->setWantsKeyboardFocus(true);
addChildComponent(*ol);

ol->onPress = [this](OscillatorWaveformDisplay *d) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/surge-xt/gui/widgets/OscillatorWaveformDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "juce_gui_basics/juce_gui_basics.h"
#include "Oscillator.h"
#include "AccessibleHelpers.h"

class SurgeStorage;
class SurgeGUIEditor;
Expand Down

0 comments on commit 67b91b2

Please sign in to comment.