Skip to content

Commit 9481c4f

Browse files
mike-spacbjeukendrup
authored andcommitted
Tie layout overhaul
Move out piece of code to separate function Introduce TiePlacement property and property type correction Introduce inspector section for tie placement Created placeholder style widget for tie inside/outside Update calculation of inside/outside according to new settings Remove responsibility for setting pos out of adjustY Rename SlurPos to SlurTiePos Move computation of start and end system out of tie pos correction Temporarily deactivate adjustX and adjustY Rationalize calculation of default start/end points Force horizontal correction Re-implementation of adjustX correction Rationalize shoulder height formula and increase default curvature Decrease thickness for short ties Extract thickness calculation to dedicated method initial reimplementation of adjustY Implementing arc vs staffLine avoidance correction Better management of short ties more Don't do adjustments if autoplace is off Correct dragging behaviour cleanup Fix glitches when when dragging ties correction improvements Adjust for ledger lines corrected values Fix tie-to-tie collisions Tweak curve correction correction correction margins above and below correction move some constants to style correction
1 parent 751bd05 commit 9481c4f

33 files changed

+948
-273
lines changed

src/engraving/dom/property.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ static constexpr PropertyMetaData propertyList[] = {
406406
{ Pid::CAPO_IGNORED_STRINGS, true, "ignoredStrings", P_TYPE::INT_VEC, DUMMY_QT_TR_NOOP("propertyName", "ignored strings") },
407407
{ Pid::CAPO_GENERATE_TEXT, true, "generateText", P_TYPE::BOOL, DUMMY_QT_TR_NOOP("propertyName", "automatically generate text") },
408408

409+
{ Pid::TIE_PLACEMENT, true, "tiePlacement", P_TYPE::TIE_PLACEMENT, DUMMY_QT_TR_NOOP("propertyName", "tie placement") },
410+
409411
{ Pid::END, false, "++end++", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "<invalid property>") }
410412
};
411413
/* *INDENT-ON* */

src/engraving/dom/property.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ enum class Pid {
415415
CAPO_IGNORED_STRINGS,
416416
CAPO_GENERATE_TEXT,
417417

418+
TIE_PLACEMENT,
419+
418420
END
419421
};
420422

src/engraving/dom/shape.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,30 @@ double Shape::bottom() const
297297
return dist;
298298
}
299299

300+
double Shape::rightMostEdgeAtHeight(double yAbove, double yBelow) const
301+
{
302+
double edge = -100000.0;
303+
for (const ShapeElement& sh : *this) {
304+
if (sh.bottom() > yAbove && sh.top() < yBelow) {
305+
edge = std::max(edge, sh.right());
306+
}
307+
}
308+
309+
return edge;
310+
}
311+
312+
double Shape::leftMostEdgeAtHeight(double yAbove, double yBelow) const
313+
{
314+
double edge = 100000.0;
315+
for (const ShapeElement& sh : *this) {
316+
if (sh.bottom() > yAbove && sh.top() < yBelow) {
317+
edge = std::min(edge, sh.left());
318+
}
319+
}
320+
321+
return edge;
322+
}
323+
300324
//---------------------------------------------------------
301325
// topDistance
302326
// p is on top of shape

src/engraving/dom/shape.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class Shape : public std::vector<ShapeElement>
9595
double right() const;
9696
double top() const;
9797
double bottom() const;
98+
double rightMostEdgeAtHeight(double yAbove, double yBelow) const;
99+
double leftMostEdgeAtHeight(double yAbove, double yBelow) const;
98100

99101
size_t size() const { return std::vector<ShapeElement>::size(); }
100102
bool empty() const { return std::vector<ShapeElement>::empty(); }

src/engraving/dom/slur.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ Slur::Slur(const Slur& s)
822822
// relative to System() position.
823823
//---------------------------------------------------------
824824

825-
void Slur::slurPosChord(SlurPos* sp)
825+
void Slur::slurPosChord(SlurTiePos* sp)
826826
{
827827
Chord* stChord;
828828
Chord* enChord;

src/engraving/dom/slur.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Slur final : public SlurTie
125125
Slur(EngravingItem* parent);
126126
Slur(const Slur&);
127127

128-
void slurPosChord(SlurPos*);
128+
void slurPosChord(SlurTiePos*);
129129

130130
int m_sourceStemArrangement = -1;
131131

src/engraving/dom/slurtie.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace mu::engraving {
3232
// SlurPos
3333
//---------------------------------------------------------
3434

35-
struct SlurPos {
35+
struct SlurTiePos {
3636
PointF p1; // start point of slur
3737
System* system1 = nullptr; // start system of slur
3838
PointF p2; // end point of slur

0 commit comments

Comments
 (0)