LCOV - code coverage report
Current view: top level - src/notation - inotationparts.h Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 4 4
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 "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          259 :     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              :     struct SystemObjectsMove {
      74              :         muse::ID staffId;
      75              :         muse::ID destinationStaffId;
      76              :         bool belowBottomStaff = false;
      77              : 
      78           17 :         bool operator==(const SystemObjectsMove& other) const
      79              :         {
      80           34 :             return staffId == other.staffId && destinationStaffId == other.destinationStaffId
      81           34 :                    && belowBottomStaff == other.belowBottomStaff;
      82              :         }
      83              :     };
      84              : 
      85              :     //! Puts the parts in the given order and moves the system markings, as one undo step
      86              :     virtual void reorderParts(const muse::IDList& partIds, const std::vector<SystemObjectsMove>& systemObjectsMoves) = 0;
      87              : 
      88              :     //! Puts the part's staves in the given order, as one undo step
      89              :     virtual void reorderStaves(const muse::IDList& staffIds) = 0;
      90              : 
      91              :     virtual bool appendStaff(Staff* staff, const muse::ID& destinationPartId) = 0;
      92              :     virtual bool appendLinkedStaff(Staff* staff, const muse::ID& sourceStaffId, const muse::ID& destinationPartId) = 0;
      93              : 
      94              :     virtual void insertPart(Part* part, size_t index) = 0;
      95              : 
      96              :     virtual void replacePart(const muse::ID& partId, Part* newPart) = 0;
      97              :     virtual void replaceInstrument(const InstrumentKey& instrumentKey, const Instrument& newInstrument,
      98              :                                    const StaffType* newStaffType = nullptr) = 0;
      99              :     virtual void replaceDrumset(const InstrumentKey& instrumentKey, const Drumset& newDrumset, bool undoable = true) = 0;
     100              : 
     101              :     virtual const std::vector<Staff*>& systemObjectStaves() const = 0;
     102              :     virtual muse::async::Notification systemObjectStavesChanged() const = 0;
     103              : 
     104              :     virtual void addSystemObjects(const muse::IDList& stavesIds) = 0;
     105              :     virtual void removeSystemObjects(const muse::IDList& stavesIds) = 0;
     106              : 
     107              :     virtual void toggleStaveSharing(bool on) = 0;
     108              : 
     109              :     virtual muse::async::Notification partsChanged() const = 0;
     110              :     virtual muse::async::Notification scoreOrderChanged() const = 0;
     111              : 
     112              :     virtual muse::async::Notification sharedPartsChanged() const = 0;
     113              : };
     114              : 
     115              : using INotationPartsPtr = std::shared_ptr<INotationParts>;
     116              : }
        

Generated by: LCOV version 2.0-1