Skip to content

Commit 302a506

Browse files
authored
Merge pull request #30751 from cbjeukendrup/sp_literal
Introduce `_sp` literal
2 parents 80d3310 + 99834f1 commit 302a506

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+352
-352
lines changed

src/engraving/dom/ambitus.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
using namespace mu;
4141
using namespace mu::engraving;
4242

43-
const Spatium Ambitus::LINEWIDTH_DEFAULT = Spatium(0.12);
4443
//---------------------------------------------------------
4544
// Ambitus
4645
//---------------------------------------------------------
@@ -446,7 +445,7 @@ PropertyValue Ambitus::propertyDefault(Pid id) const
446445
case Pid::GHOST:
447446
return HASLINE_DEFAULT;
448447
case Pid::LINE_WIDTH:
449-
return Spatium(LINEWIDTH_DEFAULT);
448+
return LINEWIDTH_DEFAULT;
450449
case Pid::TPC1:
451450
return estimateRanges().topTpc;
452451
case Pid::FBPARENTHESIS1:

src/engraving/dom/ambitus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Ambitus final : public EngravingItem
4848
static constexpr NoteHeadType NOTEHEADTYPE_DEFAULT = NoteHeadType::HEAD_AUTO;
4949
static constexpr DirectionH DIRECTION_DEFAULT = DirectionH::AUTO;
5050
static constexpr bool HASLINE_DEFAULT = true;
51-
static const Spatium LINEWIDTH_DEFAULT;
51+
static constexpr Spatium LINEWIDTH_DEFAULT = 0.12_sp;
5252
static constexpr double LINEOFFSET_DEFAULT = 0.8; // the distance between notehead and line
5353

5454
Ambitus* clone() const override { return new Ambitus(*this); }

src/engraving/dom/box.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ PropertyValue Box::propertyDefault(Pid id) const
250250
switch (id) {
251251
case Pid::BOX_HEIGHT:
252252
case Pid::BOX_WIDTH:
253-
return Spatium(0.0);
253+
return 0.0_sp;
254254

255255
case Pid::TOP_GAP:
256-
return isHBox() ? Spatium(0.0) : style().styleS(Sid::systemFrameDistance);
256+
return isHBox() ? 0.0_sp : style().styleS(Sid::systemFrameDistance);
257257
case Pid::BOTTOM_GAP:
258-
return isHBox() ? Spatium(0.0) : style().styleS(Sid::frameSystemDistance);
258+
return isHBox() ? 0.0_sp : style().styleS(Sid::frameSystemDistance);
259259

260260
case Pid::LEFT_MARGIN:
261261
case Pid::RIGHT_MARGIN:
@@ -597,7 +597,7 @@ PropertyValue HBox::propertyDefault(Pid id) const
597597
case Pid::CREATE_SYSTEM_HEADER:
598598
return true;
599599
case Pid::BOX_WIDTH:
600-
return Spatium(5.0);
600+
return 5.0_sp;
601601
default:
602602
return Box::propertyDefault(id);
603603
}
@@ -624,12 +624,12 @@ VBox::VBox(System* parent)
624624

625625
double VBox::minHeight() const
626626
{
627-
return absoluteFromSpatium(Spatium(10));
627+
return absoluteFromSpatium(10_sp);
628628
}
629629

630630
double VBox::maxHeight() const
631631
{
632-
return absoluteFromSpatium(Spatium(30));
632+
return absoluteFromSpatium(30_sp);
633633
}
634634

