Skip to content

Commit

Permalink
ENG-54: Check spanners when assessing emptiness
Browse files Browse the repository at this point in the history
Previously, a staff's emptiness was calculated based on its note and
annotation content. Since this is evaluated before the system was laid
out, the system did not have pointers to its SpannerSegments. This
commit adds a way to include whether a staff has any spanners
(particularly pedal markings and hanging slurs) in assessing emptiness,
creating more consistent/expected hiding behavior in HideMode::AUTO.

Duplicate of musescore#8430, part 2
  • Loading branch information
iveshenry18 authored and Jojo-Schmitz committed Sep 2, 2021
1 parent 694dc04 commit 7feba98
Show file tree
Hide file tree
Showing 2 changed files with 1,548 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,10 @@ void Score::hideEmptyStaves(System* system, bool isFirstSystem)
int staffIdx = 0;
bool systemIsEmpty = true;

Fraction stick = system->measures().front()->tick();
Fraction etick = system->measures().back()->endTick();
auto spanners = score()->spannerMap().findOverlapping(stick.ticks(), etick.ticks());

for (Staff* staff : qAsConst(_staves)) {
SysStaff* ss = system->staff(staffIdx);

Expand All @@ -1339,6 +1343,12 @@ void Score::hideEmptyStaves(System* system, bool isFirstSystem)
&& !(isFirstSystem && styleB(Sid::dontHideStavesInFirstSystem))
&& hideMode != Staff::HideMode::NEVER)) {
bool hideStaff = true;
for (auto spanner : spanners) {
if (spanner.value->staff() == staff) {
hideStaff = false;
break;
}
}
for (MeasureBase* m : system->measures()) {
if (!m->isMeasure())
continue;
Expand Down
Loading

0 comments on commit 7feba98

Please sign in to comment.