@@ -40,24 +40,28 @@ namespace mu::engraving {
4040// LyricsLine
4141// ---------------------------------------------------------
4242
43+ static const ElementStyle lyricsLineElementStyle {
44+ { Sid::lyricsDashLineThickness, Pid::LINE_WIDTH }
45+ };
46+
4347LyricsLine::LyricsLine (EngravingItem* parent)
44- : SLine(ElementType::LYRICSLINE, parent, ElementFlag::NOT_SELECTABLE )
48+ : SLine(ElementType::LYRICSLINE, parent)
4549{
46- setGenerated (true ); // no need to save it, as it can be re-generated
4750 setDiagonal (false );
48- setLineWidth ( style (). styleS (Sid::lyricsDashLineThickness) );
51+ initElementStyle (&lyricsLineElementStyle );
4952 setAnchor (Spanner::Anchor::SEGMENT);
5053 m_nextLyrics = 0 ;
54+ setGenerated (true ); // no need to save it, as it can be re-generated
5155}
5256
5357LyricsLine::LyricsLine (const ElementType& type, EngravingItem* parent, ElementFlags f)
5458 : SLine(type, parent, f)
5559{
56- setGenerated (true ); // no need to save it, as it can be re-generated
5760 setDiagonal (false );
58- setLineWidth ( style (). styleS (Sid::lyricsDashLineThickness) );
61+ initElementStyle (&lyricsLineElementStyle );
5962 setAnchor (Spanner::Anchor::SEGMENT);
6063 m_nextLyrics = 0 ;
64+ setGenerated (true ); // no need to save it, as it can be re-generated
6165}
6266
6367LyricsLine::LyricsLine (const LyricsLine& g)
@@ -66,15 +70,6 @@ LyricsLine::LyricsLine(const LyricsLine& g)
6670 m_nextLyrics = 0 ;
6771}
6872
69- // ---------------------------------------------------------
70- // styleChanged
71- // ---------------------------------------------------------
72-
73- void LyricsLine::styleChanged ()
74- {
75- setLineWidth (style ().styleS (Sid::lyricsDashLineThickness));
76- }
77-
7873// ---------------------------------------------------------
7974// createLineSegment
8075// ---------------------------------------------------------
@@ -128,6 +123,25 @@ bool LyricsLine::setProperty(Pid propertyId, const engraving::PropertyValue& v)
128123 return true ;
129124}
130125
126+ PropertyValue LyricsLine::propertyDefault (Pid id) const
127+ {
128+ switch (id) {
129+ case Pid::LINE_WIDTH:
130+ return styleValue (Pid::LINE_WIDTH, getPropertyStyle (Pid::LINE_WIDTH));
131+ default :
132+ return SLine::propertyDefault (id);
133+ }
134+ }
135+
136+ Sid LyricsLine::getPropertyStyle (Pid propertyId) const
137+ {
138+ if (propertyId == Pid::LINE_WIDTH) {
139+ return isEndMelisma () ? Sid::lyricsLineThickness : Sid::lyricsDashLineThickness;
140+ }
141+
142+ return SLine::getPropertyStyle (propertyId);
143+ }
144+
131145void LyricsLine::doComputeEndElement ()
132146{
133147 if (!isEndMelisma ()) {
@@ -146,8 +160,14 @@ void LyricsLine::doComputeEndElement()
146160// LyricsLineSegment
147161// =========================================================
148162
163+ void LyricsLineSegment::rebaseAnchors (EditData&, Grip)
164+ {
165+ // Don't rebase lyric line anchors on drag
166+ return ;
167+ }
168+
149169LyricsLineSegment::LyricsLineSegment (LyricsLine* sp, System* parent)
150- : LineSegment(ElementType::LYRICSLINE_SEGMENT, sp, parent, ElementFlag::ON_STAFF | ElementFlag::NOT_SELECTABLE )
170+ : LineSegment(ElementType::LYRICSLINE_SEGMENT, sp, parent, ElementFlag::ON_STAFF)
151171{
152172 setGenerated (true );
153173}
@@ -168,6 +188,42 @@ double LyricsLineSegment::baseLineShift() const
168188 return -style ().styleD (Sid::lyricsDashYposRatio) * segLyrics->fontMetrics ().xHeight ();
169189}
170190
191+ PropertyValue LyricsLineSegment::getProperty (Pid propertyId) const
192+ {
193+ if (EngravingObject* delegate = propertyDelegate (propertyId)) {
194+ return delegate->getProperty (propertyId);
195+ }
196+
197+ return LineSegment::getProperty (propertyId);
198+ }
199+
200+ bool LyricsLineSegment::setProperty (Pid propertyId, const PropertyValue& val)
201+ {
202+ if (EngravingObject* delegate = propertyDelegate (propertyId)) {
203+ return delegate->setProperty (propertyId, val);
204+ }
205+
206+ return LineSegment::setProperty (propertyId, val);
207+ }
208+
209+ PropertyValue LyricsLineSegment::propertyDefault (Pid propertyId) const
210+ {
211+ if (EngravingObject* delegate = propertyDelegate (propertyId)) {
212+ return delegate->propertyDefault (propertyId);
213+ }
214+
215+ return LineSegment::propertyDefault (propertyId);
216+ }
217+
218+ EngravingObject* LyricsLineSegment::propertyDelegate (Pid propertyId) const
219+ {
220+ if (propertyId == Pid::GENERATED) {
221+ return lyricsLine ();
222+ }
223+
224+ return LineSegment::propertyDelegate (propertyId);
225+ }
226+
171227// =========================================================
172228// PartialLyricsLine
173229// =========================================================
@@ -251,7 +307,6 @@ void PartialLyricsLine::doComputeEndElement()
251307
252308static const ElementStyle partialLyricsLineSegmentElementStyle {
253309 { Sid::lyricsPlacement, Pid::PLACEMENT },
254- { Sid::lyricsPosBelow, Pid::OFFSET },
255310 { Sid::lyricsMinTopDistance, Pid::MIN_DISTANCE },
256311};
257312
0 commit comments