@@ -136,7 +136,7 @@ void TieSegment::changeAnchor(EditData& ed, EngravingItem* element)
136
136
137
137
void TieSegment::editDrag (EditData& ed)
138
138
{
139
- consolidateAdjustOffsetIntoUserOffset ();
139
+ consolidateAdjustmentOffsetIntoUserOffset ();
140
140
Grip g = ed.curGrip ;
141
141
ups (g).off += ed.delta ;
142
142
@@ -197,61 +197,61 @@ void TieSegment::computeMidThickness(double tieLengthInSp)
197
197
198
198
void TieSegment::computeBezier (PointF shoulderOffset)
199
199
{
200
- PointF tieStart = ups (Grip::START).p + ups (Grip::START).off ;
201
- PointF tieEnd = ups (Grip::END).p + ups (Grip::END).off ;
200
+ const PointF tieStart = ups (Grip::START).p + ups (Grip::START).off ;
201
+ const PointF tieEnd = ups (Grip::END).p + ups (Grip::END).off ;
202
202
203
203
PointF tieEndNormalized = tieEnd - tieStart; // normalize to zero
204
204
if (RealIsNull (tieEndNormalized.x ())) {
205
205
return ;
206
206
}
207
207
208
- double tieAngle = atan (tieEndNormalized.y () / tieEndNormalized.x ()); // angle required from tie start to tie end--zero if horizontal
208
+ const double tieAngle = atan (tieEndNormalized.y () / tieEndNormalized.x ()); // angle required from tie start to tie end--zero if horizontal
209
209
Transform t;
210
210
t.rotateRadians (-tieAngle); // rotate so that we are working with horizontal ties regardless of endpoint height difference
211
211
tieEndNormalized = t.map (tieEndNormalized); // apply that rotation
212
212
shoulderOffset = t.map (shoulderOffset); // also apply to shoulderOffset
213
213
214
- double _spatium = spatium ();
214
+ const double _spatium = spatium ();
215
215
double tieLengthInSp = tieEndNormalized.x () / _spatium;
216
216
217
- double minShoulderHeight = style ().styleMM (Sid::tieMinShoulderHeight);
218
- double maxShoulderHeight = style ().styleMM (Sid::tieMaxShoulderHeight);
217
+ const double minShoulderHeight = style ().styleMM (Sid::tieMinShoulderHeight);
218
+ const double maxShoulderHeight = style ().styleMM (Sid::tieMaxShoulderHeight);
219
219
double shoulderH = minShoulderHeight + _spatium * 0.3 * sqrt (abs (tieLengthInSp - 1 ));
220
220
shoulderH = std::clamp (shoulderH, minShoulderHeight, maxShoulderHeight);
221
221
222
222
shoulderH -= shoulderOffset.y ();
223
223
224
224
PointF shoulderAdjustOffset = tie ()->up () ? PointF (0.0 , shoulderOffset.y ()) : PointF (0.0 , -shoulderOffset.y ());
225
- addAdjustOffset (shoulderAdjustOffset, Grip::BEZIER1);
226
- addAdjustOffset (shoulderAdjustOffset, Grip::BEZIER2);
225
+ addAdjustmentOffset (shoulderAdjustOffset, Grip::BEZIER1);
226
+ addAdjustmentOffset (shoulderAdjustOffset, Grip::BEZIER2);
227
227
228
228
if (!tie ()->up ()) {
229
229
shoulderH = -shoulderH;
230
230
}
231
231
232
232
double shoulderW = 0.6 ; // TODO: style
233
233
234
- double tieWidth = tieEndNormalized.x ();
235
- double bezier1X = (tieWidth - tieWidth * shoulderW) * .5 + shoulderOffset.x ();
236
- double bezier2X = bezier1X + tieWidth * shoulderW + shoulderOffset.x ();
234
+ const double tieWidth = tieEndNormalized.x ();
235
+ const double bezier1X = (tieWidth - tieWidth * shoulderW) * .5 + shoulderOffset.x ();
236
+ const double bezier2X = bezier1X + tieWidth * shoulderW + shoulderOffset.x ();
237
237
238
- PointF tieDrag = PointF (tieWidth * .5 , 0.0 );
238
+ const PointF tieDrag = PointF (tieWidth * .5 , 0.0 );
239
239
240
- PointF bezier1 (bezier1X, -shoulderH);
241
- PointF bezier2 (bezier2X, -shoulderH);
240
+ const PointF bezier1 (bezier1X, -shoulderH);
241
+ const PointF bezier2 (bezier2X, -shoulderH);
242
242
243
243
computeMidThickness (tieLengthInSp);
244
244
245
245
PointF tieThickness (0.0 , m_midThickness);
246
246
247
- PointF bezier1Offset = t.map (ups (Grip::BEZIER1).off );
248
- PointF bezier2Offset = t.map (ups (Grip::BEZIER2).off );
247
+ const PointF bezier1Offset = t.map (ups (Grip::BEZIER1).off );
248
+ const PointF bezier2Offset = t.map (ups (Grip::BEZIER2).off );
249
249
250
250
// -----------------------------------calculate p6
251
- PointF bezier1Final = bezier1 + bezier1Offset;
252
- PointF bezier2Final = bezier2 + bezier2Offset;
251
+ const PointF bezier1Final = bezier1 + bezier1Offset;
252
+ const PointF bezier2Final = bezier2 + bezier2Offset;
253
253
254
- PointF tieShoulder = 0.5 * (bezier1Final + bezier2Final);
254
+ const PointF tieShoulder = 0.5 * (bezier1Final + bezier2Final);
255
255
// -----------------------------------
256
256
257
257
m_path = PainterPath ();
@@ -751,17 +751,17 @@ void TieSegment::adjustX()
751
751
}
752
752
}
753
753
754
- void TieSegment::consolidateAdjustOffsetIntoUserOffset ()
754
+ void TieSegment::consolidateAdjustmentOffsetIntoUserOffset ()
755
755
{
756
- for (size_t i = 0 ; i < m_adjustOffsets .size (); ++i) {
756
+ for (size_t i = 0 ; i < m_adjustmentOffsets .size (); ++i) {
757
757
Grip grip = static_cast <Grip>(i);
758
- PointF adjustOffset = m_adjustOffsets [i];
758
+ PointF adjustOffset = m_adjustmentOffsets [i];
759
759
if (!adjustOffset.isNull ()) {
760
760
ups (grip).p -= adjustOffset;
761
761
ups (grip).off = adjustOffset;
762
762
}
763
763
}
764
- resetAdjustOffset ();
764
+ resetAdjustmentOffset ();
765
765
}
766
766
767
767
// ---------------------------------------------------------
@@ -953,18 +953,18 @@ void Tie::calculateIsInside()
953
953
return ;
954
954
}
955
955
956
- Note* startN = startNote ();
957
- Chord* startChord = startN ? startN->chord () : nullptr ;
958
- Note* endN = endNote ();
959
- Chord* endChord = endN ? endN->chord () : nullptr ;
956
+ const Note* startN = startNote ();
957
+ const Chord* startChord = startN ? startN->chord () : nullptr ;
958
+ const Note* endN = endNote ();
959
+ const Chord* endChord = endN ? endN->chord () : nullptr ;
960
960
961
961
if (!startChord || !endChord) {
962
962
setIsInside (false );
963
963
return ;
964
964
}
965
965
966
- bool startIsSingleNote = startChord->notes ().size () <= 1 ;
967
- bool endIsSingleNote = endChord->notes ().size () <= 1 ;
966
+ const bool startIsSingleNote = startChord->notes ().size () <= 1 ;
967
+ const bool endIsSingleNote = endChord->notes ().size () <= 1 ;
968
968
969
969
if (startIsSingleNote && endIsSingleNote) {
970
970
setIsInside (style ().styleV (Sid::tiePlacementSingleNote).value <TiePlacement>() == TiePlacement::INSIDE);
@@ -1041,29 +1041,29 @@ bool Tie::isOuterTieOfChord(Grip startOrEnd) const
1041
1041
return false ;
1042
1042
}
1043
1043
1044
- bool start = startOrEnd == Grip::START;
1045
- Note* note = start ? startNote () : endNote ();
1044
+ const bool start = startOrEnd == Grip::START;
1045
+ const Note* note = start ? startNote () : endNote ();
1046
1046
if (!note) {
1047
1047
return false ;
1048
1048
}
1049
1049
1050
- Chord* chord = note->chord ();
1050
+ const Chord* chord = note->chord ();
1051
1051
1052
1052
return (note == chord->upNote () && up ()) || (note == chord->downNote () && !up ());
1053
1053
}
1054
1054
1055
1055
bool Tie::hasTiedSecondInside () const
1056
1056
{
1057
- Note* note = startNote ();
1057
+ const Note* note = startNote ();
1058
1058
if (!note) {
1059
1059
return false ;
1060
1060
}
1061
1061
1062
- Chord* chord = note->chord ();
1063
- int line = note->line ();
1064
- int secondInsideLine = up () ? line + 1 : line - 1 ;
1062
+ const Chord* chord = note->chord ();
1063
+ const int line = note->line ();
1064
+ const int secondInsideLine = up () ? line + 1 : line - 1 ;
1065
1065
1066
- for (Note* otherNote : chord->notes ()) {
1066
+ for (const Note* otherNote : chord->notes ()) {
1067
1067
if (otherNote->line () == secondInsideLine && otherNote->tieFor () && otherNote->tieFor ()->up () == up ()) {
1068
1068
return true ;
1069
1069
}
@@ -1074,8 +1074,8 @@ bool Tie::hasTiedSecondInside() const
1074
1074
1075
1075
bool Tie::isCrossStaff () const
1076
1076
{
1077
- Note* startN = startNote ();
1078
- Note* endN = endNote ();
1077
+ const Note* startN = startNote ();
1078
+ const Note* endN = endNote ();
1079
1079
1080
1080
return (startN && startN->chord ()->staffMove () != 0 ) || (endN && endN->chord ()->staffMove () != 0 );
1081
1081
}
0 commit comments