LCOV - code coverage report
Current view: top level - src/engraving/dom - shadownote.h Coverage Total Hit
Test: filtered_coverage.info Lines: 5.6 % 18 1
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              : #pragma once
      24              : 
      25              : #include "engravingitem.h"
      26              : 
      27              : #include "accidental.h"
      28              : #include "durationtype.h"
      29              : #include "../types/types.h"
      30              : 
      31              : namespace mu::engraving {
      32              : //---------------------------------------------------------
      33              : //   ShadowNote
      34              : //---------------------------------------------------------
      35              : 
      36              : /**
      37              :  Graphic representation of a shadow note,
      38              :  which shows the note insert position in note entry mode.
      39              : */
      40              : 
      41              : class ShadowNote final : public EngravingItem
      42              : {
      43         5290 :     OBJECT_ALLOCATOR(engraving, ShadowNote)
      44              :     DECLARE_CLASSOF(ElementType::SHADOW_NOTE)
      45              : 
      46              : public:
      47              :     ShadowNote(Score*);
      48              : 
      49            0 :     ShadowNote* clone() const override { return new ShadowNote(*this); }
      50              : 
      51              :     bool isValid() const;
      52              : 
      53            0 :     Fraction tick() const override { return m_tick; }
      54            0 :     void setTick(Fraction t) { m_tick = t; }
      55              : 
      56            0 :     int lineIndex() const { return m_lineIndex; }
      57            0 :     void setLineIndex(int n) { m_lineIndex = n; }
      58              : 
      59            0 :     bool isRest() const { return m_isRest; }
      60              : 
      61            0 :     const TDuration& duration() const { return m_duration; }
      62              : 
      63              :     void setState(SymId noteSymbol, TDuration duration, bool isRest, bool beyondScore, AccidentalType accidentalType = AccidentalType::NONE,
      64              :                   const std::set<SymId>& articulationIds = {});
      65              : 
      66              :     void drawArticulations(muse::draw::Painter* painter) const;
      67              :     void drawCloseArticulation(muse::draw::Painter* painter, const SymId& articulation, RectF& boundRect, bool up,
      68              :                                const SymId& prevArticulation) const;
      69              :     void drawFarArticulation(muse::draw::Painter* painter, const SymId& articulation, RectF& boundRect, bool up,
      70              :                              bool accentStaccatoKern) const;
      71              : 
      72              :     bool computeUp() const;
      73            0 :     SymId noteheadSymbol() const { return m_noteheadSymbol; }
      74              :     bool hasStem() const;
      75              :     bool hasFlag() const;
      76              :     SymId flagSym() const;
      77              :     AccidentalType accidentalType() const;
      78              :     const std::set<SymId>& articulationIds() const;
      79              : 
      80              :     bool ledgerLinesVisible() const;
      81              : 
      82            0 :     bool isBeyondScore() const { return m_beyondScore; }
      83              : 
      84            0 :     String jianpuDigit() const { return m_jianpuDigit; }
      85            0 :     void setJianpuDigit(const String& s) { m_jianpuDigit = s; }
      86            0 :     String jianpuAccidental() const { return m_jianpuAccidental; }
      87            0 :     void setJianpuAccidental(const String& s) { m_jianpuAccidental = s; }
      88              : 
      89            0 :     int jianpuDiminutionLines() const { return m_jianpuDiminutionLines; }
      90            0 :     void setJianpuDiminutionLines(int lines) { m_jianpuDiminutionLines = lines; }
      91              : 
      92            0 :     int jianpuOctaveDots() const { return m_jianpuOctaveDots; }
      93            0 :     void setJianpuOctaveDots(int dots) { m_jianpuOctaveDots = dots; }
      94              : private:
      95              : 
      96              :     Fraction m_tick;
      97              :     int m_lineIndex = -1;
      98              :     SymId m_noteheadSymbol = SymId::noSym;
      99              :     TDuration m_duration;
     100              :     bool m_isRest = false;
     101              :     AccidentalType m_accidentalType = AccidentalType::NONE;
     102              :     std::set<SymId> m_articulationIds;
     103              :     bool m_beyondScore = false;
     104              :     String m_jianpuDigit;
     105              :     String m_jianpuAccidental;
     106              :     int m_jianpuDiminutionLines = 0;
     107              :     int m_jianpuOctaveDots = 0;
     108              : };
     109              : } // namespace mu::engraving
        

Generated by: LCOV version 2.0-1