fix #26476
This commit is contained in:
parent
a4d6faa2ed
commit
a2c0bf6188
10 changed files with 30 additions and 39 deletions
|
@ -1357,7 +1357,7 @@ void Score::doLayout()
|
|||
Spanner* sp = s.second;
|
||||
if (sp->type() == Element::Type::OTTAVA && sp->tick2() == -1) {
|
||||
sp->setTick2(lastMeasure()->endTick());
|
||||
sp->staff()->updateOttava(static_cast<Ottava*>(sp));
|
||||
sp->staff()->updateOttava();
|
||||
}
|
||||
// 1.3 scores can have ties in this list
|
||||
if (sp->type() != Element::Type::TIE) {
|
||||
|
|
|
@ -1906,11 +1906,7 @@ void Measure::read(XmlReader& e, int staffIdx)
|
|||
// track is the same as the beginning of the slur
|
||||
if (spanner->track2() == -1)
|
||||
spanner->setTrack2(spanner->track() ? spanner->track() : e.track());
|
||||
if (spanner->type() == Element::Type::OTTAVA) {
|
||||
Ottava* o = static_cast<Ottava*>(spanner);
|
||||
o->staff()->updateOttava(o);
|
||||
}
|
||||
else if (spanner->type() == Element::Type::HAIRPIN) {
|
||||
if (spanner->type() == Element::Type::HAIRPIN) {
|
||||
Hairpin* hp = static_cast<Hairpin*>(spanner);
|
||||
score()->updateHairpin(hp);
|
||||
}
|
||||
|
|
|
@ -225,10 +225,7 @@ void Ottava::endEdit()
|
|||
{
|
||||
if (editTick != tick() || editTick2 != tick2()) {
|
||||
Staff* s = staff();
|
||||
s->pitchOffsets().remove(editTick);
|
||||
s->pitchOffsets().remove(editTick2);
|
||||
|
||||
s->updateOttava(this);
|
||||
s->updateOttava();
|
||||
score()->addLayoutFlags(LayoutFlag::FIX_PITCH_VELO);
|
||||
score()->setPlaylistDirty(true);
|
||||
}
|
||||
|
@ -353,15 +350,13 @@ bool Ottava::setProperty(P_ID propertyId, const QVariant& val)
|
|||
break;
|
||||
|
||||
case P_ID::SPANNER_TICK2:
|
||||
staff()->pitchOffsets().remove(tick2());
|
||||
setTick2(val.toInt());
|
||||
staff()->updateOttava(this);
|
||||
staff()->updateOttava();
|
||||
break;
|
||||
|
||||
case P_ID::SPANNER_TICK:
|
||||
staff()->pitchOffsets().remove(tick());
|
||||
setTick(val.toInt());
|
||||
staff()->updateOttava(this);
|
||||
staff()->updateOttava();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -163,10 +163,8 @@ void Score::pasteStaff(XmlReader& e, Segment* dst, int staffIdx)
|
|||
spanner->setTick2(e.tick() - tickStart + dstTick);
|
||||
removeSpanner(spanner);
|
||||
undoAddElement(spanner);
|
||||
if (spanner->type() == Element::Type::OTTAVA) {
|
||||
Ottava* o = static_cast<Ottava*>(spanner);
|
||||
o->staff()->updateOttava(o);
|
||||
}
|
||||
if (spanner->type() == Element::Type::OTTAVA)
|
||||
spanner->staff()->updateOttava();
|
||||
else if (spanner->type() == Element::Type::HAIRPIN) {
|
||||
Hairpin* hp = static_cast<Hairpin*>(spanner);
|
||||
updateHairpin(hp);
|
||||
|
|
|
@ -584,7 +584,6 @@ Score::FileError Score::read114(XmlReader& e)
|
|||
if (s->type() == Element::Type::OTTAVA) {
|
||||
// fix ottava position
|
||||
Ottava* ottava = static_cast<Ottava*>(s);
|
||||
ottava->staff()->updateOttava(ottava);
|
||||
yo = styleS(StyleIdx::ottavaY).val() * spatium();
|
||||
if (s->placement() == Element::Placement::BELOW)
|
||||
yo = -yo + s->staff()->height();
|
||||
|
|
|
@ -1366,8 +1366,8 @@ void Score::addElement(Element* element)
|
|||
if (ss->system())
|
||||
ss->system()->add(ss);
|
||||
}
|
||||
o->staff()->updateOttava(o);
|
||||
layoutFlags |= LayoutFlag::FIX_PITCH_VELO;
|
||||
o->staff()->updateOttava();
|
||||
_playlistDirty = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1504,9 +1504,7 @@ void Score::removeElement(Element* element)
|
|||
if (ss->system())
|
||||
ss->system()->remove(ss);
|
||||
}
|
||||
Staff* s = o->staff();
|
||||
s->pitchOffsets().remove(o->tick());
|
||||
s->pitchOffsets().remove(o->tick2());
|
||||
o->staff()->updateOttava();
|
||||
layoutFlags |= LayoutFlag::FIX_PITCH_VELO;
|
||||
_playlistDirty = true;
|
||||
}
|
||||
|
|
|
@ -852,17 +852,14 @@ Score::FileError Score::read1(XmlReader& e, bool ignoreVersionError)
|
|||
if (i->second->tick2() == -1)
|
||||
sl.append(i->second);
|
||||
}
|
||||
if (!sl.isEmpty()) {
|
||||
int lastTick = lastMeasure()->endTick();
|
||||
for (Spanner* s : sl) {
|
||||
s->setTick2(lastTick);
|
||||
_spanner.removeSpanner(s);
|
||||
_spanner.addSpanner(s);
|
||||
}
|
||||
int lastTick = lastMeasure()->endTick();
|
||||
for (Spanner* s : sl) {
|
||||
s->setTick2(lastTick);
|
||||
_spanner.removeSpanner(s);
|
||||
_spanner.addSpanner(s);
|
||||
}
|
||||
|
||||
// _mscVersion is needed used during layout
|
||||
// _mscVersion = MSCVERSION; // for later drag & drop usage
|
||||
for (Staff* s : _staves)
|
||||
s->updateOttava();
|
||||
|
||||
setCreated(false);
|
||||
return FileError::FILE_NO_ERROR;
|
||||
|
|
|
@ -815,10 +815,18 @@ bool Staff::showLedgerLines()
|
|||
// updateOttava
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Staff::updateOttava(Ottava* o)
|
||||
void Staff::updateOttava()
|
||||
{
|
||||
_pitchOffsets.setPitchOffset(o->tick(), o->pitchShift());
|
||||
_pitchOffsets.setPitchOffset(o->tick2(), 0);
|
||||
int staffIdx = idx();
|
||||
_pitchOffsets.clear();
|
||||
for (auto i : score()->spanner()) {
|
||||
const Spanner* s = i.second;
|
||||
if (s->type() == Element::Type::OTTAVA && s->staffIdx() == staffIdx) {
|
||||
const Ottava* o = static_cast<const Ottava*>(s);
|
||||
_pitchOffsets.setPitchOffset(o->tick(), o->pitchShift());
|
||||
_pitchOffsets.setPitchOffset(o->tick2(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -200,9 +200,9 @@ class Staff : public QObject {
|
|||
bool isDrumStaff() const { return staffGroup() == StaffGroup::PERCUSSION; }
|
||||
|
||||
VeloList& velocities() { return _velocities; }
|
||||
PitchList& pitchOffsets() { return _pitchOffsets; }
|
||||
// PitchList& pitchOffsets() { return _pitchOffsets; }
|
||||
int pitchOffset(int tick) { return _pitchOffsets.pitchOffset(tick); }
|
||||
void updateOttava(Ottava*);
|
||||
void updateOttava();
|
||||
|
||||
LinkedStaves* linkedStaves() const { return _linkedStaves; }
|
||||
void setLinkedStaves(LinkedStaves* l) { _linkedStaves = l; }
|
||||
|
|
|
@ -692,8 +692,8 @@ void OveToMScore::convertTrackElements(int track) {
|
|||
int absTick = mtt_->getTick(i, octave->getEndTick());
|
||||
|
||||
ottava->setTick2(absTick);
|
||||
ottava->staff()->updateOttava(ottava);
|
||||
score_->addSpanner(ottava);
|
||||
ottava->staff()->updateOttava();
|
||||
ottava = 0;
|
||||
} else {
|
||||
qDebug("octave-shift stop without start");
|
||||
|
|
Loading…
Reference in a new issue