Skip to content

Commit

Permalink
fix #281957: display of beam properties for a selected note
Browse files Browse the repository at this point in the history
Do not deactivate the highlighted beam mode palette cell when the user clicks on the canvas to drag the score. Also, highlight the beam mode for multiple selected ChordRests, if they all have the same beam mode.
  • Loading branch information
mattmcclinch committed Nov 23, 2019
1 parent b35311d commit e3dd8fe
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
7 changes: 3 additions & 4 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2336,10 +2336,10 @@ void MuseScore::selectionChanged(SelState selectionState)
// chord rest
//---------------------------------------------------------

void MuseScore::updatePaletteBeamMode(bool unselect)
void MuseScore::updatePaletteBeamMode()
{
if (paletteWorkspace)
paletteWorkspace->updateCellsState(cs->selection(), unselect);
paletteWorkspace->updateCellsState(cs->selection());
}

//---------------------------------------------------------
Expand Down Expand Up @@ -5968,8 +5968,7 @@ void MuseScore::endCmd()
selectionChanged(SelState::NONE);
}
updateInspector();
if (cv)
updatePaletteBeamMode(cv->clickOffElement);
updatePaletteBeamMode();
#ifdef SCRIPT_INTERFACE
getPluginEngine()->endEndCmd(this);
#endif
Expand Down
2 changes: 1 addition & 1 deletion mscore/musescore.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ class MuseScore : public QMainWindow, public MuseScoreCore {
void showPluginManager();

// void updateTabNames();
void updatePaletteBeamMode(bool unselect = false);
void updatePaletteBeamMode();
QProgressBar* showProgressBar();
void hideProgressBar();
void addRecentScore(Score*);
Expand Down
20 changes: 14 additions & 6 deletions mscore/palette/palettemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,13 +789,21 @@ bool PaletteTreeModel::insertPalettePanel(std::unique_ptr<PalettePanel> pp, int
// PaletteTreeModel::updateCellsState
//---------------------------------------------------------

void PaletteTreeModel::updateCellsState(const Selection& sel, bool deactivateAll)
void PaletteTreeModel::updateCellsState(const Selection& sel)
{
const ChordRest* cr = sel.cr();
const IconType beamIconType = cr ? Beam::iconType(cr->beamMode()) : IconType::NONE;

if (!sel.isSingle() || !cr)
deactivateAll = true;
const ChordRest* cr = sel.firstChordRest();
const Beam::Mode bm = cr ? cr->beamMode() : Beam::Mode::NONE;
const IconType beamIconType = Beam::iconType(bm);
bool deactivateAll = !cr;

for (Element* e : sel.elements()) {
if (e->isNote())
e = e->parent();
if (e->isChordRest()) {
if (toChordRest(e)->beamMode() != bm)
deactivateAll = true;
}
}

const size_t npalettes = palettes().size();
for (size_t row = 0; row < npalettes; ++row) {
Expand Down
2 changes: 1 addition & 1 deletion mscore/palette/palettemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class PaletteTreeModel : public QAbstractItemModel {
PaletteCellPtr findCell(const QModelIndex& index);
bool insertPalettePanel(std::unique_ptr<PalettePanel> pp, int row, const QModelIndex& parent = QModelIndex());

void updateCellsState(const Selection&, bool deactivateAll);
void updateCellsState(const Selection&);
void retranslate();
};

Expand Down
2 changes: 1 addition & 1 deletion mscore/palette/paletteworkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class PaletteWorkspace : public QObject {
void write(XmlWriter&) const;
bool read(XmlReader&);

void updateCellsState(const Selection& sel, bool deactivateAll) { userPalette->updateCellsState(sel, deactivateAll); }
void updateCellsState(const Selection& sel) { userPalette->updateCellsState(sel); }
void retranslate() { userPalette->retranslate(); masterPalette->retranslate(); defaultPalette->retranslate(); }
};

Expand Down

0 comments on commit e3dd8fe

Please sign in to comment.