fix barline span for invisible measures

This commit is contained in:
Marc Sabatella 2015-08-04 19:59:48 -06:00
parent 1051f3ec9b
commit 623f082751
3 changed files with 11 additions and 6 deletions

View file

@ -238,18 +238,24 @@ void BarLine::getY(qreal* y1, qreal* y2) const
Staff* staff2 = score()->staff(staffIdx2);
SysStaff* sysStaff1 = system->staff(staffIdx1);
SysStaff* sysStaff2 = system->staff(staffIdx2);
SysStaff* sysStaff1a = nullptr; // first staff that is shown, even if it has invisible measures
Measure* nm = measure->nextMeasure();
if (nm && nm->system() != measure->system())
nm = nullptr;
while (span > 0) {
// TODO: skip barlines for invisible measures too; requires vertical position adjustment
bool show1 = sysStaff1->show() && staff1->show();
// if start staff not shown, reduce span and move one staff down
if ( !(sysStaff1->show() && staff1->show() /*&& measure->visible(staffIdx1)*/) ) {
if (!(show1 && (measure->visible(staffIdx1) || (nm && nm->visible(staffIdx1))))) {
span--;
if (show1 && !sysStaff1a)
sysStaff1a = sysStaff1; // use for its y offset
if (staffIdx1 >= nstaves-1) // running out of staves?
break;
sysStaff1 = system->staff(++staffIdx1);
staff1 = score()->staff(staffIdx1);
}
// if end staff not shown, reduce span and move one staff up
else if ( !(sysStaff2->show() && staff2->show() /*&& measure->visible(staffIdx2)*/) ) {
else if (!(sysStaff2->show() && staff2->show() && (measure->visible(staffIdx2) || (nm && nm->visible(staffIdx2))))) {
span--;
if (staffIdx2 == 0)
break;
@ -280,9 +286,8 @@ void BarLine::getY(qreal* y1, qreal* y2) const
// ordinary barline within system, parent is measure
// base y on top visible staff in barline span
// after skipping ones with hideSystemBarLine set
yp = sysStaff1->y();
// TODO: adjustment for staves skipped because of invisible measures
// so that barlines are not drawn through invisible measures at top/bottom of span
// and accounting for staves that are shown but have invisible measures
yp = sysStaff1a ? sysStaff1a->y() : sysStaff1->y();
}
*y1 = l1->y1() - yp;
*y1 += (_spanFrom * staff1->lineDistance() * staff1->spatium()) / 2;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.