layout tempo text on top of slurs
This commit is contained in:
parent
2b94c90bca
commit
4151a1e3b6
5 changed files with 38 additions and 24 deletions
|
@ -587,8 +587,8 @@ bool Beam::slopeZero(const std::vector<ChordRest*>& cl)
|
|||
if (cl.size() == 2 && (cl.front()->isRest() || cl.back()->isRest()))
|
||||
return true;
|
||||
|
||||
// for(const ChordRest* cr : cl) {
|
||||
// if (cr->type() != ElementType::CHORD)
|
||||
// for (const ChordRest* cr : cl) {
|
||||
// if (!cr->isChord())
|
||||
// return true;
|
||||
// }
|
||||
int l1 = cl.front()->line();
|
||||
|
@ -599,9 +599,8 @@ bool Beam::slopeZero(const std::vector<ChordRest*>& cl)
|
|||
int l2 = cl[1]->line();
|
||||
int l3 = cl[2]->line();
|
||||
|
||||
if ((l1 < le) && (l2 > l1) && (l2 > l3) && (l3 > le)) {
|
||||
if ((l1 < le) && (l2 > l1) && (l2 > l3) && (l3 > le))
|
||||
return true;
|
||||
}
|
||||
if ((l1 == l3) && (l2 == le))
|
||||
return true;
|
||||
}
|
||||
|
@ -623,11 +622,9 @@ bool Beam::slopeZero(const std::vector<ChordRest*>& cl)
|
|||
int l4 = cl[1]->line(_up);
|
||||
for (unsigned i = 1; i < cl.size()-1; ++i) {
|
||||
// Don't consider interior rests
|
||||
if (cl[i]->type() != ElementType::CHORD)
|
||||
if (!cl[i]->isChord())
|
||||
continue;
|
||||
int l3 = cl[i]->line(_up);
|
||||
if (l3 != l4)
|
||||
sameLine = false;
|
||||
if (_up) {
|
||||
if (l3 < l1 && l3 < le)
|
||||
return true;
|
||||
|
@ -636,8 +633,9 @@ bool Beam::slopeZero(const std::vector<ChordRest*>& cl)
|
|||
if (l3 > l1 && l3 > le)
|
||||
return true;
|
||||
}
|
||||
sameLine = l3 == l4;
|
||||
}
|
||||
if (sameLine && (l1 == l4 || le == l4) && cl[1]->type() == ElementType::CHORD) {
|
||||
if (sameLine && (l1 == l4 || le == l4) && cl[1]->isChord()) {
|
||||
if (_up) {
|
||||
if (l1 == l4 && l1 < le)
|
||||
return true;
|
||||
|
|
|
@ -1160,8 +1160,10 @@ void Chord::processSiblings(std::function<void(Element*)> func) const
|
|||
func(_tremolo);
|
||||
for (LedgerLine* ll = _ledgerLines; ll; ll = ll->next())
|
||||
func(ll);
|
||||
|
||||
for (Note* note : _notes)
|
||||
func(note);
|
||||
|
||||
for (Element* e : el())
|
||||
func(e);
|
||||
for (Chord* chord : _graceNotes) // process grace notes last, needed for correct shape calculation
|
||||
|
|
|
@ -2989,7 +2989,6 @@ System* Score::collectSystem(LayoutContext& lc)
|
|||
//
|
||||
// layout
|
||||
// - beams
|
||||
// - TempoText
|
||||
// - RehearsalMark, StaffText
|
||||
// - Dynamic
|
||||
// - update the segment shape + measure shape
|
||||
|
@ -3018,17 +3017,7 @@ System* Score::collectSystem(LayoutContext& lc)
|
|||
}
|
||||
}
|
||||
for (Element* e : s->annotations()) {
|
||||
if (e->isTempoText()) {
|
||||
TempoText* tt = toTempoText(e);
|
||||
setTempo(tt->segment(), tt->tempo());
|
||||
tt->layout();
|
||||
if (tt->visible()) {
|
||||
int si = tt->staffIdx();
|
||||
s->staffShape(si).add(tt->shape().translated(e->pos()));
|
||||
m->staffShape(si).add(tt->shape().translated(s->pos() + e->pos()));
|
||||
}
|
||||
}
|
||||
else if (e->visible() && (e->isRehearsalMark() || e->isStaffText())) {
|
||||
if (e->visible() && (e->isRehearsalMark() || e->isStaffText())) {
|
||||
e->layout();
|
||||
int si = e->staffIdx();
|
||||
s->staffShape(si).add(e->shape().translated(e->pos()));
|
||||
|
@ -3217,6 +3206,29 @@ System* Score::collectSystem(LayoutContext& lc)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tempo text
|
||||
|
||||
for (MeasureBase* mb : system->measures()) {
|
||||
if (!mb->isMeasure())
|
||||
continue;
|
||||
SegmentType st = SegmentType::ChordRest;
|
||||
Measure* m = toMeasure(mb);
|
||||
for (Segment* s = m->first(st); s; s = s->next(st)) {
|
||||
for (Element* e : s->annotations()) {
|
||||
if (e->isTempoText()) {
|
||||
TempoText* tt = toTempoText(e);
|
||||
setTempo(tt->segment(), tt->tempo());
|
||||
tt->layout();
|
||||
if (tt->visible()) {
|
||||
int si = tt->staffIdx();
|
||||
s->staffShape(si).add(tt->shape().translated(e->pos()));
|
||||
m->staffShape(si).add(tt->shape().translated(s->pos() + e->pos()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
system->layout2(); // compute staff distances
|
||||
|
||||
Measure* lm = system->lastMeasure();
|
||||
|
|
|
@ -2973,7 +2973,7 @@ void Note::setAccidentalType(AccidentalType type)
|
|||
Shape Note::shape() const
|
||||
{
|
||||
Shape shape;
|
||||
shape.add(symBbox(noteHead()));
|
||||
shape.add(symBbox(_cachedNoteheadSym));
|
||||
for (NoteDot* dot : _dots)
|
||||
shape.add(symBbox(SymId::augmentationDot).translated(dot->pos()));
|
||||
if (_accidental)
|
||||
|
|
|
@ -1343,16 +1343,18 @@ qreal Segment::minHorizontalDistance(Segment* ns, bool systemHeaderGap) const
|
|||
bool isGap = false;
|
||||
for (int i = 0; i < score()->nstaves() * VOICES; i++) {
|
||||
Element* el = element(i);
|
||||
if (el && el->isRest() && toRest(el)->isGap())
|
||||
if (!el)
|
||||
continue;
|
||||
if (el->isRest() && toRest(el)->isGap())
|
||||
isGap = true;
|
||||
else if (el) {
|
||||
else {
|
||||
isGap = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isGap)
|
||||
return 0.0;
|
||||
|
||||
// minimum distance between notes is one note head width
|
||||
w = qMax(w, score()->noteHeadWidth()) + score()->styleP(StyleIdx::minNoteDistance);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue