Skip to content

Commit

Permalink
add special function
Browse files Browse the repository at this point in the history
  • Loading branch information
rettinghaus committed Feb 18, 2025
1 parent a0a1361 commit 6aaa8b0
Showing 1 changed file with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -796,25 +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 String();
}

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);
}
return rest;
}

Expand Down Expand Up @@ -938,6 +943,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
Expand Down Expand Up @@ -983,6 +989,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");
Expand All @@ -993,6 +1000,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);
}
}
Expand Down

0 comments on commit 6aaa8b0

Please sign in to comment.