diff --git a/libmscore/pedal.cpp b/libmscore/pedal.cpp index f11f9388b494..04b65985f2c2 100644 --- a/libmscore/pedal.cpp +++ b/libmscore/pedal.cpp @@ -212,12 +212,14 @@ QPointF Pedal::linePos(Grip grip, System** sys) const System* s = nullptr; if (grip == Grip::START) { ChordRest* c = toChordRest(startElement()); - s = c->segment()->system(); - x = c->pos().x() + c->segment()->pos().x() + c->segment()->measure()->pos().x(); - if (c->type() == ElementType::REST && c->durationType() == TDuration::DurationType::V_MEASURE) - x -= c->x(); - if (beginHookType() == HookType::HOOK_45) - x += nhw * .5; + if (c) { + s = c->segment()->system(); + x = c->pos().x() + c->segment()->pos().x() + c->segment()->measure()->pos().x(); + if (c->type() == ElementType::REST && c->durationType() == TDuration::DurationType::V_MEASURE) + x -= c->x(); + if (beginHookType() == HookType::HOOK_45) + x += nhw * .5; + } } else { Element* e = endElement(); diff --git a/libmscore/read114.cpp b/libmscore/read114.cpp index e1386e1e5235..d03e8a28e12d 100644 --- a/libmscore/read114.cpp +++ b/libmscore/read114.cpp @@ -56,6 +56,7 @@ #include "textframe.h" #include "jump.h" #include "textline.h" +#include "pedal.h" namespace Ms { @@ -1305,6 +1306,37 @@ static void readTextLine114(XmlReader& e, TextLine* textLine) e.unknown(); } } + +//--------------------------------------------------------- +// readPedal114 +//--------------------------------------------------------- + +static void readPedal114(XmlReader& e, Pedal* pedal) + { + while (e.readNextStartElement()) { + const QStringRef& tag(e.name()); + if (tag == "beginSymbol" + || tag == "beginSymbolOffset" + || tag == "endSymbol" + || tag == "endSymbolOffset" + || tag == "subtype" + ) + e.skipCurrentElement(); + else if (tag == "endHookHeight" || tag == "hookHeight") { // hookHeight is obsolete + pedal->setEndHookHeight(Spatium(e.readDouble())); + } + else if (tag == "lineWidth") { + pedal->setLineWidth(qreal(e.readDouble())); + } + else if (tag == "lineStyle") { + pedal->setLineStyle(Qt::PenStyle(e.readInt())); + } + else if (!readTextLineProperties114(e, pedal)) + e.unknown(); + } + pedal->setBeginText("keyboardPedalPed"); + } + //--------------------------------------------------------- // readHarmony114 //--------------------------------------------------------- @@ -2881,6 +2913,8 @@ Score::FileError MasterScore::read114(XmlReader& e) readOttava114(e, toOttava(s)); else if (tag == "TextLine") readTextLine114(e, toTextLine(s)); + else if (tag == "Pedal") + readPedal114(e, toPedal(s)); else s->read(e); if (s->track() == -1) @@ -2894,8 +2928,8 @@ Score::FileError MasterScore::read114(XmlReader& e) if (s->track2() == -1) s->setTrack2(s->track()); if (s->ticks() == 0) { - delete s; qDebug("zero spanner %s ticks: %d", s->name(), s->ticks()); + delete s; } else { addSpanner(s); diff --git a/mtest/libmscore/compat114/ottava-ref.mscx b/mtest/libmscore/compat114/ottava-ref.mscx new file mode 100644 index 000000000000..d8ee118d5468 --- /dev/null +++ b/mtest/libmscore/compat114/ottava-ref.mscx @@ -0,0 +1,169 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + 2 + + + + + + Piano + + Piano + Pno. + Piano + 21 + 108 + 21 + 108 + + 100 + 100 + + + 100 + 50 + + + 100 + 100 + + + 120 + 100 + + + + + + + + + + + + G + G + + + 4 + 4 + + + 8va + <font size="12"/><font face="Times New Roman"/><i>8va</i> + <font size="12"/><font face="Times New Roman"/><i>(8va)</i> + 1.5 + 0.15 + 1 + + + quarter + + 65 + 13 + + + + quarter + + + half + + + + + + measure + 4/4 + + + + + measure + 4/4 + + + end + 1 + + + + + + + F + F + + + 4 + 4 + + + measure + 4/4 + + + + + measure + 4/4 + + + + + measure + 4/4 + + + + + diff --git a/mtest/libmscore/compat114/ottava.mscx b/mtest/libmscore/compat114/ottava.mscx new file mode 100644 index 000000000000..c2d8b78a4c9a --- /dev/null +++ b/mtest/libmscore/compat114/ottava.mscx @@ -0,0 +1,189 @@ + + + 1.3 + 5702 + 1.76389 + 480 + + 1 + 1 + + A4 + + 56.6929 + 56.6929 + 56.6929 + 113.386 + + + 56.6929 + 56.6929 + 56.6929 + 113.386 + + 0 + + + + 4 + 4 + + + + + + + + + + + + + + 2 + + + + + + + + + + + + InstrumentLong + 0 + + +

Piano

+
+
+ + + InstrumentShort + 0 + + +

Pno.

+
+
+ + 21 + 108 + 21 + 108 + Piano + + + + + + + + + + +
+ + 1.5 + 0.15 + 1 + + left + left + 1 + 1920 + + + + + + + + + TextLine + 0 + + +

8va

+
+
+ + + TextLine + 0 + + +

(8va)

+
+
+
+ + + + 260 + 4 + 4 + + + quarter + + 65 + 13 + + + + quarter + + + half + + + + + measure + + + + + measure + + + 5 + + + + + + + 260 + 4 + 4 + + + measure + + + + + measure + + + + + measure + + + + 0 +
diff --git a/mtest/libmscore/compat114/pedal-ref.mscx b/mtest/libmscore/compat114/pedal-ref.mscx new file mode 100644 index 000000000000..02169d8af84b --- /dev/null +++ b/mtest/libmscore/compat114/pedal-ref.mscx @@ -0,0 +1,166 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + 2 + + + + + + Piano + + Piano + Pno. + Piano + 21 + 108 + 21 + 108 + + 100 + 100 + + + 100 + 50 + + + 100 + 100 + + + 120 + 100 + + + + + + + + + + + + G + G + + + 4 + 4 + + + <sym>keyboardPedalPed</sym> + 0.006 + -1.5 + + + quarter + + 65 + 13 + + + + quarter + + + half + + + + + + measure + 4/4 + + + + + measure + 4/4 + + + end + 1 + + + + + + + F + F + + + 4 + 4 + + + measure + 4/4 + + + + + measure + 4/4 + + + + + measure + 4/4 + + + + + diff --git a/mtest/libmscore/compat114/pedal.mscx b/mtest/libmscore/compat114/pedal.mscx new file mode 100644 index 000000000000..3ea50b05b08b --- /dev/null +++ b/mtest/libmscore/compat114/pedal.mscx @@ -0,0 +1,180 @@ + + + 1.3 + 5702 + 1.76389 + 480 + + 1 + 1 + + A4 + + 56.6929 + 56.6929 + 56.6929 + 113.386 + + + 56.6929 + 56.6929 + 56.6929 + 113.386 + + 0 + + + + 4 + 4 + + + + + + + + + + + + + + 2 + + + + + + + + + + + + InstrumentLong + 0 + + +

Piano

+
+
+ + + InstrumentShort + 0 + + +

Pno.

+
+
+ + 21 + 108 + 21 + 108 + Piano + + + + + + + + + + +
+ + -1.5 + 0.15 + 1 + + left + left + 1920 + + + + + + 1 + + + + TextLine + 0 + + +


+
+
+ 197 + +
+ + + + 260 + 4 + 4 + + + quarter + + 65 + 13 + + + + quarter + + + half + + + + + measure + + + + + measure + + + 5 + + + + + + + 260 + 4 + 4 + + + measure + + + + + measure + + + + + measure + + + + -1 +
diff --git a/mtest/libmscore/compat114/textline-ref.mscx b/mtest/libmscore/compat114/textline-ref.mscx new file mode 100644 index 000000000000..2657abbab563 --- /dev/null +++ b/mtest/libmscore/compat114/textline-ref.mscx @@ -0,0 +1,164 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + 2 + + + + + + Piano + + Piano + Pno. + Piano + 21 + 108 + 21 + 108 + + 100 + 100 + + + 100 + 50 + + + 100 + 100 + + + 120 + 100 + + + + + + + + + + + + G + G + + + 4 + 4 + + + <font size="12"/><font face="Times New Roman"/>VII + + + quarter + + 65 + 13 + + + + quarter + + + half + + + + + + measure + 4/4 + + + + + measure + 4/4 + + + end + 1 + + + + + + + F + F + + + 4 + 4 + + + measure + 4/4 + + + + + measure + 4/4 + + + + + measure + 4/4 + + + + + diff --git a/mtest/libmscore/compat114/textline.mscx b/mtest/libmscore/compat114/textline.mscx new file mode 100644 index 000000000000..421a05d02564 --- /dev/null +++ b/mtest/libmscore/compat114/textline.mscx @@ -0,0 +1,178 @@ + + + 1.3 + 5702 + 1.76389 + 480 + + 1 + 1 + + A4 + + 56.6929 + 56.6929 + 56.6929 + 113.386 + + + 56.6929 + 56.6929 + 56.6929 + 113.386 + + 0 + + + + 4 + 4 + + + + + + + + + + + + + + 2 + + + + + + + + + + + + InstrumentLong + 0 + + +

Piano

+
+
+ + + InstrumentShort + 0 + + +

Pno.

+
+
+ + 21 + 108 + 21 + 108 + Piano + + + + + + + + + + +
+ + 1.5 + 0.15 + 1 + + left + left + 1920 + + + + + + 1 + + + + TextLine + 0 + + +

VII

+
+
+
+ + + + 260 + 4 + 4 + + + quarter + + 65 + 13 + + + + quarter + + + half + + + + + measure + + + + + measure + + + 5 + + + + + + + 260 + 4 + 4 + + + measure + + + + + measure + + + + + measure + + + + -1 +
diff --git a/mtest/libmscore/compat114/tst_compat114.cpp b/mtest/libmscore/compat114/tst_compat114.cpp index a4ed5119fa8a..edfc0fc8f249 100644 --- a/mtest/libmscore/compat114/tst_compat114.cpp +++ b/mtest/libmscore/compat114/tst_compat114.cpp @@ -60,6 +60,9 @@ void TestCompat114::compat_data() QTest::newRow("hairpin") << "hairpin"; QTest::newRow("articulations") << "articulations"; QTest::newRow("textstyles") << "textstyles"; + QTest::newRow("pedal") << "pedal"; + QTest::newRow("textline") << "textline"; + QTest::newRow("ottava") << "ottava"; QTest::newRow("title") << "title"; //TODO QTest::newRow("notes_useroffset") << "notes_useroffset"; QTest::newRow("tremolo2notes") << "tremolo2notes";