From b14999a428f52c54d7d1e584460a37889bb7a285 Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Tue, 18 Feb 2025 14:45:49 +0100 Subject: [PATCH] add special function --- .../musicxml/export/exportmusicxml.cpp | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp index f08ecf6d5ba9f..173f4c5c67243 100644 --- a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp @@ -796,26 +796,30 @@ static String slurTieLineStyle(const SlurTie* s) rest += String(u" placement=\"%1\"").arg(s->up() ? u"above" : u"below"); } rest += color2xml(s); + return rest; +} - if (ExportMusicXml::configuration()->exportLayout()) { - const SlurSegment* front = toSlurSegment(s->frontSegment()); - const SlurSegment* back = toSlurSegment(s->backSegment()); - const int spatium = s->spatium(); - if (front) { - const PointF start = front->ups(Grip::START).pos(); - const PointF bezier = front->ups(Grip::BEZIER1).pos(); - rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - start.x()) / spatium); - rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium); - } - if (back) { - const PointF end = back->ups(Grip::END).pos(); - const PointF bezier = back->ups(Grip::BEZIER2).pos(); - rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - end.x()) / spatium); - rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium); - } +static String slurBezier(const Slur* s, const bool start); +{ + if (!ExportMusicXml::configuration()->exportLayout()) { + return; } - return rest; + String rest; + const int spatium = s->spatium(); + if (start) { + const SlurSegment* front = s->frontSegment(); + const PointF start = front->ups(Grip::START).pos(); + const PointF bezier = front->ups(Grip::BEZIER1).pos(); + rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - start.x()) / spatium); + rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium); + } else { + const SlurSegment* back = s->backSegment(); + const PointF end = back->ups(Grip::END).pos(); + const PointF bezier = back->ups(Grip::BEZIER2).pos(); + rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - end.x()) / spatium); + rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium); + } } //--------------------------------------------------------- @@ -938,6 +942,7 @@ void SlurHandler::doSlurStart(const Slur* s, Notations& notations, XmlWriter& xm String tagName = u"slur"; tagName += u" type=\"start\""; tagName += slurTieLineStyle(s); + tagName += slurBezier(s, true); if (i >= 0) { // remove from list and print start @@ -983,6 +988,7 @@ void SlurHandler::doSlurStop(const Slur* s, Notations& notations, XmlWriter& xml m_started[i] = false; notations.tag(xml, s); String tagName = String(u"slur type=\"stop\" number=\"%1\"").arg(i + 1); + tagName += slurBezier(s, false); xml.tagRaw(tagName); } else { LOGD("no free slur slot"); @@ -993,6 +999,7 @@ void SlurHandler::doSlurStop(const Slur* s, Notations& notations, XmlWriter& xml m_started[i] = false; notations.tag(xml, s); String tagName = String(u"slur type=\"stop\" number=\"%1\"").arg(i + 1); + tagName += slurBezier(s, false); xml.tagRaw(tagName); } }