Skip to content

Commit

Permalink
Accessibility Menu; Patch to Text (surge-synthesizer#6819)
Browse files Browse the repository at this point in the history
A couple of accessibility features

1. Add an "Accessibility" menu
2. Add a "set to recommended accessibility settings" item to it that sets
   the four settings which folks recommend.
3. Add a very early draft of patch->text for sharing a description of the
   patch for feedback on if it is is even useful to consider developing

Addresses surge-synthesizer#6811
  • Loading branch information
baconpaul authored Jan 24, 2023
1 parent f49f79a commit 2dd21f5
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 31 deletions.
3 changes: 3 additions & 0 deletions src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ struct FxStorage
struct SurgeSceneStorage
{
OscillatorStorage osc[n_oscs];

// If you change the start and end points of this param list the iteration in the
// dump to HTML will break.
Parameter pitch, octave;
Parameter fm_depth, fm_switch;
Parameter drift, noise_colour, keytrack_root;
Expand Down
110 changes: 79 additions & 31 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2928,11 +2928,14 @@ void SurgeGUIEditor::showSettingsMenu(const juce::Point<int> &where,
settingsMenu.addSubMenu(Surge::GUI::toOSCase("Mouse Behavior"), mouseMenu);

auto patchDefMenu = makePatchDefaultsMenu(where);
settingsMenu.addSubMenu(Surge::GUI::toOSCase("Patch Defaults"), patchDefMenu);
settingsMenu.addSubMenu(Surge::GUI::toOSCase("Patch Settings"), patchDefMenu);

auto wfMenu = makeWorkflowMenu(where);
settingsMenu.addSubMenu(Surge::GUI::toOSCase("Workflow"), wfMenu);

auto accMenu = makeAccesibilityMenu(where);
settingsMenu.addSubMenu(Surge::GUI::toOSCase("Accessibility"), accMenu);

settingsMenu.addSeparator();

auto mpeSubMenu = makeMpeMenu(where, false);
Expand Down Expand Up @@ -3966,6 +3969,12 @@ juce::PopupMenu SurgeGUIEditor::makePatchDefaultsMenu(const juce::Point<int> &wh

patchDefMenu.addSubMenu(Surge::GUI::toOSCase("Tuning on Patch Load"), tuningOnLoadMenu);

patchDefMenu.addSeparator();
patchDefMenu.addItem(Surge::GUI::toOSCase("Export Patch as Text (Non-Default Values)"), true,
false, [this]() { showHTML(patchToHtml()); });
patchDefMenu.addItem(Surge::GUI::toOSCase("Export Patch as Text (All Values)"), true, false,
[this]() { showHTML(patchToHtml(true)); });

return patchDefMenu;
}

Expand Down Expand Up @@ -4160,21 +4169,44 @@ juce::PopupMenu SurgeGUIEditor::makeWorkflowMenu(const juce::Point<int> &where)

wfMenu.addSeparator();

bool showVirtualKeyboard = getShowVirtualKeyboard();

Surge::GUI::addMenuWithShortcut(wfMenu, Surge::GUI::toOSCase("Show Virtual Keyboard"),
showShortcutDescription("Alt + K", u8"\U00002325K"), true,
showVirtualKeyboard, [this]() { toggleVirtualKeyboard(); });

bool showOscilloscope = isAnyOverlayPresent(OSCILLOSCOPE);

Surge::GUI::addMenuWithShortcut(wfMenu, Surge::GUI::toOSCase("Open Oscilloscope"),
showShortcutDescription("Alt + O", u8"\U00002325O"), true,
showOscilloscope, [this]() { toggleOverlay(OSCILLOSCOPE); });

return wfMenu;
}

juce::PopupMenu SurgeGUIEditor::makeAccesibilityMenu(const juce::Point<int> &rect)
{
auto accMenu = juce::PopupMenu();

accMenu.addItem(Surge::GUI::toOSCase("Set All Recommended Accessibility Options"), true, false,
[this]() { setRecommendedAccessibility(); });
accMenu.addSeparator();

bool doAccAnn = Surge::Storage::getUserDefaultValue(
&(this->synth->storage), Surge::Storage::UseNarratorAnnouncements, false);

wfMenu.addItem(Surge::GUI::toOSCase("Send Additional Accessibility Announcements"), true,
doAccAnn, [this, doAccAnn]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::UseNarratorAnnouncements,
!doAccAnn);
});
accMenu.addItem(Surge::GUI::toOSCase("Send Additional Accessibility Announcements"), true,
doAccAnn, [this, doAccAnn]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::UseNarratorAnnouncements,
!doAccAnn);
});

#if WINDOWS
bool doAccAnnPatch = Surge::Storage::getUserDefaultValue(
&(this->synth->storage), Surge::Storage::UseNarratorAnnouncementsForPatchTypeahead, true);

