LCOV - code coverage report
Current view: top level - src/engraving/dom - tapping.h Coverage Total Hit
Test: filtered_coverage.info Lines: 65.4 % 26 17
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              : #pragma once
      23              : 
      24              : #include "engraving/types/types.h"
      25              : 
      26              : #include "articulation.h"
      27              : #include "slur.h"
      28              : #include "textbase.h"
      29              : 
      30              : namespace mu::engraving {
      31              : class TappingHalfSlur;
      32              : class TappingText;
      33              : 
      34              : class Tapping : public Articulation
      35              : {
      36           70 :     OBJECT_ALLOCATOR(engraving, Tapping)
      37              :     DECLARE_CLASSOF(ElementType::TAPPING)
      38              : 
      39              : public:
      40              :     Tapping(const Tapping&);
      41            0 :     Tapping* clone() const override { return new Tapping(*this); }
      42              : 
      43              :     struct LayoutData : public Articulation::LayoutData
      44              :     {
      45              :     };
      46         3097 :     DECLARE_LAYOUTDATA_METHODS(Tapping)
      47              : 
      48          335 :     TappingHand hand() const { return m_hand; }
      49           35 :     void setHand(TappingHand h) { m_hand = h; }
      50              : 
      51          214 :     TappingText* text() const { return m_text; }
      52          134 :     void setText(TappingText* text) { m_text = text; }
      53              : 
      54              :     void setSelected(bool f) override;
      55              : 
      56          236 :     TappingHalfSlur* halfSlurAbove() const { return m_halfSlurAbove; }
      57            8 :     void setHalfSlurAbove(TappingHalfSlur* s) { m_halfSlurAbove = s; }
      58          236 :     TappingHalfSlur* halfSlurBelow() const { return m_halfSlurBelow; }
      59            0 :     void setHalfSlurBelow(TappingHalfSlur* s) { m_halfSlurBelow = s; }
      60              : 
      61              :     LHTappingShowItems lhShowItems() const;
      62              : 
      63              :     void styleChanged() override;
      64              : 
      65              :     double mag() const override;
      66              : 
      67              :     int subtype() const override;
      68              : 
      69              :     String accessibleInfo() const override;
      70              :     TranslatableString typeUserName() const override;
      71              :     TranslatableString subtypeUserName() const override;
      72              : 
      73              : protected:
      74              :     friend class mu::engraving::Factory;
      75              :     Tapping(DummyParentOr<ChordRest> parent);
      76              : 
      77              : private:
      78              :     TappingHand m_hand = TappingHand::INVALID;
      79              :     TappingText* m_text = nullptr;
      80              :     TappingHalfSlur* m_halfSlurAbove = nullptr;
      81              :     TappingHalfSlur* m_halfSlurBelow = nullptr;
      82              : };
      83              : 
      84              : class TappingHalfSlurSegment : public SlurSegment
      85              : {
      86           16 :     OBJECT_ALLOCATOR(engraving, TappingHalfSlurSegment)
      87              :     DECLARE_CLASSOF(ElementType::TAPPING_HALF_SLUR_SEGMENT)
      88              : 
      89              : public:
      90              :     TappingHalfSlurSegment(TappingHalfSlur* sp);
      91              :     TappingHalfSlurSegment(const TappingHalfSlurSegment& other);
      92            0 :     TappingHalfSlurSegment* clone() const override { return new TappingHalfSlurSegment(*this); }
      93              : 
      94            0 :     TappingHalfSlur* tappingHalfSlur() const { return toTappingHalfSlur(spanner()); }
      95              : };
      96              : 
      97              : class TappingHalfSlur : public Slur
      98              : {
      99           16 :     OBJECT_ALLOCATOR(engraving, TappingHalfSlur)
     100         1338 :     DECLARE_CLASSOF(ElementType::TAPPING_HALF_SLUR)
     101              : 
     102            0 :     bool isHalfSlurAbove() const { return m_isHalfSlurAbove; }
     103           32 :     void setIsHalfSlurAbove(bool v) { m_isHalfSlurAbove = v; }
     104              : 
     105              : public:
     106              :     TappingHalfSlur(EngravingItem* parent);
     107              :     TappingHalfSlur(const TappingHalfSlur&);
     108            0 :     TappingHalfSlur* clone() const override { return new TappingHalfSlur(*this); }
     109            8 :     TappingHalfSlurSegment* newSlurTieSegment() override { return new TappingHalfSlurSegment(this); }
     110              : 
     111            0 :     Tapping* tapping() const { return toTapping(ownershipParent()); }
     112              : 
     113              : protected:
     114            8 :     bool isInSpannerMap() const override { return false; }
     115              : 
     116              : private:
     117              :     bool m_isHalfSlurAbove = true;
     118              : };
     119              : 
     120              : class TappingText final : public TextBase
     121              : {
     122           24 :     OBJECT_ALLOCATOR(engraving, TappingText)
     123              :     DECLARE_CLASSOF(ElementType::TAPPING_TEXT)
     124              : 
     125              : public:
     126              :     TappingText(Tapping* parent = nullptr);
     127              :     TappingText(const TappingText& t);
     128            0 :     TappingText* clone() const override { return new TappingText(*this); }
     129              : 
     130            0 :     Tapping* tapping() const { return toTapping(ownershipParent()); }
     131              : 
     132              :     Color curColor(const rendering::PaintOptions& opt) const override;
     133              : 
     134           48 :     bool positionRelativeToNoteheadRest() const override { return true; }
     135              : };
     136              : } // namespace mu::engraving
        

Generated by: LCOV version 2.0-1