Skip to content

Commit

Permalink
Fix GH#26675: Correct barline on oneline to hidden staff
Browse files Browse the repository at this point in the history
Backport of musescore#26686 plus fixing clazy warnings
  • Loading branch information
sammik authored and Jojo-Schmitz committed Feb 23, 2025
1 parent 677f43b commit 316093b
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions libmscore/barline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
// the file LICENCE.GPL
//=============================================================================

#include "articulation.h"
#include "barline.h"
#include "score.h"
#include "sym.h"
#include "staff.h"
#include "part.h"
#include "system.h"
#include "fermata.h"
#include "image.h"
#include "marker.h"
#include "measure.h"
#include "part.h"
#include "score.h"
#include "segment.h"
#include "articulation.h"
#include "stafftype.h"
#include "xml.h"
#include "marker.h"
#include "stafflines.h"
#include "spanner.h"
#include "undo.h"
#include "fermata.h"
#include "staff.h"
#include "stafflines.h"
#include "stafftype.h"
#include "sym.h"
#include "symbol.h"
#include "image.h"
#include "system.h"
#include "undo.h"
#include "xml.h"

namespace Ms {

Expand All @@ -54,7 +54,7 @@ static void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStav
else if (bl->barLineType() == BarLineType::START_REPEAT) {
if (m->isFirstInSystem()) {
if (barType != BarLineType::END_REPEAT) {
for (Score* lscore : m->score()->scoreList()) {
for (Score*& lscore : m->score()->scoreList()) {
Measure* lmeasure = lscore->tick2measure(m->tick());
if (lmeasure)
lmeasure->undoChangeProperty(Pid::REPEAT_START, false);
Expand Down Expand Up @@ -128,7 +128,7 @@ static void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStav
// barlines themselves are not necessarily linked,
// so use staffList to find linked staves
BarLine* sbl = toBarLine(e);
for (Staff* lstaff : sbl->staff()->staffList()) {
for (Staff*& lstaff : sbl->staff()->staffList()) {
Score* lscore = lstaff->score();
int ltrack = lstaff->idx() * VOICES;

Expand Down Expand Up @@ -173,7 +173,7 @@ static void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStav
}
}
else if (segmentType == SegmentType::BeginBarLine) {
for (Score* lscore : m2->score()->scoreList()) {
for (Score*& lscore : m2->score()->scoreList()) {
Measure* lmeasure = lscore->tick2measure(m2->tick());
Segment* segment1 = lmeasure->undoGetSegmentR(SegmentType::BeginBarLine, Fraction(0, 1));
for (Element* e : segment1->elist()) {
Expand All @@ -189,23 +189,23 @@ static void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStav
}
break;
case BarLineType::START_REPEAT: {
for (Score* lscore : m2->score()->scoreList()) {
for (Score*& lscore : m2->score()->scoreList()) {
Measure* lmeasure = lscore->tick2measure(m2->tick());
if (lmeasure)
lmeasure->undoChangeProperty(Pid::REPEAT_START, true);
}
}
break;
case BarLineType::END_REPEAT: {
for (Score* lscore : m2->score()->scoreList()) {
for (Score*& lscore : m2->score()->scoreList()) {
Measure* lmeasure = lscore->tick2measure(m2->tick());
if (lmeasure)
lmeasure->undoChangeProperty(Pid::REPEAT_END, true);
}
}
break;
case BarLineType::END_START_REPEAT: {
for (Score* lscore : m2->score()->scoreList()) {
for (Score*& lscore : m2->score()->scoreList()) {
Measure* lmeasure = lscore->tick2measure(m2->tick());
if (lmeasure) {
lmeasure->undoChangeProperty(Pid::REPEAT_END, true);
Expand Down Expand Up @@ -491,7 +491,7 @@ void BarLine::getY() const
int oneLine = st1->lines() <= 1;
if (oneLine && _spanFrom == 0) {
from = BARLINE_SPAN_1LINESTAFF_FROM;
if (!_spanStaff || (staffIdx1 == nstaves - 1))
if (!_spanStaff || (staffIdx1 == nstaves - 1) || (staffIdx2 == staffIdx1))
to = BARLINE_SPAN_1LINESTAFF_TO;
}
SysStaff* sysStaff1 = system->staff(staffIdx1);
Expand Down

0 comments on commit 316093b

Please sign in to comment.