Skip to content

Commit

Permalink
Merge pull request #4834 from joshwd36/284991-hidefermatastaves
Browse files Browse the repository at this point in the history
fix #284991: Hide empty staves with fermatas
  • Loading branch information
dmitrio95 committed Apr 10, 2019
2 parents 842f8a1 + ff2907b commit 2e4f5b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ void Score::hideEmptyStaves(System* system, bool isFirstSystem)
if (!m->isMeasure())
continue;
Measure* measure = toMeasure(m);
if (!measure->isMeasureRest(staffIdx)) {
if (!measure->isEmpty(staffIdx)) {
hideStaff = false;
break;
}
Expand All @@ -1267,7 +1267,7 @@ void Score::hideEmptyStaves(System* system, bool isFirstSystem)
if (!mb->isMeasure())
continue;
Measure* m = toMeasure(mb);
if (staff->hideWhenEmpty() == Staff::HideMode::INSTRUMENT && !m->isMeasureRest(st)) {
if (staff->hideWhenEmpty() == Staff::HideMode::INSTRUMENT && !m->isEmpty(st)) {
hideStaff = false;
break;
}
Expand Down
14 changes: 7 additions & 7 deletions libmscore/measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,7 @@ bool Measure::visible(int staffIdx) const
}
if (system() && (system()->staves()->empty() || !system()->staff(staffIdx)->show()))
return false;
if (score()->staff(staffIdx)->cutaway() && isMeasureRest(staffIdx))
if (score()->staff(staffIdx)->cutaway() && isEmpty(staffIdx))
return false;
return score()->staff(staffIdx)->show() && _mstaves[staffIdx]->visible();
}
Expand Down Expand Up @@ -2585,13 +2585,13 @@ bool Measure::hasVoice(int track) const
}

//-------------------------------------------------------------------
// isMeasureRest
/// Check if the measure is filled by a full-measure rest or full
/// of rests on this staff. If staff is -1, then check for
/// all staves.
// isEmpty
/// Check if the measure is filled by a full-measure rest, or is
/// full of rests on this staff, that may have fermatas on them.
/// If staff is -1, then check for all staves.
//-------------------------------------------------------------------

bool Measure::isMeasureRest(int staffIdx) const
bool Measure::isEmpty(int staffIdx) const
{
int strack;
int etrack;
Expand All @@ -2610,7 +2610,7 @@ bool Measure::isMeasureRest(int staffIdx) const
return false;
}
for (Element* a : s->annotations()) {
if (!a || a->systemFlag() || !a->visible())
if (!a || a->systemFlag() || !a->visible() || a->isFermata())
continue;
int atrack = a->track();
if (atrack >= strack && atrack < etrack)
Expand Down
2 changes: 1 addition & 1 deletion libmscore/measure.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class Measure final : public MeasureBase {
void exchangeVoice(int voice1, int voice2, int staffIdx);
void checkMultiVoices(int staffIdx);
bool hasVoice(int track) const;
bool isMeasureRest(int staffIdx) const;
bool isEmpty(int staffIdx) const;
bool isFullMeasureRest() const;
bool isRepeatMeasure(Staff* staff) const;
bool visible(int staffIdx) const;
Expand Down

0 comments on commit 2e4f5b8

Please sign in to comment.