@@ -4043,9 +4043,7 @@ void Score::updateBracesAndBarlines(Part* part, size_t newIndex)
40434043 auto updateBracketSpan = [this , part](size_t modIndex, size_t refIndex) {
40444044 Staff* modStaff = staff (part->staves ()[modIndex]->idx ());
40454045 Staff* refStaff = staff (part->staves ()[refIndex]->idx ());
4046- if (modStaff->getProperty (Pid::STAFF_BARLINE_SPAN) != refStaff->getProperty (Pid::STAFF_BARLINE_SPAN)) {
4047- modStaff->undoChangeProperty (Pid::STAFF_BARLINE_SPAN, refStaff->getProperty (Pid::STAFF_BARLINE_SPAN));
4048- }
4046+ modStaff->undoChangeProperty (Pid::STAFF_BARLINE_SPAN, refStaff->getProperty (Pid::STAFF_BARLINE_SPAN));
40494047 };
40504048
40514049 if (newIndex >= 2 ) {
@@ -4055,8 +4053,9 @@ void Score::updateBracesAndBarlines(Part* part, size_t newIndex)
40554053 if (part->nstaves () == 2 ) {
40564054 const InstrumentTemplate* tp = searchTemplate (part->instrumentId ());
40574055 if (tp) {
4058- if (tp->barlineSpan [0 ] > 0 ) {
4059- staff (part->staves ()[0 ]->idx ())->undoChangeProperty (Pid::STAFF_BARLINE_SPAN, tp->barlineSpan [0 ]);
4056+ const bool firstStaffBarLineSpan = tp->barlineSpan [0 ];
4057+ if (firstStaffBarLineSpan) {
4058+ staff (part->staff (0 )->idx ())->undoChangeProperty (Pid::STAFF_BARLINE_SPAN, firstStaffBarLineSpan);
40604059 }
40614060 if (noBracesFound && (tp->bracket [0 ] != BracketType::NO_BRACKET)) {
40624061 undoAddBracket (part->staves ()[0 ], 0 , tp->bracket [0 ], part->nstaves ());
@@ -4145,8 +4144,8 @@ void Score::remapBracketsAndBarlines()
41454144 // Look in the masterScore for all the staves spanned by a common barline.
41464145 // If at least one of them is also in this score, then connect it through.
41474146 bool extendBarline = false ;
4148- int span = masterStaff->barLineSpan ();
4149- while (!extendBarline && span > 0 && masterStaff->idx () + 1 < master->nstaves ()) {
4147+ bool span = masterStaff->barLineSpan ();
4148+ while (!extendBarline && span && masterStaff->idx () + 1 < master->nstaves ()) {
41504149 masterStaff = masterScore ()->staff (masterStaff->idx () + 1 );
41514150 span = masterStaff->barLineSpan ();
41524151 if (masterStaff->findLinkedInScore (this )) {
@@ -4155,7 +4154,7 @@ void Score::remapBracketsAndBarlines()
41554154 }
41564155 }
41574156 if (extendBarline) {
4158- staff->setBarLineSpan (1 );
4157+ staff->setBarLineSpan (true );
41594158 }
41604159 }
41614160}
0 commit comments