Fix bar line management for mensurstrich special case

In mensurstrich bar lines, lines span 2 staves, but second staff needs its own bar lines kept, in order to allow mensurstich bars from it to the following staff, if any. Previous code deleted them unconditionally.
This commit is contained in:
Maurizio Gavioli 2012-11-02 10:03:07 +01:00
parent 4afe07da6c
commit 1787bcc18e
2 changed files with 19 additions and 3 deletions

View file

@ -494,7 +494,14 @@ void BarLine::endEdit()
int idx2 = idx1 + _span;
// set span 0 to all additional staves
for (int idx = idx1 + 1; idx < idx2; ++idx)
score()->undoChangeBarLineSpan(score()->staff(idx), 0, 0, (score()->staff(idx)->lines()-1)*2);
// mensurstrich special case:
// if line spans to top line of a stave AND current staff is
// the last spanned staff BUT NOT the last score staff
// keep its bar lines
// otherwise remove them
if(_spanTo > 0 || !(idx == idx2-1 && idx != score()->nstaves()-1) )
score()->undoChangeBarLineSpan(score()->staff(idx), 0, 0,
(score()->staff(idx)->lines()-1)*2);
}
// if now bar lines span fewer staves
else {

View file

@ -2544,8 +2544,17 @@ bool Measure::createEndBarLines()
// we are extending down the bar line of a staff above (bl)
// and the bar line for this staff (cbl) is not needed: delete it
if (cbl && cbl != bl) {
score()->undoRemoveElement(cbl);
changed = true;
// mensurstrich special case:
// if line spans to top line of a stave AND current staff is
// the last spanned staff (span==1) BUT NOT the last score staff
// keep its bar line and scan this staff again!
// otherwise remove them
if(spanTo <= 0 && spanTot > 1 && (span == 1 && staffIdx != nstaves-1) )
staffIdx--;
else {
score()->undoRemoveElement(cbl);
changed = true;
}
}
}
}