LCOV - code coverage report
Current view: top level - src/engraving/dom - trill.h Coverage Total Hit
Test: filtered_coverage.info Lines: 88.9 % 18 16
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_TRILL_H
      24              : #define MU_ENGRAVING_TRILL_H
      25              : 
      26              : #include "line.h"
      27              : 
      28              : namespace mu::engraving {
      29              : class Trill;
      30              : class Accidental;
      31              : 
      32              : //---------------------------------------------------------
      33              : //   @@ TrillSegment
      34              : //---------------------------------------------------------
      35              : 
      36              : class TrillSegment final : public LineSegment
      37              : {
      38          124 :     OBJECT_ALLOCATOR(engraving, TrillSegment)
      39              :     DECLARE_CLASSOF(ElementType::TRILL_SEGMENT)
      40              : 
      41              : public:
      42              :     TrillSegment(Trill* sp);
      43              : 
      44          350 :     Trill* trill() const { return (Trill*)spanner(); }
      45              : 
      46            1 :     TrillSegment* clone() const override { return new TrillSegment(*this); }
      47              : 
      48              :     void scanElements(std::function<void(EngravingItem*)> func) override;
      49              : 
      50              :     EngravingObject* propertyDelegate(Pid) const override;
      51              : 
      52              :     void remove(EngravingItem*) override;
      53              : 
      54          242 :     const SymIdList& symbols() const { return m_symbols; }
      55              :     void setSymbols(const SymIdList& s) { m_symbols = s; }
      56              : 
      57              :     void symbolLine(SymId start, SymId fill);
      58              :     void symbolLine(SymId start, SymId fill, SymId end);
      59              : 
      60              : protected:
      61              :     void rebaseAnchors(EditData& ed, Grip grip) override;
      62              : 
      63              : private:
      64              :     SymIdList m_symbols;
      65              : };
      66              : 
      67              : //---------------------------------------------------------
      68              : //   @@ Trill
      69              : //   @P trillType  enum (Trill.DOWNPRALL_LINE, .PRALLPRALL_LINE, .PURE_LINE, .TRILL_LINE, .UPPRALL_LINE)
      70              : //---------------------------------------------------------
      71              : 
      72              : class Trill final : public SLine
      73              : {
      74          132 :     OBJECT_ALLOCATOR(engraving, Trill)
      75          134 :     DECLARE_CLASSOF(ElementType::TRILL)
      76              : 
      77              : public:
      78              :     Trill(DummyParentOr<EngravingItem> parent);
      79              :     Trill(const Trill& t);
      80              : 
      81            2 :     Trill* clone() const override { return new Trill(*this); }
      82              :     EngravingItem* linkedClone() override;
      83              : 
      84          643 :     Anchor anchor() const override { return Anchor::SEGMENT; }
      85              : 
      86              :     LineSegment* createLineSegment() override;
      87              :     void remove(EngravingItem*) override;
      88              : 
      89              :     void setTrack(track_idx_t n) override;
      90              :     void setScore(Score* s) override;
      91              :     void computeStartElement() override;
      92              :     static PointF trillLinePos(const SLine* line, Grip grip, System** system);
      93              :     PointF linePos(Grip grip, System** system) const override;
      94              : 
      95              :     void setTrillType(TrillType tt);
      96          302 :     TrillType trillType() const { return m_trillType; }
      97            0 :     int subtype() const override { return int(m_trillType); }
      98              :     TranslatableString subtypeUserName() const override;
      99            0 :     void setOrnamentStyle(OrnamentStyle val) { m_ornamentStyle = val; }
     100           19 :     OrnamentStyle ornamentStyle() const { return m_ornamentStyle; }
     101              :     String trillTypeUserName() const;
     102          379 :     Accidental* accidental() const { return m_accidental; }
     103          116 :     void setAccidental(Accidental* a) { m_accidental = a; }
     104            1 :     Chord* cueNoteChord() const { return m_cueNoteChord; }
     105          116 :     void setCueNoteChord(Chord* c) { m_cueNoteChord = c; }
     106              : 
     107              :     Segment* segment() const { return (Segment*)ownershipParent(); }
     108              : 
     109              :     PropertyValue getProperty(Pid propertyId) const override;
     110              :     bool setProperty(Pid propertyId, const PropertyValue&) override;
     111              :     PropertyValue propertyDefault(Pid) const override;
     112              : 
     113              :     String accessibleInfo() const override;
     114              : 
     115          716 :     Ornament* ornament() const { return m_ornament; }
     116           13 :     void setOrnament(Ornament* o) { m_ornament = o; }
     117              : 
     118              :     Sid defaultPosSid() const override;
     119              : 
     120              : protected:
     121              :     void doComputeEndElement() override;
     122              : 
     123              : private:
     124              :     TrillType m_trillType = TrillType::TRILL_LINE;
     125              :     Accidental* m_accidental = nullptr;
     126              :     Chord* m_cueNoteChord = nullptr;
     127              :     OrnamentStyle m_ornamentStyle = OrnamentStyle::DEFAULT;   // for use in ornaments such as trill
     128              :     Ornament* m_ornament = nullptr;
     129              : };
     130              : } // namespace mu::engraving
     131              : 
     132              : #endif
        

Generated by: LCOV version 2.0-1