Skip to content

Commit

Permalink
Merge pull request musescore#13563 from iwoithe/fix-9476-accidental-i…
Browse files Browse the repository at this point in the history
…nteraction

Fix musescore#9476: Fix accidental note input bar and palette interaction
  • Loading branch information
RomanPudashkin committed Jul 12, 2023
2 parents 1caf582 + 3bc0903 commit 8d2434c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/engraving/libmscore/accidental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ bool Accidental::acceptDrop(EditData& data) const
{
EngravingItem* e = data.dropElement;

if (e->type() == ElementType::ACCIDENTAL) {
return true;
}

if (e->isActionIcon()) {
ActionIconType type = toActionIcon(e)->actionType();
return type == ActionIconType::PARENTHESES
Expand All @@ -411,6 +415,9 @@ EngravingItem* Accidental::drop(EditData& data)
{
EngravingItem* e = data.dropElement;
switch (e->type()) {
case ElementType::ACCIDENTAL:
score()->changeAccidental(note(), toAccidental(e)->accidentalType());
break;
case ElementType::ACTION_ICON:
switch (toActionIcon(e)->actionType()) {
case ActionIconType::PARENTHESES:
Expand Down
23 changes: 21 additions & 2 deletions src/engraving/libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1959,8 +1959,27 @@ void Score::toggleAccidental(AccidentalType at, const EditData& ed)

void Score::changeAccidental(AccidentalType idx)
{
for (Note* note : selection().noteList()) {
changeAccidental(note, idx);
for (EngravingItem* item : selection().elements()) {
Accidental* accidental = 0;
Note* note = 0;
switch (item->type()) {
case ElementType::ACCIDENTAL:
accidental = toAccidental(item);

if (accidental->accidentalType() == idx) {
changeAccidental(accidental->note(), AccidentalType::NONE);
} else {
changeAccidental(accidental->note(), idx);
}

break;
case ElementType::NOTE:
note = toNote(item);
changeAccidental(note, idx);
break;
default:
break;
}
}
}

Expand Down

0 comments on commit 8d2434c

Please sign in to comment.