Skip to content

Commit

Permalink
Merge pull request #358 from mgavioli/Fix_bug_in_Measure_createEndBar…
Browse files Browse the repository at this point in the history
…Lines

Fix a bug in Measure::createEndBarLines().
  • Loading branch information
mgavioli committed May 18, 2013
2 parents 64783f9 + 5a9abfd commit 418044c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions libmscore/measure.cpp
Expand Up @@ -2531,8 +2531,8 @@ bool Measure::setStartRepeatBarLine(bool val)

//---------------------------------------------------------
// createEndBarLines
// actually create or modify barlines
// return true if layout changes
// actually creates or modifies barlines
// returns true if layout changes
//---------------------------------------------------------

bool Measure::createEndBarLines()
Expand All @@ -2544,6 +2544,7 @@ bool Measure::createEndBarLines()
BarLine* bl = 0;
int span = 0; // span counter
int aspan = 0; // actual span
bool mensur = false; // keep note of mensurstrich case
int spanTot; // to keep track of the target span
int spanFrom;
int spanTo;
Expand All @@ -2567,17 +2568,19 @@ bool Measure::createEndBarLines()
}
else { // otherwise, get from staff
span = staff->barLineSpan();
if (span) {
// if some span OR last staff (span=0) of a mensurstrich case, get From/To from staff
if (span || mensur) {
spanFrom = staff->barLineFrom();
spanTo = staff->barLineTo();
mensur = false;
}
// but if staff is set to no span, a multi-staff spanning bar line
// has been shortened to span less staves and following staves left without bars;
// set bar line span values to default
else {
span = 1;
spanFrom = 0;
spanTot = (staff->lines()-1)*2;
spanTo = (staff->lines()-1)*2;
}
}
if ((staffIdx + span) > nstaves)
Expand Down Expand Up @@ -2671,8 +2674,10 @@ bool Measure::createEndBarLines()
}
// if just finished (span==0) a multi-staff span (spanTot>1) ending at the top of a staff (spanTo<=0)
// scan this staff again, as it may have its own bar lines (mensurstich(-like) span)
if (spanTot > 1 && spanTo <= 0 && span == 0)
if (spanTot > 1 && spanTo <= 0 && span == 0) {
mensur = true;
staffIdx--;
}
}
return changed;
}
Expand Down

0 comments on commit 418044c

Please sign in to comment.