LCOV - code coverage report
Current view: top level - src/engraving/dom - staffstate.h Coverage Total Hit
Test: filtered_coverage.info Lines: 12.5 % 8 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              : #ifndef MU_ENGRAVING_STAFFSTATE_H
      24              : #define MU_ENGRAVING_STAFFSTATE_H
      25              : 
      26              : #include "engravingitem.h"
      27              : #include "instrument.h"
      28              : #include "draw/types/painterpath.h"
      29              : 
      30              : namespace mu::engraving {
      31              : class Transaction;
      32              : 
      33              : enum class StaffStateType : char {
      34              :     INSTRUMENT,
      35              :     TYPE,
      36              :     VISIBLE,
      37              :     INVISIBLE
      38              : };
      39              : 
      40              : //---------------------------------------------------------
      41              : //   @@ StaffState
      42              : //---------------------------------------------------------
      43              : 
      44              : class StaffState final : public EngravingItem
      45              : {
      46            0 :     OBJECT_ALLOCATOR(engraving, StaffState)
      47         1106 :     DECLARE_CLASSOF(ElementType::STAFF_STATE)
      48              : 
      49              : public:
      50              : 
      51              :     ~StaffState();
      52              : 
      53            0 :     StaffState* clone() const override { return new StaffState(*this); }
      54              :     void setOwnershipParent(DummyParentOr<Segment> parent) { EngravingItem::setOwnershipParent(parent); }
      55              : 
      56              :     void setStaffStateType(const String&);
      57            0 :     void setStaffStateType(StaffStateType st) { m_staffStateType = st; }
      58            0 :     StaffStateType staffStateType() const { return m_staffStateType; }
      59              :     String staffStateTypeName() const;
      60              : 
      61              :     bool acceptDrop(EditData&) const override;
      62              :     EngravingItem* drop(Transaction& tx, EditData&) override;
      63              : 
      64            0 :     Instrument* instrument() const { return m_instrument; }
      65              :     void setInstrument(const Instrument* i) { *m_instrument = *i; }
      66            0 :     void setInstrument(const Instrument&& i) { *m_instrument = i; }
      67              :     Segment* segment() { return (Segment*)ownershipParent(); }
      68              : 
      69              :     struct LayoutData : public EngravingItem::LayoutData {
      70              :         double lw = 0.0;
      71              :         muse::draw::PainterPath path;
      72              :     };
      73            0 :     DECLARE_LAYOUTDATA_METHODS(StaffState)
      74              : 
      75              : private:
      76              : 
      77              :     friend class Factory;
      78              :     StaffState(DummyParentOr<Segment> parent);
      79              :     StaffState(const StaffState&);
      80              : 
      81              :     StaffStateType m_staffStateType = StaffStateType::INVISIBLE;
      82              : 
      83              :     Instrument* m_instrument = nullptr;
      84              : };
      85              : } // namespace mu::engraving
      86              : #endif
        

Generated by: LCOV version 2.0-1