wfMenu.addItem("Announce Patch Browser entries", true, doAccAnnPatch, [this, doAccAnnPatch]() {
accMenu.addItem("Announce Patch Browser entries", true, doAccAnnPatch, [this, doAccAnnPatch]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::UseNarratorAnnouncementsForPatchTypeahead,
!doAccAnnPatch);
Expand All @@ -4184,39 +4216,55 @@ juce::PopupMenu SurgeGUIEditor::makeWorkflowMenu(const juce::Point<int> &where)
bool doExpMen = Surge::Storage::getUserDefaultValue(
&(this->synth->storage), Surge::Storage::ExpandModMenusWithSubMenus, false);

wfMenu.addItem(Surge::GUI::toOSCase("Add Sub-Menus for Modulation Menu Items"), true, doExpMen,
[this, doExpMen]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::ExpandModMenusWithSubMenus,
!doExpMen);
});
accMenu.addItem(Surge::GUI::toOSCase("Add Sub-Menus for Modulation Menu Items"), true, doExpMen,
[this, doExpMen]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::ExpandModMenusWithSubMenus,
!doExpMen);
});

bool focusModEditor = Surge::Storage::getUserDefaultValue(
&(this->synth->storage), Surge::Storage::FocusModEditorAfterAddModulationFrom, false);

wfMenu.addItem(Surge::GUI::toOSCase("Focus Modulator Editor on \"") +
Surge::GUI::toOSCase("Add Modulation From\" Actions"),
true, focusModEditor, [this, focusModEditor]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage),
Surge::Storage::FocusModEditorAfterAddModulationFrom, !focusModEditor);
});
accMenu.addItem(Surge::GUI::toOSCase("Focus Modulator Editor on \"") +
Surge::GUI::toOSCase("Add Modulation From\" Actions"),
true, focusModEditor, [this, focusModEditor]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage),
Surge::Storage::FocusModEditorAfterAddModulationFrom, !focusModEditor);
});

wfMenu.addSeparator();
return accMenu;
}

bool showVirtualKeyboard = getShowVirtualKeyboard();
void SurgeGUIEditor::setRecommendedAccessibility()
{
std::ostringstream oss;
oss << "Set Accessibility Options: ";

Surge::GUI::addMenuWithShortcut(wfMenu, Surge::GUI::toOSCase("Show Virtual Keyboard"),
showShortcutDescription("Alt + K", u8"\U00002325K"), true,
showVirtualKeyboard, [this]() { toggleVirtualKeyboard(); });
Surge::Storage::updateUserDefaultValue(&(this->synth->storage),
Surge::Storage::UseKeyboardShortcuts_Plugin, true);
Surge::Storage::updateUserDefaultValue(&(this->synth->storage),
Surge::Storage::UseKeyboardShortcuts_Standalone, true);
oss << "Keyboard shortcuts on; ";

bool showOscilloscope = isAnyOverlayPresent(OSCILLOSCOPE);
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::MenuAndEditKeybindingsFollowKeyboardFocus, true);
oss << "Menu Follows Keyboard; ";

Surge::GUI::addMenuWithShortcut(wfMenu, Surge::GUI::toOSCase("Open Oscilloscope"),
showShortcutDescription("Alt + O", u8"\U00002325O"), true,
showOscilloscope, [this]() { toggleOverlay(OSCILLOSCOPE); });
Surge::Storage::updateUserDefaultValue(&(this->synth->storage),
Surge::Storage::UseNarratorAnnouncements, true);
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::UseNarratorAnnouncementsForPatchTypeahead, true);
oss << "Narrator announcements on; ";

return wfMenu;
Surge::Storage::updateUserDefaultValue(&(this->synth->storage),
Surge::Storage::ExpandModMenusWithSubMenus, true);
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::FocusModEditorAfterAddModulationFrom, true);
oss << "Expanded Modulation Menus and Modulation Focus.";

enqueueAccessibleAnnouncement(oss.str());
}

bool SurgeGUIEditor::getShowVirtualKeyboard()
Expand Down
5 changes: 5 additions & 0 deletions src/surge-xt/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,

std::string midiMappingToHtml();

std::string patchToHtml(bool includeDefaults = false);

// These are unused right now
enum SkinInspectorFlags
{
Expand Down Expand Up @@ -780,12 +782,15 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,
juce::PopupMenu makePatchDefaultsMenu(const juce::Point<int> &rect);
juce::PopupMenu makeValueDisplaysMenu(const juce::Point<int> &rect);
juce::PopupMenu makeWorkflowMenu(const juce::Point<int> &rect);
juce::PopupMenu makeAccesibilityMenu(const juce::Point<int> &rect);
juce::PopupMenu makeDataMenu(const juce::Point<int> &rect);
juce::PopupMenu makeMidiMenu(const juce::Point<int> &rect);
juce::PopupMenu makeDevMenu(const juce::Point<int> &rect);
juce::PopupMenu makeLfoMenu(const juce::Point<int> &rect);
juce::PopupMenu makeMonoModeOptionsMenu(const juce::Point<int> &rect, bool updateDefaults);

void setRecommendedAccessibility();

public:
void addHelpHeaderTo(const std::string &lab, const std::string &hu, juce::PopupMenu &m) const;

Expand Down
Loading

0 comments on commit 2dd21f5

Please sign in to comment.