From 04f0db72aacc80f57f0c9c3cc02e9075096da686 Mon Sep 17 00:00:00 2001 From: Howard-C Date: Tue, 28 Jul 2020 15:42:07 +0800 Subject: [PATCH] Adjust code style --- libmscore/chord.cpp | 2 +- libmscore/edit.cpp | 39 +++++++++++++++++++-------------------- libmscore/score.cpp | 17 +++++++++-------- libmscore/tremolo.cpp | 7 +++---- 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/libmscore/chord.cpp b/libmscore/chord.cpp index 3f809892d3790..5a68e0718cc10 100644 --- a/libmscore/chord.cpp +++ b/libmscore/chord.cpp @@ -1536,7 +1536,7 @@ qreal Chord::minAbsStemLength() const if (hasHook) { beamLvl += (up() ? 4 : 2); // reserve more space for stem with both hook and tremolo } - const qreal additionalHeight = beamLvl ? 0 : sw * spatium(); + const qreal additionalHeight = beamLvl ? 0 : (sw * spatium()); return height + beamLvl * beamDist + additionalHeight; } diff --git a/libmscore/edit.cpp b/libmscore/edit.cpp index 3ecc765660368..bfef8a71912bd 100644 --- a/libmscore/edit.cpp +++ b/libmscore/edit.cpp @@ -812,26 +812,25 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local) return; } - auto getStaffIdxRange = [this, local, staffIdx](const Score* score) -> std::pair { - int startStaffIdx, endStaffIdx; - if (local) { - if (score == this) { - startStaffIdx = staffIdx; - endStaffIdx = startStaffIdx + 1; - } - else { - // TODO: get index for this score - qDebug("cmdAddTimeSig: unable to write local time signature change to linked score"); - startStaffIdx = 0; - endStaffIdx = 0; - } - } - else { - startStaffIdx = 0; - endStaffIdx = score->nstaves(); - } - return std::make_pair(startStaffIdx, endStaffIdx); - }; + auto getStaffIdxRange + = [this, local, staffIdx](const Score* score) -> std::pair { + int startStaffIdx, endStaffIdx; + if (local) { + if (score == this) { + startStaffIdx = staffIdx; + endStaffIdx = startStaffIdx + 1; + } else { + // TODO: get index for this score + qDebug("cmdAddTimeSig: unable to write local time signature change to linked score"); + startStaffIdx = 0; + endStaffIdx = 0; + } + } else { + startStaffIdx = 0; + endStaffIdx = score->nstaves(); + } + return std::make_pair(startStaffIdx, endStaffIdx); + }; if (ots && ots->sig() == ns && ots->stretch() == ts->stretch()) { // diff --git a/libmscore/score.cpp b/libmscore/score.cpp index e4356b4b0d67d..a28d860619d14 100644 --- a/libmscore/score.cpp +++ b/libmscore/score.cpp @@ -4329,14 +4329,15 @@ int Score::duration() //--------------------------------------------------------- int Score::durationWithoutRepeats() - { - masterScore()->setExpandRepeats(false); - const RepeatList& rl = repeatList(); - if (rl.empty()) - return 0; - const RepeatSegment* rs = rl.last(); - return lrint(utick2utime(rs->utick + rs->len())); - } +{ + masterScore()->setExpandRepeats(false); + const RepeatList& rl = repeatList(); + if (rl.empty()) { + return 0; + } + const RepeatSegment* rs = rl.last(); + return lrint(utick2utime(rs->utick + rs->len())); +} //--------------------------------------------------------- // createRehearsalMarkText diff --git a/libmscore/tremolo.cpp b/libmscore/tremolo.cpp index f9ff45b22f145..0c37313c2d88c 100644 --- a/libmscore/tremolo.cpp +++ b/libmscore/tremolo.cpp @@ -258,11 +258,11 @@ void Tremolo::layoutOneNoteTremolo(qreal x, qreal y, qreal spatium) if (!up && !(line & 1)) { // stem is down; even line t = qMax(4.0 + offset - 2.0 * minHeight(), 3.0); } else if (!up && (line & 1)) { // stem is down; odd line - t = qMax(5.0 - 2.0 * minHeight(), 3.0); + t = qMax(5.0 - 2.0 * minHeight(), 3.0); } else if (up && !(line & 1)) { // stem is up; even line - t = qMin(-3.0 - 2.0 * minHeight(), -4.0 - offset); + t = qMin(-3.0 - 2.0 * minHeight(), -4.0 - offset); } else { /*if ( up && (line & 1))*/ // stem is up; odd line - t = qMin(-3.0 - 2.0 * minHeight(), -5.0); + t = qMin(-3.0 - 2.0 * minHeight(), -5.0); } } @@ -535,7 +535,6 @@ void Tremolo::layout() } } - //--------------------------------------------------------- // crossStaffBeamBetween // Return true if tremolo is two-note cross-staff and beams between staves