@@ -1502,7 +1502,7 @@ TieSegment* SlurTieLayout::tieLayoutFor(Tie* item, System* system)
1502
1502
segment->setSystem (system); // Needed to populate System.spannerSegments
1503
1503
segment->resetAdjustmentOffset ();
1504
1504
1505
- Chord* startChord = item->startNote ()->chord ();
1505
+ const Chord* startChord = item->startNote ()->chord ();
1506
1506
item->setTick (startChord->tick ()); // Why is this here?? (M.S.)
1507
1507
1508
1508
if (segment->autoplace () && !segment->isEdited ()) {
@@ -1529,9 +1529,11 @@ TieSegment* SlurTieLayout::tieLayoutFor(Tie* item, System* system)
1529
1529
1530
1530
TieSegment* SlurTieLayout::tieLayoutBack (Tie* item, System* system, LayoutContext& ctx)
1531
1531
{
1532
+ Chord* chord = item->endNote () ? item->endNote ()->chord () : nullptr ;
1533
+
1532
1534
if (item->staffType () && item->staffType ()->isTabStaff ()) {
1533
1535
// On TAB, the presence of this tie may require to add a parenthesis
1534
- ChordLayout::layout (item-> endNote ()-> chord () , ctx);
1536
+ ChordLayout::layout (chord, ctx);
1535
1537
}
1536
1538
// do not layout ties in tablature if not showing back-tied fret marks
1537
1539
if (tieSegmentShouldBeSkipped (item)) {
@@ -1556,6 +1558,10 @@ TieSegment* SlurTieLayout::tieLayoutBack(Tie* item, System* system, LayoutContex
1556
1558
segment->setSystem (system);
1557
1559
segment->resetAdjustmentOffset ();
1558
1560
1561
+ if (chord) {
1562
+ segment->setStaffMove (chord->vStaffIdx () - segment->staffIdx ());
1563
+ }
1564
+
1559
1565
adjustY (segment);
1560
1566
segment->setSpannerSegmentType (SpannerSegmentType::END);
1561
1567
@@ -1672,7 +1678,7 @@ void SlurTieLayout::correctForCrossStaff(Tie* tie, SlurTiePos& sPos)
1672
1678
return ;
1673
1679
}
1674
1680
1675
- if (startChord->vStaffIdx () != tie->staffIdx () && sPos .system1 ) {
1681
+ if (startChord->vStaffIdx () != tie->staffIdx () && sPos .system1 && sPos . system1 == sPos . system2 ) {
1676
1682
double yOrigin = sPos .system1 ->staff (tie->staffIdx ())->y ();
1677
1683
double yMoved = sPos .system1 ->staff (startChord->vStaffIdx ())->y ();
1678
1684
double yDiff = yMoved - yOrigin;
@@ -1684,7 +1690,7 @@ void SlurTieLayout::correctForCrossStaff(Tie* tie, SlurTiePos& sPos)
1684
1690
return ;
1685
1691
}
1686
1692
1687
- if (endChord->vStaffIdx () != tie->staffIdx () && sPos .system2 ) {
1693
+ if (endChord->vStaffIdx () != tie->staffIdx () && sPos .system2 && sPos . system2 == sPos . system1 ) {
1688
1694
double yOrigin = sPos .system2 ->staff (tie->staffIdx ())->y ();
1689
1695
double yMoved = sPos .system2 ->staff (endChord->vStaffIdx ())->y ();
1690
1696
double yDiff = yMoved - yOrigin;
@@ -1744,7 +1750,7 @@ void SlurTieLayout::adjustX(TieSegment* tieSegment, SlurTiePos& sPos, Grip start
1744
1750
}
1745
1751
1746
1752
PointF chordSystemPos = chord->pos () + chord->segment ()->pos () + chord->measure ()->pos ();
1747
- if (chord->vStaffIdx () != tieSegment->staffIdx ()) {
1753
+ if (chord->vStaffIdx () != tieSegment->vStaffIdx ()) {
1748
1754
System* system = tieSegment->system ();
1749
1755
double yDiff = system->staff (chord->vStaffIdx ())->y () - system->staff (tie->staffIdx ())->y ();
1750
1756
chordSystemPos += PointF (0.0 , yDiff);
@@ -1852,7 +1858,7 @@ void SlurTieLayout::adjustYforLedgerLines(TieSegment* tieSegment, SlurTiePos& sP
1852
1858
1853
1859
void SlurTieLayout::adjustY (TieSegment* tieSegment)
1854
1860
{
1855
- Staff* staff = tieSegment->staff () ;
1861
+ Staff* staff = tieSegment->score () ? tieSegment-> score ()-> staff (tieSegment-> vStaffIdx ()) : nullptr ;
1856
1862
if (!staff) {
1857
1863
return ;
1858
1864
}
@@ -2009,7 +2015,14 @@ void SlurTieLayout::resolveVerticalTieCollisions(const std::vector<TieSegment*>&
2009
2015
return ;
2010
2016
}
2011
2017
2012
- Staff* staff = thisTie->staff ();
2018
+ if (!thisTie->score ()) {
2019
+ return ;
2020
+ }
2021
+ Staff* staff = thisTie->score () ? thisTie->score ()->staff (thisTie->vStaffIdx ()) : nullptr ;
2022
+ if (!staff) {
2023
+ return ;
2024
+ }
2025
+
2013
2026
Fraction tick = thisTie->tick ();
2014
2027
double yMidPoint = 0.5 * (thisTieOuterY + nextTieInnerY);
2015
2028
double halfLineDist = 0.5 * staff->lineDistance (tick) * spatium;
@@ -2481,7 +2494,8 @@ void SlurTieLayout::computeMidThickness(SlurTieSegment* slurTieSeg, double slurT
2481
2494
: slurTieSeg->style ().styleMM (Sid::SlurEndWidth);
2482
2495
const Millimetre midWidth = slurTieSeg->isTieSegment () ? slurTieSeg->style ().styleMM (Sid::TieMidWidth)
2483
2496
: slurTieSeg->style ().styleMM (Sid::SlurMidWidth);
2484
- const double mag = slurTieSeg->staff () ? slurTieSeg->staff ()->staffMag (slurTieSeg->slurTie ()->tick ()) : 1.0 ;
2497
+ Staff* staff = slurTieSeg->score () ? slurTieSeg->score ()->staff (slurTieSeg->vStaffIdx ()) : nullptr ;
2498
+ const double mag = staff ? staff->staffMag (slurTieSeg->slurTie ()->tick ()) : 1.0 ;
2485
2499
const double minTieLength = mag * slurTieSeg->style ().styleS (Sid::MinTieLength).val ();
2486
2500
const double shortTieLimit = mag * 4.0 ;
2487
2501
const double minTieThickness = mag * (0.15 * slurTieSeg->spatium () - endWidth);
0 commit comments