Skip to content

Commit 8d2434c

Browse files
Merge pull request #13563 from iwoithe/fix-9476-accidental-interaction
Fix #9476: Fix accidental note input bar and palette interaction
2 parents 1caf582 + 3bc0903 commit 8d2434c

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/engraving/libmscore/accidental.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ bool Accidental::acceptDrop(EditData& data) const
394394
{
395395
EngravingItem* e = data.dropElement;
396396

397+
if (e->type() == ElementType::ACCIDENTAL) {
398+
return true;
399+
}
400+
397401
if (e->isActionIcon()) {
398402
ActionIconType type = toActionIcon(e)->actionType();
399403
return type == ActionIconType::PARENTHESES
@@ -411,6 +415,9 @@ EngravingItem* Accidental::drop(EditData& data)
411415
{
412416
EngravingItem* e = data.dropElement;
413417
switch (e->type()) {
418+
case ElementType::ACCIDENTAL:
419+
score()->changeAccidental(note(), toAccidental(e)->accidentalType());
420+
break;
414421
case ElementType::ACTION_ICON:
415422
switch (toActionIcon(e)->actionType()) {
416423
case ActionIconType::PARENTHESES:

src/engraving/libmscore/cmd.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,27 @@ void Score::toggleAccidental(AccidentalType at, const EditData& ed)
19591959

19601960
void Score::changeAccidental(AccidentalType idx)
19611961
{
1962-
for (Note* note : selection().noteList()) {
1963-
changeAccidental(note, idx);
1962+
for (EngravingItem* item : selection().elements()) {
1963+
Accidental* accidental = 0;
1964+
Note* note = 0;
1965+
switch (item->type()) {
1966+
case ElementType::ACCIDENTAL:
1967+
accidental = toAccidental(item);
1968+
1969+
if (accidental->accidentalType() == idx) {
1970+
changeAccidental(accidental->note(), AccidentalType::NONE);
1971+
} else {
1972+
changeAccidental(accidental->note(), idx);
1973+
}
1974+
1975+
break;
1976+
case ElementType::NOTE:
1977+
note = toNote(item);
1978+
changeAccidental(note, idx);
1979+
break;
1980+
default:
1981+
break;
1982+
}
19641983
}
19651984
}
19661985

0 commit comments

Comments
 (0)