Skip to content

Commit 4ae5a98

Browse files
committed
independent slur/tie style settings
1 parent f1d4b52 commit 4ae5a98

File tree

11 files changed

+533
-243
lines changed

11 files changed

+533
-243
lines changed

src/engraving/internal/engravingfont.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ void EngravingFont::loadEngravingDefaults(const JsonObject& engravingDefaultsObj
438438
{ "legerLineExtension", { { Sid::ledgerLineLength } } },
439439
{ "slurEndpointThickness", { { Sid::SlurEndWidth } } },
440440
{ "slurMidpointThickness", { { Sid::SlurMidWidth } } },
441-
// "tieEndpointThickness" not supported
442-
// "tieMidpointThickness" not supported
441+
{ "tieEndpointThickness", { { Sid::TieEndWidth } } },
442+
{ "tieMidpointThickness", { { Sid::TieMidWidth } } },
443443
{ "thinBarlineThickness", { { Sid::barWidth, Sid::doubleBarWidth } } },
444444
{ "thickBarlineThickness", { { Sid::endBarWidth } } },
445445
// "dashedBarlineThickness" not supported

src/engraving/rendering/dev/slurtielayout.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,11 +2446,15 @@ void SlurTieLayout::layoutSegment(SlurSegment* item, LayoutContext& ctx, const P
24462446

24472447
void SlurTieLayout::computeMidThickness(SlurTieSegment* slurTieSeg, double slurTieLengthInSp)
24482448
{
2449+
const Millimetre endWidth = slurTieSeg->isTieSegment() ? slurTieSeg->style().styleMM(Sid::TieEndWidth)
2450+
: slurTieSeg->style().styleMM(Sid::SlurEndWidth);
2451+
const Millimetre midWidth = slurTieSeg->isTieSegment() ? slurTieSeg->style().styleMM(Sid::TieMidWidth)
2452+
: slurTieSeg->style().styleMM(Sid::SlurMidWidth);
24492453
const double mag = slurTieSeg->staff() ? slurTieSeg->staff()->staffMag(slurTieSeg->slurTie()->tick()) : 1.0;
24502454
const double minTieLength = mag * slurTieSeg->style().styleS(Sid::MinTieLength).val();
24512455
const double shortTieLimit = mag * 4.0;
2452-
const double minTieThickness = mag * (0.15 * slurTieSeg->spatium() - slurTieSeg->style().styleMM(Sid::SlurEndWidth));
2453-
const double normalThickness = mag * (slurTieSeg->style().styleMM(Sid::SlurMidWidth) - slurTieSeg->style().styleMM(Sid::SlurEndWidth));
2456+
const double minTieThickness = mag * (0.15 * slurTieSeg->spatium() - endWidth);
2457+
const double normalThickness = mag * (midWidth - endWidth);
24542458

24552459
bool invalid = RealIsEqualOrMore(minTieLength, shortTieLimit);
24562460

src/engraving/rendering/dev/tdraw.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,23 +2943,23 @@ void TDraw::draw(const TieSegment* item, Painter* painter)
29432943
painter->setBrush(Brush(pen.color()));
29442944
pen.setCapStyle(PenCapStyle::RoundCap);
29452945
pen.setJoinStyle(PenJoinStyle::RoundJoin);
2946-
pen.setWidthF(item->style().styleMM(Sid::SlurEndWidth) * mag);
2946+
pen.setWidthF(item->style().styleMM(Sid::TieEndWidth) * mag);
29472947
break;
29482948
case SlurStyleType::Dotted:
29492949
painter->setBrush(BrushStyle::NoBrush);
29502950
pen.setCapStyle(PenCapStyle::RoundCap); // True dots
29512951
pen.setDashPattern(dotted);
2952-
pen.setWidthF(item->style().styleMM(Sid::SlurDottedWidth) * mag);
2952+
pen.setWidthF(item->style().styleMM(Sid::TieDottedWidth) * mag);
29532953
break;
29542954
case SlurStyleType::Dashed:
29552955
painter->setBrush(BrushStyle::NoBrush);
29562956
pen.setDashPattern(dashed);
2957-
pen.setWidthF(item->style().styleMM(Sid::SlurDottedWidth) * mag);
2957+
pen.setWidthF(item->style().styleMM(Sid::TieDottedWidth) * mag);
29582958
break;
29592959
case SlurStyleType::WideDashed:
29602960
painter->setBrush(BrushStyle::NoBrush);
29612961
pen.setDashPattern(wideDashed);
2962-
pen.setWidthF(item->style().styleMM(Sid::SlurDottedWidth) * mag);
2962+
pen.setWidthF(item->style().styleMM(Sid::TieDottedWidth) * mag);
29632963
break;
29642964
case SlurStyleType::Undefined:
29652965
break;

src/engraving/rendering/single/singledraw.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,23 +2347,23 @@ void SingleDraw::draw(const TieSegment* item, Painter* painter)
23472347
painter->setBrush(Brush(pen.color()));
23482348
pen.setCapStyle(PenCapStyle::RoundCap);
23492349
pen.setJoinStyle(PenJoinStyle::RoundJoin);
2350-
pen.setWidthF(item->style().styleMM(Sid::SlurEndWidth) * mag);
2350+
pen.setWidthF(item->style().styleMM(Sid::TieEndWidth) * mag);
23512351
break;
23522352
case SlurStyleType::Dotted:
23532353
painter->setBrush(BrushStyle::NoBrush);
23542354
pen.setCapStyle(PenCapStyle::RoundCap); // True dots
23552355
pen.setDashPattern(dotted);
2356-
pen.setWidthF(item->style().styleMM(Sid::SlurDottedWidth) * mag);
2356+
pen.setWidthF(item->style().styleMM(Sid::TieDottedWidth) * mag);
23572357
break;
23582358
case SlurStyleType::Dashed:
23592359
painter->setBrush(BrushStyle::NoBrush);
23602360
pen.setDashPattern(dashed);
2361-
pen.setWidthF(item->style().styleMM(Sid::SlurDottedWidth) * mag);
2361+
pen.setWidthF(item->style().styleMM(Sid::TieDottedWidth) * mag);
23622362
break;
23632363
case SlurStyleType::WideDashed:
23642364
painter->setBrush(BrushStyle::NoBrush);
23652365
pen.setDashPattern(wideDashed);
2366-
pen.setWidthF(item->style().styleMM(Sid::SlurDottedWidth) * mag);
2366+
pen.setWidthF(item->style().styleMM(Sid::TieDottedWidth) * mag);
23672367
break;
23682368
case SlurStyleType::Undefined:
23692369
break;

src/engraving/style/style.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,27 @@ void MStyle::read(XmlReader& e, compat::ReadChordListHook* readChordListHook)
371371
if (pedContText != "") {
372372
set(Sid::pedalText, pedContText);
373373
}
374+
} else if ((tag == "slurEndWidth"
375+
|| tag == "slurMidWidth"
376+
|| tag == "slurDottedWidth"
377+
|| tag == "slurMinDistance")
378+
&& m_version < 430) {
379+
// Pre-4.3 scores used identical style values for slurs and ties.
380+
// When opening older scores, use the same values for both.
381+
double _val = e.readDouble();
382+
if (tag == "slurEndWidth") {
383+
set(Sid::TieEndWidth, Spatium(_val));
384+
set(Sid::SlurEndWidth, Spatium(_val));
385+
} else if (tag == "slurMidWidth") {
386+
set(Sid::TieMidWidth, Spatium(_val));
387+
set(Sid::SlurMidWidth, Spatium(_val));
388+
} else if (tag == "slurDottedWidth") {
389+
set(Sid::TieDottedWidth, Spatium(_val));
390+
set(Sid::SlurDottedWidth, Spatium(_val));
391+
} else if (tag == "slurMinDistance") {
392+
set(Sid::TieMinDistance, Spatium(_val));
393+
set(Sid::SlurMinDistance, Spatium(_val));
394+
}
374395
} else if (!readProperties(e)) {
375396
e.unknown();
376397
}

src/engraving/style/styledef.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,14 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
477477
{ Sid::SlurEndWidth, "slurEndWidth", Spatium(.05) },
478478
{ Sid::SlurMidWidth, "slurMidWidth", Spatium(.21) },
479479
{ Sid::SlurDottedWidth, "slurDottedWidth", Spatium(.10) },
480+
{ Sid::TieEndWidth, "tieEndWidth", Spatium(.05) },
481+
{ Sid::TieMidWidth, "tieMidWidth", Spatium(.21) },
482+
{ Sid::TieDottedWidth, "tieDottedWidth", Spatium(.10) },
480483
{ Sid::MinTieLength, "minTieLength", Spatium(1.0) },
481484
{ Sid::MinStraightGlissandoLength, "minStraightGlissandoLength", Spatium(1.2) },
482485
{ Sid::MinWigglyGlissandoLength, "minWigglyGlissandoLength", Spatium(2.0) },
483486
{ Sid::SlurMinDistance, "slurMinDistance", Spatium(0.5) },
487+
{ Sid::TieMinDistance, "tieMinDistance", Spatium(0.5) },
484488
{ Sid::HeaderToLineStartDistance, "headerSlurTieDistance", Spatium(1.0) },
485489

486490
{ Sid::tiePlacementSingleNote, "tiePlacementSingleNote", TiePlacement::OUTSIDE },

src/engraving/style/styledef.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,14 @@ enum class Sid {
487487
SlurEndWidth,
488488
SlurMidWidth,
489489
SlurDottedWidth,
490+
TieEndWidth,
491+
TieMidWidth,
492+
TieDottedWidth,
490493
MinTieLength,
491494
MinStraightGlissandoLength,
492495
MinWigglyGlissandoLength,
493496
SlurMinDistance,
497+
TieMinDistance,
494498
HeaderToLineStartDistance, // determines start point of "dangling" lines (ties, gliss, lyrics...) at start of system
495499

496500
tiePlacementSingleNote,

src/importexport/musicxml/internal/musicxml/exportxml.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,8 @@ static void defaults(XmlWriter& xml, const MStyle& s, double& millimeters, const
13791379
xml.tag("line-width", { { "type", "slur tip" } }, s.styleS(Sid::SlurEndWidth).val() * 10);
13801380
xml.tag("line-width", { { "type", "staff" } }, s.styleS(Sid::staffLineWidth).val() * 10);
13811381
xml.tag("line-width", { { "type", "stem" } }, s.styleS(Sid::stemWidth).val() * 10);
1382-
xml.tag("line-width", { { "type", "tie middle" } }, s.styleS(Sid::SlurMidWidth).val() * 10);
1383-
xml.tag("line-width", { { "type", "tie tip" } }, s.styleS(Sid::SlurEndWidth).val() * 10);
1382+
xml.tag("line-width", { { "type", "tie middle" } }, s.styleS(Sid::TieMidWidth).val() * 10);
1383+
xml.tag("line-width", { { "type", "tie tip" } }, s.styleS(Sid::TieEndWidth).val() * 10);
13841384
xml.tag("line-width", { { "type", "tuplet bracket" } }, s.styleS(Sid::tupletBracketWidth).val() * 10);
13851385
xml.tag("line-width", { { "type", "wedge" } }, s.styleS(Sid::hairpinLineWidth).val() * 10);
13861386
// note size values in percent

src/importexport/musicxml/internal/musicxml/importmxmlpass1.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,10 +1737,14 @@ void MusicXMLParserPass1::setStyle(const String& type, const double val)
17371737
m_score->style().set(Sid::tupletBracketWidth, Spatium(val / 10));
17381738
} else if (type == u"wedge") {
17391739
m_score->style().set(Sid::hairpinLineWidth, Spatium(val / 10));
1740-
} else if ((type == u"slur middle") || (type == u"tie middle")) {
1740+
} else if (type == u"slur middle") {
17411741
m_score->style().set(Sid::SlurMidWidth, Spatium(val / 10));
1742-
} else if ((type == u"slur tip") || (type == u"tie tip")) {
1742+
} else if (type == u"slur tip") {
17431743
m_score->style().set(Sid::SlurEndWidth, Spatium(val / 10));
1744+
} else if (type == u"tie middle") {
1745+
m_score->style().set(Sid::TieMidWidth, Spatium(val / 10));
1746+
} else if (type == u"tie tip") {
1747+
m_score->style().set(Sid::TieEndWidth, Spatium(val / 10));
17441748
} else if ((type == u"cue")) {
17451749
m_score->style().set(Sid::smallNoteMag, val / 100);
17461750
} else if ((type == u"grace")) {

src/notation/view/widgets/editstyle.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ EditStyle::EditStyle(QWidget* parent)
438438
{ StyleId::SlurMidWidth, false, slurMidLineWidth, resetSlurMidLineWidth },
439439
{ StyleId::SlurDottedWidth, false, slurDottedLineWidth, resetSlurDottedLineWidth },
440440
{ StyleId::SlurMinDistance, false, slurMinDistance, resetSlurMinDistance },
441+
{ StyleId::TieEndWidth, false, tieEndLineWidth, resetTieEndLineWidth },
442+
{ StyleId::TieMidWidth, false, tieMidLineWidth, resetTieMidLineWidth },
443+
{ StyleId::TieDottedWidth, false, tieDottedLineWidth, resetTieDottedLineWidth },
444+
{ StyleId::TieMinDistance, false, tieMinDistance, resetTieMinDistance },
441445
{ StyleId::MinTieLength, false, minTieLength, resetMinTieLength },
442446
{ StyleId::bracketWidth, false, bracketWidth, resetBracketThickness },
443447
{ StyleId::bracketDistance, false, bracketDistance, resetBracketDistance },

0 commit comments

Comments
 (0)