Skip to content

Commit

Permalink
Merge pull request #5455 from MarcSabatella/293301-read-location
Browse files Browse the repository at this point in the history
fix #293301: add get-location command to read current location
  • Loading branch information
dmitrio95 committed Dec 6, 2019
2 parents ebf2b55 + ea02b2e commit eb66794
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 @@ -2138,6 +2139,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 eb66794

Please sign in to comment.