diff --git a/src/engraving/rendering/score/tlayout.cpp b/src/engraving/rendering/score/tlayout.cpp index 7e5079793fb67..1a8b700d9f20a 100644 --- a/src/engraving/rendering/score/tlayout.cpp +++ b/src/engraving/rendering/score/tlayout.cpp @@ -199,12 +199,14 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::BAR_LINE: layoutBarLine(item_cast(item), static_cast(ldata), ctx); break; - case ElementType::BEAM: layoutBeam(item_cast(item), ctx); + case ElementType::BEAM: + layoutBeam(item_cast(item), ctx); break; case ElementType::BEND: layoutBend(item_cast(item), static_cast(ldata)); break; - case ElementType::STRETCHED_BEND: layoutStretchedBend(item_cast(item), ctx); + case ElementType::STRETCHED_BEND: + layoutStretchedBend(item_cast(item), ctx); break; case ElementType::HBOX: layoutHBox(item_cast(item), static_cast(ldata), ctx); @@ -224,7 +226,8 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::BREATH: layoutBreath(item_cast(item), static_cast(ldata), ctx.conf()); break; - case ElementType::CHORD: layoutChord(item_cast(item), ctx); + case ElementType::CHORD: + layoutChord(item_cast(item), ctx); break; case ElementType::CHORDLINE: layoutChordLine(item_cast(item), static_cast(ldata), ctx.conf()); @@ -256,23 +259,32 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::FRET_DIAGRAM: layoutFretDiagram(item_cast(item), static_cast(ldata), ctx); break; - case ElementType::GLISSANDO: layoutGlissando(item_cast(item), ctx); + case ElementType::GLISSANDO: + layoutGlissando(item_cast(item), ctx); break; - case ElementType::GLISSANDO_SEGMENT: layoutGlissandoSegment(item_cast(item), ctx); + case ElementType::GLISSANDO_SEGMENT: + layoutGlissandoSegment(item_cast(item), ctx); break; - case ElementType::GRADUAL_TEMPO_CHANGE: layoutGradualTempoChange(item_cast(item), ctx); + case ElementType::GRADUAL_TEMPO_CHANGE: + layoutGradualTempoChange(item_cast(item), ctx); break; - case ElementType::GRADUAL_TEMPO_CHANGE_SEGMENT: layoutGradualTempoChangeSegment(item_cast(item), ctx); + case ElementType::GRADUAL_TEMPO_CHANGE_SEGMENT: + layoutGradualTempoChangeSegment(item_cast(item), ctx); break; - case ElementType::GUITAR_BEND: layoutGuitarBend(item_cast(item), ctx); + case ElementType::GUITAR_BEND: + layoutGuitarBend(item_cast(item), ctx); break; - case ElementType::GUITAR_BEND_SEGMENT: layoutGuitarBendSegment(item_cast(item), ctx); + case ElementType::GUITAR_BEND_SEGMENT: + layoutGuitarBendSegment(item_cast(item), ctx); break; - case ElementType::GUITAR_BEND_HOLD_SEGMENT: GuitarBendLayout::layoutHoldLine(item_cast(item)); + case ElementType::GUITAR_BEND_HOLD_SEGMENT: + GuitarBendLayout::layoutHoldLine(item_cast(item)); break; - case ElementType::HAIRPIN: layoutHairpin(item_cast(item), ctx); + case ElementType::HAIRPIN: + layoutHairpin(item_cast(item), ctx); break; - case ElementType::HAIRPIN_SEGMENT: layoutHairpinSegment(item_cast(item), ctx); + case ElementType::HAIRPIN_SEGMENT: + layoutHairpinSegment(item_cast(item), ctx); break; case ElementType::HARP_DIAGRAM: layoutHarpPedalDiagram(item_cast(item), static_cast(ldata)); @@ -280,7 +292,8 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::HARMONY: layoutHarmony(item_cast(item), static_cast(ldata), ctx); break; - case ElementType::HARMONIC_MARK_SEGMENT: layoutHarmonicMarkSegment(item_cast(item), ctx); + case ElementType::HARMONIC_MARK_SEGMENT: + layoutHarmonicMarkSegment(item_cast(item), ctx); break; case ElementType::HOOK: layoutHook(item_cast(item), static_cast(ldata)); @@ -309,17 +322,23 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::SYSTEM_LOCK_INDICATOR: layoutSystemLockIndicator(item_cast(item), static_cast(ldata)); break; - case ElementType::LET_RING: layoutLetRing(item_cast(item), ctx); + case ElementType::LET_RING: + layoutLetRing(item_cast(item), ctx); break; - case ElementType::LET_RING_SEGMENT: layoutLetRingSegment(item_cast(item), ctx); + case ElementType::LET_RING_SEGMENT: + layoutLetRingSegment(item_cast(item), ctx); break; - case ElementType::LEDGER_LINE: layoutLedgerLine(item_cast(item), ctx); + case ElementType::LEDGER_LINE: + layoutLedgerLine(item_cast(item), ctx); break; - case ElementType::LYRICS: layoutLyrics(item_cast(item), ctx); + case ElementType::LYRICS: + layoutLyrics(item_cast(item), ctx); break; - case ElementType::LYRICSLINE_SEGMENT: layoutLyricsLineSegment(item_cast(item), ctx); + case ElementType::LYRICSLINE_SEGMENT: + layoutLyricsLineSegment(item_cast(item), ctx); break; - case ElementType::PARTIAL_LYRICSLINE_SEGMENT: layoutLyricsLineSegment(item_cast(item), ctx); + case ElementType::PARTIAL_LYRICSLINE_SEGMENT: + layoutLyricsLineSegment(item_cast(item), ctx); break; case ElementType::MARKER: layoutMarker(item_cast(item), static_cast(ldata)); @@ -354,26 +373,35 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::ORNAMENT: layoutOrnament(item_cast(item), static_cast(ldata), ctx.conf()); break; - case ElementType::OTTAVA: layoutOttava(item_cast(item), ctx); + case ElementType::OTTAVA: + layoutOttava(item_cast(item), ctx); break; - case ElementType::OTTAVA_SEGMENT: layoutOttavaSegment(item_cast(item), ctx); + case ElementType::OTTAVA_SEGMENT: + layoutOttavaSegment(item_cast(item), ctx); break; - case ElementType::PALM_MUTE: layoutPalmMute(item_cast(item), ctx); + case ElementType::PALM_MUTE: + layoutPalmMute(item_cast(item), ctx); break; - case ElementType::PALM_MUTE_SEGMENT: layoutPalmMuteSegment(item_cast(item), ctx); + case ElementType::PALM_MUTE_SEGMENT: + layoutPalmMuteSegment(item_cast(item), ctx); break; - case ElementType::PARENTHESIS: layoutParenthesis(item_cast(item), ctx); + case ElementType::PARENTHESIS: + layoutParenthesis(item_cast(item), ctx); break; - case ElementType::PEDAL: layoutPedal(item_cast(item), ctx); + case ElementType::PEDAL: + layoutPedal(item_cast(item), ctx); break; - case ElementType::PEDAL_SEGMENT: layoutPedalSegment(item_cast(item), ctx); + case ElementType::PEDAL_SEGMENT: + layoutPedalSegment(item_cast(item), ctx); break; - case ElementType::PICK_SCRAPE_SEGMENT: layoutPickScrapeSegment(item_cast(item), ctx); + case ElementType::PICK_SCRAPE_SEGMENT: + layoutPickScrapeSegment(item_cast(item), ctx); break; case ElementType::PLAYTECH_ANNOTATION: layoutPlayTechAnnotation(item_cast(item), static_cast(ldata)); break; - case ElementType::RASGUEADO_SEGMENT: layoutRasgueadoSegment(item_cast(item), ctx); + case ElementType::RASGUEADO_SEGMENT: + layoutRasgueadoSegment(item_cast(item), ctx); break; case ElementType::REHEARSAL_MARK: layoutRehearsalMark(item_cast(item), static_cast(ldata)); @@ -381,11 +409,14 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::REST: layoutRest(item_cast(item), static_cast(ldata), ctx); break; - case ElementType::SHADOW_NOTE: layoutShadowNote(item_cast(item), ctx); + case ElementType::SHADOW_NOTE: + layoutShadowNote(item_cast(item), ctx); break; - case ElementType::SLUR: layoutSlur(item_cast(item), ctx); + case ElementType::SLUR: + layoutSlur(item_cast(item), ctx); break; - case ElementType::SPACER: layoutSpacer(item_cast(item), ctx); + case ElementType::SPACER: + layoutSpacer(item_cast(item), ctx); break; case ElementType::STAFF_STATE: layoutStaffState(item_cast(item), static_cast(ldata)); @@ -429,42 +460,56 @@ void TLayout::layoutItem(EngravingItem* item, LayoutContext& ctx) case ElementType::TEXT: layoutText(item_cast(item), static_cast(ldata)); break; - case ElementType::TEXTLINE: layoutTextLine(item_cast(item), ctx); + case ElementType::TEXTLINE: + layoutTextLine(item_cast(item), ctx); break; - case ElementType::TEXTLINE_SEGMENT: layoutTextLineSegment(item_cast(item), ctx); + case ElementType::TEXTLINE_SEGMENT: + layoutTextLineSegment(item_cast(item), ctx); break; - case ElementType::TIE: layoutTie(item_cast(item), ctx); + case ElementType::TIE: + layoutTie(item_cast(item), ctx); break; case ElementType::TIMESIG: layoutTimeSig(item_cast(item), static_cast(ldata), ctx); break; - case ElementType::TIME_TICK_ANCHOR: layoutTimeTickAnchor(static_cast(item), ctx); + case ElementType::TIME_TICK_ANCHOR: + layoutTimeTickAnchor(static_cast(item), ctx); break; - case ElementType::TREMOLO_SINGLECHORD: layoutTremoloSingle(item_cast(item), ctx); + case ElementType::TREMOLO_SINGLECHORD: + layoutTremoloSingle(item_cast(item), ctx); break; - case ElementType::TREMOLO_TWOCHORD: layoutTremoloTwo(item_cast(item), ctx); + case ElementType::TREMOLO_TWOCHORD: + layoutTremoloTwo(item_cast(item), ctx); break; case ElementType::TREMOLOBAR: layoutTremoloBar(item_cast(item), static_cast(ldata)); break; - case ElementType::TRILL: layoutTrill(item_cast(item), ctx); + case ElementType::TRILL: + layoutTrill(item_cast(item), ctx); break; - case ElementType::TRILL_SEGMENT: layoutTrillSegment(item_cast(item), ctx); + case ElementType::TRILL_SEGMENT: + layoutTrillSegment(item_cast(item), ctx); break; case ElementType::TRIPLET_FEEL: layoutTripletFeel(item_cast(item), static_cast(ldata)); break; - case ElementType::TUPLET: layoutTuplet(item_cast(item), ctx); + case ElementType::TUPLET: + layoutTuplet(item_cast(item), ctx); break; - case ElementType::VIBRATO: layoutVibrato(item_cast(item), ctx); + case ElementType::VIBRATO: + layoutVibrato(item_cast(item), ctx); break; - case ElementType::VIBRATO_SEGMENT: layoutVibratoSegment(item_cast(item), ctx); + case ElementType::VIBRATO_SEGMENT: + layoutVibratoSegment(item_cast(item), ctx); break; - case ElementType::VOLTA: layoutVolta(item_cast(item), ctx); + case ElementType::VOLTA: + layoutVolta(item_cast(item), ctx); break; - case ElementType::VOLTA_SEGMENT: layoutVoltaSegment(item_cast(item), ctx); + case ElementType::VOLTA_SEGMENT: + layoutVoltaSegment(item_cast(item), ctx); break; - case ElementType::WHAMMY_BAR_SEGMENT: layoutWhammyBarSegment(item_cast(item), ctx); + case ElementType::WHAMMY_BAR_SEGMENT: + layoutWhammyBarSegment(item_cast(item), ctx); break; default: LOGE() << "not found in layout types item: " << item->typeName(); @@ -2167,7 +2212,7 @@ void TLayout::layoutFermata(const Fermata* item, Fermata::LayoutData* ldata, con double x = 0.0; double y = 0.0; const Segment* s = item->segment(); - const EngravingItem* e = s->element(item->track()); + const EngravingItem* e = s ? s->element(item->track()) : nullptr; if (e) { LD_CONDITION(e->ldata()->isSetBbox()); // e->shape() @@ -2204,11 +2249,13 @@ void TLayout::layoutFermata(const Fermata* item, Fermata::LayoutData* ldata, con ldata->setBbox(b.translated(-0.5 * b.width(), 0.0)); if (item->autoplace()) { - const Segment* s2 = item->segment(); - const Measure* m = s2->measure(); LD_CONDITION(ldata->isSetPos()); - LD_CONDITION(m->ldata()->isSetPos()); - LD_CONDITION(s2->ldata()->isSetPos()); + const Segment* s2 = item->segment(); + if (s2) { + const Measure* m = s2->measure(); + LD_CONDITION(m->ldata()->isSetPos()); + LD_CONDITION(s2->ldata()->isSetPos()); + } } Autoplace::autoplaceSegmentElement(item, ldata);