Skip to content

Commit

Permalink
fix #281957 beam property highlighting for selected notes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhieuvu committed Feb 25, 2019
1 parent 36843a3 commit c3d0c12
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions mscore/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ void ScoreView::mousePressEventNormal(QMouseEvent* ev)
}
_score->update();
mscore->endCmd();
mscore->updatePaletteBeamMode(clickOffElement);
}

//---------------------------------------------------------
Expand Down
61 changes: 61 additions & 0 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
#include "libmscore/excerpt.h"
#include "libmscore/synthesizerstate.h"
#include "libmscore/utils.h"
#include "libmscore/icon.h"

#include "driver.h"

Expand Down Expand Up @@ -2153,6 +2154,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
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions mscore/musescore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down
2 changes: 2 additions & 0 deletions mscore/palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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) {
Expand Down

0 comments on commit c3d0c12

Please sign in to comment.