Skip to content

Commit

Permalink
Merge pull request #17765 from sammik/instrument-change-paste
Browse files Browse the repository at this point in the history
fix #17691 - Instrument change copy paste
  • Loading branch information
RomanPudashkin committed Jun 6, 2023
2 parents 279de6d + 662407b commit 55e4991
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/engraving/libmscore/chordrest.cpp
Expand Up @@ -327,14 +327,21 @@ EngravingItem* ChordRest::drop(EditData& data)
ic->setParent(segment());
ic->setTrack(trackZeroVoice(track()));

const Instrument* instr = part()->instrument(tick());
IF_ASSERT_FAILED(instr) {
const Instrument* prevInstr = part()->instrument(tick());
const Instrument instr = *ic->instrument();

IF_ASSERT_FAILED(prevInstr) {
delete e;
return nullptr;
}

ic->setInstrument(*instr);
// temporarily set previous instrument, for correct transposition calculation
ic->setInstrument(*prevInstr);
score()->undoAddElement(ic);

if (!fromPalette) {
ic->setupInstrument(&instr);
}
return e;
}
case ElementType::FIGURED_BASS:
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/libmscore/edit.cpp
Expand Up @@ -3187,7 +3187,7 @@ void Score::deleteAnnotationsFromRange(Segment* s1, Segment* s2, track_idx_t tra
if (!filter.canSelect(annotation)) {
continue;
}
if (!annotation->systemFlag() && annotation->track() == track) {
if (!annotation->systemFlag() && annotation->track() == track && !(annotation->type() == ElementType::INSTRUMENT_CHANGE)) {
deleteItem(annotation);
}
}
Expand Down

0 comments on commit 55e4991

Please sign in to comment.