LCOV - code coverage report
Current view: top level - src/engraving/rendering/score - measurelayout.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 "../layoutoptions.h"
      25              : #include "layoutcontext.h"
      26              : 
      27              : namespace mu::engraving {
      28              : class Measure;
      29              : class MeasureBase;
      30              : class Parenthesis;
      31              : class Score;
      32              : class Segment;
      33              : class StaffLines;
      34              : enum class SegmentType;
      35              : enum class CourtesySegmentPosition : char;
      36              : }
      37              : 
      38              : namespace mu::engraving::rendering::score {
      39              : class MeasureLayout
      40              : {
      41              : public:
      42              :     struct MeasureStartEndPos {
      43        28569 :         MeasureStartEndPos(double x1, double x2)
      44        28569 :             : x1(x1), x2(x2) {}
      45              :         double x1;
      46              :         double x2;
      47              :     };
      48              : 
      49              :     MeasureLayout() = default;
      50              : 
      51              :     static void layout2(Measure* item, LayoutContext& ctx);
      52              : 
      53              :     static void getNextMeasure(LayoutContext& ctx);
      54              :     static void updateTicksMeasNumbersAndMMRests(MeasureBase* currentMB, LayoutContext& ctx);
      55              :     static void layoutMeasure(MeasureBase* currentMB, LayoutContext& ctx);
      56              : 
      57              :     static void computePreSpacingItems(Measure* m, LayoutContext& ctx);
      58              : 
      59              :     static void layoutStaffLines(Measure* m, LayoutContext& ctx);
      60              :     static void layoutPlayCountText(Measure* m, LayoutContext& ctx);
      61              :     static void layoutMeasureNumber(Measure* m, LayoutContext& ctx);
      62              :     static void layoutMeasureElements(Measure* m, LayoutContext& ctx);
      63              : 
      64              :     static void createEndBarLines(Measure* m, bool isLastMeasureInSystem, LayoutContext& ctx);
      65              :     static Segment* addHeaderClef(Measure* m, bool isFirstClef, const Staff* staff, LayoutContext& ctx);
      66              :     static Segment* addHeaderKeySig(Measure* m, bool isFirstKeysig, const Staff* staff, LayoutContext& ctx);
      67              :     static void addSystemHeader(Measure* m, bool isFirstSystem, LayoutContext& ctx);
      68              :     static void removeSystemHeader(Measure* m);
      69              :     static void addSystemTrailer(Measure* m, Measure* nm, LayoutContext& ctx);
      70              :     static void removeSystemTrailer(Measure* m, LayoutContext& ctx);
      71              : 
      72              :     static void setRepeatCourtesiesAndParens(Measure* m, LayoutContext& ctx);
      73              : 
      74              :     static void updateGraceNotes(Measure* measure, LayoutContext& ctx);
      75              : 
      76              :     static void createSystemBeginBarLine(Measure* m, LayoutContext& ctx);
      77              : 
      78              :     static void stretchMeasureInPracticeMode(Measure* m, double targetWidth, LayoutContext& ctx);
      79              : 
      80              :     static void layoutTimeTickAnchors(Measure* m, LayoutContext& ctx);
      81              : 
      82              :     static MeasureStartEndPos getMeasureStartEndPos(const Measure* measure, const Segment* firstCrSeg, const staff_idx_t staffIdx,
      83              :                                                     const bool needsHeaderException, const bool modernMMRest, const LayoutContext& ctx);
      84              : 
      85              :     static void updateKeySignatures(const Measure* measure, LayoutContext& ctx);
      86              : 
      87              :     static int adjustMeasureNumber(Measure* m, int measureNumber);
      88              : 
      89              : private:
      90              :     static void barLinesSetSpan(Segment* seg, LayoutContext& ctx);
      91              : 
      92              :     static void layoutPartialWidth(StaffLines* lines, LayoutContext& ctx, double w, double wPartial, bool alignLeft);
      93              : 
      94              :     static void moveToNextMeasure(LayoutContext& ctx);
      95              : 
      96              :     static void checkStaffMoveValidity(Measure* measure, const LayoutContext& ctx);
      97              : 
      98              :     static void setClefSegVisibility(Measure* m, bool isLastMeasureInSystem, LayoutContext& ctx);
      99              : 
     100              :     static void setCourtesyTimeSig(Measure* m, const Fraction& refSigTick, const Fraction& courtesySigTick, const SegmentType segType,
     101              :                                    LayoutContext& ctx);
     102              :     static void setCourtesyKeySig(Measure* m, const Fraction& refSigTick, const Fraction& courtesySigTick, const SegmentType segType,
     103              :                                   LayoutContext& ctx);
     104              :     static void setCourtesyClef(Measure* m, const Fraction& refSigTick, const Fraction& courtesySigTick, const SegmentType segType,
     105              :                                 LayoutContext& ctx);
     106              : 
     107              :     static void removeRepeatCourtesyParenthesesMeasure(Measure* m, const bool continuation, LayoutContext& ctx);
     108              :     static void removeRepeatCourtesyParenthesis(EngravingItem* item, const DirectionH direction = DirectionH::AUTO);
     109              :     static void addRepeatCourtesyParentheses(Measure* m, const bool continuation,  LayoutContext& ctx);
     110              :     static void addRepeatCourtesies(Measure* m, LayoutContext& ctx);
     111              :     static void removeRepeatCourtesies(Measure* m);
     112              :     static void addRepeatContinuationCourtesies(Measure* m, LayoutContext& ctx);
     113              :     static void removeRepeatContinuationCourtesies(Measure* m);
     114              : };
     115              : }
        

Generated by: LCOV version 2.0-1