Skip to content

Commit 0efebd2

Browse files
iveshenry18Jojo-Schmitz
authored andcommitted
ENG-60: Move and hide additional fermatas
When a fermata in a secondary voice is read, this commit adds handling that moves it below the staff. Additionally, there is handling to hide it if the duration of both voices is the same, or if there is also already a fermata below the staff. Duplicate of musescore#8509
1 parent 6819c58 commit 0efebd2

File tree

4 files changed

+1324
-0
lines changed

4 files changed

+1324
-0
lines changed

importexport/musicxml/importmxmlpass2.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,28 @@ static void addFermataToChord(const Notation& notation, ChordRest* cr)
10291029
cr->el().push_back(na); // store for later move to segment
10301030
else
10311031
cr->segment()->add(na);
1032+
1033+
// Move or hide fermata based on existing fermatas.
1034+
bool alreadyAbove = false;
1035+
bool alreadyBelow = false;
1036+
for (Element* e: cr->segment()->annotations()) {
1037+
if (e->isFermata() && e != na
1038+
&& e->staffIdx() == na->staffIdx() && e->track() != na->track()) {
1039+
Element* otherCr = cr->segment()->elist()[e->track()];
1040+
if (toFermata(e)->placement() == Placement::BELOW) alreadyBelow = true;
1041+
if (toFermata(e)->placement() == Placement::ABOVE) alreadyAbove = true;
1042+
1043+
if (direction.isEmpty() && alreadyAbove)
1044+
na->setPlacement(Placement::BELOW);
1045+
else if (direction.isEmpty() && alreadyBelow)
1046+
na->setPlacement(Placement::ABOVE);
1047+
1048+
if ((otherCr->isChord() && cr->isChord()
1049+
&& toChord(otherCr)->durationType() == toChord(cr)->durationType())
1050+
|| (alreadyAbove && alreadyBelow))
1051+
na->setVisible(false);
1052+
}
1053+
}
10321054
}
10331055

10341056
//---------------------------------------------------------

0 commit comments

Comments
 (0)