diff --git a/mscore/events.cpp b/mscore/events.cpp index 45cb1d3b85bd..83289c3e9bf4 100644 --- a/mscore/events.cpp +++ b/mscore/events.cpp @@ -367,6 +367,7 @@ void ScoreView::mousePressEventNormal(QMouseEvent* ev) } _score->update(); mscore->endCmd(); + mscore->updatePaletteBeamMode(clickOffElement); } //--------------------------------------------------------- diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp index 6cbe436584df..9619e0305a57 100644 --- a/mscore/musescore.cpp +++ b/mscore/musescore.cpp @@ -101,6 +101,7 @@ #include "libmscore/excerpt.h" #include "libmscore/synthesizerstate.h" #include "libmscore/utils.h" +#include "libmscore/icon.h" #include "driver.h" @@ -2162,6 +2163,66 @@ void MuseScore::selectionChanged(SelState selectionState) updateInspector(); } +//--------------------------------------------------------- +// updatePaletteBeamMode +// +// Updates the selected index of the Beam Properties +// palette to reflect the beam mode of the selected +// chord rest +//--------------------------------------------------------- + +void MuseScore::updatePaletteBeamMode(bool unselect) + { + for (Palette* p : paletteBox->palettes()) { + if (p->name() == "Beam Properties") { + if (unselect) { + p->setSelected(-1); + return; + } + const Selection sel = cs->selection(); + const ChordRest* cr = sel.cr(); + if (sel.isSingle() && cr) { + Beam::Mode bm = cr->beamMode(); + IconType type; + switch (bm) { + case Beam::Mode::BEGIN: + type = IconType::SBEAM; + break; + case Beam::Mode::MID: + type = IconType::MBEAM; + break; + case Beam::Mode::NONE: + type = IconType::NBEAM; + break; + case Beam::Mode::BEGIN32: + type = IconType::BEAM32; + break; + case Beam::Mode::BEGIN64: + type = IconType::BEAM64; + break; + case Beam::Mode::AUTO: + type = IconType::AUTOBEAM; + break; + default: + p->setSelected(-1); + return; + } + for (int i = 0; i < p->size(); ++i) { + if (toIcon(p->element(i))->iconType() == type) { + p->setSelected(i); + p->update(); + return; + } + } + } + else { + p->setSelected(-1); + } + p->update(); + } + } + } + //--------------------------------------------------------- // updateInspector //--------------------------------------------------------- diff --git a/mscore/musescore.h b/mscore/musescore.h index cd743d25aeef..7288ba48866f 100644 --- a/mscore/musescore.h +++ b/mscore/musescore.h @@ -619,6 +619,7 @@ class MuseScore : public QMainWindow, public MuseScoreCore { void showPluginManager(); // void updateTabNames(); + void updatePaletteBeamMode(bool unselect = false); QProgressBar* showProgressBar(); void hideProgressBar(); void addRecentScore(Score*); diff --git a/mscore/palette.cpp b/mscore/palette.cpp index b45273bc5467..bdcbdd09ad8a 100644 --- a/mscore/palette.cpp +++ b/mscore/palette.cpp @@ -534,6 +534,7 @@ void Palette::applyPaletteElement(PaletteCell* cell, Qt::KeyboardModifiers modif else { for (Element* e : sel.elements()) applyDrop(score, viewer, e, element, modifiers); + selectedIdx = currentIdx; } } else if (sel.isRange()) { @@ -560,6 +561,7 @@ void Palette::applyPaletteElement(PaletteCell* cell, Qt::KeyboardModifiers modif applyDrop(score, viewer, m, element, modifiers, pt); if (m == last) break; + selectedIdx = currentIdx; } } else if (element->type() == ElementType::LAYOUT_BREAK) {