Merge pull request #2303 from MarcSabatella/51626-local-meter-paste
cheap partial fix for #51626: disallow copy/paste with local time sig…
This commit is contained in:
commit
6a68ee57a3
2 changed files with 21 additions and 2 deletions
|
@ -156,6 +156,11 @@ bool Score::pasteStaff(XmlReader& e, Segment* dst, int dstStaff)
|
|||
tuplet->setTrack(e.track());
|
||||
tuplet->read(e);
|
||||
int tick = e.tick();
|
||||
// no paste into local time signature
|
||||
if (staff(dstStaffIdx)->timeStretch(tick) != Fraction(1, 1)) {
|
||||
qDebug("paste into local time signature");
|
||||
return false;
|
||||
}
|
||||
Measure* measure = tick2measure(tick);
|
||||
tuplet->setParent(measure);
|
||||
tuplet->setTick(tick);
|
||||
|
@ -174,6 +179,11 @@ bool Score::pasteStaff(XmlReader& e, Segment* dst, int dstStaff)
|
|||
cr->read(e);
|
||||
cr->setSelected(false);
|
||||
int tick = e.tick();
|
||||
// no paste into local time signature
|
||||
if (staff(dstStaffIdx)->timeStretch(tick) != Fraction(1, 1)) {
|
||||
qDebug("paste into local time signature");
|
||||
return false;
|
||||
}
|
||||
if (cr->isGrace())
|
||||
graceNotes.push_back(static_cast<Chord*>(cr));
|
||||
else {
|
||||
|
|
|
@ -1044,7 +1044,7 @@ static bool checkEnd(Element* e, int endTick)
|
|||
//---------------------------------------------------------
|
||||
// canCopy
|
||||
// return false if range selection intersects a tuplet
|
||||
// or a tremolo
|
||||
// or a tremolo, or a local timne signature
|
||||
//---------------------------------------------------------
|
||||
|
||||
bool Selection::canCopy() const
|
||||
|
@ -1054,7 +1054,8 @@ bool Selection::canCopy() const
|
|||
|
||||
int endTick = _endSegment ? _endSegment->tick() : score()->lastSegment()->tick();
|
||||
|
||||
for (int staffIdx = _staffStart; staffIdx != _staffEnd; ++staffIdx)
|
||||
for (int staffIdx = _staffStart; staffIdx != _staffEnd; ++staffIdx) {
|
||||
|
||||
for (int voice = 0; voice < VOICES; ++voice) {
|
||||
int track = staffIdx * VOICES + voice;
|
||||
if (!canSelectVoice(track))
|
||||
|
@ -1079,6 +1080,14 @@ bool Selection::canCopy() const
|
|||
if (checkEnd(endSegmentSelection->element(track), endTick))
|
||||
return false;
|
||||
}
|
||||
|
||||
// loop through measures on this staff checking for local time signatures
|
||||
for (Measure* m = _startSegment->measure(); m && m->tick() < endTick; m = m->nextMeasure()) {
|
||||
if (_score->staff(staffIdx)->timeStretch(m->tick()) != Fraction(1, 1))
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue