LCOV - code coverage report
Current view: top level - src/engraving/dom - stem.h Coverage Total Hit
Test: filtered_coverage.info Lines: 64.7 % 17 11
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              : namespace mu::engraving {
      28              : class Chord;
      29              : class Transaction;
      30              : 
      31              : class Stem final : public EngravingItem
      32              : {
      33        60184 :     OBJECT_ALLOCATOR(engraving, Stem)
      34         1106 :     DECLARE_CLASSOF(ElementType::STEM)
      35              : 
      36              : public:
      37              : 
      38         2945 :     Stem(const Stem&) = default;
      39              :     Stem& operator=(const Stem&) = delete;
      40              : 
      41            0 :     Stem* clone() const override { return new Stem(*this); }
      42              :     void setOwnershipParent(DummyParentOr<Chord> parent) { EngravingItem::setOwnershipParent(parent); }
      43              : 
      44              :     EngravingItem* elementBase() const override;
      45              : 
      46            0 :     bool isEditable() const override { return true; }
      47              :     void startEdit(EditData&) override;
      48              :     void startDragGrip(EditData&) override;
      49              :     void dragGrip(EditData&) override;
      50              : 
      51              :     bool acceptDrop(EditData&) const override;
      52              :     EngravingItem* drop(Transaction& tx, EditData&) override;
      53              : 
      54              :     void reset() override;
      55              :     PropertyValue getProperty(Pid propertyId) const override;
      56              :     bool setProperty(Pid propertyId, const PropertyValue&) override;
      57              :     PropertyValue propertyDefault(Pid id) const override;
      58              : 
      59              :     staff_idx_t vStaffIdx() const override;
      60              : 
      61      2287575 :     Chord* chord() const { return toChord(ownershipParent()); }
      62              :     bool up() const;
      63              : 
      64        64660 :     Spatium baseLength() const { return m_baseLength; }
      65              :     void setBaseLength(Spatium baseLength);
      66              : 
      67        16756 :     Spatium userLength() const { return m_userLength; }
      68        28928 :     void setUserLength(Spatium userLength) { m_userLength = userLength; }
      69              : 
      70        33512 :     Spatium lineWidth() const { return m_lineWidth; }
      71              :     double lineWidthMag() const;
      72        29756 :     void setLineWidth(Spatium lineWidth) { m_lineWidth = lineWidth; }
      73              : 
      74              :     PointF flagPosition() const;
      75       235342 :     double length() const { return absoluteFromSpatium(m_baseLength + m_userLength); }
      76              : 
      77            0 :     bool needStartEditingAfterSelecting() const override { return true; }
      78            0 :     int gripsCount() const override { return 1; }
      79            0 :     Grip initialEditModeGrip() const override { return Grip::START; }
      80            0 :     Grip defaultGrip() const override { return Grip::START; }
      81              :     std::vector<PointF> gripsPositions(const EditData&) const override;
      82              : 
      83              :     struct LayoutData : public EngravingItem::LayoutData {
      84              :         LineF line;
      85              :         double beamCorrection = 0.0;
      86              :     };
      87       775442 :     DECLARE_LAYOUTDATA_METHODS(Stem)
      88              : 
      89              : private:
      90              :     friend class Factory;
      91              :     Stem(DummyParentOr<Chord> parent);
      92              : 
      93              :     Spatium m_baseLength = 0.0_sp;
      94              : 
      95              :     Spatium m_userLength = 0.0_sp;
      96              :     Spatium m_lineWidth = 0.0_sp;
      97              : };
      98              : }
        

Generated by: LCOV version 2.0-1