LCOV - code coverage report
Current view: top level - src/engraving/rendering/score - slurtielayout.h Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 2 2
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2023 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #pragma once
      23              : 
      24              : #include "layoutcontext.h"
      25              : 
      26              : namespace mu::engraving {
      27              : class LaissezVib;
      28              : class LaissezVibSegment;
      29              : class Slur;
      30              : class SlurSegment;
      31              : struct SlurTiePos;
      32              : class SlurTieSegment;
      33              : class SpannerSegment;
      34              : class System;
      35              : class Chord;
      36              : class TieSegment;
      37              : class Tie;
      38              : class TremoloTwoChord;
      39              : enum class Grip : signed char;
      40              : class Note;
      41              : class PartialTie;
      42              : class PartialTieSegment;
      43              : class TappingHalfSlur;
      44              : class TappingHalfSlurSegment;
      45              : }
      46              : 
      47              : namespace muse::draw {
      48              : class Transform;
      49              : }
      50              : 
      51              : namespace mu::engraving::rendering::score {
      52              : class SlurTieLayout
      53              : {
      54              : public:
      55              :     static SpannerSegment* layoutSystem(Slur* item, System* system, LayoutContext& ctx);
      56              : 
      57              :     static TieSegment* layoutTieFor(Tie* item, System* system);
      58              :     static TieSegment* layoutTieBack(Tie* item, System* system, LayoutContext& ctx);
      59              :     static void resolveVerticalTieCollisions(const std::vector<TieSegment*>& stackedTies);
      60              : 
      61              :     static void computeUp(Slur* slur, LayoutContext& ctx);
      62              :     static void calculateDirection(Tie* item);
      63              : 
      64              :     static void computeBezier(TieSegment* tieSeg, PointF shoulderOffset = PointF());
      65              :     static void computeBezier(SlurSegment* slurSeg, PointF shoulderOffset = PointF());
      66              :     static double noteOpticalCenterForTie(const Note* note, bool up);
      67              :     static void createSlurSegments(Slur* item, LayoutContext& ctx);
      68              : 
      69              :     static void adjustOverlappingSlurs(const std::list<SpannerSegment*>& spannerSegments);
      70              : 
      71              :     static void layoutLaissezVibChord(Chord* chord, LayoutContext& ctx);
      72              : private:
      73              : 
      74              :     static void slurPos(Slur* item, SlurTiePos* sp, LayoutContext& ctx);
      75              :     static void adjustForTappingHalfSlurs(TappingHalfSlur* item, SlurTiePos* sp, Note* endNote);
      76              :     static void avoidPreBendsOnTab(const Chord* sc, const Chord* ec, SlurTiePos* sp);
      77              :     static void fixArticulations(Slur* item, PointF& pt, Chord* c, double up, bool stemSide);
      78              :     static void adjustEndPoints(SlurSegment* slurSeg);
      79              :     static void adjustSlurFloatingEndPointAngles(SlurSegment* slurSeg, PointF& p1, PointF& p2, bool incomingPartial, bool outgoingPartial);
      80              : 
      81              :     static void layoutSegment(SlurSegment* item, const PointF& p1, const PointF& p2);
      82              :     static void avoidCollisions(SlurSegment* slurSeg, PointF& pp1, PointF& p2, PointF& p3, PointF& p4,
      83              :                                 muse::draw::Transform& toSystemCoordinates, double& slurAngle);
      84              :     static Shape getSegmentShapes(SlurSegment* slurSeg, ChordRest* startCR, ChordRest* endCR);
      85              :     static Shape getSegmentShape(SlurSegment* slurSeg, Segment* seg, ChordRest* startCR, ChordRest* endCR);
      86              :     static void addMinClearanceToShapes(Shape& segShapes, double spatium, bool slurUp, const ChordRest* startCR, const ChordRest* endCR);
      87              :     static double computeArcClearance(double spatium, double slurLength, double slurAngle);
      88              :     static void computeAdjustmentBalance(SlurSegment* slurSeg, const ChordRest* startCR, const ChordRest* endCR, double& leftBalance,
      89              :                                          double& rightBalance);
      90              :     static bool hasArticulationAbove(SlurSegment* slurSeg, const ChordRest* chordRest);
      91              :     static double computeAdjustmentStep(int upSign, double spatium, double slurLength);
      92              :     static bool stemSideForBeam(Slur* slur, bool start);
      93          116 :     static bool stemSideStartForBeam(Slur* slur) { return stemSideForBeam(slur, true); }
      94          116 :     static bool stemSideEndForBeam(Slur* slur) { return stemSideForBeam(slur, false); }
      95              :     static bool isOverBeams(Slur* slur);
      96              :     static double computeShoulderHeight(SlurSegment* slurSeg, double slurLengthInSp, PointF shoulderOffset);
      97              : 
      98              :     static double endingXForOpenEndedSlurTie(const Measure* measure, staff_idx_t staffIdx);
      99              : 
     100              :     static bool tieSegmentShouldBeSkipped(const Tie* item);
     101              :     static void computeStartAndEndSystem(Tie* item, SlurTiePos& slurTiePos);
     102              :     static PointF computeDefaultStartOrEndPoint(const Tie* tie, Grip startOrEnd);
     103              :     static void correctForCrossStaff(Tie* tie, SlurTiePos& sPos, SpannerSegmentType type);
     104              :     static void forceHorizontal(Tie* tie, SlurTiePos& sPos);
     105              :     static void adjustX(TieSegment* tieSegment, SlurTiePos& sPos, Grip startOrEnd);
     106              :     static void adjustXforLedgerLines(TieSegment* tieSegment, bool start, Chord* chord, Note* note, const PointF& chordSystemPos,
     107              :                                       double padding, double& resultingX);
     108              :     static void adjustYforLedgerLines(TieSegment* tieSegment, SlurTiePos& sPos);
     109              :     static void adjustY(TieSegment* tieSegment);
     110              :     static bool hasEndPointAboveNote(TieSegment* tieSegment);
     111              : 
     112              :     static double defaultStemLengthStart(TremoloTwoChord* tremolo);
     113              :     static double defaultStemLengthEnd(TremoloTwoChord* tremolo);
     114              : 
     115              :     static bool isDirectionMixture(const Chord* c1, const Chord* c2, LayoutContext& ctx);
     116              : 
     117              :     static void computeMidThickness(SlurTieSegment* slurTieSeg, double slurTieLengthInSp);
     118              :     static void fillShape(SlurTieSegment* slurTieSeg, double slurTieLengthInSp);
     119              :     static bool shouldHideSlurSegment(SlurSegment* item);
     120              : 
     121              :     static void addLineAttachPoints(TieSegment* segment);
     122              :     static void addLineAttachPoints(PartialTieSegment* segment);
     123              : 
     124              :     static void calculateIsInside(Tie* item);
     125              : 
     126              :     static LaissezVibSegment* createLaissezVibSegment(LaissezVib* item);
     127              :     static void calculateLaissezVibX(LaissezVibSegment* segment, SlurTiePos& sPos, bool smufl);
     128              :     static void calculateLaissezVibY(LaissezVibSegment* segment, SlurTiePos& sPos);
     129              : 
     130              :     static PartialTieSegment* createPartialTieSegment(PartialTie* item);
     131              :     static PartialTieSegment* layoutPartialTie(PartialTie* item);
     132              : 
     133              :     static void setPartialTieEndPos(PartialTie* item, SlurTiePos& sPos);
     134              : };
     135              : }
        

Generated by: LCOV version 2.0-1