Skip to content

Commit 20914dd

Browse files
authored
Merge pull request #3442 from lasconic/fix-volta-22
Fix several issues with repeat and volta. Counterpart of PR #3371
2 parents b88c0ef + 1f82889 commit 20914dd

25 files changed

+2406
-215
lines changed

libmscore/jump.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Jump::Jump(Score* s)
4545
setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE);
4646
setTextStyleType(TextStyleType::REPEAT_RIGHT);
4747
setLayoutToParentWidth(true);
48+
_playRepeats = false;
4849
}
4950

5051
//---------------------------------------------------------
@@ -100,6 +101,8 @@ void Jump::read(XmlReader& e)
100101
_playUntil = e.readElementText();
101102
else if (tag == "continueAt")
102103
_continueAt = e.readElementText();
104+
else if (tag == "playRepeats")
105+
_playRepeats = e.readBool();
103106
else if (!Text::readProperties(e))
104107
e.unknown();
105108
}
@@ -117,6 +120,7 @@ void Jump::write(Xml& xml) const
117120
xml.tag("jumpTo", _jumpTo);
118121
xml.tag("playUntil", _playUntil);
119122
xml.tag("continueAt", _continueAt);
123+
xml.tag("playRepeats", _playRepeats);
120124
xml.etag();
121125
}
122126

@@ -160,6 +164,8 @@ QVariant Jump::getProperty(P_ID propertyId) const
160164
return playUntil();
161165
case P_ID::CONTINUE_AT:
162166
return continueAt();
167+
case P_ID::PLAY_REPEATS:
168+
return playRepeats();
163169
default:
164170
break;
165171
}
@@ -182,12 +188,16 @@ bool Jump::setProperty(P_ID propertyId, const QVariant& v)
182188
case P_ID::CONTINUE_AT:
183189
setContinueAt(v.toString());
184190
break;
191+
case P_ID::PLAY_REPEATS:
192+
setPlayRepeats(v.toInt());
193+
break;
185194
default:
186195
if (!Text::setProperty(propertyId, v))
187196
return false;
188197
break;
189198
}
190199
score()->setLayoutAll(true);
200+
score()->setPlaylistDirty();
191201
return true;
192202
}
193203

@@ -203,6 +213,9 @@ QVariant Jump::propertyDefault(P_ID propertyId) const
203213
case P_ID::CONTINUE_AT:
204214
return QString("");
205215

216+
case P_ID::PLAY_REPEATS:
217+
return false;
218+
206219
default:
207220
break;
208221
}

libmscore/jump.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class Jump : public Text {
4141
QString _jumpTo;
4242
QString _playUntil;
4343
QString _continueAt;
44+
bool _playRepeats;
4445

4546
public:
4647
enum class Type : char {
@@ -76,6 +77,8 @@ class Jump : public Text {
7677
void undoSetJumpTo(const QString& s);
7778
void undoSetPlayUntil(const QString& s);
7879
void undoSetContinueAt(const QString& s);
80+
bool playRepeats() const { return _playRepeats; }
81+
void setPlayRepeats(bool val) { _playRepeats = val; }
7982

8083
virtual bool systemFlag() const override { return true; }
8184

libmscore/measure.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ class Measure : public MeasureBase {
282282
void setRepeatFlags(Repeat val) { _repeatFlags = val; }
283283
void setRepeatFlag(Repeat val) { _repeatFlags = _repeatFlags | val; }
284284
void resetRepeatFlag(Repeat val) { _repeatFlags = Repeat(int(_repeatFlags) & ~int(val)); }
285+
bool repeatEnd() { return _repeatFlags & Repeat::END; }
286+
bool repeatStart() { return _repeatFlags & Repeat::START; }
287+
bool repeatJump() { return _repeatFlags & Repeat::JUMP; }
285288

286289
AccidentalVal findAccidental(Note*) const;
287290
AccidentalVal findAccidental(Segment* s, int staffIdx, int line, bool &error) const;

libmscore/property.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ static const PropertyData propertyList[] = {
237237
{ P_ID::FRET_FRETS, false, "frets", P_TYPE::INT },
238238
{ P_ID::FRET_BARRE, false, "barre", P_TYPE::INT },
239239
{ P_ID::FRET_OFFSET, false, "fretOffset", P_TYPE::INT },
240+
{ P_ID::PLAY_REPEATS, false, "playRepeats", P_TYPE::BOOL},
240241

241242
{ P_ID::END, false, "", P_TYPE::INT }
242243
};

libmscore/property.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ enum class P_ID : unsigned char {
230230
FRET_FRETS,
231231
FRET_BARRE,
232232
FRET_OFFSET,
233+
PLAY_REPEATS,
233234
END
234235
};
235236

0 commit comments

Comments
 (0)