From 083d88189a359b1d759e5f958705ac5dcf3e4405 Mon Sep 17 00:00:00 2001 From: Howard-C Date: Sat, 7 Dec 2019 11:49:04 +0800 Subject: [PATCH] fix #270589: "bend type" does not remember previous user selection Resolves: https://musescore.org/node/270589. A "Custom" option is added to get the right behaviour of bend type. --- mscore/inspector/inspectorBend.cpp | 54 ++++++++++++++++++------------ mscore/inspector/inspectorBend.h | 12 +++++++ mscore/inspector/inspector_bend.ui | 5 +++ 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/mscore/inspector/inspectorBend.cpp b/mscore/inspector/inspectorBend.cpp index 4d566ae8d007..3067628cb901 100644 --- a/mscore/inspector/inspectorBend.cpp +++ b/mscore/inspector/inspectorBend.cpp @@ -60,38 +60,23 @@ void InspectorBend::bendTypeChanged(int n) { QList& points = g.bendCanvas->points(); - points.clear(); switch (n) { case 0: - points.append(PitchValue(0, 0)); - points.append(PitchValue(15, 100)); - points.append(PitchValue(60, 100)); + points = BEND; break; case 1: - points.append(PitchValue(0, 0)); - points.append(PitchValue(10, 100)); - points.append(PitchValue(20, 100)); - points.append(PitchValue(30, 0)); - points.append(PitchValue(60, 0)); + points = BEND_RELEASE; break; case 2: - points.append(PitchValue(0, 0)); - points.append(PitchValue(10, 100)); - points.append(PitchValue(20, 100)); - points.append(PitchValue(30, 0)); - points.append(PitchValue(40, 0)); - points.append(PitchValue(50, 100)); - points.append(PitchValue(60, 100)); + points = BEND_RELEASE_BEND; break; case 3: - points.append(PitchValue(0, 100)); - points.append(PitchValue(60, 100)); + points = PREBEND; break; case 4: - points.append(PitchValue(0, 100)); - points.append(PitchValue(15, 100)); - points.append(PitchValue(30, 0)); - points.append(PitchValue(60, 0)); + points = PREBEND_RELEASE; + break; + case 5: break; } @@ -99,6 +84,31 @@ void InspectorBend::bendTypeChanged(int n) update(); } +//--------------------------------------------------------- +// setElement +//--------------------------------------------------------- + +void InspectorBend::setElement() + { + InspectorElementBase::setElement(); + + QList points = g.bendCanvas->points(); + if (!(g.bendType->currentIndex() == 5)) { + if (points == BEND) + g.bendType->setCurrentIndex(0); + else if (points == BEND_RELEASE) + g.bendType->setCurrentIndex(1); + else if (points == BEND_RELEASE_BEND) + g.bendType->setCurrentIndex(2); + else if (points == PREBEND) + g.bendType->setCurrentIndex(3); + else if (points == PREBEND_RELEASE) + g.bendType->setCurrentIndex(4); + else + g.bendType->setCurrentIndex(5); + } + } + //--------------------------------------------------------- // bendCanvasUpdate //--------------------------------------------------------- diff --git a/mscore/inspector/inspectorBend.h b/mscore/inspector/inspectorBend.h index 24512732fe17..c0c998573761 100644 --- a/mscore/inspector/inspectorBend.h +++ b/mscore/inspector/inspectorBend.h @@ -34,7 +34,19 @@ class InspectorBend : public InspectorElementBase { public: InspectorBend(QWidget* parent); const QList& points() const; + virtual void setElement() override; }; +static const QList BEND + = { PitchValue(0, 0), PitchValue(15, 100), PitchValue(60, 100) }; +static const QList BEND_RELEASE + = { PitchValue(0, 0), PitchValue(10, 100), PitchValue(20, 100), PitchValue(30, 0), PitchValue(60, 0) }; +static const QList BEND_RELEASE_BEND + = { PitchValue(0, 0), PitchValue(10, 100), PitchValue(20, 100), PitchValue(30, 0), PitchValue(40, 0), PitchValue(50, 100), PitchValue(60, 100) }; +static const QList PREBEND + = { PitchValue(0, 100), PitchValue(60, 100) }; +static const QList PREBEND_RELEASE + = { PitchValue(0, 100), PitchValue(15, 100), PitchValue(30, 0), PitchValue(60, 0) }; + } // namespace Ms #endif diff --git a/mscore/inspector/inspector_bend.ui b/mscore/inspector/inspector_bend.ui index 188c2360c670..6e1e0f93f473 100644 --- a/mscore/inspector/inspector_bend.ui +++ b/mscore/inspector/inspector_bend.ui @@ -378,6 +378,11 @@ Prebend/Release + + + Custom + +