LCOV - code coverage report
Current view: top level - src/engraving/dom - spacer.h Coverage Total Hit
Test: filtered_coverage.info Lines: 46.7 % 15 7
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              : #pragma once
      24              : 
      25              : #include "engravingitem.h"
      26              : #include "draw/types/painterpath.h"
      27              : 
      28              : namespace mu::engraving {
      29              : class Factory;
      30              : 
      31              : //---------------------------------------------------------
      32              : //   SpacerType
      33              : //---------------------------------------------------------
      34              : 
      35              : enum class SpacerType : char {
      36              :     UP, DOWN, FIXED
      37              : };
      38              : 
      39              : //-------------------------------------------------------------------
      40              : //   @@ Spacer
      41              : ///    Vertical spacer element to adjust the distance of staves.
      42              : //-------------------------------------------------------------------
      43              : 
      44              : class Spacer final : public EngravingItem
      45              : {
      46            2 :     OBJECT_ALLOCATOR(engraving, Spacer)
      47         1106 :     DECLARE_CLASSOF(ElementType::SPACER)
      48              : 
      49              : public:
      50              : 
      51            0 :     Spacer* clone() const override { return new Spacer(*this); }
      52            0 :     Measure* measure() const { return toMeasure(ownershipParent()); }
      53              : 
      54           13 :     SpacerType spacerType() const { return m_spacerType; }
      55            1 :     void setSpacerType(SpacerType t) { m_spacerType = t; }
      56              : 
      57            0 :     int subtype() const override { return int(m_spacerType); }
      58              :     TranslatableString subtypeUserName() const override;
      59              : 
      60            0 :     bool isEditable() const override { return true; }
      61              :     void startDragGrip(EditData&) override;
      62              :     void dragGrip(EditData&) override;
      63              : 
      64              :     void setGap(Spatium sp);
      65            1 :     Spatium gap() const { return m_gap; }
      66              : 
      67            8 :     double absoluteGap() const { return absoluteFromSpatium(m_gap); }
      68              : 
      69            0 :     bool needStartEditingAfterSelecting() const override { return true; }
      70            0 :     int gripsCount() const override { return 1; }
      71            0 :     Grip initialEditModeGrip() const override { return Grip::START; }
      72            0 :     Grip defaultGrip() const override { return Grip::START; }
      73              :     std::vector<PointF> gripsPositions(const EditData&) const override;
      74              : 
      75              :     PropertyValue getProperty(Pid propertyId) const override;
      76              :     bool setProperty(Pid propertyId, const PropertyValue&) override;
      77              :     PropertyValue propertyDefault(Pid id) const override;
      78              :     void triggerLayout() const override;
      79              : 
      80              :     struct LayoutData : public EngravingItem::LayoutData {
      81              :         PainterPath path;
      82              :     };
      83            3 :     DECLARE_LAYOUTDATA_METHODS(Spacer)
      84              : 
      85              : private:
      86              : 
      87              :     friend class Factory;
      88              :     Spacer(DummyParentOr<Measure> parent);
      89              :     Spacer(const Spacer&);
      90              : 
      91              :     SpacerType m_spacerType = SpacerType::UP;
      92              :     Spatium m_gap;
      93              : };
      94              : }
        

Generated by: LCOV version 2.0-1