Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions src/engraving/compat/engravingcompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,6 @@ void EngravingCompat::doPostLayoutCompatIfNeeded(MasterScore* score)
needRelayout |= setLyricLineVisibility(score);
}

if (mscVersion < 460) {
needRelayout |= resetHookHeightSign(score);
}

if (mscVersion < 440) {
needRelayout |= relayoutUserModifiedCrossStaffBeams(score);
}
Expand Down Expand Up @@ -353,38 +349,6 @@ bool EngravingCompat::relayoutUserModifiedCrossStaffBeams(MasterScore* score)
return found;
}

bool EngravingCompat::resetHookHeightSign(MasterScore* masterScore)
{
bool needRelayout = false;

for (Score* score : masterScore->scoreList()) {
for (auto pair : score->spanner()) {
Spanner* spanner = pair.second;
if (spanner->isTextLineBase()) {
for (SpannerSegment* spannerSeg : spanner->spannerSegments()) {
TextLineBaseSegment* textLineSeg = static_cast<TextLineBaseSegment*>(spannerSeg);
if (textLineSeg->placeBelow()) {
if (!textLineSeg->isStyled(Pid::BEGIN_HOOK_HEIGHT)) {
Spatium beginHookHeight = textLineSeg->getProperty(Pid::BEGIN_HOOK_HEIGHT).value<Spatium>();
textLineSeg->setProperty(Pid::BEGIN_HOOK_HEIGHT, -beginHookHeight);
spanner->triggerLayout();
needRelayout = true;
}
if (!textLineSeg->isStyled(Pid::END_HOOK_HEIGHT)) {
Spatium endHookHeight = textLineSeg->getProperty(Pid::END_HOOK_HEIGHT).value<Spatium>();
textLineSeg->setProperty(Pid::END_HOOK_HEIGHT, -endHookHeight);
spanner->triggerLayout();
needRelayout = true;
}
}
}
}
}
}

return needRelayout;
}

bool EngravingCompat::setLyricLineVisibility(MasterScore* masterScore)
{
bool needRelayout = false;
Expand Down
1 change: 0 additions & 1 deletion src/engraving/compat/engravingcompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class EngravingCompat
static void migrateNoteParens(MasterScore* masterScore);

static bool relayoutUserModifiedCrossStaffBeams(MasterScore* score);
static bool resetHookHeightSign(MasterScore* masterScore);
static bool setLyricLineVisibility(MasterScore* masterScore);
};
} // namespace mu::engraving::compat
16 changes: 16 additions & 0 deletions src/engraving/rw/compat/compatutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,22 @@ void CompatUtils::setTextLineTextPositionFromAlign(TextLineBase* tl)
}
}

void CompatUtils::resetHookHeightSign(TextLineBase* tl)
{
if (!tl->placeBelow()) {
return;
}

if (!tl->isStyled(Pid::BEGIN_HOOK_HEIGHT)) {
Spatium beginHookHeight = tl->getProperty(Pid::BEGIN_HOOK_HEIGHT).value<Spatium>();
tl->setProperty(Pid::BEGIN_HOOK_HEIGHT, -beginHookHeight);
}
if (!tl->isStyled(Pid::END_HOOK_HEIGHT)) {
Spatium endHookHeight = tl->getProperty(Pid::END_HOOK_HEIGHT).value<Spatium>();
tl->setProperty(Pid::END_HOOK_HEIGHT, -endHookHeight);
}
}

void compat::CompatUtils::setMusicSymbolSize470(MStyle* style)
{
// Music symbols have their own point size in 4.7
Expand Down
1 change: 1 addition & 0 deletions src/engraving/rw/compat/compatutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class CompatUtils
static const std::map<Sid, Sid> ALIGN_VALS_TO_CONVERT;
static void setPositionStylesFromAlign(MStyle* style, std::vector<Sid> ignoreSids = {});
static void setTextLineTextPositionFromAlign(TextLineBase* tl);
static void resetHookHeightSign(TextLineBase* tl);
static void setMusicSymbolSize470(MStyle* style);
static Spatium convertPre470FrameRadius(double frameRadius);
static void convertPre470ImageSize(Image* image);
Expand Down
7 changes: 7 additions & 0 deletions src/engraving/rw/read114/read114.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ static void readVolta114(XmlReader& e, ReadContext& ctx, Volta* volta)
}
volta->setOffset(PointF()); // ignore offsets
volta->setAutoplace(true);
CompatUtils::resetHookHeightSign(volta);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -1217,6 +1218,8 @@ static void readOttava114(XmlReader& e, ReadContext& ctx, Ottava* ottava)
e.unknown();
}
}

