Merge pull request #822 from Isensee/25112-slur-on-grace-export
fix #25112 export slur on grace notes
This commit is contained in:
commit
807e1dabfe
3 changed files with 33 additions and 5 deletions
|
@ -233,7 +233,7 @@ class SlurHandler {
|
|||
|
||||
public:
|
||||
SlurHandler();
|
||||
void doSlurStart(Chord* chord, Notations& notations, Xml& xml);
|
||||
void doSlurStart(Chord* chord, Notations& notations, Xml& xml, bool grace = false);
|
||||
void doSlurStop(Chord* chord, Notations& notations, Xml& xml);
|
||||
};
|
||||
|
||||
|
@ -445,8 +445,28 @@ int SlurHandler::findSlur(const Slur* s) const
|
|||
// doSlurStart
|
||||
//---------------------------------------------------------
|
||||
|
||||
void SlurHandler::doSlurStart(Chord* chord, Notations& notations, Xml& xml)
|
||||
void SlurHandler::doSlurStart(Chord* chord, Notations& notations, Xml& xml, bool grace)
|
||||
{
|
||||
// slurs on grace notes are not in spanner list, therefore:
|
||||
if (grace){
|
||||
foreach(Element* el, chord->el()){
|
||||
if (el->type() == Element::SLUR){
|
||||
const Slur* s = static_cast<const Slur*>(el);
|
||||
//define line type
|
||||
QString rest = slurTieLineStyle(s);
|
||||
int i = findSlur(0);
|
||||
if (i >= 0) {
|
||||
slur[i] = s;
|
||||
started[i] = true;
|
||||
notations.tag(xml);
|
||||
xml.tagE(QString("slur%1 type=\"start\" number=\"%2\"").arg(rest).arg(i + 1));
|
||||
}
|
||||
else
|
||||
qDebug("no free slur slot");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// search for slur(s) starting at this chord
|
||||
int tick = chord->tick();
|
||||
auto sl = chord->score()->spanner();
|
||||
|
@ -2309,9 +2329,11 @@ void ExportMusicXml::chord(Chord* chord, int staff, const QList<Lyrics*>* ll, bo
|
|||
}
|
||||
|
||||
if (note == nl.front()) {
|
||||
if (grace){
|
||||
sh.doSlurStart(chord, notations, xml, true);
|
||||
}
|
||||
else {
|
||||
tupletStartStop(chord, notations, xml);
|
||||
if (!grace) {
|
||||
// handle slurs between normal (non-grace) notes
|
||||
sh.doSlurStop(chord, notations, xml);
|
||||
sh.doSlurStart(chord, notations, xml);
|
||||
}
|
||||
|
|
|
@ -4153,6 +4153,10 @@ void MusicXml::xmlNotations(Note* note, ChordRest* cr, int trk, int ticks, QDomE
|
|||
bool endSlur = false;
|
||||
if (slur[slurNo] == 0) {
|
||||
slur[slurNo] = new Slur(score);
|
||||
if(cr->isGrace()){
|
||||
slur[slurNo]->setAnchor(Spanner::ANCHOR_CHORD);
|
||||
slur[slurNo]->setParent(cr);
|
||||
}
|
||||
if (lineType == "dotted")
|
||||
slur[slurNo]->setLineType(1);
|
||||
else if (lineType == "dashed")
|
||||
|
|
|
@ -4105,6 +4105,8 @@ void ScoreView::cmdAddSlur(Note* firstNote, Note* lastNote)
|
|||
|
||||
slur->setStartChord(static_cast<Chord*>(cr1));
|
||||
slur->setEndChord(static_cast<Chord*>(cr2));
|
||||
slur->setTick(cr1->tick());
|
||||
slur->setTick2(cr2->tick());
|
||||
slur->setTrack(cr1->track());
|
||||
slur->setTrack2(cr2->track());
|
||||
slur->setParent(cr1);
|
||||
|
|
Loading…
Reference in a new issue