Skip to content

Commit

Permalink
Merge pull request #16223 from asattely/beam-refactor
Browse files Browse the repository at this point in the history
Beam / tremolo layout refactor
  • Loading branch information
RomanPudashkin authored Mar 22, 2023
2 parents b599b65 + 2cc6de2 commit a66ac8d
Show file tree
Hide file tree
Showing 42 changed files with 1,982 additions and 1,028 deletions.
13 changes: 13 additions & 0 deletions src/engraving/layout/layoutbeams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "containers.h"

#include "libmscore/beam.h"
#include "libmscore/tremolo.h"
#include "libmscore/chord.h"
#include "libmscore/factory.h"
#include "libmscore/measure.h"
Expand Down Expand Up @@ -503,6 +504,18 @@ void LayoutBeams::layoutNonCrossBeams(Segment* s)
// layout beam
if (LayoutBeams::isTopBeam(cr)) {
cr->beam()->layout();
if (!cr->beam()->tremAnchors().empty()) {
// there are inset tremolos in here
for (ChordRest* beamCr : cr->beam()->elements()) {
if (!beamCr->isChord()) {
continue;
}
Chord* c = toChord(beamCr);
if (c->tremolo() && c->tremolo()->twoNotes()) {
c->tremolo()->layout();
}
}
}
}
if (!cr->isChord()) {
continue;
Expand Down
12 changes: 12 additions & 0 deletions src/engraving/layout/layoutsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,18 @@ void LayoutSystem::updateCrossBeams(System* system, const LayoutContext& ctx)
LayoutChords::layoutChords1(chord->score(), &seg, chord->vStaffIdx());
seg.createShape(chord->vStaffIdx());
}
} else if (chord->tremolo() && chord->tremolo()->twoNotes()) {
Tremolo* t = chord->tremolo();
Chord* c1 = t->chord1();
Chord* c2 = t->chord2();
if (t->userModified() || (c1->staffMove() != 0 || c2->staffMove() != 0)) {
bool prevUp = chord->up();
chord->computeUp();
if (chord->up() != prevUp) {
LayoutChords::layoutChords1(chord->score(), &seg, chord->vStaffIdx());
seg.createShape(chord->vStaffIdx());
}
}
}
}
}
Expand Down
Loading

0 comments on commit a66ac8d

Please sign in to comment.