LCOV - code coverage report
Current view: top level - src/engraving/dom - tapping.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 36.7 % 60 22
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              : #include "stafftype.h"
      24              : #include "style/style.h"
      25              : #include "tapping.h"
      26              : #include "text.h"
      27              : #include "types/typesconv.h"
      28              : 
      29              : namespace mu::engraving {
      30           35 : Tapping::Tapping(DummyParentOr<ChordRest> parent)
      31           35 :     : Articulation(parent, ElementType::TAPPING)
      32              : {
      33           35 : }
      34              : 
      35            0 : Tapping::Tapping(const Tapping& other)
      36            0 :     : Articulation(other)
      37              : {
      38            0 :     m_hand = other.m_hand;
      39            0 : }
      40              : 
      41            0 : void Tapping::setSelected(bool f)
      42              : {
      43            0 :     if (m_text) {
      44            0 :         m_text->setSelected(f);
      45              :     }
      46            0 :     if (m_halfSlurAbove) {
      47            0 :         m_halfSlurAbove->setSelected(f);
      48              :     }
      49            0 :     if (m_halfSlurBelow) {
      50            0 :         m_halfSlurBelow->setSelected(f);
      51              :     }
      52              : 
      53            0 :     EngravingItem::setSelected(f);
      54            0 : }
      55              : 
      56           64 : LHTappingShowItems Tapping::lhShowItems() const
      57              : {
      58           64 :     DO_ASSERT(m_hand == TappingHand::LEFT);
      59              : 
      60           64 :     const MStyle& s = style();
      61           64 :     bool tabStaff = staffType()->isTabStaff();
      62              : 
      63           64 :     return s.styleV(tabStaff ? Sid::lhTappingShowItemsTab : Sid::lhTappingShowItemsNormalStave).value<LHTappingShowItems>();
      64              : }
      65              : 
      66            0 : void Tapping::styleChanged()
      67              : {
      68            0 :     if (m_text) {
      69            0 :         m_text->styleChanged();
      70              :     }
      71            0 :     Articulation::styleChanged();
      72            0 : }
      73              : 
      74         3062 : double Tapping::mag() const
      75              : {
      76         3062 :     return ldata()->mag() * Articulation::mag();
      77              : }
      78              : 
      79           32 : int Tapping::subtype() const
      80              : {
      81           32 :     return static_cast<int>(m_hand);
      82              : }
      83              : 
      84            0 : String Tapping::accessibleInfo() const
      85              : {
      86            0 :     return String(u"%1 %2").arg(translatedSubtypeUserName(), TConv::userName(ElementType::TAPPING).translated());
      87              : }
      88              : 
      89            0 : TranslatableString Tapping::typeUserName() const
      90              : {
      91            0 :     return EngravingItem::typeUserName();
      92              : }
      93              : 
      94            0 : TranslatableString Tapping::subtypeUserName() const
      95              : {
      96            0 :     return m_hand == TappingHand::LEFT ? TranslatableString("engraving", "Left-hand") : TranslatableString("engraving", "Right-hand");
      97              : }
      98              : 
      99            8 : TappingHalfSlur::TappingHalfSlur(EngravingItem* parent)
     100            8 :     : Slur(parent, ElementType::TAPPING_HALF_SLUR)
     101              : {
     102            8 : }
     103              : 
     104            0 : TappingHalfSlur::TappingHalfSlur(const TappingHalfSlur& other)
     105            0 :     : Slur(other)
     106              : {
     107            0 : }
     108              : 
     109            8 : TappingHalfSlurSegment::TappingHalfSlurSegment(TappingHalfSlur* sp)
     110            8 :     : SlurSegment(sp, ElementType::TAPPING_HALF_SLUR_SEGMENT)
     111              : {
     112            8 : }
     113              : 
     114            0 : TappingHalfSlurSegment::TappingHalfSlurSegment(const TappingHalfSlurSegment& other)
     115            0 :     : SlurSegment(other)
     116              : {
     117            0 : }
     118              : 
     119              : static ElementStyle tapTextStyle;
     120              : 
     121           12 : TappingText::TappingText(Tapping* parent)
     122            0 :     : TextBase(ElementType::TAPPING_TEXT, parent, TextStyleType::HAMMER_ON_PULL_OFF,
     123           12 :                ElementFlag::MOVABLE | ElementFlag::GENERATED | ElementFlag::ON_STAFF)
     124              : {
     125           12 :     initElementStyle(&tapTextStyle);
     126           12 : }
     127              : 
     128            0 : TappingText::TappingText(const TappingText& t)
     129            0 :     : TextBase(t)
     130              : {
     131            0 : }
     132              : 
     133            0 : Color TappingText::curColor(const rendering::PaintOptions& opt) const
     134              : {
     135            0 :     if (Tapping* t = tapping()) {
     136            0 :         return t->curColor(opt);
     137              :     }
     138              : 
     139            0 :     return EngravingItem::curColor(opt);
     140              : }
     141              : }
        

Generated by: LCOV version 2.0-1