Skip to content

Commit 8e09dec

Browse files
committed
[engraving] remove friend class SlurTieLayout from Slur
1 parent 74148cb commit 8e09dec

File tree

6 files changed

+125
-122
lines changed

6 files changed

+125
-122
lines changed

src/engraving/layout/v0/slurtielayout.cpp

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

src/engraving/libmscore/slur.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ bool SlurSegment::isEndPointsEdited() const
855855
Slur::Slur(const Slur& s)
856856
: SlurTie(s)
857857
{
858-
_sourceStemArrangement = s._sourceStemArrangement;
858+
m_sourceStemArrangement = s.m_sourceStemArrangement;
859859
}
860860

861861
//---------------------------------------------------------
@@ -871,15 +871,15 @@ void Slur::slurPosChord(SlurPos* sp)
871871
if (startChord()->isGraceAfter()) { // grace notes after, coming in reverse order
872872
stChord = endChord();
873873
enChord = startChord();
874-
_up = false;
874+
m_up = false;
875875
} else {
876876
stChord = startChord();
877877
enChord = endChord();
878878
}
879879
Note* _startNote = stChord->downNote();
880880
Note* _endNote = enChord->downNote();
881881
double hw = _startNote->bboxRightPos();
882-
double __up = _up ? -1.0 : 1.0;
882+
double __up = m_up ? -1.0 : 1.0;
883883
double _spatium = spatium();
884884

885885
Measure* measure = endChord()->measure();
@@ -896,7 +896,7 @@ void Slur::slurPosChord(SlurPos* sp)
896896
double yo;
897897

