Skip to content

Commit

Permalink
Remove unnecessary track mapping code
Browse files Browse the repository at this point in the history
This code was conflicting with the newly reimplemented function Staff::getLinkedTrackInStaff. The logic that these pieces of code were trying to handle is now all handled (as it should) in one single place.
  • Loading branch information
mike-spa committed Aug 9, 2024
1 parent af37f22 commit 3eff0b8
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/engraving/dom/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5761,18 +5761,7 @@ void Score::undoChangeVisible(EngravingItem* item, bool visible)
void Score::undoAddElement(EngravingItem* element, bool addToLinkedStaves, bool ctrlModifier, EngravingItem* elementToRelink)
{
Staff* ostaff = element->staff();
track_idx_t strack = muse::nidx;
if (ostaff) {
strack = ostaff->idx() * VOICES + element->track() % VOICES;

if (mu::engraving::Excerpt* excerpt = ostaff->score()->excerpt()) {
const TracksMap& tracks = excerpt->tracksMapping();

if (!tracks.empty() && strack != muse::nidx) {
strack = muse::key(tracks, strack, muse::nidx);
}
}
}
track_idx_t strack = element->track();

ElementType et = element->type();

Expand Down Expand Up @@ -6431,15 +6420,6 @@ void Score::undoAddCR(ChordRest* cr, Measure* measure, const Fraction& tick)

Staff* ostaff = cr->staff();
track_idx_t strack = ostaff->idx() * VOICES + cr->voice();
// If this is on an excerpt, get actual track
if (mu::engraving::Excerpt* excerpt = ostaff->score()->excerpt()) {
if (ostaff->isVoiceVisible(cr->voice())) {
const TracksMap& tracks = excerpt->tracksMapping();
if (!tracks.empty()) {
strack = muse::key(tracks, strack, muse::nidx);
}
}
}

SegmentType segmentType = SegmentType::ChordRest;

Expand Down

0 comments on commit 3eff0b8

Please sign in to comment.