Skip to content

Commit

Permalink
fix #270589: "bend type" does not remember previous user selection
Browse files Browse the repository at this point in the history
Resolves: https://musescore.org/node/270589.

A "Custom" option is added to get the right behaviour of bend type.
  • Loading branch information
Harmoniker1 committed Dec 24, 2019
1 parent 13e6772 commit 083d881
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 22 deletions.
54 changes: 32 additions & 22 deletions mscore/inspector/inspectorBend.cpp
Expand Up @@ -60,45 +60,55 @@ void InspectorBend::bendTypeChanged(int n)
{
QList<PitchValue>& 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;
}

bendCanvasUpdate();
update();
}

//---------------------------------------------------------
// setElement
//---------------------------------------------------------

void InspectorBend::setElement()
{
InspectorElementBase::setElement();

QList<PitchValue> 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
//---------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions mscore/inspector/inspectorBend.h
Expand Up @@ -34,7 +34,19 @@ class InspectorBend : public InspectorElementBase {
public:
InspectorBend(QWidget* parent);
const QList<PitchValue>& points() const;
virtual void setElement() override;
};

static const QList<PitchValue> BEND
= { PitchValue(0, 0), PitchValue(15, 100), PitchValue(60, 100) };
static const QList<PitchValue> BEND_RELEASE
= { PitchValue(0, 0), PitchValue(10, 100), PitchValue(20, 100), PitchValue(30, 0), PitchValue(60, 0) };
static const QList<PitchValue> 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<PitchValue> PREBEND
= { PitchValue(0, 100), PitchValue(60, 100) };
static const QList<PitchValue> PREBEND_RELEASE
= { PitchValue(0, 100), PitchValue(15, 100), PitchValue(30, 0), PitchValue(60, 0) };

} // namespace Ms
#endif
5 changes: 5 additions & 0 deletions mscore/inspector/inspector_bend.ui
Expand Up @@ -378,6 +378,11 @@
<string>Prebend/Release</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 083d881

Please sign in to comment.