898898
//------p1
899-
if (_up) {
899+
if (m_up) {
900900
xo = _startNote->x() + hw * 1.12;
901901
yo = _startNote->pos().y() + hw * .3 * __up;
902902
} else {
@@ -906,7 +906,7 @@ void Slur::slurPosChord(SlurPos* sp)
906906
sp->p1 = stChord->pagePos() - pp + PointF(xo, yo);
907907

908908
//------p2
909-
if ((enChord->notes().size() > 1) || (enChord->stem() && !enChord->up() && !_up)) {
909+
if ((enChord->notes().size() > 1) || (enChord->stem() && !enChord->up() && !m_up)) {
910910
xo = _endNote->x() - hw * 0.12;
911911
yo = _endNote->pos().y() + hw * .3 * __up;
912912
} else {

src/engraving/libmscore/slur.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ class Slur final : public SlurTie
100100

101101
void setTrack(track_idx_t val) override;
102102

103-
void setSourceStemArrangement(int v) { _sourceStemArrangement = v; }
103+
int sourceStemArrangement() const { return m_sourceStemArrangement; }
104+
void setSourceStemArrangement(int v) { m_sourceStemArrangement = v; }
104105

105106
SlurSegment* frontSegment() { return toSlurSegment(Spanner::frontSegment()); }
106107
const SlurSegment* frontSegment() const { return toSlurSegment(Spanner::frontSegment()); }
@@ -114,24 +115,25 @@ class Slur final : public SlurTie
114115
bool stemSideForBeam(bool start);
115116
bool stemSideStartForBeam() { return stemSideForBeam(true); }
116117
bool stemSideEndForBeam() { return stemSideForBeam(false); }
117-
const StemFloated& stemFloated() const { return _stemFloated; }
118+
const StemFloated& stemFloated() const { return m_stemFloated; }
119+
StemFloated& stemFloated() { return m_stemFloated; }
118120

119121
SlurTieSegment* newSlurTieSegment(System* parent) override { return new SlurSegment(parent); }
120122

121123
static int calcStemArrangement(EngravingItem* start, EngravingItem* end);
122124
static bool isDirectionMixture(Chord* c1, Chord* c2);
123125

124126
private:
125-
void slurPosChord(SlurPos*);
126127

127-
friend class layout::v0::SlurTieLayout;
128128
friend class Factory;
129129
Slur(EngravingItem* parent);
130130
Slur(const Slur&);
131131

132-
int _sourceStemArrangement = -1;
132+
void slurPosChord(SlurPos*);
133+
134+
int m_sourceStemArrangement = -1;
133135

134-
StemFloated _stemFloated; // end point position is attached to stem but floated towards the note
136+
StemFloated m_stemFloated; // end point position is attached to stem but floated towards the note
135137
};
136138
} // namespace mu::engraving
137139
#endif

src/engraving/libmscore/slurtie.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,17 +366,17 @@ void SlurTieSegment::drawEditMode(mu::draw::Painter* p, EditData& ed, double /*c
366366
SlurTie::SlurTie(const ElementType& type, EngravingItem* parent)
367367
: Spanner(type, parent)
368368
{
369-
_slurDirection = DirectionV::AUTO;
370-
_up = true;
371-
_styleType = SlurStyleType::Solid;
369+
m_slurDirection = DirectionV::AUTO;
370+
m_up = true;
371+
m_styleType = SlurStyleType::Solid;
372372
}
373373

374374
SlurTie::SlurTie(const SlurTie& t)
375375
: Spanner(t)
376376
{
377-
_up = t._up;
378-
_slurDirection = t._slurDirection;
379-
_styleType = t._styleType;
377+
m_up = t.m_up;
378+
m_slurDirection = t.m_slurDirection;
379+
m_styleType = t.m_styleType;
380380
}
381381

382382
//---------------------------------------------------------

src/engraving/libmscore/slurtie.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,42 +153,43 @@ class SlurTie : public Spanner
153153
{
154154
OBJECT_ALLOCATOR(engraving, SlurTie)
155155

156-
SlurStyleType _styleType = SlurStyleType::Undefined;
157-
158-
protected:
159-
160-
friend class layout::v0::SlurTieLayout;
161-
162-
bool _up; // actual direction
163-
164-
DirectionV _slurDirection;
165-
void fixupSegments(unsigned nsegs);
166-
167156
public:
168157
SlurTie(const ElementType& type, EngravingItem* parent);
169158
SlurTie(const SlurTie&);
170159
~SlurTie();
171160

172-
bool up() const { return _up; }
173-
void setUp(bool val) { _up = val; }
161+
bool up() const { return m_up; }
162+
void setUp(bool val) { m_up = val; }
174163

175164
virtual void reset() override;
176165

177-
DirectionV slurDirection() const { return _slurDirection; }
178-
void setSlurDirection(DirectionV d) { _slurDirection = d; }
166+
DirectionV slurDirection() const { return m_slurDirection; }
167+
void setSlurDirection(DirectionV d) { m_slurDirection = d; }
179168
void undoSetSlurDirection(DirectionV d);
180169

181170
virtual void layout2(const PointF, int, struct UP&) {}
182171
virtual bool contains(const PointF&) const { return false; } // not selectable
183172

184-
SlurStyleType styleType() const { return _styleType; }
185-
void setStyleType(SlurStyleType type) { _styleType = type; }
173+
SlurStyleType styleType() const { return m_styleType; }
174+
void setStyleType(SlurStyleType type) { m_styleType = type; }
186175

187176
virtual SlurTieSegment* newSlurTieSegment(System* parent) = 0;
188177

189178
PropertyValue getProperty(Pid propertyId) const override;
190179
bool setProperty(Pid propertyId, const PropertyValue&) override;
191180
PropertyValue propertyDefault(Pid id) const override;
181+
182+
void fixupSegments(unsigned nsegs);
183+
184+
protected:
185+
186+
bool m_up = true; // actual direction
187+
188+
DirectionV m_slurDirection = DirectionV::AUTO;
189+
190+
private:
191+
192+
SlurStyleType m_styleType = SlurStyleType::Undefined;
192193
};
193194
}
194195

src/engraving/libmscore/tie.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -879,25 +879,25 @@ void Tie::calculateDirection()
879879
Measure* m1 = c1->measure();
880880
Measure* m2 = c2->measure();
881881

882-
if (_slurDirection == DirectionV::AUTO) {
882+
if (m_slurDirection == DirectionV::AUTO) {
883883
std::vector<Note*> notes = c1->notes();
884884
size_t n = notes.size();
885885
StaffType* st = staff()->staffType(startNote() ? startNote()->tick() : Fraction(0, 1));
886886
bool simpleException = st && st->isSimpleTabStaff();
887887
// if there are multiple voices, the tie direction goes on stem side
888888
if (m1->hasVoices(c1->staffIdx(), c1->tick(), c1->actualTicks())) {
889-
_up = simpleException ? isUpVoice(c1->voice()) : c1->up();
889+
m_up = simpleException ? isUpVoice(c1->voice()) : c1->up();
890890
} else if (m2->hasVoices(c2->staffIdx(), c2->tick(), c2->actualTicks())) {
891-
_up = simpleException ? isUpVoice(c2->voice()) : c2->up();
891+
m_up = simpleException ? isUpVoice(c2->voice()) : c2->up();
892892
} else if (n == 1) {
893893
//
894894
// single note
895895
//
896896
if (c1->up() != c2->up()) {
897897
// if stem direction is mixed, always up
898-
_up = true;
898+
m_up = true;
899899
} else {
900-
_up = !c1->up();
900+
m_up = !c1->up();
901901
}
902902
} else {
903903
//
@@ -960,27 +960,27 @@ void Tie::calculateDirection()
960960
if (tiesAbove == 0 && tiesBelow == 0 && unisonTies == 0) {
961961
// this is the only tie in the chord.
962962
if (notesAbove == notesBelow) {
963-
_up = !c1->up();
963+
m_up = !c1->up();
964964
} else {
965-
_up = (notesAbove < notesBelow);
965+
m_up = (notesAbove < notesBelow);
966966
}
967967
} else if (tiesAbove == tiesBelow) {
968968
// this note is dead center, so its tie should go counter to the stem direction
969-
_up = !c1->up();
969+
m_up = !c1->up();
970970
} else {
971-
_up = (tiesAbove < tiesBelow);
971+
m_up = (tiesAbove < tiesBelow);
972972
}
973973
} else if (pivotPoint == startNote()) {
974974
// the current note is the lower of the only second or unison in the chord; tie goes down.
975-
_up = false;
975+
m_up = false;
976976
} else {
977977
// if lower than the pivot, tie goes down, otherwise up
978978
int noteDiff = compareNotesPos(startNote(), pivotPoint);
979-
_up = (noteDiff >= 0);
979+
m_up = (noteDiff >= 0);
980980
}
981981
}
982982
} else {
983-
_up = _slurDirection == DirectionV::UP ? true : false;
983+
m_up = m_slurDirection == DirectionV::UP ? true : false;
984984
}
985985
}
986986

0 commit comments

Comments
 (0)