Skip to content

Commit

Permalink
fix #293301: add get-location command to read current location
Browse files Browse the repository at this point in the history
We have optimized the screenreader feedback when navigating
to only mention measure and staff if it has changed.
Blind users can easily lose track of where they are, however,
so this adds a new command "Get Location" that forces a full read.
It also re-establishes a lost selection (the last-selected note or rest),
which can also be useful for sighted users,
although Alt+Left/Right already re-established the location before beginning navigation.

Eventually I would like the new "Get Location" command
to read the current key and time signature.
Right now, though, it is is not straightforward to force the screenreader to do this,
I left it as a TODO in the code.
  • Loading branch information
MarcSabatella committed Dec 5, 2019
1 parent a6c04d4 commit ea02b2e
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mscore/data/shortcuts-Mac.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@
<key>palette-search</key>
<seq>Ctrl+F9</seq>
</SC>
<SC>
<key>get-location</key>
<seq>Shift+L</seq>
</SC>
<SC>
<key>move-up</key>
<seq>Ctrl+Shift+Up</seq>
Expand Down
4 changes: 4 additions & 0 deletions mscore/data/shortcuts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@
<key>palette-search</key>
<seq>Ctrl+F9</seq>
</SC>
<SC>
<key>get-location</key>
<seq>Shift+L</seq>
</SC>
<SC>
<key>move-up</key>
<seq>Ctrl+Shift+Up</seq>
Expand Down
4 changes: 4 additions & 0 deletions mscore/data/shortcuts_AZERTY.xml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@
<key>palette-search</key>
<seq>Ctrl+F9</seq>
</SC>
<SC>
<key>get-location</key>
<seq>Shift+L</seq>
</SC>
<SC>
<key>move-up</key>
<seq>Ctrl+Shift+Up</seq>
Expand Down
2 changes: 2 additions & 0 deletions mscore/scoreaccessibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ void ScoreAccessibility::clearAccessibilityInfo()
MuseScoreView* view = static_cast<MuseScore*>(mainWindow)->currentScoreView();
if (view)
view->score()->setAccessibleInfo(tr("No selection"));
_oldBar = -1;
_oldStaff = -1;
}

void ScoreAccessibility::currentInfoChanged()
Expand Down
20 changes: 20 additions & 0 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "musescore.h"
#include "navigator.h"
#include "preferences.h"
#include "scoreaccessibility.h"
#include "scoretab.h"
#include "seq.h"
#include "splitstaff.h"
Expand Down Expand Up @@ -2144,6 +2145,25 @@ void ScoreView::cmd(const char* s)
else if (cmd == "last-element") {
cmdGotoElement(score()->lastElement(false));
}
else if (cmd == "get-location") {
// get current selection
Element* e = score()->selection().element();
if (!e) {
// no current selection - restore lost selection
e = score()->selection().currentCR();
if (e && e->isChord())
e = toChord(e)->upNote();
}
if (!e) {
// no current or last selection - fall back to first element
e = score()->firstElement(false);
}
// TODO: find & read current key & time signatures
if (e) {
ScoreAccessibility::instance()->clearAccessibilityInfo();
cmdGotoElement(e);
}
}
else if (cmd == "rest" || cmd == "rest-TAB")
cmdEnterRest();
else if (cmd == "rest-1")
Expand Down
11 changes: 11 additions & 0 deletions mscore/shortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,17 @@ Shortcut Shortcut::_sc[] = {
Qt::WindowShortcut,
ShortcutFlags::A_CMD
},
{
MsWidget::SCORE_TAB,
STATE_NORMAL | STATE_TEXT_EDIT | STATE_HARMONY_FIGBASS_EDIT,
"get-location",
QT_TRANSLATE_NOOP("action","Get Location"),
QT_TRANSLATE_NOOP("action","Accessibility: Get location"),
0,
Icons::Invalid_ICON,
Qt::WindowShortcut,
ShortcutFlags::A_CMD
},
{
MsWidget::MAIN_WINDOW,
STATE_NORMAL | STATE_NOTE_ENTRY,
Expand Down

0 comments on commit ea02b2e

Please sign in to comment.