LCOV - code coverage report
Current view: top level - src/engraving/dom - tremolobar.h Coverage Total Hit
Test: filtered_coverage.info Lines: 76.9 % 13 10
Test Date: 2026-11-19 04:14:36

            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_TREMOLOBAR_H
      24              : #define MU_ENGRAVING_TREMOLOBAR_H
      25              : 
      26              : #include "engravingitem.h"
      27              : 
      28              : namespace mu::engraving {
      29              : //---------------------------------------------------------
      30              : //   @@ TremoloBar
      31              : //
      32              : //   @P userMag    double
      33              : //   @P lineWidth  double
      34              : //   @P play       bool         play tremolo bar
      35              : //---------------------------------------------------------
      36              : 
      37              : enum class TremoloBarType : unsigned char {
      38              :     DIP = 0,
      39              :     DIVE,
      40              :     RELEASE_UP,
      41              :     INVERTED_DIP,
      42              :     RETURN,
      43              :     RELEASE_DOWN,
      44              :     CUSTOM
      45              : };
      46              : 
      47              : class TremoloBar final : public EngravingItem
      48              : {
      49           58 :     OBJECT_ALLOCATOR(engraving, TremoloBar)
      50          138 :     DECLARE_CLASSOF(ElementType::TREMOLOBAR)
      51              : 
      52              : public:
      53              : 
      54            0 :     TremoloBar* clone() const override { return new TremoloBar(*this); }
      55              :     void setOwnershipParent(DummyParentOr<Segment> parent) { EngravingItem::setOwnershipParent(parent); }
      56              : 
      57           85 :     PitchValues& points() { return m_points; }
      58           49 :     const PitchValues& points() const { return m_points; }
      59            0 :     void setPoints(const PitchValues& p) { m_points = p; }
      60              : 
      61              :     PropertyValue getProperty(Pid propertyId) const override;
      62              :     bool setProperty(Pid propertyId, const PropertyValue&) override;
      63              :     PropertyValue propertyDefault(Pid) const override;
      64              : 
      65           42 :     double userMag() const { return m_userMag; }
      66            1 :     void setUserMag(double m) { m_userMag = m; }
      67              : 
      68           31 :     void setLineWidth(Spatium v) { m_lw = v; }
      69           38 :     Spatium lineWidth() const { return m_lw; }
      70              : 
      71            4 :     bool play() const { return m_play; }
      72            0 :     void setPlay(bool val) { m_play = val; }
      73              : 
      74              :     struct LayoutData : public EngravingItem::LayoutData {
      75              :         PolygonF polygon;
      76              :     };
      77           30 :     DECLARE_LAYOUTDATA_METHODS(TremoloBar)
      78              : 
      79              : private:
      80              : 
      81              :     friend class Factory;
      82              :     TremoloBar(DummyParentOr<Segment> parent);
      83              : 
      84              :     TremoloBarType parseTremoloBarTypeFromCurve(const PitchValues& curve) const;
      85              :     void updatePointsByTremoloBarType(const TremoloBarType type);
      86              : 
      87              :     Spatium m_lw;
      88              :     double m_userMag = 1.0;           // allowed 0.1 - 10.0
      89              :     bool m_play = true;
      90              : 
      91              :     PitchValues m_points;
      92              : };
      93              : } // namespace mu::engraving
      94              : #endif
        

Generated by: LCOV version 2.0-1