635635
PropertyValue VBox::getProperty(Pid propertyId) const
@@ -654,7 +654,7 @@ PropertyValue VBox::propertyDefault(Pid id) const
654654
{
655655
switch (id) {
656656
case Pid::BOX_HEIGHT:
657-
return Spatium(10.0);
657+
return 10.0_sp;
658658
default:
659659
return Box::propertyDefault(id);
660660
}
@@ -892,7 +892,7 @@ PropertyValue FBox::propertyDefault(Pid propertyId) const
892892
return 1.0;
893893
case Pid::FRET_FRAME_COLUMN_GAP:
894894
case Pid::FRET_FRAME_ROW_GAP:
895-
return Spatium(3.0);
895+
return 3.0_sp;
896896
case Pid::FRET_FRAME_CHORDS_PER_ROW:
897897
return 8;
898898
case Pid::FRET_FRAME_H_ALIGN:
@@ -1057,7 +1057,7 @@ PropertyValue TBox::propertyDefault(Pid id) const
10571057
{
10581058
switch (id) {
10591059
case Pid::BOX_HEIGHT:
1060-
return Spatium(1);
1060+
return 1_sp;
10611061
default:
10621062
return VBox::propertyDefault(id);
10631063
}

src/engraving/dom/chord.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ void Chord::setBeamExtension(double extension)
981981
{
982982
if (m_stem) {
983983
double baseLength = m_stem->absoluteFromSpatium(m_stem->baseLength());
984-
m_stem->setBaseLength(std::max(Spatium::fromMM(baseLength + extension, spatium()), Spatium(0.0)));
984+
m_stem->setBaseLength(std::max(Spatium::fromMM(baseLength + extension, spatium()), 0.0_sp));
985985
m_defaultStemLength = std::max(m_defaultStemLength + extension, m_stem->absoluteFromSpatium(m_stem->baseLength()));
986986
}
987987
}

src/engraving/dom/engravingitem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ EngravingItem::EngravingItem(const ElementType& type, EngravingObject* parent, E
8989
m_flags = f;
9090
m_color = configuration()->defaultColor();
9191
m_z = -1;
92-
m_minDistance = Spatium(0.0);
92+
m_minDistance = 0.0_sp;
9393
}
9494

9595
EngravingItem::EngravingItem(const EngravingItem& e, bool link)
@@ -1531,7 +1531,7 @@ PropertyValue EngravingItem::propertyDefault(Pid pid) const
15311531
if (v.isValid()) {
15321532
return v;
15331533
}
1534-
return Spatium(0.0);
1534+
return 0.0_sp;
15351535
}
15361536
case Pid::AUTOPLACE:
15371537
return true;

src/engraving/dom/hairpin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ PropertyValue Hairpin::propertyDefault(Pid id) const
730730

731731
case Pid::BEGIN_HOOK_HEIGHT:
732732
case Pid::END_HOOK_HEIGHT:
733-
return Spatium(1.9);
733+
return 1.9_sp;
734734

735735
case Pid::LINE_VISIBLE:
736736
return true;

src/engraving/dom/laissezvib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ PropertyValue LaissezVib::propertyDefault(Pid propertyId) const
5555
{
5656
switch (propertyId) {
5757
case Pid::MIN_LENGTH:
58-
return Spatium(2.0);
58+
return 2.0_sp;
5959
default:
6060
return Tie::propertyDefault(propertyId);
6161
}

src/engraving/dom/laissezvib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ class LaissezVib : public Tie
8080
LaissezVibSegment* segmentAt(int n) { return toLaissezVibSegment(Spanner::segmentAt(n)); }
8181
const LaissezVibSegment* segmentAt(int n) const { return toLaissezVibSegment(Spanner::segmentAt(n)); }
8282
private:
83-
Spatium m_minLength = Spatium(2.0);
83+
Spatium m_minLength = 2.0_sp;
8484
};
8585
}

src/engraving/dom/line.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ RectF LineSegment::drag(EditData& ed)
828828
Spatium LineSegment::lineWidth() const
829829
{
830830
if (!line()) {
831-
return Spatium(0.0);
831+
return 0.0_sp;
832832
}
833833

834834
return line()->lineWidth();
@@ -883,7 +883,7 @@ SLine::SLine(const ElementType& type, EngravingItem* parent, ElementFlags f)
883883
{
884884
setTrack(0);
885885
m_lineColor = configuration()->defaultColor();
886-
m_lineWidth = Spatium(0.15);
886+
m_lineWidth = 0.15_sp;
887887
}
888888

889889
SLine::SLine(const SLine& s)
@@ -1046,7 +1046,7 @@ PropertyValue SLine::propertyDefault(Pid pid) const
10461046
if (propertyFlags(pid) != PropertyFlags::NOSTYLE) {
10471047
return Spanner::propertyDefault(pid);
10481048
}
1049-
return Spatium(0.15);
1049+
return 0.15_sp;
10501050
case Pid::LINE_STYLE:
10511051
if (propertyFlags(pid) != PropertyFlags::NOSTYLE) {
10521052
return Spanner::propertyDefault(pid);

src/engraving/dom/measurerepeat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class MeasureRepeat final : public Rest
9292
Sid getPropertyStyle(Pid) const override;
9393

9494
int m_numMeasures = 0;
95-
Spatium m_numberPos = Spatium(0.0);
95+
Spatium m_numberPos = 0.0_sp;
9696
};
9797
} // namespace mu::engraving
9898
#endif

0 commit comments

Comments
 (0)