LCOV - code coverage report
Current view: top level - src/engraving/dom - volta.h Coverage Total Hit
Test: filtered_coverage.info Lines: 90.9 % 11 10
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) 2021 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              : 
      23              : #ifndef MU_ENGRAVING_VOLTA_H
      24              : #define MU_ENGRAVING_VOLTA_H
      25              : 
      26              : #include "textlinebase.h"
      27              : 
      28              : namespace mu::engraving {
      29              : class Score;
      30              : 
      31              : class Volta;
      32              : class Measure;
      33              : 
      34              : //---------------------------------------------------------
      35              : //   @@ VoltaSegment
      36              : //---------------------------------------------------------
      37              : 
      38              : class VoltaSegment final : public TextLineBaseSegment
      39              : {
      40          496 :     OBJECT_ALLOCATOR(engraving, VoltaSegment)
      41              :     DECLARE_CLASSOF(ElementType::VOLTA_SEGMENT)
      42              : 
      43              : public:
      44              :     VoltaSegment(Volta*);
      45              : 
      46           75 :     VoltaSegment* clone() const override { return new VoltaSegment(*this); }
      47              : 
      48          243 :     Volta* volta() const { return (Volta*)spanner(); }
      49              : 
      50              :     EngravingObject* propertyDelegate(Pid) const override;
      51              : };
      52              : 
      53              : //---------------------------------------------------------
      54              : //   @@ Volta
      55              : //   @P voltaType  enum (Volta.CLOSE, Volta.OPEN)
      56              : //---------------------------------------------------------
      57              : 
      58              : class Volta final : public TextLineBase
      59              : {
      60          793 :     OBJECT_ALLOCATOR(engraving, Volta)
      61         1438 :     DECLARE_CLASSOF(ElementType::VOLTA)
      62              : 
      63              : public:
      64              :     enum class Type : char {
      65              :         OPEN, CLOSED
      66              :     };
      67              : 
      68              :     Volta(DummyParentOr<EngravingItem> parent);
      69              : 
      70          231 :     Volta* clone() const override { return new Volta(*this); }
      71              : 
      72         2918 :     Anchor anchor() const override { return Anchor::MEASURE; }
      73              : 
      74              :     LineSegment* createLineSegment() override;
      75              : 
      76            0 :     bool allowTimeAnchor() const override { return false; }
      77              : 
      78              :     void setChannel() const;
      79              : 
      80          549 :     std::vector<int> endings() const { return m_endings; }
      81          135 :     std::vector<int>& endings() { return m_endings; }
      82              :     void setEndings(const std::vector<int>& l);
      83              :     void setText(const String& s);
      84              :     String text() const;
      85              : 
      86              :     bool hasEnding(int repeat) const;
      87              :     int firstEnding() const;
      88              :     int lastEnding() const;
      89              :     void setVoltaType(Volta::Type);       // deprecated
      90              :     Type voltaType() const;               // deprecated
      91              : 
      92              :     bool isFirstVolta() const { return m_endings.size() == 1 && hasEnding(1); }
      93              : 
      94              :     PropertyValue getProperty(Pid propertyId) const override;
      95              :     bool setProperty(Pid propertyId, const PropertyValue&) override;
      96              :     PropertyValue propertyDefault(Pid) const override;
      97              : 
      98              :     String accessibleInfo() const override;
      99              : 
     100              :     PointF linePos(Grip grip, System** system) const override;
     101              : 
     102              : protected:
     103              :     Sid defaultPosSid() const override;
     104              : 
     105              : private:
     106              :     std::vector<int> m_endings;
     107              : };
     108              : } // namespace mu::engraving
     109              : 
     110              : #ifndef NO_QT_SUPPORT
     111           16 : Q_DECLARE_METATYPE(mu::engraving::Volta::Type)
     112              : #endif
     113              : 
     114              : #endif
        

Generated by: LCOV version 2.0-1