Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/engraving/api/v1/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ int Staff::lines(Fraction* tick)

qreal Staff::lineDistance(Fraction* tick)
{
return staff()->lineDistance(tick->fraction());
return staff()->lineDistance(tick->fraction()).val();
}

bool Staff::isLinesInvisible(Fraction* tick)
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/barline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ void BarLine::dragGrip(EditData& ed)

BarLineEditData* bed = static_cast<BarLineEditData*>(ed.getData(this).get());

double lineDist = staff()->lineDistance(tick()) * spatium();
double lineDist = staff()->lineDistance(tick()).toAbsolute(spatium());
calcY();

// min for bottom grip is 1 line below top grip
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ void Note::setDotRelativeLine(int dotMove)
return;
}
}
y *= spatium() * staff()->lineDistance(tick());
y *= staff()->lineDistance(tick()).toAbsolute(spatium());

// apply to dots

Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/staff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,9 +1874,9 @@ void Staff::setLines(const Fraction& tick, int val)
// distance between staff lines
//---------------------------------------------------------

double Staff::lineDistance(const Fraction& tick) const
Spatium Staff::lineDistance(const Fraction& tick) const
{
return staffType(tick)->lineDistance().val();
return staffType(tick)->lineDistance();
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/staff.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class Staff final : public EngravingItem

int lines(const Fraction&) const;
void setLines(const Fraction&, int lines);
double lineDistance(const Fraction&) const;
Spatium lineDistance(const Fraction&) const;

bool isLinesInvisible(const Fraction&) const;
void setIsLinesInvisible(const Fraction&, bool val);
Expand Down
6 changes: 3 additions & 3 deletions src/engraving/dom/tremolosinglechord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ double TremoloSingleChord::chordMag() const
return explicitParent() ? toChord(explicitParent())->intrinsicMag() : 1.0;
}

double TremoloSingleChord::minHeight() const
Spatium TremoloSingleChord::minHeight() const
{
const double sw = style().styleS(Sid::tremoloLineWidth).val() * chordMag();
const double td = style().styleS(Sid::tremoloDistance).val() * chordMag();
const Spatium sw = style().styleS(Sid::tremoloLineWidth) * chordMag();
const Spatium td = style().styleS(Sid::tremoloDistance) * chordMag();
return (lines() - 1) * td + sw;
}

Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/tremolosinglechord.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TremoloSingleChord final : public EngravingItem
void setTremoloType(TremoloType t);
TremoloType tremoloType() const { return m_tremoloType; }

double minHeight() const;
Spatium minHeight() const;
void reset() override;

double chordMag() const;
Expand Down
9 changes: 0 additions & 9 deletions src/engraving/dom/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@
using namespace mu;