CompatUtils::resetHookHeightSign(ottava);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -1296,6 +1299,8 @@ static void readTextLine114(XmlReader& e, ReadContext& ctx, TextLine* textLine)
e.unknown();
}
}

CompatUtils::resetHookHeightSign(textLine);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -1389,6 +1394,8 @@ static void readPedal114(XmlReader& e, ReadContext& ctx, Pedal* pedal)
} else if (pedal->endText() == pedal->propertyDefault(Pid::END_TEXT).value<String>()) {
pedal->setPropertyFlags(Pid::END_TEXT, PropertyFlags::STYLED);
}

CompatUtils::resetHookHeightSign(pedal);
}

//---------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions src/engraving/rw/read206/read206.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,7 @@ static bool readTextLineProperties(XmlReader& e, ReadContext& ctx, TextLineBase*
} else if (!read400::TRead::readProperties(tl, e, ctx)) {
return false;
}

return true;
}

Expand Down Expand Up @@ -2175,6 +2176,7 @@ static void readVolta206(XmlReader& e, ReadContext& ctx, Volta* volta)
LOGW("Correcting volta anchor type from %d to %d", int(volta->anchor()), int(Volta::VOLTA_ANCHOR));
volta->setAnchor(Volta::VOLTA_ANCHOR);
}
CompatUtils::resetHookHeightSign(volta);
adjustPlacement(volta);
}

Expand Down Expand Up @@ -2220,6 +2222,7 @@ static void readPedal(XmlReader& e, ReadContext& ctx, Pedal* pedal)
pedal->setPropertyFlags(Pid::END_TEXT, PropertyFlags::STYLED);
}

CompatUtils::resetHookHeightSign(pedal);
adjustPlacement(pedal);
}

Expand Down Expand Up @@ -2254,6 +2257,7 @@ static void readOttava(XmlReader& e, ReadContext& ctx, Ottava* ottava)
}
}
ottava->styleChanged();
CompatUtils::resetHookHeightSign(ottava);
adjustPlacement(ottava);
}

Expand Down Expand Up @@ -2296,6 +2300,7 @@ void Read206::readHairpin206(XmlReader& e, ReadContext& ctx, Hairpin* h)
h->setContinueText(u"");
h->setEndText(u"");
}
CompatUtils::resetHookHeightSign(h);
adjustPlacement(h);
}

Expand Down Expand Up @@ -2331,6 +2336,7 @@ void Read206::readTextLine206(XmlReader& e, ReadContext& ctx, TextLineBase* tlb)
e.unknown();
}
}
CompatUtils::resetHookHeightSign(tlb);
adjustPlacement(tlb);
}

Expand Down
8 changes: 8 additions & 0 deletions src/engraving/rw/read400/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2663,6 +2663,7 @@ void TRead::read(GradualTempoChange* c, XmlReader& xml, ReadContext& ctx)
xml.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(c);
compat::CompatUtils::setTextLineTextPositionFromAlign(c);
}

Expand Down Expand Up @@ -2712,6 +2713,7 @@ void TRead::read(Hairpin* h, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(h);
compat::CompatUtils::setTextLineTextPositionFromAlign(h);

h->styleChanged();
Expand Down Expand Up @@ -2881,6 +2883,7 @@ void TRead::read(LetRing* r, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(r);
compat::CompatUtils::setTextLineTextPositionFromAlign(r);
}

Expand Down Expand Up @@ -3219,6 +3222,7 @@ void TRead::read(Ottava* o, XmlReader& e, ReadContext& ctx)
while (e.readNextStartElement()) {
readProperties(o, e, ctx);
}
compat::CompatUtils::resetHookHeightSign(o);
compat::CompatUtils::setTextLineTextPositionFromAlign(o);
if (o->ottavaType() != OttavaType::OTTAVA_8VA || o->numbersOnly() != o->propertyDefault(Pid::NUMBERS_ONLY).toBool()) {
o->styleChanged();
Expand Down Expand Up @@ -3285,6 +3289,7 @@ void TRead::read(PalmMute* p, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(p);
compat::CompatUtils::setTextLineTextPositionFromAlign(p);
}

Expand Down Expand Up @@ -3463,6 +3468,7 @@ void TRead::read(Pedal* p, XmlReader& e, ReadContext& ctx)
p->setPropertyFlags(Pid::END_TEXT, PropertyFlags::STYLED);
}

compat::CompatUtils::resetHookHeightSign(p);
compat::CompatUtils::setTextLineTextPositionFromAlign(p);
}

Expand Down Expand Up @@ -4010,6 +4016,7 @@ void TRead::read(TextLineBase* b, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(b);
compat::CompatUtils::setTextLineTextPositionFromAlign(b);
}

