Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GH#23119: Ensure TextLineBase properties are written for hairpins #568

Merged
merged 2 commits into from
Jan 14, 2025
Merged
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
8 changes: 4 additions & 4 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ static void addTextToNote(long l, long c, QString txt, QString placement, QStrin

/**
Helper for direction().
SLine placement is modified by changing the first segments user offset
SLine placement is modified by changing the first segment's user offset
As the SLine has just been created, it does not have any segment yet
*/

Expand All @@ -1475,11 +1475,11 @@ static void setSLinePlacement(SLine* sli, const QString placement)
qreal y = 0;
y += offsAbove;
// add linesegment containing the user offset
LineSegment* tls= sli->createLineSegment();
LineSegment* tls = sli->createLineSegment();
//qDebug(" y = %g", y);
tls->setAutoplace(false);
y *= sli->score()->spatium();
tls->setUserOff(QPointF(0, y));
tls->setUserOff2(QPointF(0, y));
sli->add(tls);
}
}
Expand All @@ -1489,7 +1489,7 @@ static void setSLinePlacement(SLine* sli, const QString placement)
#endif
if (placement == "above" || placement == "below") {
sli->setPlacement(placement == "above" ? Placement::ABOVE : Placement::BELOW);
sli->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
sli->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::NOSTYLE);
Jojo-Schmitz marked this conversation as resolved.
Show resolved Hide resolved
sli->resetProperty(Pid::OFFSET);
}
}
Expand Down
17 changes: 7 additions & 10 deletions libmscore/hairpin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,10 @@ Hairpin::Hairpin(Score* s)
initElementStyle(&hairpinStyle);

resetProperty(Pid::BEGIN_TEXT_PLACE);
resetProperty(Pid::END_TEXT_PLACE);
resetProperty(Pid::CONTINUE_TEXT_PLACE);
resetProperty(Pid::BEGIN_HOOK_HEIGHT);
resetProperty(Pid::END_HOOK_HEIGHT);
resetProperty(Pid::HAIRPIN_TYPE);
resetProperty(Pid::LINE_VISIBLE);

Expand Down Expand Up @@ -671,18 +674,11 @@ void Hairpin::write(XmlWriter& xml) const
writeProperty(xml, Pid::VELO_CHANGE);
writeProperty(xml, Pid::HAIRPIN_CIRCLEDTIP);
writeProperty(xml, Pid::DYNAMIC_RANGE);
// writeProperty(xml, Pid::BEGIN_TEXT);
writeProperty(xml, Pid::END_TEXT);
// writeProperty(xml, Pid::CONTINUE_TEXT);
writeProperty(xml, Pid::LINE_VISIBLE);
writeProperty(xml, Pid::SINGLE_NOTE_DYNAMICS);
writeProperty(xml, Pid::VELO_CHANGE_METHOD);
//writeProperty(xml, Pid::PLACEMENT);
Jojo-Schmitz marked this conversation as resolved.
Show resolved Hide resolved

for (const StyledProperty& spp : *styledProperties()) {
if (!isStyled(spp.pid))
writeProperty(xml, spp.pid);
}
SLine::writeProperties(xml);
TextLineBase::writeProperties(xml);
xml.etag();
}

Expand Down Expand Up @@ -840,6 +836,7 @@ QVariant Hairpin::propertyDefault(Pid id) const

case Pid::BEGIN_TEXT_PLACE:
case Pid::CONTINUE_TEXT_PLACE:
case Pid::END_TEXT_PLACE:
return int(PlaceText::LEFT);

case Pid::BEGIN_TEXT_OFFSET:
Expand All @@ -853,7 +850,7 @@ QVariant Hairpin::propertyDefault(Pid id) const

case Pid::BEGIN_HOOK_HEIGHT:
case Pid::END_HOOK_HEIGHT:
return Spatium(0.0);
return Spatium(1.9);

case Pid::LINE_VISIBLE:
return true;
Expand Down
6 changes: 3 additions & 3 deletions mtest/musicxml/io/testInferredCrescLines2_ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>3</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down Expand Up @@ -672,8 +672,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>2</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down Expand Up @@ -1293,8 +1293,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>3</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down
10 changes: 5 additions & 5 deletions mtest/musicxml/io/testInferredCrescLines_ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>2</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down Expand Up @@ -251,8 +251,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>2</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down Expand Up @@ -300,8 +300,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>2</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down Expand Up @@ -446,8 +446,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>3</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down Expand Up @@ -551,8 +551,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>2</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down
2 changes: 1 addition & 1 deletion mtest/musicxml/io/testInferredDynamicsExpression_ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>2</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down
2 changes: 1 addition & 1 deletion mtest/musicxml/io/testInferredDynamics_ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
<Spanner type="HairPin">
<HairPin>
<subtype>2</subtype>
<endText></endText>
<lineVisible>0</lineVisible>
<endText></endText>
</HairPin>
<next>
<location>
Expand Down