Skip to content

Commit

Permalink
fix #25151
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Apr 24, 2014
1 parent 4b9a1d9 commit 5a02b93
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
11 changes: 6 additions & 5 deletions libmscore/layout.cpp
Expand Up @@ -1614,15 +1614,18 @@ static bool validMMRestMeasure(Measure* m)
if (!m->isEmpty())
return false;

#if 0
auto l = m->score()->spannerMap().findOverlapping(m->tick(), m->endTick());
for (::Interval<Spanner*> isp : l) {
Spanner* s = isp.value;
if (s->type() == Element::VOLTA && (s->tick() == m->tick() || s->tick2() == m->tick()))
return false;
}
#endif

for (Segment* s = m->first(); s; s = s->next()) {
for (Element* e : s->annotations()) {
if(e->type() != Element::REHEARSAL_MARK && e->type() != Element::TEMPO_TEXT && e->type() != Element::STAFF_TEXT)
if (e->type() != Element::REHEARSAL_MARK && e->type() != Element::TEMPO_TEXT && e->type() != Element::STAFF_TEXT)
return false;
}
}
Expand All @@ -1642,10 +1645,8 @@ static bool breakMultiMeasureRest(Measure* m)
auto sl = m->score()->spannerMap().findOverlapping(m->tick(), m->endTick());
foreach (auto i, sl) {
Spanner* s = i.value;
if (s->type() == Element::VOLTA) {
if (s->tick() == m->tick() || s->tick2() == m->tick())
return true;
}
if (s->type() == Element::VOLTA && (s->tick() == m->tick() || s->tick2() == m->tick()))
return true;
}

for (Segment* s = m->first(); s; s = s->next()) {
Expand Down
6 changes: 6 additions & 0 deletions libmscore/line.cpp
Expand Up @@ -507,6 +507,12 @@ QPointF SLine::linePos(int grip, System** sys)
}
}
}
if (score()->styleB(ST_createMultiMeasureRests)) {
if (m->mmRest())
m = m->mmRest();
else if (m->mmRestCount())
m = m->mmRest1();
}
Q_ASSERT(m->system());
*sys = m->system();
}
Expand Down
21 changes: 21 additions & 0 deletions libmscore/measure.cpp
Expand Up @@ -3926,5 +3926,26 @@ Measure* Measure::mmRestLast() const
return score()->lastMeasure();
}

//---------------------------------------------------------
// mmRest1
// return the multi measure rest this measure is covered
// by
//---------------------------------------------------------

Measure* Measure::mmRest1() const
{
if (_mmRest)
return _mmRest;
if (_mmRestCount != -1)
return 0;
const Measure* m = this;
while (m && !m->_mmRest)
m = m->prevMeasure();
if (m)
return const_cast<Measure*>(m->_mmRest);
return 0;
}


}

1 change: 1 addition & 0 deletions libmscore/measure.h
Expand Up @@ -293,6 +293,7 @@ class Measure : public MeasureBase {
bool hasMMRest() const { return _mmRest != 0; }
bool isMMRest() const { return _mmRestCount > 0; }
Measure* mmRest() const { return _mmRest; }
Measure* mmRest1() const;
void setMMRest(Measure* m) { _mmRest = m; }
int mmRestCount() const { return _mmRestCount; } // number of measures _mmRest spans
void setMMRestCount(int n) { _mmRestCount = n; }
Expand Down

0 comments on commit 5a02b93

Please sign in to comment.