@@ -64,6 +64,7 @@ ChordRest::ChordRest(Score* s)
6464 _up = true ;
6565 _beamMode = Beam::Mode::AUTO;
6666 m_isSmall = false ;
67+ _melismaEnd = false ;
6768 _crossMeasure = CrossMeasure::UNKNOWN;
6869 }
6970
@@ -79,7 +80,7 @@ ChordRest::ChordRest(const ChordRest& cr, bool link)
7980 _beamMode = cr._beamMode ;
8081 _up = cr._up ;
8182 m_isSmall = cr.m_isSmall ;
82- _melismaEnds = cr._melismaEnds ;
83+ _melismaEnd = cr._melismaEnd ;
8384 _crossMeasure = cr._crossMeasure ;
8485
8586 for (Lyrics* l : cr._lyrics ) { // make deep copy
@@ -1231,21 +1232,20 @@ QString ChordRest::accessibleExtraInfo() const
12311232
12321233bool ChordRest::isMelismaEnd () const
12331234 {
1234- return !_melismaEnds. empty () ;
1235+ return _melismaEnd ;
12351236 }
12361237
12371238// ---------------------------------------------------------
1238- // removeMelismaEnd()
1239- // removes a Lyrics object from the _melismaEnds set
1240- // if present by iterating through the set.
1241- // Returns a boolean representing whether the Lyrics
1242- // was found.
1243- // No-op and return false if Lyrics not present in _melismaEnds.
1239+ // setMelismaEnd
12441240// ---------------------------------------------------------
12451241
1246- void ChordRest::removeMelismaEnd (Lyrics* const l )
1242+ void ChordRest::setMelismaEnd ( bool v )
12471243 {
1248- _melismaEnds.erase (l);
1244+ _melismaEnd = v;
1245+ // TODO: don't take "false" at face value
1246+ // check to see if some other melisma ends here,
1247+ // in which case we can leave this set to true
1248+ // for now, rely on the fact that we'll generate the value correctly on layout
12491249 }
12501250
12511251// ---------------------------------------------------------
@@ -1256,8 +1256,6 @@ Shape ChordRest::shape() const
12561256 {
12571257 Shape shape;
12581258 {
1259- // Add horizontal spacing for lyrics
1260-
12611259 qreal x1 = 1000000.0 ;
12621260 qreal x2 = -1000000.0 ;
12631261 bool adjustWidth = false ;
@@ -1267,14 +1265,11 @@ Shape ChordRest::shape() const
12671265 qreal lmargin = score ()->styleS (Sid::lyricsMinDistance).val () * spatium () * 0.5 ;
12681266 qreal rmargin = lmargin;
12691267 Lyrics::Syllabic syl = l->syllabic ();
1270- bool hasHyphen = syl == Lyrics::Syllabic::BEGIN || syl == Lyrics::Syllabic::MIDDLE;
1271- if (hasHyphen && score ()->styleB (Sid::lyricsDashForce))
1268+ if ((syl == Lyrics::Syllabic::BEGIN || syl == Lyrics::Syllabic::MIDDLE) && score ()->styleB (Sid::lyricsDashForce))
12721269 rmargin = qMax (rmargin, styleP (Sid::lyricsDashMinLength));
1273- // for horizontal spacing we only need the lyrics' width:
1270+ // for horizontal spacing we only need the lyrics width:
12741271 x1 = qMin (x1, l->bbox ().x () - lmargin + l->pos ().x ());
1275- // Melismas (without hyphens) only create right spacing on their last note
1276- if (!l->isMelisma () || hasHyphen)
1277- x2 = qMax (x2, l->bbox ().x () + l->bbox ().width () + rmargin + l->pos ().x ());
1272+ x2 = qMax (x2, l->bbox ().x () + l->bbox ().width () + rmargin + l->pos ().x ());
12781273 if (l->ticks () == Fraction::fromTicks (Lyrics::TEMP_MELISMA_TICKS))
12791274 x2 += spatium ();
12801275 adjustWidth = true ;
@@ -1284,8 +1279,6 @@ Shape ChordRest::shape() const
12841279 }
12851280
12861281 {
1287- // Add horizontal spacing for annotations
1288-
12891282 qreal x1 = 1000000.0 ;
12901283 qreal x2 = -1000000.0 ;
12911284 bool adjustWidth = false ;
@@ -1332,24 +1325,8 @@ Shape ChordRest::shape() const
13321325 }
13331326
13341327 if (isMelismaEnd ()) {
1335- // Add horizontal spacing (only on the right) for melismaEnds
1336- // in case a melisma syllable extends beyond its last note.
1337- // TODO: distribute this extra spacing rather than dumping
1338- // it all on the last note (or otherwise overhaul horizontal spacing).
1339- // TODO: this doesn't redraw on layout reset (like line breaks),
1340- // causing temporary incorrect rendering.
1341-
1342- qreal rmargin = score ()->styleS (Sid::lyricsMinDistance).val () * spatium () * 0.5 ;
13431328 qreal right = rightEdge ();
1344-
1345- for (Lyrics* me : melismaEnds ()) {
1346- if (me->measure ()->system () != measure ()->system ()) // ignore cross-system melisma
1347- continue ;
1348- // Lyric's right edge relative to Chord by way of page position
1349- qreal meRight = me->pageBoundingRect ().right () + rmargin - pagePos ().x ();
1350- right = qMax (right, meRight);
1351- }
1352- shape.addHorizontalSpacing (Shape::SPACING_LYRICS, 0 , right);
1329+ shape.addHorizontalSpacing (Shape::SPACING_LYRICS, right, right);
13531330 }
13541331
13551332 return shape;
0 commit comments