@@ -1424,6 +1424,10 @@ void MeasureLayout::createEndBarLines(Measure* m, bool isLastMeasureInSystem, La
14241424 Segment* seg = m->findSegmentR (SegmentType::EndBarLine, m->ticks ());
14251425 Measure* nm = m->nextMeasure ();
14261426 double blw = 0.0 ;
1427+ bool hideCourtesy = false ;
1428+ if (LayoutBreak* sectionBreakElement = m->sectionBreakElement ()) {
1429+ hideCourtesy = !sectionBreakElement->showCourtesy ();
1430+ }
14271431
14281432 if (nm && nm->repeatStart () && !m->repeatEnd () && !isLastMeasureInSystem && m->next () == nm) {
14291433 // we may skip barline at end of a measure immediately before a start repeat:
@@ -1445,7 +1449,7 @@ void MeasureLayout::createEndBarLines(Measure* m, bool isLastMeasureInSystem, La
14451449 // This flag is later used to set a double end bar line and to actually
14461450 // create the courtesy key sig.
14471451
1448- if (nm && !m-> sectionBreak () ) {
1452+ if (nm && !hideCourtesy ) {
14491453 // Don't change barlines at the end of a section break,
14501454 // and don't create courtesy key/time signatures.
14511455 bool hasKeySig = false ;
@@ -1585,8 +1589,9 @@ void MeasureLayout::createEndBarLines(Measure* m, bool isLastMeasureInSystem, La
15851589 bool showCourtesy = ctx.conf ().styleB (Sid::genCourtesyClef) && clef->showCourtesy (); // normally show a courtesy clef
15861590 // check if the measure is the last measure of the system or the last measure before a frame
15871591 bool lastMeasure = isLastMeasureInSystem || (nm ? !(m->next () == nm) : true );
1588- if (!nm || m->isFinalMeasureOfSection () || (lastMeasure && !showCourtesy)) {
1589- // hide the courtesy clef in the final measure of a section, or if the measure is the final measure of a system
1592+ if (!nm || hideCourtesy || (lastMeasure && !showCourtesy)) {
1593+ // hide the courtesy clef in the final measure of a section,
1594+ // or if the measure is the final measure of a system
15901595 // and the score style or the clef style is set to "not show courtesy clef",
15911596 // or if the clef is at the end of the very last measure of the score
15921597 clef->clear ();
@@ -1858,7 +1863,10 @@ void MeasureLayout::removeSystemHeader(Measure* m)
18581863void MeasureLayout::addSystemTrailer (Measure* m, Measure* nm, LayoutContext& ctx)
18591864{
18601865 Fraction _rtick = m->ticks ();
1861- bool isFinalMeasure = m->isFinalMeasureOfSection ();
1866+ bool hideCourtesy = false ;
1867+ if (LayoutBreak* sectionBreakElement = m->sectionBreakElement ()) {
1868+ hideCourtesy = !sectionBreakElement->showCourtesy ();
1869+ }
18621870
18631871 // locate a time sig. in the next measure and, if found,
18641872 // check if it has court. sig. turned off
@@ -1868,7 +1876,7 @@ void MeasureLayout::addSystemTrailer(Measure* m, Measure* nm, LayoutContext& ctx
18681876 if (s) {
18691877 s->setTrailer (true );
18701878 }
1871- if (nm && ctx.conf ().styleB (Sid::genCourtesyTimesig) && !isFinalMeasure && !ctx.conf ().isFloatMode ()) {
1879+ if (nm && ctx.conf ().styleB (Sid::genCourtesyTimesig) && !hideCourtesy && !ctx.conf ().isFloatMode ()) {
18721880 Segment* tss = nm->findSegmentR (SegmentType::TimeSig, Fraction (0 , 1 ));
18731881 if (tss) {
18741882 size_t nstaves = ctx.dom ().nstaves ();
0 commit comments