LCOV - code coverage report
Current view: top level - src/notation - inotationparts.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 1 0
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 "async/notification.h"
      26              : 
      27              : #include "types/instrumentstypes.h"
      28              : #include "types/staffparttypes.h"
      29              : 
      30              : namespace muse::async {
      31              : template<typename T>
      32              : class NotifyList;
      33              : }
      34              : 
      35              : namespace mu::notation {
      36              : class INotationParts
      37              : {
      38              : public:
      39            0 :     virtual ~INotationParts() = default;
      40              : 
      41              :     virtual muse::async::NotifyList<const Part*> partList() const = 0;
      42              :     virtual muse::async::NotifyList<const Staff*> staffList(const muse::ID& partId) const = 0;
      43              : 
      44              :     virtual bool hasParts() const = 0;
      45              : 
      46              :     virtual const Part* part(const muse::ID& partId) const = 0;
      47              :     virtual bool partExists(const muse::ID& partId) const = 0;
      48              : 
      49              :     virtual const Staff* staff(const muse::ID& staffId) const = 0;
      50              :     virtual bool staffExists(const muse::ID& staffId) const = 0;
      51              : 
      52              :     virtual StaffConfig staffConfig(const muse::ID& staffId, engraving::Fraction tick = { 0, 1 }) const = 0;
      53              :     virtual ScoreOrder scoreOrder() const = 0;
      54              : 
      55              :     virtual void setParts(const PartInstrumentList& instruments, const ScoreOrder& order) = 0;
      56              :     virtual void setScoreOrder(const ScoreOrder& order) = 0;
      57              :     virtual void setPartVisible(const muse::ID& partId, bool visible) = 0;
      58              :     virtual bool setVoiceVisible(const muse::ID& staffId, int voiceIndex, bool visible) = 0;
      59              :     virtual void setStaffVisible(const muse::ID& staffId, bool visible) = 0;
      60              :     virtual void setPartSharpFlat(const muse::ID& partId, const SharpFlat& sharpFlat) = 0;
      61              :     virtual void setInstrumentName(const InstrumentKey& instrumentKey, const QString& name) = 0;
      62              :     virtual void setInstrumentAbbreviature(const InstrumentKey& instrumentKey, const QString& abbreviature) = 0;
      63              :     virtual void setInstrumentGroupNameOptions(const std::vector<InstrumentKey>& instruments, bool useCustom, const QString& longName,
      64              :                                                const QString& shortName) = 0;
      65              :     virtual void setInstrumentNumber(const InstrumentKey& instrumentKey, int v) = 0;
      66              :     virtual void setStaffType(const muse::ID& staffId, StaffTypeId type) = 0;
      67              :     virtual void setStaffConfig(const muse::ID& staffId, const StaffConfig& config, engraving::Fraction tick = { 0, 1 }) = 0;
      68              :     virtual void setSharedPartEnabled(const muse::ID& partId, bool enable) = 0;
      69              : 
      70              :     virtual void removeParts(const muse::IDList& partsIds) = 0;
      71              :     virtual void removeStaves(const muse::IDList& stavesIds) = 0;
      72              : 
      73              :     enum class InsertMode {
      74              :         Before,
      75              :         After
      76              :     };
      77              : 
      78              :     virtual void moveParts(const muse::IDList& sourcePartsIds, const muse::ID& destinationPartId, InsertMode mode = InsertMode::Before) = 0;
      79              :     virtual void moveStaves(const muse::IDList& sourceStavesIds, const muse::ID& destinationStaffId,
      80              :                             InsertMode mode = InsertMode::Before) = 0;
      81              : 
      82              :     virtual bool appendStaff(Staff* staff, const muse::ID& destinationPartId) = 0;
      83              :     virtual bool appendStaffLinkedToMaster(Staff* staff, Staff* masterSourceStaff, const muse::ID& destinationPartId) = 0;
      84              :     virtual bool appendLinkedStaff(Staff* staff, const muse::ID& sourceStaffId, const muse::ID& destinationPartId) = 0;
      85              : 
      86              :     virtual void insertPart(Part* part, size_t index) = 0;
      87              : 
      88              :     virtual void replacePart(const muse::ID& partId, Part* newPart) = 0;
      89              :     virtual void replaceInstrument(const InstrumentKey& instrumentKey, const Instrument& newInstrument,
      90              :                                    const StaffType* newStaffType = nullptr) = 0;
      91              :     virtual void replaceDrumset(const InstrumentKey& instrumentKey, const Drumset& newDrumset, bool undoable = true) = 0;
      92              : 
      93              :     virtual const std::vector<Staff*>& systemObjectStaves() const = 0;
      94              :     virtual muse::async::Notification systemObjectStavesChanged() const = 0;
      95              : 
      96              :     virtual void addSystemObjects(const muse::IDList& stavesIds) = 0;
      97              :     virtual void removeSystemObjects(const muse::IDList& stavesIds) = 0;
      98              :     virtual void moveSystemObjects(const muse::ID& sourceStaffId, const muse::ID& destinationStaffId) = 0;
      99              :     virtual void moveSystemObjectLayerBelowBottomStaff() = 0;
     100              :     virtual void moveSystemObjectLayerAboveBottomStaff() = 0;
     101              : 
     102              :     virtual void toggleStaveSharing(bool on) = 0;
     103              : 
     104              :     virtual muse::async::Notification partsChanged() const = 0;
     105              :     virtual muse::async::Notification scoreOrderChanged() const = 0;
     106              : 
     107              :     virtual muse::async::Notification sharedPartsChanged() const = 0;
     108              : };
     109              : 
     110              : using INotationPartsPtr = std::shared_ptr<INotationParts>;
     111              : }
        

Generated by: LCOV version 2.0-1