Skip to content

Commit

Permalink
fix #309760: chord symbols realized before executing dialog
Browse files Browse the repository at this point in the history
Resolves: https://musescore.org/en/node/309760

There is a command realize-chord-symbols that you can access
from the tools menu or shortcut if you have defined it,
and also a similarly item on the context menu for chord symbols.
They are slightly differently, however -
the command just runs, whereas the context menu brings up a dialog.
Because they shared the same action,
the context menu was actually executing both versions.
This is fixed by creating a new action for the context menu.
I reuse the name of the command but add an ellipsis,
since it brings up a dialog.

I suppose it's an open question why the behaviors should be different
between invoking this from the Tools menu versus the context menu,
but I'll wait until someone actually complains before changing it.
  • Loading branch information
MarcSabatella committed Aug 28, 2020
1 parent f4c0004 commit d23fbf2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 2 additions & 3 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5934,10 +5934,9 @@ void MuseScore::transpose()
}

//---------------------------------------------------------
// cmdRealizeChordSymbols
// realizeChordSymbols
/// Realize selected chord symbols into notes on the staff.
/// Currently just pops up a dialog to list TPCs,
/// Intervals, and pitches.
/// Display dialog to offer overrides to default behavior
//---------------------------------------------------------

void MuseScore::realizeChordSymbols()
Expand Down
4 changes: 3 additions & 1 deletion mscore/propertymenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ void ScoreView::createElementPropertyMenu(Element* e, QMenu* popup)
}
else if (e->isHarmony()) {
genPropertyMenu1(e, popup);
popup->addAction(getAction("realize-chord-symbols"));
QAction* a = getAction("realize-chord-symbols");
if (a)
popup->addAction(a->text() + "")->setData("realize-chord-symbols-dialog");
}
else if (e->isTempoText())
genPropertyMenu1(e, popup);
Expand Down
11 changes: 8 additions & 3 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,15 @@ void ScoreView::objectPopup(const QPoint& pos, Element* obj)
mscore->selectSimilarInRange(obj);
else if (cmd == "select-dialog")
mscore->selectElementDialog(obj);
else if (cmd == "realize-chord-symbols") {
else if (cmd == "realize-chord-symbols-dialog") {
if (obj->isEditable()) {
if (obj->score())
obj->score()->select(obj, SelectType::ADD);
// try to construct a reasonable selection
if (obj->score()) {
Score* score = obj->score();
if (score->selection().isRange())
mscore->selectSimilarInRange(obj);
score->select(obj, SelectType::ADD);
}
mscore->realizeChordSymbols();
}
}
Expand Down

0 comments on commit d23fbf2

Please sign in to comment.