fix #38486
This commit is contained in:
parent
ae9f8de1a8
commit
666ea12d00
4 changed files with 41 additions and 15 deletions
|
@ -46,12 +46,9 @@ DurationElement::DurationElement(const DurationElement& e)
|
|||
|
||||
DurationElement::~DurationElement()
|
||||
{
|
||||
qDebug("~DurationElement: tuplet %p", tuplet());
|
||||
if (tuplet() && !tuplet()->elements().isEmpty() && tuplet()->elements().front() == this) {
|
||||
qDebug(" delete tuplet");
|
||||
if (tuplet() && !tuplet()->elements().isEmpty() && tuplet()->elements().front() == this)
|
||||
delete tuplet();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// globalDuration
|
||||
|
|
|
@ -287,6 +287,26 @@ static void cloneTuplets(ChordRest* ocr, ChordRest* ncr, Tuplet* ot, TupletMap&
|
|||
ncr->setTuplet(nt);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// mapTrack
|
||||
//---------------------------------------------------------
|
||||
|
||||
static int mapTrack(int srcTrack, const QList<int>& map)
|
||||
{
|
||||
if (srcTrack == -1)
|
||||
return -1;
|
||||
int track = -1;
|
||||
int st = 0;
|
||||
foreach(int staff, map) {
|
||||
if (staff == srcTrack / VOICES) {
|
||||
track = (st * VOICES) + srcTrack % VOICES;
|
||||
break;
|
||||
}
|
||||
++st;
|
||||
}
|
||||
return track;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// cloneStaves
|
||||
//---------------------------------------------------------
|
||||
|
@ -327,15 +347,9 @@ void cloneStaves(Score* oscore, Score* score, const QList<int>& map)
|
|||
int tracks = oscore->nstaves() * VOICES;
|
||||
for (int srcTrack = 0; srcTrack < tracks; ++srcTrack) {
|
||||
TupletMap tupletMap; // tuplets cannot cross measure boundaries
|
||||
int track = -1;
|
||||
int st = 0;
|
||||
foreach(int staff, map) {
|
||||
if (staff == srcTrack/VOICES) {
|
||||
track = (st * VOICES) + srcTrack % VOICES;
|
||||
break;
|
||||
}
|
||||
++st;
|
||||
}
|
||||
|
||||
int track = mapTrack(srcTrack, map);
|
||||
|
||||
Tremolo* tremolo = 0;
|
||||
for (Segment* oseg = m->first(); oseg; oseg = oseg->next()) {
|
||||
Segment* ns = nullptr; //create segment later, on demand
|
||||
|
@ -461,12 +475,20 @@ void cloneStaves(Score* oscore, Score* score, const QList<int>& map)
|
|||
if (st == LayoutBreak::Type::PAGE || st == LayoutBreak::Type::LINE)
|
||||
continue;
|
||||
}
|
||||
int track = -1;
|
||||
if (e->track() != -1) {
|
||||
track = mapTrack(e->track(), map);
|
||||
if (track == -1)
|
||||
continue;
|
||||
}
|
||||
|
||||
Element* ne;
|
||||
if (e->type() == Element::Type::TEXT || e->type() == Element::Type::LAYOUT_BREAK) // link the title, subtitle etc...
|
||||
ne = e->linkedClone();
|
||||
else
|
||||
ne = e->clone();
|
||||
ne->setScore(score);
|
||||
ne->setTrack(track);
|
||||
nmb->add(ne);
|
||||
}
|
||||
nmbl->add(nmb);
|
||||
|
@ -500,9 +522,10 @@ void cloneStaves(Score* oscore, Score* score, const QList<int>& map)
|
|||
int dstTrack = -1;
|
||||
int dstTrack2 = -1;
|
||||
int st = 0;
|
||||
if (s->type() == Element::Type::VOLTA) {
|
||||
//always export voltas to first staff in part
|
||||
if (s->type() == Element::Type::VOLTA)
|
||||
dstTrack = s->voice();
|
||||
}
|
||||
else { //export other spanner if staffidx matches
|
||||
for (int index : map) {
|
||||
if (index == staffIdx) {
|
||||
|
|
|
@ -2329,6 +2329,10 @@ bool Measure::visible(int staffIdx) const
|
|||
{
|
||||
if (system() && (system()->staves()->isEmpty() || !system()->staff(staffIdx)->show()))
|
||||
return false;
|
||||
if (staffIdx >= score()->staves().size()) {
|
||||
qDebug("Measure::visible: bad staffIdx: %d", staffIdx);
|
||||
return false;
|
||||
}
|
||||
return score()->staff(staffIdx)->show() && staves[staffIdx]->_visible;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ void MeasureBase::scanElements(void* data, void (*func)(void*, Element*), bool a
|
|||
if (type() == Element::Type::MEASURE) {
|
||||
foreach(Element* e, _el) {
|
||||
if (score()->tagIsValid(e->tag())) {
|
||||
if (e->staffIdx() >= score()->staves().size())
|
||||
qDebug("MeasureBase::scanElements: bad staffIdx %d in element %s", e->staffIdx(), e->name());
|
||||
if ((e->track() == -1) || ((Measure*)this)->visible(e->staffIdx()))
|
||||
e->scanElements(data, func, all);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue