Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Inspector] move Tremolo Bar Properties into Inspector (fix #53236) #5585

Merged
merged 4 commits into from Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions mscore/CMakeLists.txt
Expand Up @@ -96,7 +96,7 @@ QT5_WRAP_UI (ui_headers
transposedialog.ui excerptsdialog.ui stafftext.ui tupletdialog.ui
articulation.ui metaedit.ui paletteProperties.ui paletteCellProperties.ui selectdialog.ui selectnotedialog.ui
synthcontrol.ui splitstaff.ui keyedit.ui selectinstr.ui
editstafftype.ui tremolobar.ui
editstafftype.ui
editpitch.ui editstringdata.ui editraster.ui mediadialog.ui albummanager.ui layer.ui
omrpanel.ui masterpalette.ui harmonyedit.ui pathlistdialog.ui
note_groups.ui resourceManager.ui stafftypetemplates.ui
Expand Down Expand Up @@ -335,7 +335,7 @@ add_library(mscoreapp STATIC
seq.h shortcut.h shortcutcapturedialog.h simplebutton.h splitstaff.h stafftextproperties.h
startcenter.h startupWizard.h stringutils.h svggenerator.h symboldialog.h synthcontrol.h
templateBrowser.h textcursor.h textpalette.h texttools.h timedialog.h timeline.h timesigproperties.h
toolbarEditor.h toolbuttonmenu.h transposedialog.h tremolobarcanvas.h tremolobarprop.h
toolbarEditor.h toolbuttonmenu.h transposedialog.h tremolobarcanvas.h
tupletdialog.h updatechecker.h uploadscoredialog.h waveview.h webpage.h workspace.h

recordbutton.h greendotbutton prefsdialog.h prefsdialog.cpp
Expand Down Expand Up @@ -377,8 +377,8 @@ add_library(mscoreapp STATIC
stafftextproperties.cpp splitstaff.cpp
tupletdialog.cpp
articulationprop.cpp
bendcanvas.cpp fretcanvas.cpp
tremolobarprop.cpp file.cpp keyb.cpp osc.cpp
bendcanvas.cpp fretcanvas.cpp tremolobarcanvas.cpp
file.cpp keyb.cpp osc.cpp
layer.cpp selectdialog.cpp selectnotedialog.cpp propertymenu.cpp shortcut.cpp bb.cpp
dragelement.cpp startupWizard.cpp
svggenerator.cpp
Expand Down Expand Up @@ -423,6 +423,7 @@ add_library(mscoreapp STATIC
inspector/inspectorPedal.cpp
inspector/inspectorDynamic.cpp
inspector/inspectorInstrchange.cpp
inspector/inspectorTremoloBar.cpp
inspector/inspectorElementBase.cpp
inspector/resetButton.cpp
enableplayforwidget.cpp
Expand Down
8 changes: 4 additions & 4 deletions mscore/bendcanvas.cpp
Expand Up @@ -49,8 +49,8 @@ void BendCanvas::paintEvent(QPaintEvent* ev)
static const int ROWS = 13;
static const int COLUMNS = 13;

int xs = w / (COLUMNS);
int ys = h / (ROWS);
int xs = w / COLUMNS;
int ys = h / ROWS;
int lm = xs / 2;
int tm = ys / 2;
int tw = (COLUMNS - 1) * xs;
Expand Down Expand Up @@ -82,7 +82,7 @@ void BendCanvas::paintEvent(QPaintEvent* ev)
pen.setWidth(5);
pen.setColor(Qt::gray);
p.setPen(pen);
foreach(const PitchValue& v, _points) {
for (const PitchValue& v : _points) {
int x = ((tw * v.time) / 60) + lm;
int y = th - ((th * v.pitch) / 300) + tm;
if (idx)
Expand All @@ -92,7 +92,7 @@ void BendCanvas::paintEvent(QPaintEvent* ev)
++idx;
}

foreach(const PitchValue& v, _points) {
for (const PitchValue& v : _points) {
int x = ((tw * v.time) / 60) + lm;
int y = th - ((th * v.pitch) / 300) + tm;
p.fillRect(x - GRIP2, y - GRIP2, GRIP, GRIP, Qt::blue);
Expand Down
38 changes: 2 additions & 36 deletions mscore/inspector/inspector.cpp
Expand Up @@ -41,6 +41,7 @@
#include "inspectorInstrchange.h"
#include "inspectorMeasureNumber.h"
#include "inspectorBend.h"
#include "inspectorTremoloBar.h"
#include "musescore.h"
#include "scoreview.h"
#include "icons.h"
Expand All @@ -65,7 +66,6 @@
#include "libmscore/staff.h"
#include "libmscore/measure.h"
#include "libmscore/tuplet.h"
#include "libmscore/tremolobar.h"
#include "libmscore/slur.h"
#include "libmscore/breath.h"
#include "libmscore/lyrics.h"
Expand Down Expand Up @@ -986,41 +986,7 @@ InspectorAccidental::InspectorAccidental(QWidget* parent)
}

//---------------------------------------------------------
// InspectorTremoloBar
//---------------------------------------------------------

InspectorTremoloBar::InspectorTremoloBar(QWidget* parent)
: InspectorElementBase(parent)
{
g.setupUi(addWidget());

const std::vector<InspectorItem> iiList = {
{ Pid::PLAY, 0, g.play, g.resetPlay },
{ Pid::LINE_WIDTH, 0, g.lineWidth, g.resetLineWidth },
{ Pid::MAG, 0, g.mag, g.resetMag }
};
const std::vector<InspectorPanel> ppList = { { g.title, g.panel } };

mapSignals(iiList, ppList);
connect(g.properties, SIGNAL(clicked()), SLOT(propertiesClicked()));
}

//---------------------------------------------------------
// propertiesClicked
//---------------------------------------------------------

void InspectorTremoloBar::propertiesClicked()
{
TremoloBar* b = toTremoloBar(inspector->element());
Score* score = b->score();
score->startCmd();
mscore->currentScoreView()->editTremoloBarProperties(b);
b->triggerLayoutAll();
score->endCmd();
}

//---------------------------------------------------------
// InspectorTremoloBar
// InspectorTremolo
//---------------------------------------------------------

InspectorTremolo::InspectorTremolo(QWidget* parent)
Expand Down
17 changes: 0 additions & 17 deletions mscore/inspector/inspector.h
Expand Up @@ -42,7 +42,6 @@
#include "ui_inspector_text.h"
// #include "ui_inspector_fret.h"
#include "ui_inspector_tremolo.h"
#include "ui_inspector_tremolobar.h"
#include "ui_inspector_caesura.h"
#include "ui_inspector_bracket.h"
#include "ui_inspector_iname.h"
Expand Down Expand Up @@ -306,22 +305,6 @@ class InspectorAccidental : public InspectorElementBase {
InspectorAccidental(QWidget* parent);
};

//---------------------------------------------------------
// InspectorTremoloBar
//---------------------------------------------------------

class InspectorTremoloBar : public InspectorElementBase {
Q_OBJECT

Ui::InspectorTremoloBar g;

private slots:
void propertiesClicked();

public:
InspectorTremoloBar(QWidget* parent);
};

//---------------------------------------------------------
// InspectorTremolo
//---------------------------------------------------------
Expand Down
81 changes: 42 additions & 39 deletions mscore/inspector/inspectorBend.cpp
Expand Up @@ -19,18 +19,22 @@
namespace Ms {

//---------------------------------------------------------
// Preset bends
// BendType
//---------------------------------------------------------

static const QList<PitchValue> BEND
enum class BendType : char {
BEND, BEND_RELEASE, BEND_RELEASE_BEND, PREBEND, PREBEND_RELEASE, CUSTOM
};

static const QList<PitchValue> bend
= { PitchValue(0, 0), PitchValue(15, 100), PitchValue(60, 100) };
static const QList<PitchValue> BEND_RELEASE
static const QList<PitchValue> bendRelease
= { PitchValue(0, 0), PitchValue(10, 100), PitchValue(20, 100), PitchValue(30, 0), PitchValue(60, 0) };
static const QList<PitchValue> BEND_RELEASE_BEND
static const QList<PitchValue> bendReleaseBend
= { 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
static const QList<PitchValue> prebend
= { PitchValue(0, 100), PitchValue(60, 100) };
static const QList<PitchValue> PREBEND_RELEASE
static const QList<PitchValue> prebendRelease
= { PitchValue(0, 100), PitchValue(15, 100), PitchValue(30, 0), PitchValue(60, 0) };

//---------------------------------------------------------
Expand All @@ -50,8 +54,17 @@ InspectorBend::InspectorBend(QWidget* parent)
{ Pid::FONT_STYLE, 0, g.fontStyle, g.resetFontStyle },
};
const std::vector<InspectorPanel> ppList = { {g.title, g.panel} };

mapSignals(iiList, ppList);

g.bendType->clear();
g.bendType->addItem(tr("Bend"), int(BendType::BEND) );
g.bendType->addItem(tr("Bend/Release"), int(BendType::BEND_RELEASE) );
g.bendType->addItem(tr("Bend/Release/Bend"), int(BendType::BEND_RELEASE_BEND) );
g.bendType->addItem(tr("Prebend"), int(BendType::PREBEND) );
g.bendType->addItem(tr("Prebend/Release"), int(BendType::PREBEND_RELEASE) );
g.bendType->addItem(tr("Custom"), int(BendType::CUSTOM) );

Bend* b = toBend(inspector->element());
g.bendCanvas->setPoints(b->points());
connect(g.bendType, SIGNAL(currentIndexChanged(int)), SLOT(bendTypeChanged(int)));
Expand All @@ -67,56 +80,46 @@ 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);
if (!(g.bendType->currentIndex() == int(BendType::CUSTOM))) { // custom bend
if (points == bend)
g.bendType->setCurrentIndex(int(BendType::BEND));
else if (points == bendRelease)
g.bendType->setCurrentIndex(int(BendType::BEND_RELEASE));
else if (points == bendReleaseBend)
g.bendType->setCurrentIndex(int(BendType::BEND_RELEASE_BEND));
else if (points == prebend)
g.bendType->setCurrentIndex(int(BendType::PREBEND));
else if (points == prebendRelease)
g.bendType->setCurrentIndex(int(BendType::PREBEND_RELEASE));
else
g.bendType->setCurrentIndex(5);
g.bendType->setCurrentIndex(int(BendType::CUSTOM));
}
}

//---------------------------------------------------------
// points
//---------------------------------------------------------

const QList<PitchValue>& InspectorBend::points() const
{
return g.bendCanvas->points();
}

//---------------------------------------------------------
// bendTypeChanged
//---------------------------------------------------------

void InspectorBend::bendTypeChanged(int n)
{
QList<PitchValue>& points = g.bendCanvas->points();

switch (n) {
case 0:
points = BEND;
g.bendCanvas->setPoints(bend);
break;
case 1:
points = BEND_RELEASE;
g.bendCanvas->setPoints(bendRelease);
break;
case 2:
points = BEND_RELEASE_BEND;
g.bendCanvas->setPoints(bendReleaseBend);
break;
case 3:
points = PREBEND;
g.bendCanvas->setPoints(prebend);
break;
case 4:
points = PREBEND_RELEASE;
g.bendCanvas->setPoints(prebendRelease);
break;
case 5:
default:
break;
}

Expand All @@ -130,12 +133,12 @@ void InspectorBend::bendTypeChanged(int n)

void InspectorBend::updateBend()
{
Bend* bend = toBend(inspector->element());
Score* sc = bend->score();
Bend* b = toBend(inspector->element());
Score* sc = b->score();
sc->startCmd();
for (ScoreElement* b : bend->linkList()) {
sc->undo(new ChangeBend(toBend(b), g.bendCanvas->points()));
toBend(b)->triggerLayout();
for (ScoreElement* el : b->linkList()) {
sc->undo(new ChangeBend(toBend(el), g.bendCanvas->points()));
toBend(el)->triggerLayout();
}
sc->endCmd();
}
Expand Down
1 change: 0 additions & 1 deletion mscore/inspector/inspectorBend.h
Expand Up @@ -34,7 +34,6 @@ class InspectorBend : public InspectorElementBase {

public:
InspectorBend(QWidget* parent);
const QList<PitchValue>& points() const;
virtual void setElement() override;
};

Expand Down