Skip to content

Commit 7594d8b

Browse files
committed
Fix double barlines after musescore#9138 (for GH#8975)
The 2nd part of musescore#9138 can't really get ported, as it would create a compatibility issue. Values found by some educated guesses and some trial and error...
1 parent 958b640 commit 7594d8b

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

libmscore/barline.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ void BarLine::draw(QPainter* painter) const
585585

586586
qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
587587
painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
588-
x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
588+
x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
589589
painter->drawLine(QLineF(x, y1, x, y2));
590590
}
591591
break;
@@ -595,7 +595,7 @@ void BarLine::draw(QPainter* painter) const
595595
painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::FlatCap));
596596
qreal x = lw * .5;
597597
painter->drawLine(QLineF(x, y1, x, y2));
598-
x += ((lw * .5) + score()->styleP(Sid::doubleBarDistance) + (lw * .5)) * mag();
598+
x += ((lw * .5) + (score()->styleP(Sid::doubleBarDistance) * .67) + (lw * .5)) * mag();
599599
painter->drawLine(QLineF(x, y1, x, y2));
600600
}
601601
break;
@@ -608,7 +608,7 @@ void BarLine::draw(QPainter* painter) const
608608

609609
qreal lw2 = score()->styleP(Sid::barWidth) * mag();
610610
painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
611-
x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
611+
x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
612612
painter->drawLine(QLineF(x, y1, x, y2));
613613
}
614614
break;
@@ -625,7 +625,7 @@ void BarLine::draw(QPainter* painter) const
625625
painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
626626
qreal x = lw2 * .5;
627627
painter->drawLine(QLineF(x, y1, x, y2));
628-
x += ((lw2 * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
628+
x += ((lw2 * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
629629
painter->drawLine(QLineF(x, y1, x, y2));
630630
}
631631
break;
@@ -638,10 +638,10 @@ void BarLine::draw(QPainter* painter) const
638638

639639
qreal lw = score()->styleP(Sid::barWidth) * mag();
640640
painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::FlatCap));
641-
x += ((lw2 * .5) + score()->styleP(Sid::endBarDistance) + (lw * .5)) * mag();
641+
x += ((lw2 * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw * .5)) * mag();
642642
painter->drawLine(QLineF(x, y1, x, y2));
643643

644-
x += ((lw * .5) + score()->styleP(Sid::repeatBarlineDotSeparation)) * mag();
644+
x += ((lw * .5) + (score()->styleP(Sid::repeatBarlineDotSeparation) * .67)) * mag();
645645
drawDots(painter, x);
646646

647647
if (score()->styleB(Sid::repeatBarTips))
@@ -657,11 +657,11 @@ void BarLine::draw(QPainter* painter) const
657657
drawDots(painter, x);
658658

659659
x += symBbox(SymId::repeatDot).width();
660-
x += (score()->styleP(Sid::repeatBarlineDotSeparation) + (lw * .5)) * mag();
660+
x += ((score()->styleP(Sid::repeatBarlineDotSeparation) *.67) + (lw * .5)) * mag();
661661
painter->drawLine(QLineF(x, y1, x, y2));
662662

663663
qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
664-
x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
664+
x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
665665
painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
666666
painter->drawLine(QLineF(x, y1, x, y2));
667667

@@ -677,22 +677,22 @@ void BarLine::draw(QPainter* painter) const
677677
drawDots(painter, x);
678678

679679
x += symBbox(SymId::repeatDot).width();
680-
x += (score()->styleP(Sid::repeatBarlineDotSeparation) + (lw * .5)) * mag();
680+
x += ((score()->styleP(Sid::repeatBarlineDotSeparation) * .67) + (lw * .5)) * mag();
681681
painter->drawLine(QLineF(x, y1, x, y2));
682682

683683
qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
684-
x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
684+
x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
685685
painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
686686
painter->drawLine(QLineF(x, y1, x, y2));
687687

688688
if (score()->styleB(Sid::repeatBarTips))
689689
drawTips(painter, true, x + lw2 * .5);
690690

691691
painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::FlatCap));
692-
x += ((lw2 * .5) + score()->styleP(Sid::endBarDistance) + (lw * .5)) * mag();
692+
x += ((lw2 * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw * .5)) * mag();
693693
painter->drawLine(QLineF(x, y1, x, y2));
694694

695-
x += ((lw * .5) + score()->styleP(Sid::repeatBarlineDotSeparation)) * mag();
695+
x += ((lw * .5) + (score()->styleP(Sid::repeatBarlineDotSeparation) * .67)) * mag();
696696
drawDots(painter, x);
697697

698698
if (score()->styleB(Sid::repeatBarTips))
@@ -1244,32 +1244,32 @@ qreal BarLine::layoutWidth(Score* score, BarLineType type)
12441244
switch (type) {
12451245
case BarLineType::DOUBLE:
12461246
w = (score->styleP(Sid::doubleBarWidth) * 2)
1247-
+ score->styleP(Sid::doubleBarDistance);
1247+
+ (score->styleP(Sid::doubleBarDistance) * .67);
12481248
break;
12491249
case BarLineType::DOUBLE_HEAVY:
12501250
w = (score->styleP(Sid::endBarWidth) * 2)
1251-
+ score->styleP(Sid::endBarDistance);
1251+
+ (score->styleP(Sid::endBarDistance) * .5);
12521252
break;
12531253
case BarLineType::END_START_REPEAT:
12541254
w = score->styleP(Sid::endBarWidth)
12551255
+ (score->styleP(Sid::barWidth) * 2)
1256-
+ (score->styleP(Sid::endBarDistance) * 2)
1257-
+ (score->styleP(Sid::repeatBarlineDotSeparation) * 2)
1256+
+ (score->styleP(Sid::endBarDistance) * 2 * .5)
1257+
+ (score->styleP(Sid::repeatBarlineDotSeparation) * .67 * 2)
12581258
+ (dotwidth * 2);
12591259
break;
12601260
case BarLineType::START_REPEAT:
12611261
case BarLineType::END_REPEAT:
12621262
w = score->styleP(Sid::endBarWidth)
12631263
+ score->styleP(Sid::barWidth)
1264-
+ score->styleP(Sid::endBarDistance)
1265-
+ score->styleP(Sid::repeatBarlineDotSeparation)
1264+
+ (score->styleP(Sid::endBarDistance) * .5)
1265+
+ (score->styleP(Sid::repeatBarlineDotSeparation) * .67)
12661266
+ dotwidth;
12671267
break;
12681268
case BarLineType::END:
12691269
case BarLineType::REVERSE_END:
12701270
w = score->styleP(Sid::endBarWidth)
12711271
+ score->styleP(Sid::barWidth)
1272-
+ score->styleP(Sid::endBarDistance);
1272+
+ (score->styleP(Sid::endBarDistance) * .5);
12731273
break;
12741274
case BarLineType::BROKEN:
12751275
case BarLineType::NORMAL:

0 commit comments

Comments
 (0)