Expand Down Expand Up @@ -4414,6 +4421,7 @@ void TRead::read(Volta* v, XmlReader& e, ReadContext& ctx)
}
}

compat::CompatUtils::resetHookHeightSign(v);
compat::CompatUtils::setTextLineTextPositionFromAlign(v);
}

Expand Down
9 changes: 9 additions & 0 deletions src/engraving/rw/read410/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,7 @@ void TRead::read(GradualTempoChange* c, XmlReader& xml, ReadContext& ctx)
}
}

compat::CompatUtils::resetHookHeightSign(c);
compat::CompatUtils::setTextLineTextPositionFromAlign(c);
}

Expand Down Expand Up @@ -2976,6 +2977,7 @@ void TRead::read(Hairpin* h, XmlReader& e, ReadContext& ctx)
}
}

compat::CompatUtils::resetHookHeightSign(h);
compat::CompatUtils::setTextLineTextPositionFromAlign(h);

h->styleChanged();
Expand Down Expand Up @@ -3144,6 +3146,7 @@ void TRead::read(LetRing* r, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(r);
compat::CompatUtils::setTextLineTextPositionFromAlign(r);
}

Expand Down Expand Up @@ -3479,6 +3482,7 @@ void TRead::read(Ottava* o, XmlReader& e, ReadContext& ctx)
while (e.readNextStartElement()) {
readProperties(o, e, ctx);
}
compat::CompatUtils::resetHookHeightSign(o);
compat::CompatUtils::setTextLineTextPositionFromAlign(o);
if (o->ottavaType() != OttavaType::OTTAVA_8VA || o->numbersOnly() != o->propertyDefault(Pid::NUMBERS_ONLY).toBool()) {
o->styleChanged();
Expand Down Expand Up @@ -3534,6 +3538,7 @@ void TRead::read(PalmMute* p, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(p);
compat::CompatUtils::setTextLineTextPositionFromAlign(p);
}

Expand Down Expand Up @@ -3681,6 +3686,7 @@ void TRead::read(Pedal* p, XmlReader& e, ReadContext& ctx)
p->setPropertyFlags(Pid::END_TEXT, PropertyFlags::STYLED);
}
}
compat::CompatUtils::resetHookHeightSign(p);
compat::CompatUtils::setTextLineTextPositionFromAlign(p);
}

Expand Down Expand Up @@ -4229,6 +4235,8 @@ void TRead::read(TextLineBase* b, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}

compat::CompatUtils::resetHookHeightSign(b);
compat::CompatUtils::setTextLineTextPositionFromAlign(b);
}

Expand Down Expand Up @@ -4614,6 +4622,7 @@ void TRead::read(Volta* v, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
compat::CompatUtils::resetHookHeightSign(v);
compat::CompatUtils::setTextLineTextPositionFromAlign(v);
}

Expand Down
2 changes: 2 additions & 0 deletions src/engraving/tests/compat114_data/hairpin-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>O_O</eid>
</HairPin>
<next>
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/tests/compat114_data/pedal-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<Spanner type="Pedal">
<Pedal>
<continueText>&lt;font size=&quot;11&quot;/&gt;</continueText>
<endHookHeight>-1.5</endHookHeight>
<endHookHeight>1.5</endHookHeight>
<eid>I_I</eid>
</Pedal>
<next>
Expand Down
4 changes: 4 additions & 0 deletions src/engraving/tests/compat206_data/hairpin-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>H_H</eid>
</HairPin>
<next>
Expand Down Expand Up @@ -732,6 +734,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>5B_5B</eid>
</HairPin>
<next>
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/tests/compat206_data/textstyles-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,6 @@
<Spanner type="Pedal">
<Pedal>
<endHookType>1</endHookType>
<beginHookHeight>-1.2</beginHookHeight>
<endHookHeight>-1.2</endHookHeight>
<eid>AB_AB</eid>
</Pedal>
<next>
Expand Down
8 changes: 8 additions & 0 deletions src/engraving/tests/copypaste_data/copypaste_parts-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>i_i</eid>
</HairPin>
<next>
Expand Down Expand Up @@ -642,6 +644,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>ZB_ZB</eid>
</HairPin>
<next>
Expand Down Expand Up @@ -1110,6 +1114,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>bC_bC</eid>
<linkedTo>i_i</linkedTo>
</HairPin>
Expand Down Expand Up @@ -1517,6 +1523,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>SD_SD</eid>
<linkedTo>ZB_ZB</linkedTo>
</HairPin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>J_J</eid>
</HairPin>
<next>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>0</subtype>
<beginHookHeight>-1.9</beginHookHeight>
<endHookHeight>-1.9</endHookHeight>
<eid>J_J</eid>
</HairPin>
<next>
Expand Down
Loading
Loading