Skip to content

Commit

Permalink
Manually merge libmscore part of #4220 to master
Browse files Browse the repository at this point in the history
Remaining changes have to be migrated to the ew inspector
  • Loading branch information
anatoly-os committed Aug 20, 2020
1 parent c83c0db commit f30bec6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
9 changes: 6 additions & 3 deletions libmscore/breath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ void Breath::layout()
{
bool palette = (track() == -1);
if (!palette) {
int voiceOffset = placeBelow() * (staff()->lines(tick()) - 1) * spatium();
if (isCaesura()) {
setPos(rxpos(), spatium());
setPos(rxpos(), spatium() + voiceOffset);
} else if ((score()->styleSt(Sid::MusicalSymbolFont) == "Emmentaler") && (symId() == SymId::breathMarkComma)) {
setPos(rxpos(), 0.5 * spatium());
setPos(rxpos(), 0.5 * spatium() + voiceOffset);
} else {
setPos(rxpos(), -0.5 * spatium());
setPos(rxpos(), -0.5 * spatium() + voiceOffset);
}
}
setbbox(symBbox(_symId));
Expand Down Expand Up @@ -209,6 +210,8 @@ QVariant Breath::propertyDefault(Pid id) const
switch (id) {
case Pid::PAUSE:
return 0.0;
case Pid::PLACEMENT:
return track() & 1 ? int(Placement::BELOW) : int(Placement::ABOVE);
default:
return Element::propertyDefault(id);
}
Expand Down
15 changes: 5 additions & 10 deletions libmscore/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,11 @@ Element* ChordRest::drop(EditData& data)
{
Breath* b = toBreath(e);
b->setPos(QPointF());
int track = staffIdx() * VOICES;
b->setTrack(track);

// find start tick of next note in staff
#if 0
int bt = tick() + actualTicks(); // this could make sense if we allowed breath marks in voice > 1
#else
Segment* next = segment()->nextCR(track);
Fraction bt = next ? next->tick() : score()->lastSegment()->tick();
#endif
// allow breath marks in voice > 1
b->setTrack(this->track());
b->setPlacement(b->track() & 1 ? Placement::BELOW : Placement::ABOVE);
Fraction bt = tick() + actualTicks();
bt = tick() + actualTicks();

// TODO: insert automatically in all staves?

Expand Down
1 change: 1 addition & 0 deletions libmscore/measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2188,6 +2188,7 @@ void Measure::readVoice(XmlReader& e, int staffIdx, bool irregular)
} else if (tag == "Breath") {
Breath* breath = new Breath(score());
breath->setTrack(e.track());
breath->setPlacement(breath->track() & 1 ? Placement::BELOW : Placement::ABOVE);
breath->read(e);
segment = getSegment(SegmentType::Breath, e.tick());
segment->add(breath);
Expand Down
1 change: 1 addition & 0 deletions libmscore/read114.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,7 @@ static void readMeasure(Measure* m, int staffIdx, XmlReader& e)
Breath* breath = new Breath(m->score());
breath->setTrack(e.track());
Fraction tick = e.tick();
breath->setPlacement(breath->track() & 1 ? Placement::BELOW : Placement::ABOVE);
breath->read(e);
// older scores placed the breath segment right after the chord to which it applies
// rather than before the next chordrest segment with an element for the staff
Expand Down
1 change: 1 addition & 0 deletions libmscore/read206.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,7 @@ static void readMeasure(Measure* m, int staffIdx, XmlReader& e)
Breath* breath = new Breath(score);
breath->setTrack(e.track());
Fraction tick = e.tick();
breath->setPlacement(Placement::ABOVE);
breath->read(e);
// older scores placed the breath segment right after the chord to which it applies
// rather than before the next chordrest segment with an element for the staff
Expand Down

0 comments on commit f30bec6

Please sign in to comment.