namespace mu::engraving {
//---------------------------------------------------------
// handleRect
//---------------------------------------------------------

RectF handleRect(const PointF& pos)
{
return RectF(pos.x() - 4, pos.y() - 4, 8, 8);
}

//---------------------------------------------------------
// tick2measure
//---------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/dom/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ struct NoteVal;

enum class Key : signed char;

extern RectF handleRect(const PointF& pos);

extern int pitchKeyAdjust(int note, Key);
extern int line2pitch(int line, ClefType clef, Key);
extern int y2pitch(double y, ClefType clef, double spatium);
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/score/beamlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ void BeamLayout::verticalAdjustBeamedRests(Rest* rest, Beam* beam, LayoutContext
const double restToBeamClearance = up
? beamShape.verticalClearance(restShape, minBeamToRestXDist)
: restShape.verticalClearance(beamShape);
const double lineDistance = rest->staff()->lineDistance(rest->tick()) * spatium;
const double lineDistance = rest->staff()->lineDistance(rest->tick()).toAbsolute(spatium);

int clearanceInSteps = std::ceil(restToBeamClearance / lineDistance);
up ? rest->verticalClearance().setAbove(clearanceInSteps) : rest->verticalClearance().setBelow(clearanceInSteps);
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/rendering/score/beamtremololayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,11 +1355,11 @@ double BeamTremoloLayout::chordBeamAnchorY(const BeamBase::LayoutData* ldata, co
double beamOffset = ldata->beamWidth / 2 * upValue;

if (ldata->isBesideTabStaff) {
double stemLength = StemLayout::tabStemLength(chord, ldata->tab) * (ldata->up ? -1 : 1);
double y = StemLayout::tabRestStemPosY(chord, ldata->tab) + stemLength;
y *= ldata->spatium;
y -= beamOffset;
return y + chord->pagePos().y();
Spatium stemLength = StemLayout::tabStemLength(chord, ldata->tab) * (ldata->up ? -1 : 1);
Spatium y = StemLayout::tabRestStemPosY(chord, ldata->tab) + stemLength;
double yAbs = y.toAbsolute(ldata->spatium);
yAbs -= beamOffset;
return yAbs + chord->pagePos().y();
}

return position.y() - note->offset().y() + (chord->defaultStemLength() * upValue) - beamOffset;
Expand Down
12 changes: 6 additions & 6 deletions src/engraving/rendering/score/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ void ChordLayout::layoutTablature(Chord* item, LayoutContext& ctx)
stem->setGenerated(true);
ctx.mutDom().addElement(stem);
}
item->stem()->setPos(StemLayout::tabStemPos(item, tab) * _spatium);
item->stem()->setPos(StemLayout::tabStemPos(item, tab).toAbsolute(_spatium));
if (item->hook()) {
if (item->beam()) {
ctx.mutDom().undoRemoveElement(item->hook());
Expand Down Expand Up @@ -1288,7 +1288,7 @@ void ChordLayout::updateLedgerLines(Chord* item, LayoutContext& ctx)
track_idx_t track = 0; // the track lines belong to
// the line pos corresponding to the bottom line of the staff
int lineBelow = 8; // assuming 5-lined "staff"
double lineDistance = 1;
Spatium lineDistance = 1_sp;
bool staffVisible = true;
int stepOffset = 0; // for staff type changes with a step offset

Expand Down Expand Up @@ -1422,7 +1422,7 @@ void ChordLayout::updateLedgerLines(Chord* item, LayoutContext& ctx)
}

double _spatium = item->spatium();
double stepDistance = lineDistance * 0.5;
Spatium stepDistance = lineDistance * 0.5;
item->resizeLedgerLinesTo(ledgerLineData.size());
for (size_t i = 0; i < ledgerLineData.size(); ++i) {
LedgerLineData lld = ledgerLineData[i];
Expand All @@ -1431,7 +1431,7 @@ void ChordLayout::updateLedgerLines(Chord* item, LayoutContext& ctx)
h->setTrack(track);
h->setVisible(lld.visible && staffVisible);
h->setLen(lld.maxX - lld.minX);
h->setPos(lld.minX, lld.line * _spatium * stepDistance);
h->setPos(lld.minX, lld.line * stepDistance.toAbsolute(_spatium));
}

for (LedgerLine* ll : item->ledgerLines()) {
Expand Down Expand Up @@ -2451,7 +2451,7 @@ double ChordLayout::centerX(const Chord* chord)
const Staff* st = chord->staff();
const StaffType* stt = st->staffTypeForElement(chord);
if (stt->isTabStaff()) {
return rendering::score::StemLayout::tabStemPosX() * chord->spatium();
return StemLayout::tabStemPosX().toAbsolute(chord->spatium());
}

const Note* note = chord->up() ? chord->downNote() : chord->upNote();
Expand Down Expand Up @@ -2635,7 +2635,7 @@ void ChordLayout::layoutChords3(const std::vector<Chord*>& chords,
Fraction tick = notes.front()->chord()->segment()->tick();
const MStyle& style = ctx.conf().style();
double sp = staff->spatium(tick);
double stepDistance = sp * staff->lineDistance(tick) * .5;
double stepDistance = staff->lineDistance(tick).toAbsolute(sp) * .5;
int stepOffset = staff->staffType(tick)->stepOffset();

double upDotPosX = 0.0;
Expand Down
5 changes: 3 additions & 2 deletions src/engraving/rendering/score/guitarbendlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void GuitarBendLayout::avoidBadStaffLineIntersection(GuitarBendSegment* item, Po
{
int upSign = item->guitarBend()->ldata()->up() ? -1 : 1;
double spatium = item->spatium();
double lineDist = spatium * item->staff()->lineDistance(item->tick());
double lineDist = item->staff()->lineDistance(item->tick()).toAbsolute(spatium);
double closestStaffLineY = lineDist * round(point.y() / lineDist);

bool isInsideStaff = closestStaffLineY >= 0 && closestStaffLineY <= 4 * spatium;
Expand Down Expand Up @@ -470,7 +470,8 @@ void GuitarBendLayout::layoutBendTabStaff(GuitarBendSegment* item, LayoutContext
double spatium = bend->spatium();
const MStyle& style = item->style();
const double verticalPad = 0.25 * spatium;
const double distAboveTab = style.styleD(Sid::guitarBendHeightAboveTABStaff) * spatium * item->staff()->lineDistance(item->tick());
const double distAboveTab = style.styleD(Sid::guitarBendHeightAboveTABStaff) * item->staff()->lineDistance(item->tick()).toAbsolute(
spatium);
const double arrowWidth = style.styleAbsolute(Sid::guitarBendArrowWidth);
const double arrowHeight = style.styleAbsolute(Sid::guitarBendArrowHeight);
const double lineWidth = item->lineWidth();
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/rendering/score/restlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void RestLayout::resolveRestVSChord(std::vector<Rest*>& rests, std::vector<Chord
Fraction tick = segment->tick();
int lines = staff->lines(tick);
double spatium = staff->spatium(tick);
double lineDistance = staff->lineDistance(tick) * spatium;
double lineDistance = staff->lineDistance(tick).toAbsolute(spatium);

for (Rest* rest : rests) {
if (!rest->visible() || !rest->autoplace()) {
Expand Down Expand Up @@ -288,7 +288,7 @@ void RestLayout::resolveRestVSRest(std::vector<Rest*>& rests, const Staff* staff

Fraction tick = segment->tick();
double spatium = staff->spatium(tick);
double lineDistance = staff->lineDistance(tick) * spatium;
double lineDistance = staff->lineDistance(tick).toAbsolute(spatium);
int lines = staff->lines(tick);
const double minRestToRestClearance = 0.55 * spatium;

Expand Down Expand Up @@ -423,7 +423,7 @@ void RestLayout::alignRests(const System* system, LayoutContext& ctx)

Rest* firstRest = group.front();
const bool alignUpwards = firstRest->voice() == 0;
const double lineDist = firstRest->staff()->lineDistance(firstRest->tick()) * firstRest->spatium();
const double lineDist = firstRest->staff()->lineDistance(firstRest->tick()).toAbsolute(firstRest->spatium());

double yOuterRest = alignUpwards ? DBL_MAX : -DBL_MAX;
for (Rest* rest : group) {
Expand Down Expand Up @@ -630,7 +630,7 @@ void RestLayout::checkFullMeasureRestCollisions(const System* system, LayoutCont
}

const double spatium = fullMeasureRest->spatium();
const double lineDist = fullMeasureRest->staff()->lineDistance(fullMeasureRest->tick()) * spatium;
const double lineDist = fullMeasureRest->staff()->lineDistance(fullMeasureRest->tick()).toAbsolute(spatium);
const double minHorizontalDistance = 4 * spatium;
const double minVertClearance = 0.75 * spatium;

Expand Down Expand Up @@ -783,7 +783,7 @@ void RestLayout::updateSymbol(const Rest* item, Rest::LayoutData* ldata)
{
Fraction t = item->tick();
Staff* st = item->staff();
double lineDistance = st->lineDistance(t) * item->spatium();
double lineDistance = st->lineDistance(t).toAbsolute(item->spatium());
int lines = st->lines(t);

double y = item->pos().y();
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/rendering/score/slurtielayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ void SlurTieLayout::adjustY(TieSegment* tieSegment)
bool up = tieSegment->tie()->up();
int upSign = up ? -1 : 1;

const double staffLineDist = staff->lineDistance(tick) * spatium;
const double staffLineDist = staff->lineDistance(tick).toAbsolute(spatium);
const double staffLineThickness = tieSegment->style().styleAbsolute(Sid::staffLineWidth) * staff->staffMag(tick);

// 1. Check for bad end point protrusion
Expand Down Expand Up @@ -2525,7 +2525,7 @@ void SlurTieLayout::resolveVerticalTieCollisions(const std::vector<TieSegment*>&

Fraction tick = thisTie->tick();
double yMidPoint = 0.5 * (thisTieOuterY + nextTieInnerY);
double halfLineDist = 0.5 * staff->lineDistance(tick) * spatium;
double halfLineDist = 0.5 * staff->lineDistance(tick).toAbsolute(spatium);
int midLine = round(yMidPoint / halfLineDist);
bool insideStaff = midLine >= -1 && midLine <= 2 * (staff->lines(tick) - 1) + 1;
if (insideStaff) {
Expand Down
Loading
Loading