Skip to content

Commit

Permalink
fix #306222 Screen readers: Speech for add/remove articulations +coll…
Browse files Browse the repository at this point in the history
…ect_artifacts
  • Loading branch information
shoogle committed Jun 8, 2020
1 parent c0cf9e8 commit a946a2e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,8 @@ void Score::upDownDelta(int pitchDelta)
void Score::addArticulation(SymId attr)
{
QSet<Chord*> set;
int numAdded = 0;
int numRemoved = 0;
for (Element* el : selection().elements()) {
if (el->isNote() || el->isChord()) {
Chord* cr = 0;
Expand All @@ -1696,12 +1698,26 @@ void Score::addArticulation(SymId attr)
}
Articulation* na = new Articulation(this);
na->setSymId(attr);
if (!addArticulation(el, na))
if (addArticulation(el, na)) {
++numAdded;
}
else {
delete na;
++numRemoved;
}
if (cr)
set.insert(cr);
}
}
QString msg = Sym::id2userName(attr);
if (numAdded == 1 && numRemoved == 0)
msg = QObject::tr("%1 added").arg(msg);
else if (numAdded == 0 && numRemoved == 1)
msg = QObject::tr("%1 removed").arg(msg);
else
msg = QObject::tr("%1, added %2, removed %3")
.arg(msg).arg(numAdded).arg(numRemoved);
setAccessibleMessage(msg);
}

//---------------------------------------------------------
Expand Down

0 comments on commit a946a2e

Please sign in to comment.