Merge pull request #599 from mgavioli/repeat_barlines_not_forced_to_generated

Do not force repeat bar lines to "generated" status.
This commit is contained in:
Maurizio M. Gavioli 2013-12-28 16:04:21 -08:00
commit fa00a2ace3
3 changed files with 691 additions and 8 deletions

View file

@ -1984,7 +1984,7 @@ QList<System*> Score::layoutSystemRow(qreal rowWidth, bool isFirstSystem, bool u
//
BarLineType bl = hasCourtesyKeysig ? DOUBLE_BAR : NORMAL_BAR;
if (m->repeatFlags() & RepeatEnd)
m->setEndBarLineType(END_REPEAT, true);
m->setEndBarLineType(END_REPEAT, m->endBarLineGenerated());
else if (m->endBarLineGenerated())
m->setEndBarLineType(bl, true);
if (m->setStartRepeatBarLine(fmr))
@ -2002,14 +2002,14 @@ QList<System*> Score::layoutSystemRow(qreal rowWidth, bool isFirstSystem, bool u
needRelayout |= m->setStartRepeatBarLine(fmr);
if (m->repeatFlags() & RepeatEnd) {
if (nm && (nm->repeatFlags() & RepeatStart))
m->setEndBarLineType(END_START_REPEAT, true);
m->setEndBarLineType(END_START_REPEAT, m->endBarLineGenerated());
else
m->setEndBarLineType(END_REPEAT, true);
m->setEndBarLineType(END_REPEAT, m->endBarLineGenerated());
}
else if (nm && (nm->repeatFlags() & RepeatStart))
m->setEndBarLineType(START_REPEAT, true);
m->setEndBarLineType(START_REPEAT, m->endBarLineGenerated());
else if (m->endBarLineGenerated())
m->setEndBarLineType(NORMAL_BAR, true);
m->setEndBarLineType(NORMAL_BAR, m->endBarLineGenerated());
}
if (m->createEndBarLines())
m->setDirty();
@ -2220,12 +2220,12 @@ void Score::layoutLinear()
Measure* nm = m->nextMeasure();
if (m->repeatFlags() & RepeatEnd) {
if (nm && (nm->repeatFlags() & RepeatStart))
m->setEndBarLineType(END_START_REPEAT, true);
m->setEndBarLineType(END_START_REPEAT, m->endBarLineGenerated());
else
m->setEndBarLineType(END_REPEAT, true);
m->setEndBarLineType(END_REPEAT, m->endBarLineGenerated());
}
else if (nm && (nm->repeatFlags() & RepeatStart))
m->setEndBarLineType(START_REPEAT, true);
m->setEndBarLineType(START_REPEAT, m->endBarLineGenerated());
m->createEndBarLines();
w = m->minWidth1() * styleD(ST_linearStretch);
m->layout(w);

View file

@ -0,0 +1,636 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="1.24">
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle"></metaTag>
<PageList>
<Page>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<type>0</type>
</Staff>
<trackName>Violin</trackName>
<Instrument>
<longName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Violin<!--EndFragment--></p></body></html>
</longName>
<shortName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Vln.<!--EndFragment--></p></body></html>
</shortName>
<trackName>Violin</trackName>
<minPitchP>55</minPitchP>
<maxPitchP>103</maxPitchP>
<minPitchA>55</minPitchA>
<maxPitchA>88</maxPitchA>
<Articulation>
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>85</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="40"/>
</Channel>
<Channel name="pizzicato">
<program value="45"/>
</Channel>
<Channel name="tremolo">
<program value="44"/>
</Channel>
</Instrument>
</Part>
<Part>
<Staff id="2">
<type>0</type>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Violin</trackName>
<Instrument>
<longName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Violin<!--EndFragment--></p></body></html>
</longName>
<shortName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Vln.<!--EndFragment--></p></body></html>
</shortName>
<trackName>Violin</trackName>
<minPitchP>55</minPitchP>
<maxPitchP>103</maxPitchP>
<minPitchA>55</minPitchA>
<maxPitchA>88</maxPitchA>
<Articulation>
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>85</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="40"/>
</Channel>
<Channel name="pizzicato">
<program value="45"/>
</Channel>
<Channel name="tremolo">
<program value="44"/>
</Channel>
</Instrument>
</Part>
<Part>
<Staff id="3">
<type>0</type>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Viola</trackName>
<Instrument>
<longName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Viola<!--EndFragment--></p></body></html>
</longName>
<shortName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Vla.<!--EndFragment--></p></body></html>
</shortName>
<trackName>Viola</trackName>
<minPitchP>48</minPitchP>
<maxPitchP>93</maxPitchP>
<minPitchA>48</minPitchA>
<maxPitchA>79</maxPitchA>
<Articulation>
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>85</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="41"/>
</Channel>
<Channel name="pizzicato">
<program value="45"/>
</Channel>
<Channel name="tremolo">
<program value="44"/>
</Channel>
</Instrument>
</Part>
<Part>
<Staff id="4">
<type>0</type>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Violoncello</trackName>
<Instrument>
<longName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Violoncello<!--EndFragment--></p></body></html>
</longName>
<shortName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Vlc.<!--EndFragment--></p></body></html>
</shortName>
<trackName>Violoncello</trackName>
<minPitchP>36</minPitchP>
<maxPitchP>90</maxPitchP>
<minPitchA>36</minPitchA>
<maxPitchA>67</maxPitchA>
<Articulation>
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>85</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="42"/>
</Channel>
<Channel name="pizzicato">
<program value="45"/>
</Channel>
<Channel name="tremolo">
<program value="44"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<Measure number="1">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<KeySig>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<subtype>1</subtype>
<sigN>4</sigN>
<sigD>4</sigD>
<textN></textN>
<textD></textD>
<showCourtesySig>0</showCourtesySig>
</TimeSig>
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="2">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="4">
<endRepeat>2</endRepeat>
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end-start-repeat</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="5">
<startRepeat/>
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="6">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="7">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="8">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Staff id="2">
<Measure number="1">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<KeySig>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<subtype>1</subtype>
<sigN>4</sigN>
<sigD>4</sigD>
<textN></textN>
<textD></textD>
<showCourtesySig>0</showCourtesySig>
</TimeSig>
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="2">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="4">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end-start-repeat</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="5">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="6">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="7">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="8">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Staff id="3">
<Measure number="1">
<Clef>
<concertClefType>C3</concertClefType>
<transposingClefType>C3</transposingClefType>
</Clef>
<KeySig>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<subtype>1</subtype>
<sigN>4</sigN>
<sigD>4</sigD>
<textN></textN>
<textD></textD>
<showCourtesySig>0</showCourtesySig>
</TimeSig>
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="2">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="4">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end-start-repeat</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="5">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="6">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="7">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="8">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Staff id="4">
<Measure number="1">
<Clef>
<concertClefType>F</concertClefType>
<transposingClefType>F</transposingClefType>
</Clef>
<KeySig>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<subtype>1</subtype>
<sigN>4</sigN>
<sigD>4</sigD>
<textN></textN>
<textD></textD>
<showCourtesySig>0</showCourtesySig>
</TimeSig>
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="2">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="4">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end-start-repeat</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="5">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="6">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="7">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="8">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
</Score>
</museScore>

View file

@ -36,6 +36,7 @@ class TestBarline : public QObject, public MTest
void barline02();
void barline03();
void barline04();
void barline05();
};
//---------------------------------------------------------
@ -235,6 +236,52 @@ void TestBarline::barline04()
delete score;
}
//---------------------------------------------------------
/// barline05
/// Adds a line break in the middle of a end-start-repeat bar line and then checks the two resulting
/// bar lines (an end-repeat and a start-repeat) are not marked as generated.
//
// NO REFERENCE SCORE IS USED.
//---------------------------------------------------------
void TestBarline::barline05()
{
Score* score = readScore(DIR + "barline05.mscx");
QVERIFY(score);
score->doLayout();
// 'go' to 4th measure
Measure* msr = score->firstMeasure();
for (int i=0; i < 3; i++)
msr = msr->nextMeasure();
// create and add a LineBreak element
LayoutBreak* lb = new LayoutBreak(score);
lb->setLayoutBreakType(LayoutBreak::LINE);
lb->setTrack(-1); // system-level element
lb->setParent(msr);
score->undoAddElement(lb);
score->doLayout();
// check an end-repeat bar line has been created at the end of this measure and it is not generated
Segment* seg = msr->findSegment(Segment::SegEndBarLine, msr->tick()+msr->ticks());
QVERIFY2(seg != nullptr, "No SegEndBarLine segment in measure 4.");
BarLine* bar = static_cast<BarLine*>(seg->element(0));
QVERIFY2(bar != nullptr, "No end-repeat bar line in measure 4.");
QVERIFY2(bar->barLineType() == END_REPEAT, "Bar line at measure 4 is not END-REPEAT");
QVERIFY2(!bar->generated(), "End-reapeat bar line in measure 4 is generated.");
// check an end-repeat bar line has been created at the beginning of the next measure and it is not generated
msr = msr->nextMeasure();
seg = msr->findSegment(Segment::SegStartRepeatBarLine, msr->tick());
QVERIFY2(seg != nullptr, "No SegStartRepeatBarLine segment in measure 5.");
bar = static_cast<BarLine*>(seg->element(0));
QVERIFY2(bar != nullptr, "No start-repeat bar line in measure 5.");
QVERIFY2(!bar->generated(), "Start-reapeat bar line in measure 5 is generated.");
// QVERIFY(saveCompareScore(score, "barline05.mscx", DIR + "barline05-ref.mscx"));
delete score;
}
QTEST_MAIN(TestBarline)
#include "tst_barline.moc"