Slurs on grace notes after are displaced
Slurs on a single grace note after, as well as on the last of several grace notes after, tie the grace note to the following main note, not, as they should, to the parent note, which is the main note before.
Generally, grace notes after must be handled in reverse order.
Solution is:
scoreview.cpp, ln. 4528 ff.
void ScoreView::cmdAddSlur(Note* firstNote, Note* lastNote) { _score->startCmd(); ChordRest* cr1; ChordRest* cr2; cr1 = firstNote->chord(); // instead of // cr2 = lastNote ? lastNote->chord() : nextChordRest(cr1); if (firstNote->chord()->isGraceAfter()) cr2 = lastNote ? lastNote->chord() : prevChordRest(cr1); else cr2 = lastNote ? lastNote->chord() : nextChordRest(cr1); // end instead if (cr2 == 0) cr2 = cr1; Slur* slur = new Slur(_score); slur->setTick(cr1->tick()); slur->setTick2(cr2->tick()); slur->setTrack(cr1->track()); if (cr2->staff()->part() == cr1->staff()->part() && !cr2->staff()->isLinked(cr1->staff())) slur->setTrack2(cr2->track()); else slur->setTrack2(cr1->track()); // instead of // slur->setStartElement(cr1); // slur->setEndElement(cr2); slur->setStartElement(firstNote->chord()->isGraceAfter() ? cr2 : cr1); slur->setEndElement(firstNote->chord()->isGraceAfter() ? cr1 : cr2); // end instead _score->undoAddElement(slur); slur->layout();
Comments
Slurs always connect the current note with the following, regardless of whether its a grace/cue/regular note. Changing that behavior to special case a grace note after would only work confusing imo.
And if we were to change that behavior, how do you propose I then still add a slur between the grace note after and the next note?
Sorry, but grace notes after are generally slurred to their main note, not to the next note, conventionally. "Grace notes after" belong, as their name tells, but also within the MuseScore architecture, to the main note before. So we have to implement that, if we like it or not. But, by the way, this is not even contrary to your general implementation rule: In fact grace notes after appear logically in reverse order, from point of view of the MuseScore implementation. You may whatch that, when inserting several grace notes "before" and "after", and you may realize it looking into the code. From this point of view, the desired behaviour is no exception for a special case, but quite regular.
A composer, who wants to notate a grace note slurred to the following main note, normally will add a grace note before to this note. On the other hand there is no way to realize the general case for grace notes after with the present implementation.
The change of code, shown above, is small and clear and works fine.
The change in code prevents me from connecting a grace note after with the next note, that is taking away functionality. Simply start the slur at the main note and it will extend to the grace note.
I'm confused. What specifically qre you having trouble doing currently? Maybe I'm misunderstanding. But if I have a note C, a grace after D, and then a following note E, I can slur the C to the D by first selecting the C and then adding the slur, or slur the D to the E by first selecting the D and then adding the slur, or slur directly from the the C to the E by selecting the full range than adding the slur, or by first slurring the C to the D and then presisng Shift+right. What is it you are saying you are having trouble doing currently?
Whoops - you are right! I am shure, about two weeks ago I saw a slur on the main note leading to the next main note. Of cause this way it is ok.Sorrry. I close this issue.