LCOV - code coverage report
Current view: top level - src/engraving/dom - score.h Coverage Total Hit
Test: filtered_coverage.info Lines: 60.7 % 145 88
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              : /**
      26              :  \file
      27              :  Definition of Score class.
      28              : */
      29              : 
      30              : #include <set>
      31              : #include <memory>
      32              : #include <optional>
      33              : 
      34              : #include "global/async/channel.h"
      35              : #include "global/types/ret.h"
      36              : 
      37              : #include "modularity/ioc.h"
      38              : 
      39              : #include "../automation/automationtypes_fwd.h"
      40              : #include "../types/constants.h"
      41              : 
      42              : #include "../rendering/layoutoptions.h"
      43              : #include "../rendering/paddingtable.h"
      44              : 
      45              : #include "../style/style.h"
      46              : #include "../style/pagestyle.h"
      47              : 
      48              : #include "../editing/cmd.h"
      49              : 
      50              : #include "chordlist.h"
      51              : #include "dummyparent.h"
      52              : #include "guitarbend.h"
      53              : #include "input.h"
      54              : #include "mscore.h"
      55              : #include "property.h"
      56              : #include "scoreorder.h"
      57              : #include "segment.h"
      58              : #include "select.h"
      59              : #include "spannermap.h"
      60              : #include "synthesizerstate.h"
      61              : #include "rangelock.h"
      62              : #include "tuplet.h"
      63              : 
      64              : namespace mu::engraving {
      65              : class IMimeData;
      66              : }
      67              : 
      68              : namespace mu::engraving::read114 {
      69              : class Read114;
      70              : }
      71              : 
      72              : namespace mu::engraving::read302 {
      73              : class Read302;
      74              : }
      75              : 
      76              : namespace mu::engraving::read400 {
      77              : class Read400;
      78              : }
      79              : 
      80              : namespace mu::engraving::read410 {
      81              : class Read410;
      82              : }
      83              : 
      84              : namespace mu::engraving::read460 {
      85              : class Read460;
      86              : }
      87              : 
      88              : namespace mu::engraving::read500 {
      89              : class Read500;
      90              : }
      91              : 
      92              : namespace mu::engraving::write {
      93              : class Writer;
      94              : }
      95              : 
      96              : namespace mu::engraving::compat {
      97              : class WriteScoreHook;
      98              : }
      99              : 
     100              : namespace mu::engraving {
     101              : class Articulation;
     102              : class Box;
     103              : class Bracket;
     104              : class Chord;
     105              : class ChordRest;
     106              : class Element;
     107              : class EventsHolder;
     108              : class Excerpt;
     109              : class FiguredBass;
     110              : class Harmony;
     111              : class InstrumentTemplate;
     112              : class InputState;
     113              : class KeyList;
     114              : class KeySigEvent;
     115              : class LinkedObjects;
     116              : class Lyrics;
     117              : class MasterScore;
     118              : class Measure;
     119              : class MeasureBase;
     120              : class MuseScoreView;
     121              : class Note;
     122              : class Page;
     123              : class Part;
     124              : class RehearsalMark;
     125              : class RepeatList;
     126              : struct RepeatSegmentInfo;
     127              : class Rest;
     128              : class RootItem;
     129              : class Score;
     130              : class IEngravingFont;
     131              : class Segment;
     132              : class Slur;
     133              : class Spanner;
     134              : class Staff;
     135              : class System;
     136              : class TDuration;
     137              : class TempoTimeline;
     138              : class Text;
     139              : class TimeSig;
     140              : class TimeSigMap;
     141              : class Transaction;
     142              : class TransactionManager;
     143              : class Tuplet;
     144              : class UndoableCommand;
     145              : class UndoStack;
     146              : 
     147              : class ShadowNote;
     148              : 
     149              : struct Interval;
     150              : struct NoteVal;
     151              : struct ShowAnchors;
     152              : 
     153              : enum class BeatType : unsigned char;
     154              : enum class Key : signed char;
     155              : enum class SegmentType;
     156              : enum class OttavaType : unsigned char;
     157              : enum class Prefer : char;
     158              : enum class AccidentalType : unsigned char;
     159              : enum class LayoutBreakType : unsigned char;
     160              : enum class CommandType : signed char;
     161              : enum class SystemDividerType : unsigned char;
     162              : 
     163              : struct Position {
     164              :     Segment* segment = nullptr;
     165              :     staff_idx_t staffIdx = muse::nidx;
     166              :     int line = 0;
     167              :     int fret = INVALID_FRET_INDEX;
     168              :     PointF pos;
     169              :     bool beyondScore = false;
     170              : };
     171              : 
     172              : struct ShowAnchors {
     173         2334 :     ShowAnchors() = default;
     174            0 :     ShowAnchors(voice_idx_t vIdx, staff_idx_t stfIdx, const Fraction& sTickMain, const Fraction& eTickMain,
     175              :                 const Fraction& sTickExt, const Fraction& eTickExt)
     176            0 :         : voiceIdx(vIdx), staffIdx(stfIdx), endStaffIdx(stfIdx + 1), startTickMainRegion(sTickMain), endTickMainRegion(eTickMain),
     177            0 :         startTickExtendedRegion(sTickExt), endTickExtendedRegion(eTickExt) {}
     178            0 :     ShowAnchors(voice_idx_t vIdx, staff_idx_t stfIdx, staff_idx_t endStfIdx, const Fraction& sTickMain, const Fraction& eTickMain,
     179              :                 const Fraction& sTickExt, const Fraction& eTickExt)
     180            0 :         : voiceIdx(vIdx), staffIdx(stfIdx), endStaffIdx(endStfIdx), startTickMainRegion(sTickMain), endTickMainRegion(eTickMain),
     181            0 :         startTickExtendedRegion(sTickExt), endTickExtendedRegion(eTickExt) {}
     182              : 
     183            0 :     void reset()
     184              :     {
     185            0 :         voiceIdx = muse::nidx;
     186            0 :         staffIdx = muse::nidx;
     187            0 :         startTickMainRegion = Fraction(-1, 1);
     188            0 :         endTickMainRegion = Fraction(-1, 1);
     189            0 :         startTickExtendedRegion = Fraction(-1, 1);
     190            0 :         endTickExtendedRegion = Fraction(-1, 1);
     191            0 :     }
     192              : 
     193            0 :     bool operator==(const ShowAnchors& other) const
     194              :     {
     195            0 :         return voiceIdx == other.voiceIdx
     196            0 :                && staffIdx == other.staffIdx
     197            0 :                && endStaffIdx == other.endStaffIdx
     198            0 :                && startTickMainRegion == other.startTickMainRegion
     199            0 :                && endTickMainRegion == other.endTickMainRegion
     200            0 :                && startTickExtendedRegion == other.startTickExtendedRegion
     201            0 :                && endTickExtendedRegion == other.endTickExtendedRegion;
     202              :     }
     203              : 
     204            0 :     bool operator!=(const ShowAnchors& other) const
     205              :     {
     206            0 :         return !(*this == other);
     207              :     }
     208              : 
     209              :     voice_idx_t voiceIdx = muse::nidx;
     210              :     staff_idx_t staffIdx = muse::nidx;
     211              :     staff_idx_t endStaffIdx = muse::nidx;
     212              :     Fraction startTickMainRegion = Fraction(-1, 1);
     213              :     Fraction endTickMainRegion = Fraction(-1, 1);
     214              :     Fraction startTickExtendedRegion = Fraction(-1, 1);
     215              :     Fraction endTickExtendedRegion = Fraction(-1, 1);
     216              : };
     217              : 
     218              : struct ScoreChanges {
     219              :     int tickFrom = -1;
     220              :     int tickTo = -1;
     221              :     staff_idx_t staffIdxFrom = muse::nidx;
     222              :     staff_idx_t staffIdxTo = muse::nidx;
     223              : 
     224              :     bool isTextEditing = false;
     225              : 
     226              :     std::map<EngravingObject*, std::unordered_set<CommandType> > changedObjects;
     227              :     ElementTypeSet changedTypes;
     228              :     PropertyIdSet changedPropertyIdSet;
     229              :     StyleIdSet changedStyleIdSet;
     230              : 
     231           29 :     bool isValidBoundary() const
     232              :     {
     233           29 :         bool tickRangeValid = (tickFrom != -1 && tickTo != -1);
     234           29 :         bool staffRangeValid = (staffIdxFrom != muse::nidx && staffIdxTo != muse::nidx);
     235              : 
     236           29 :         return tickRangeValid && staffRangeValid;
     237              :     }
     238              : 
     239            7 :     bool isValid() const
     240              :     {
     241            7 :         return isValidBoundary() || !changedTypes.empty();
     242              :     }
     243              : 
     244              :     void clear()
     245              :     {
     246              :         *this = ScoreChanges();
     247              :     }
     248              : };
     249              : 
     250              : //---------------------------------------------------------------------------------------
     251              : //   @@ Score
     252              : //   @P composer        string            composer of the score (read only)
     253              : //   @P duration        int               duration of score in seconds (read only)
     254              : //   @P excerpts        array[Excerpt]    the list of the excerpts (linked parts)
     255              : //   @P firstMeasure    Measure           the first measure of the score (read only)
     256              : //   @P firstMeasureMM  Measure           the first multi-measure rest measure of the score (read only)
     257              : //   @P harmonyCount    int               number of harmony items (read only)
     258              : //   @P hasHarmonies    bool              score has chord symbols (read only)
     259              : //   @P hasLyrics       bool              score has lyrics (read only)
     260              : //   @P keysig          int               key signature at the start of the score (read only)
     261              : //   @P lastMeasure     Measure           the last measure of the score (read only)
     262              : //   @P lastMeasureMM   Measure           the last multi-measure rest measure of the score (read only)
     263              : //   @P lastSegment     Segment           the last score segment (read-only)
     264              : //   @P lyricCount      int               number of lyric items (read only)
     265              : //   @P name            string            name of the score
     266              : //   @P nmeasures       int               number of measures (read only)
     267              : //   @P npages          int               number of pages (read only)
     268              : //   @P nstaves         int               number of staves (read only)
     269              : //   @P ntracks         int               number of tracks (staves * 4) (read only)
     270              : // not to be documented?
     271              : //   @P parts           array[Part]       the list of parts (read only)
     272              : //
     273              : //    a Score has always an associated MasterScore
     274              : //---------------------------------------------------------------------------------------
     275              : 
     276              : class Score : public EngravingObject, public muse::Contextable
     277              : {
     278          316 :     OBJECT_ALLOCATOR(engraving, Score)
     279            0 :     DECLARE_CLASSOF(ElementType::SCORE)
     280              : 
     281              :     muse::GlobalInject<class IEngravingConfiguration> configuration;
     282              :     muse::GlobalInject<class IEngravingFontsProvider> engravingFonts;
     283              :     muse::ContextInject<class IEngravingContextConfiguration> contextConfiguration;
     284              :     muse::ContextInject<class IEngravingElementsProvider> elementsProvider;
     285              :     muse::ContextInject<class IPaletteScoreProvider> paletteScoreProvider;
     286              :     // internal
     287              :     muse::GlobalInject<rendering::IScoreRenderer> renderer;
     288              : 
     289              : public:
     290              :     Score(const Score&) = delete;
     291              :     Score& operator=(const Score&) = delete;
     292              :     virtual ~Score();
     293              :     Score* clone();
     294              : 
     295              :     Score* paletteScore() const;
     296              :     bool isPaletteScore() const;
     297              : 
     298         4822 :     virtual bool isMaster() const { return false; }
     299              :     virtual bool readOnly() const;
     300              : 
     301              :     static void onElementDestruction(EngravingItem* se);
     302              : 
     303              :     void scanElements(std::function<void(EngravingItem*)> func) override;
     304              : 
     305            4 :     RootItem* rootItem() const { return m_rootItem; }
     306       682306 :     DummyParent* dummy() const { return m_dummy; }
     307              : 
     308              :     ShadowNote* shadowNote() const;
     309              : 
     310              :     muse::async::Channel<LoopBoundaryType, unsigned> loopBoundaryTickChanged() const;
     311              :     void notifyLoopBoundaryTickChanged(LoopBoundaryType type, unsigned ticks);
     312              : 
     313              :     muse::async::Channel<EngravingItem*> elementDestroyed();
     314              : 
     315              :     muse::async::Channel<float> layoutProgressChannel() const;
     316              : 
     317              :     void rebuildBspTree();
     318           56 :     bool noStaves() const { return m_staves.empty(); }
     319              :     void insertPart(Part*, size_t targetPartIdx);
     320              :     void appendPart(Part*);
     321              :     void removePart(Part*);
     322              :     void insertStaff(Staff*, staff_idx_t);
     323              :     void appendStaff(Staff*);
     324              :     void cmdRemoveStaff(staff_idx_t staffIdx);
     325              :     void removeStaff(Staff*);
     326              :     void addMeasure(MeasureBase*, MeasureBase*);
     327              : 
     328         3254 :     Excerpt* excerpt() { return m_excerpt; }
     329          169 :     void setExcerpt(Excerpt* e) { m_excerpt = e; }
     330              : 
     331              :     void cmdRemovePart(Part*);
     332              :     void cmdAddOttava(OttavaType);
     333              :     void addNoteLine();
     334              : 
     335              :     void cmdAddGrace(NoteType, int);
     336              :     void cmdToggleLayoutBreak(LayoutBreakType);
     337              :     void removeChordRest(ChordRest* cr, bool clearSegment);
     338              :     void cmdToggleMmrest();
     339              :     void cmdToggleHideEmpty();
     340              :     void cmdSetHideStaffIfEmptyOverride(staff_idx_t staffIdx, System* system, engraving::AutoOnOff value);
     341              :     void cmdMoveRest(Rest*, DirectionV);
     342              :     void cmdMoveLyrics(Lyrics*, DirectionV);
     343              : 
     344              :     bool appendMeasuresFromScore(Score* score, const Fraction& startTick, const Fraction& endTick);
     345              :     bool appendScore(Score*, bool addPageBreak = false, bool addSectionBreak = true);
     346              : 
     347     27162951 :     const std::vector<Staff*>& staves() const { return m_staves; }
     348      3442234 :     size_t nstaves() const { return m_staves.size(); }
     349              :     size_t visibleStavesCount() const;
     350              :     bool allStavesInvisible() const;
     351      4588265 :     size_t ntracks() const { return m_staves.size() * VOICES; }
     352              : 
     353              :     staff_idx_t staffIdx(const Staff*) const;
     354              :     staff_idx_t staffIdx(const Part*) const;
     355     34042377 :     Staff* staff(size_t n) const { return (n < m_staves.size()) ? m_staves.at(n) : nullptr; }
     356              :     Staff* staffById(const muse::ID& staffId) const;
     357              :     Part* partById(const muse::ID& partId) const;
     358              : 
     359              :     void clearSystemObjectStaves();
     360              :     void addSystemObjectStaff(Staff* staff);
     361              :     void removeSystemObjectStaff(Staff* staff);
     362        69742 :     const std::vector<Staff*>& systemObjectStaves() const { return m_systemObjectStaves; }
     363              :     const std::vector<Staff*> systemObjectStavesWithTopStaff() const;
     364              : 
     365              :     MeasureBase* pos2measureBase(const PointF&, bool scanMeasuresOnly, staff_idx_t* staffIdx, int* pitch, Segment**, PointF* offset) const;
     366              :     Measure* pos2measure(const PointF& p, staff_idx_t* staffIdx, int* pitch, Segment** seg, PointF* offset) const;
     367              :     void dragPosition(const PointF&, staff_idx_t* staffIdx, Segment**, double spacingFactor = 0.5, bool allowTimeAnchor = false) const;
     368              : 
     369              :     void undoAddElement(EngravingItem* element, bool addToLinkedStaves = true, bool ctrlModifier = false,
     370              :                         EngravingItem* elementToRelink = nullptr);
     371              :     void undoAddCR(ChordRest* element, Measure*, const Fraction& tick);
     372              :     void undoRemoveElement(EngravingItem* element, bool removeLinked = true);
     373              :     void undoRemoveHopoText(HammerOnPullOffText* hopoText);
     374              :     void undoChangeSpannerElements(Spanner* spanner, EngravingItem* startElement, EngravingItem* endElement);
     375              :     void undoChangeElement(EngravingItem* oldElement, EngravingItem* newElement);
     376              :     void undoChangeChordRestLen(ChordRest* cr, const TDuration&);
     377              :     void undoRemovePart(Part* part, size_t partIdx = muse::nidx);
     378              :     void undoInsertPart(Part* part, size_t targetPartIndex);
     379              :     void undoRemoveStaff(Staff* staff);
     380              :     void undoInsertStaff(Staff* staff, staff_idx_t idx, bool createRests=true);
     381              :     bool undoPropertyChanged(EngravingItem* item, Pid propId, const PropertyValue& propValue,
     382              :                              PropertyFlags propFlags = PropertyFlags::NOSTYLE);
     383              :     void undoPropertyChanged(EngravingObject*, Pid, const PropertyValue& v, PropertyFlags ps = PropertyFlags::NOSTYLE);
     384              :     UndoStack* undoStack() const;
     385              :     TransactionManager* transactionManager() const;
     386              :     void undo(UndoableCommand*) const;
     387              :     void undoRemoveMeasures(Measure*, Measure*, bool preserveTies = false, bool moveStaffTypeChanges = true);
     388              :     void undoChangeMeasureRepeatCount(Measure* m, int count, staff_idx_t staffIdx);
     389              :     void undoInsertTime(const Fraction& tick, const Fraction& len);
     390              :     void undoChangeStyleVal(Sid idx, const PropertyValue& v);
     391              :     void undoChangeStyleValues(std::unordered_map<Sid, PropertyValue> values);
     392              :     void undoChangePageNumberOffset(int po);
     393              :     void undoChangeParent(EngravingItem* element, EngravingItem* parent, staff_idx_t _staff, bool changeLinksParents = true);
     394              :     void undoResetPlayCountTextSettings(BarLine* bl);
     395              :     void undoUpdatePlayCountText(Measure* m);
     396              :     void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStaves, bool replace = false);
     397              : 
     398              :     void updateInstrumentChangeTranspositions(KeySigEvent& key, Staff* staff, const Fraction& tick);
     399              : 
     400              :     Measure* undoGetMeasure(const Fraction& tick);
     401              : 
     402              :     Note* setGraceNote(Chord*,  int pitch, NoteType type, int len);
     403              : 
     404              :     GuitarBend* addGuitarBend(GuitarBendType type, Note* note, Note* endNote = nullptr);
     405              : 
     406              :     Segment* setNoteRest(Segment*, track_idx_t track, NoteVal nval, Fraction, DirectionV stemDirection = DirectionV::AUTO,
     407              :                          bool forceAccidental = false, const std::set<SymId>& articulationIds = {}, bool rhythmic = false,
     408              :                          InputState* externalInputState = nullptr);
     409              :     void changeCRlen(ChordRest* cr, const TDuration&);
     410              :     void changeCRlen(ChordRest* cr, const Fraction&, bool fillWithRest=true);
     411              :     void createCRSequence(const Fraction& f, ChordRest* cr, const Fraction& tick);
     412              : 
     413              :     Fraction makeGap(Segment*, track_idx_t track, const Fraction&, Tuplet*, bool keepChord = false, bool deleteAnnotations = true);
     414              :     bool makeGapVoice(Segment* seg, track_idx_t track, Fraction len, const Fraction& tick, bool deleteAnnotations = true);
     415              : 
     416              :     Rest* addRest(const Fraction& tick, track_idx_t track, TDuration, Tuplet*);
     417              :     Rest* addRest(Segment* seg, track_idx_t track, TDuration d, Tuplet*);
     418              :     Chord* addChord(const Fraction& tick, TDuration d, Chord* oc, bool genTie, Tuplet* tuplet);
     419              : 
     420              :     Tuplet* addTuplet(ChordRest* destinationChordRest, Fraction ratio, TupletNumberType numberType, TupletBracketType bracketType);
     421              :     Tuplet* addTuplet(ChordRest* destinationChordRest, const Fraction& ratio, const TDuration& baseLen, TupletNumberType numberType,
     422              :                       TupletBracketType bracketType);
     423              :     bool canAddTuplet(const ChordRest* chordRest, const Fraction& ratio, const TDuration& baseLen) const;
     424              :     bool canAddTuplet(const Segment* segment, track_idx_t track, const Fraction& ratio, const TDuration& baseLen) const;
     425              :     Fraction tupletEndTick(const ChordRest* chordRest, const Fraction& ratio, const TDuration& baseLen) const;
     426              :     void selectNewTuplet(Tuplet* tuplet);
     427              : 
     428              :     ChordRest* addClone(ChordRest* cr, const Fraction& tick, const TDuration& d);
     429              :     Rest* setRest(const Fraction& tick, track_idx_t track, const Fraction&, bool useDots, Tuplet* tuplet, bool useFullMeasureRest = true);
     430              :     std::vector<Rest*> setRests(const Fraction& tick, track_idx_t track, const Fraction& l, bool useDots, Tuplet* tuplet,
     431              :                                 bool useFullMeasureRest = true);
     432              : 
     433              :     ChordRest* searchNote(const Fraction& tick, track_idx_t track) const;
     434              : 
     435              :     // undo/redo ops
     436              :     void addElement(EngravingItem*);
     437              :     void doUndoAddElement(EngravingItem*);
     438              :     void removeElement(EngravingItem*);
     439              :     void doUndoRemoveElement(EngravingItem*);
     440              : 
     441              :     Slur* addSlur(ChordRest* firstChordRest, ChordRest* secondChordRest, const Slur* slurTemplate);
     442              :     TextBase* addText(TextStyleType type, EngravingItem* destinationElement = nullptr);
     443              : 
     444              :     void deleteItem(EngravingItem*);
     445              :     void deleteMeasures(MeasureBase* firstMeasure, MeasureBase* lastMeasure, bool preserveTies = false);
     446              :     void restoreInitialKeySigAndTimeSig();
     447              :     void reconnectSlurs(MeasureBase* mbStart, MeasureBase* mbLast);
     448              :     void cmdDeleteSelection();
     449              :     std::vector<ChordRest*> deleteRange(Segment* segStart, Segment* segEnd, track_idx_t trackStart, track_idx_t trackEnd,
     450              :                                         const SelectionFilter& filter, bool selectionContainsMultiNoteChords);
     451              :     void cmdFullMeasureRest();
     452              : 
     453              :     void startCmd(const TranslatableString& actionName);             // start undoable command
     454              :     void endCmd(bool rollback = false, bool layoutAllParts = false, bool keepRolledBackElements = false); // end undoable command
     455              :     void update();
     456              :     void undoRedo(bool undo, EditData*);
     457              : 
     458              :     virtual muse::async::Channel<ScoreChanges> changesChannel() const;
     459              : 
     460              :     virtual void setUpdateAll();
     461              :     void setLayoutAll(staff_idx_t staff = muse::nidx, const EngravingItem* e = nullptr);
     462              :     void setLayout(const Fraction& tick, staff_idx_t staff, const EngravingItem* e = nullptr);
     463              :     void setLayout(const Fraction& tick1, const Fraction& tick2, staff_idx_t staff1, staff_idx_t staff2, const EngravingItem* e = nullptr);
     464              :     virtual CmdState& cmdState();
     465              :     virtual const CmdState& cmdState() const;
     466              :     virtual void addLayoutFlags(LayoutFlags);
     467              :     virtual void setInstrumentsChanged(bool);
     468              : 
     469              :     void cmdToggleAutoplace(bool all);
     470              : 
     471              :     bool playNote() const { return m_updateState.playNote; }
     472         1097 :     void setPlayNote(bool v) { m_updateState.playNote = v; }
     473            0 :     bool playChord() const { return m_updateState.playChord; }
     474          548 :     void setPlayChord(bool v) { m_updateState.playChord = v; }
     475            0 :     bool selectionEmpty() const { return m_selection.staffStart() == m_selection.staffEnd(); }
     476            0 :     bool selectionChanged() const { return m_updateState.selectionChanged; }
     477         7717 :     void setSelectionChanged(bool val) { m_updateState.selectionChanged = val; }
     478           30 :     const RectF& refreshRect() const { return m_updateState.refresh; }
     479              :     void addRefresh(const RectF&);
     480           30 :     void clearRefreshRect() { m_updateState.refresh = RectF(); }
     481              : 
     482              :     const std::vector<Part*>& parts() const;
     483              :     size_t visiblePartCount() const;
     484              :     std::vector<Part*> visibleParts() const;
     485              :     std::vector<SharedPart*> sharedParts() const;
     486              :     bool hasSharedParts() const;
     487              : 
     488              :     using StaffAccepted = std::function<bool (const Staff&)>;
     489              :     std::set<staff_idx_t> staffIdxSetFromRange(const track_idx_t trackFrom, const track_idx_t trackTo,
     490              :                                                StaffAccepted staffAccepted = StaffAccepted()) const;
     491              : 
     492              :     void appendPart(const InstrumentTemplate*);
     493              :     void sortSystemObjects(std::vector<staff_idx_t>& dst);
     494              :     void sortStaves(std::vector<staff_idx_t>& dst);
     495              : 
     496            0 :     bool isShowInvisible() const { return m_showInvisible; }
     497            0 :     bool showUnprintable() const { return m_showUnprintable; }
     498            0 :     bool showFrames() const { return m_showFrames; }
     499            0 :     bool showPageborders() const { return m_showPageborders; }
     500            9 :     bool showSoundFlags() const { return m_showSoundFlags; }
     501            0 :     bool markIrregularMeasures() const { return m_markIrregularMeasures; }
     502        14363 :     bool showInstrumentNames() const { return m_showInstrumentNames; }
     503              :     void setShowInvisible(bool v);
     504              :     void setShowUnprintable(bool v);
     505              :     void setShowFrames(bool v);
     506              :     void setShowPageborders(bool v);
     507              :     void setShowSoundFlags(bool v);
     508              :     void setMarkIrregularMeasures(bool v);
     509            0 :     void setShowInstrumentNames(bool v) { m_showInstrumentNames = v; }
     510              : 
     511            0 :     void hideAnchors() { m_showAnchors.reset(); }
     512              :     void setShowAnchors(const ShowAnchors& showAnchors);
     513            0 :     const ShowAnchors& showAnchors() const { return m_showAnchors; }
     514              : 
     515              :     ChordRest* getSelectedChordRest() const;
     516              :     std::set<ChordRest*> getSelectedChordRests() const;
     517              :     void getSelectedStartEndChordRests(ChordRest*& cr1, ChordRest*& cr2) const;
     518              : 
     519              :     void select(EngravingItem* item, SelectType = SelectType::SINGLE, staff_idx_t staff = 0);
     520              :     void select(const std::vector<EngravingItem*>& items, SelectType = SelectType::SINGLE, staff_idx_t staff = 0);
     521              :     void selectSimilar(EngravingItem* e, bool sameStaff);
     522              :     void selectSimilarInRange(EngravingItem* e);
     523              :     static void collectMatch(ElementPattern* p, EngravingItem* e);
     524              :     static void collectNoteMatch(NotePattern* p, EngravingItem* e);
     525              :     void deselect(EngravingItem* obj);
     526         2722 :     void deselectAll() { m_selection.deselectAll(); }
     527          202 :     void updateSelection() { m_selection.update(); }
     528           42 :     EngravingItem* getSelectedElement() const { return m_selection.element(); }
     529         1520 :     const Selection& selection() const { return m_selection; }
     530       236584 :     Selection& selection() { return m_selection; }
     531            0 :     const SelectionFilter& selectionFilter() const { return m_selectionFilter; }
     532        36827 :     SelectionFilter& selectionFilter() { return m_selectionFilter; }
     533              :     void setSelection(const Selection& s);
     534              : 
     535              :     bool canReselectItem(const EngravingItem* item) const;
     536              : 
     537              :     Fraction pos();
     538              :     Measure* tick2measure(const Fraction& tick) const;
     539              :     Measure* tick2measureMM(const Fraction& tick) const;
     540              :     MeasureBase* tick2measureBase(const Fraction& tick) const;
     541              :     Segment* tick2segment(const Fraction& tick, bool first, SegmentType st, bool useMMrest = false) const;
     542              :     Segment* tick2segment(const Fraction& tick) const;
     543              :     Segment* tick2segment(const Fraction& tick, bool first) const;
     544              :     Segment* tick2segmentMM(const Fraction& tick, bool first, SegmentType st) const;
     545              :     Segment* tick2segmentMM(const Fraction& tick) const;
     546              :     Segment* tick2segmentMM(const Fraction& tick, bool first) const;
     547              :     Segment* tick2leftSegment(const Fraction& tick, bool useMMrest = false, SegmentType segType = SegmentType::ChordRest) const;
     548              :     Segment* tick2rightSegment(const Fraction& tick, bool useMMrest = false, SegmentType segType = SegmentType::ChordRest) const;
     549            0 :     Segment* tick2leftSegmentMM(const Fraction& tick) { return tick2leftSegment(tick, /* useMMRest */ true); }
     550              : 
     551              :     void updateTicksAndTimeSigMap();
     552         4059 :     void updateTicksAndTimeSigMapLater() { m_needUpdateTicksAndTimeSigMap = true; }
     553         1555 :     bool needUpdateTicksAndTimeSigMap() const { return m_needUpdateTicksAndTimeSigMap; }
     554              : 
     555              :     EngravingItem* nextElement();
     556              :     EngravingItem* prevElement();
     557              :     ChordRest* nextTrack(ChordRest* cr, bool skipMeasureRepeatRests = true);
     558              :     ChordRest* prevTrack(ChordRest* cr, bool skipMeasureRepeatRests = true);
     559              :     ChordRest* cmdNextPrevSystem(ChordRest*, bool);
     560              :     Box* cmdNextPrevFrame(MeasureBase*, bool) const;
     561              :     EngravingItem* cmdNextPrevSection(EngravingItem*, bool) const;
     562              :     MeasureBase* getNextPrevSectionBreak(MeasureBase*, bool) const;
     563              :     EngravingItem* getScoreElementOfMeasureBase(MeasureBase*) const;
     564              : 
     565          131 :     int fileDivision(int t) const { return static_cast<int>(((int64_t)t * Constants::DIVISION + m_fileDivision / 2) / m_fileDivision); }
     566           78 :     void setFileDivision(int t) { m_fileDivision = t; }
     567              : 
     568              :     bool dirty() const;
     569              :     bool savedCapture() const { return m_savedCapture; }
     570              :     void setSavedCapture(bool v) { m_savedCapture = v; }
     571           48 :     bool printing() const { return m_printing; }
     572           10 :     void setPrinting(bool val) { m_printing = val; }
     573            0 :     bool hasCorruptedMeasures() const { return m_corrupted; }
     574           63 :     void setHasCorruptedMeasures(bool val) { m_corrupted = val; }
     575              : 
     576              :     bool isOpen() const;
     577              :     void setIsOpen(bool open);
     578              : 
     579        36718 :     ChordList* chordList() { return &m_chordList; }
     580              :     const ChordList* chordList() const { return &m_chordList; }
     581              :     void checkChordList();
     582              : 
     583     17835732 :     MStyle& style() { return m_style; }
     584      3746392 :     const MStyle& style() const { return m_style; }
     585              : 
     586              :     PageSizeGetAccessor pageSize() const { return PageSizeGetAccessor(m_style); }
     587            0 :     PageSizeSetAccessor pageSize() { return PageSizeSetAccessor(m_style); }
     588              : 
     589              :     void resetStyleValue(Sid styleToReset);
     590              :     void resetStyleValues(const StyleIdSet& styleIdSet);
     591              : 
     592              :     void setStyle(const MStyle& s, const bool overlap = false);
     593              : 
     594              :     TranslatableString getTextStyleUserName(TextStyleType tid) const;
     595              : 
     596              :     // These position are in ticks and not uticks
     597            0 :     Fraction loopInTick() const { return loopBoundaryTick(LoopBoundaryType::LoopIn); }
     598            0 :     Fraction loopOutTick() const { return loopBoundaryTick(LoopBoundaryType::LoopOut); }
     599            0 :     void setLoopInTick(const Fraction& tick) { setLoopBoundaryTick(LoopBoundaryType::LoopIn, tick); }
     600            0 :     void setLoopOutTick(const Fraction& tick) { setLoopBoundaryTick(LoopBoundaryType::LoopOut, tick); }
     601              : 
     602              :     Fraction loopBoundaryTick(LoopBoundaryType type) const;
     603              :     void setLoopBoundaryTick(LoopBoundaryType type, Fraction tick);
     604              : 
     605          137 :     bool noteEntryMode() const { return inputState().noteEntryMode(); }
     606            0 :     bool usingNoteEntryMethod(NoteEntryMethod m) { return inputState().usingNoteEntryMethod(m); }
     607          197 :     const InputState& inputState() const { return m_is; }
     608         1907 :     InputState& inputState() { return m_is; }
     609          230 :     void setInputState(const InputState& st) { m_is = st; }
     610              : 
     611              :     void spatiumChanged(double oldValue, double newValue);
     612              :     void styleChanged() override;
     613              : 
     614              :     BeatType tick2beatType(const Fraction& tick) const;
     615              : 
     616        42717 :     int mscVersion() const { return m_mscVersion; }
     617         1008 :     void setMscVersion(int v) { m_mscVersion = v; }
     618              : 
     619              :     void addLyrics(const Fraction& tick, staff_idx_t staffIdx, const String&);
     620              : 
     621              :     void updateSwing();
     622              : 
     623              :     void updateCapo(bool ignoreNotationUpdate = false);
     624              :     void updateChannel();
     625              : 
     626              :     void cmdConcertPitchChanged(bool);
     627              : 
     628              :     virtual TimeSigMap* sigmap() const;
     629              : 
     630              :     BeatsPerSecond tempo(const Fraction& tick) const;
     631              :     BeatsPerSecond multipliedTempo(const Fraction& tick) const;
     632              :     BeatsPerSecond multipliedTempoAtUtick(int utick) const;
     633              : 
     634              :     Text* getText(TextStyleType subtype) const;
     635              : 
     636              :     ScoreOrder scoreOrder() const;
     637              :     void setScoreOrder(ScoreOrder order);
     638              :     void updateBracesAndBarlines(Part* part, size_t index);
     639              :     void setBracketsAndBarlines();
     640              :     void remapBracketsAndBarlines();
     641              : 
     642              :     void lassoSelect(const RectF&);
     643              :     void lassoSelectEnd();
     644              : 
     645              :     Page* searchPage(const PointF&) const;
     646              :     std::vector<System*> searchSystem(const PointF& p, bool includeMeasurelessSystems = true, const System* preferredSystem = nullptr,
     647              :                                       double spacingFactor = 0.5, double preferredSpacingFactor = 1.0) const;
     648              :     MeasureBase* searchMeasureBase(const PointF& p, bool scanMeasuresOnly = false, const System* preferredSystem = nullptr,
     649              :                                    double spacingFactor = 0.5, double preferredSpacingFactor = 1.0) const;
     650              : 
     651              :     bool getPosition(Position* pos, const PointF&, voice_idx_t voice) const;
     652              : 
     653              :     void cmdDeleteTuplet(Tuplet*, bool replaceWithRest);
     654              : 
     655              :     void adjustKeySigs(track_idx_t sidx, track_idx_t eidx, KeyList km);
     656              :     KeyList keyList() const;
     657              : 
     658              :     /// To be used together with setExpandRepeats.
     659              :     /// For bigger operations, where suboperations might also use it,
     660              :     /// where those need to have the same value for expandRepeats.
     661              :     const RepeatList& repeatList() const;
     662              :     /// For small, one-step operations, where you need to get the relevant repeatList just once
     663              :     const RepeatList& repeatList(bool expandRepeats, bool updateTies = true) const;
     664              :     /// Read-only snapshot, safe to call mid-edit (e.g. before a structural change invalidates the current repeatList)
     665              :     std::vector<RepeatSegmentInfo> repeatSegmentInfoList(bool expandRepeats) const;
     666              :     /// Always the repeat-expanded list, regardless of the current playback setting
     667              :     const RepeatList& expandedRepeatList() const;
     668              : 
     669              :     void invalidateRepeatList();
     670              : 
     671              :     double utick2utime(int tick) const;
     672              :     int utime2utick(double utime) const;
     673              : 
     674              :     const TempoTimeline& tempoTimeline() const;
     675              :     const TempoTimeline& tempoTimeline(bool expandRepeats) const;
     676              :     void setTempoTimelineOverride(std::optional<TempoTimeline> timeline);
     677              : 
     678         4905 :     virtual size_t npages() const { return m_pages.size(); }
     679          596 :     virtual page_idx_t pageIdx(const Page* page) const { return muse::indexOf(m_pages, page); }
     680           20 :     virtual const std::vector<Page*>& pages() const { return m_pages; }
     681        12179 :     virtual std::vector<Page*>& pages() { return m_pages; }
     682              : 
     683        18372 :     const std::vector<System*>& systems() const { return m_systems; }
     684        30824 :     std::vector<System*>& systems() { return m_systems; }
     685              : 
     686        20153 :     MeasureBaseList* measures() { return &m_measures; }
     687              :     bool checkHasMeasures() const;
     688              :     MeasureBase* first() const;
     689              :     MeasureBase* firstMM() const;
     690              :     MeasureBase* last()  const;
     691              :     Measure* firstMeasure() const;
     692              :     Measure* firstMeasureMM() const;
     693              :     Measure* lastMeasure() const;
     694              :     Measure* lastMeasureMM() const;
     695              :     MeasureBase* measure(int idx) const;
     696              :     Measure* crMeasure(int idx) const;
     697              : 
     698              :     Fraction endTick() const;
     699              : 
     700              :     Segment* firstSegment(SegmentType s) const;
     701              :     Segment* firstSegmentMM(SegmentType s) const;
     702              :     Segment* lastSegment() const;
     703              :     Segment* lastSegmentMM() const;
     704              : 
     705              :     void connectTies(bool silent = false);
     706              :     void undoRemoveStaleTieJumpPoints(bool undo = true);
     707              : 
     708              :     void scanElementsInRange(std::function<void(EngravingItem*)> func);
     709           26 :     int fileDivision() const { return m_fileDivision; }   ///< division of current loading *.msc file
     710              :     void splitStaff(staff_idx_t staffIdx, int splitPoint);
     711              :     FiguredBass* addFiguredBass();
     712              :     void expandVoice(Segment* s, track_idx_t track);
     713              :     void expandVoice();
     714              : 
     715              :     void cmdEnterRest(const TDuration& d);
     716              :     void enterRest(const TDuration& d, InputState* externalInputState = nullptr);
     717              :     void addInterval(int, const std::vector<Note*>&);
     718              :     void cmdCreateTuplet(ChordRest*, Tuplet*);
     719              : 
     720              :     bool autoLayoutEnabled() const;
     721              : 
     722              :     void doLayout();
     723              :     void doLayoutRange(const Fraction& st, const Fraction& et);
     724              : 
     725           37 :     SynthesizerState& synthesizerState() { return m_synthesizerState; }
     726              :     void setSynthesizerState(const SynthesizerState& s);
     727              : 
     728       985787 :     MasterScore* masterScore() const { return m_masterScore; }
     729         2169 :     void setMasterScore(MasterScore* s) { m_masterScore = s; }
     730              : 
     731            0 :     const std::map<String, String>& metaTags() const { return m_metaTags; }
     732        26028 :     std::map<String, String>& metaTags() { return m_metaTags; }
     733            0 :     void setMetaTags(const std::map<String, String>& t) { m_metaTags = t; }
     734              : 
     735              :     String metaTag(const String& tag) const;
     736              :     void setMetaTag(const String& tag, const String& val);
     737              : 
     738        36254 :     int pageNumberOffset() const { return m_pageNumberOffset; }
     739           82 :     void setPageNumberOffset(int v) { m_pageNumberOffset = v; }
     740              : 
     741         1157 :     String mscoreVersion() const { return m_mscoreVersion; }
     742            0 :     int mscoreRevision() const { return m_mscoreRevision; }
     743          475 :     void setMscoreVersion(const String& val) { m_mscoreVersion = val; }
     744          459 :     void setMscoreRevision(int val) { m_mscoreRevision = val; }
     745              : 
     746            0 :     void addViewer(MuseScoreView* v) { m_viewer.push_back(v); }
     747              :     void removeViewer(MuseScoreView* v) { m_viewer.remove(v); }
     748       546166 :     const std::list<MuseScoreView*>& getViewer() const { return m_viewer; }
     749              : 
     750              :     //! NOTE Layout
     751       545828 :     const LayoutOptions& layoutOptions() const { return m_layoutOptions; }
     752            3 :     void setLayoutMode(LayoutMode lm) { m_layoutOptions.mode = lm; }
     753            0 :     void setShowVBox(bool v) { m_layoutOptions.isShowVBox = v; }
     754       281689 :     double noteHeadWidth() const { return m_layoutOptions.noteHeadWidth; }
     755            0 :     void setNoteHeadWidth(double n) { m_layoutOptions.noteHeadWidth = n; }
     756              : 
     757              :     // temporary methods
     758         2776 :     bool isLayoutMode(LayoutMode lm) const { return m_layoutOptions.isMode(lm); }
     759            0 :     LayoutMode layoutMode() const { return m_layoutOptions.mode; }
     760            0 :     bool lineMode() const { return m_layoutOptions.isMode(LayoutMode::LINE); }
     761            5 :     bool linearMode() const { return m_layoutOptions.isLinearMode(); }
     762              :     // ----
     763              : 
     764              :     void cmdSelectAll();
     765              :     void cmdSelectSection();
     766              : 
     767              :     struct InsertMeasureOptions {
     768          279 :         InsertMeasureOptions() {}
     769              : 
     770              :         bool createMeasureRests = false;
     771              :         bool moveSignaturesClef = true;
     772              :         bool needDeselectAll = true;
     773              :         bool cloneBoxToAllParts = true;
     774              :         bool moveStaffTypeChanges = true;
     775              :         bool ignoreBarLines = false;
     776              :     };
     777              : 
     778              :     MeasureBase* insertMeasure(ElementType type, MeasureBase* beforeMeasure = nullptr,
     779              :                                const InsertMeasureOptions& options = InsertMeasureOptions());
     780              :     MeasureBase* insertBox(ElementType type, MeasureBase* beforeMeasure = nullptr,
     781              :                            const InsertMeasureOptions& options = InsertMeasureOptions());
     782              :     MeasureBase* insertBox(MeasureBase* box, MeasureBase* beforeMeasure = nullptr,
     783              :                            const InsertMeasureOptions& options = InsertMeasureOptions());
     784              : 
     785              :     std::list<Score*> scoreList();
     786              : 
     787              :     void appendMeasures(int numMeasures);
     788              : 
     789        48847 :     const std::multimap<int, Spanner*>& spanner() const { return m_spanner.map(); }
     790        73546 :     SpannerMap& spannerMap() { return m_spanner; }
     791        65437 :     const SpannerMap& spannerMap() const { return m_spanner; }
     792              :     std::vector<Spanner*> spannerList() const; // Return all spanners as a vector for Plugin API
     793              :     bool isSpannerStartEnd(const Fraction& tick, track_idx_t track) const;
     794              :     void removeSpanner(Spanner*);
     795              :     void addSpanner(Spanner*, bool computeStartEnd = true);
     796              :     void checkSpanner(const Fraction& startTick, const Fraction& lastTick, bool removeOrphans = true);
     797         8311 :     const std::set<Spanner*>& unmanagedSpanners() const { return m_unmanagedSpanner; }
     798              :     void addUnmanagedSpanner(Spanner*);
     799              :     void removeUnmanagedSpanner(Spanner*);
     800              : 
     801              :     ChordRest* findCR(Fraction tick, track_idx_t track) const;
     802              :     ChordRest* findChordRestEndingBeforeTickInStaff(const Fraction& tick, staff_idx_t staffIdx) const;
     803              :     ChordRest* findChordRestEndingBeforeTickInStaffAndVoice(const Fraction& tick, staff_idx_t staffIdx, voice_idx_t voice) const;
     804              :     ChordRest* findChordRestEndingBeforeTickInTrack(const Fraction& tick, track_idx_t trackIdx) const;
     805              :     void insertTime(const Fraction& tickPos, const Fraction& tickLen, const std::vector<RepeatSegmentInfo>& oldSegments);
     806              : 
     807      2148987 :     std::shared_ptr<IEngravingFont> engravingFont() const { return m_engravingFont; }
     808           39 :     void setEngravingFont(std::shared_ptr<IEngravingFont> f) { m_engravingFont = f; }
     809              : 
     810              :     std::vector<staff_idx_t> uniqueStaves() const;
     811              : 
     812              :     size_t nmeasures() const;
     813              : 
     814              :     bool hasHarmonies() const;
     815              :     int harmonyCount() const;
     816              : 
     817              :     bool hasLyrics() const;
     818              :     int  lyricCount() const;
     819              :     std::vector<Lyrics*> lyrics() const;
     820              :     String extractLyrics() const;
     821              : 
     822              :     int keysig() const;
     823              :     int duration() const;
     824              :     int durationWithoutRepeats() const;
     825              : 
     826              :     void cmdRemoveEmptyTrailingMeasures();
     827              : 
     828              :     Measure* firstTrailingMeasure(ChordRest** cr = nullptr);
     829              : 
     830              :     muse::Ret sanityCheckLocal();
     831              : 
     832              :     bool checkKeys();
     833              : 
     834              :     void switchToPageMode();
     835              : 
     836              :     PropertyValue getProperty(Pid) const override;
     837              :     bool setProperty(Pid, const PropertyValue&) override;
     838              :     PropertyValue propertyDefault(Pid) const override;
     839              : 
     840              :     /// For MasterScores: returns the filename without extension
     841              :     /// For Scores: returns the excerpt name
     842              :     virtual String name() const;
     843              : 
     844              :     void cmdTimeDelete();
     845              :     bool checkTimeDelete(Segment* startSegment, Segment* endSegment);
     846              :     void doTimeDelete(Segment* startSegment, Segment* endSegment);
     847              :     void doTimeDeleteForMeasure(Measure*, Segment*, const Fraction&);
     848              : 
     849              :     void forAllLyrics(std::function<void(Lyrics*)> f);
     850              : 
     851              :     void updatePaddingTables();
     852      4574021 :     const PaddingTables& paddingTables() const { return m_paddingTables; }
     853              : 
     854        75631 :     const RangeLocks* systemLocks() const { return &m_systemLocks; }
     855              :     void addSystemLock(const RangeLock* lock);
     856              :     void removeSystemLock(const RangeLock* lock);
     857            0 :     void clearSystemLocks() { m_systemLocks.clear(); }
     858              : 
     859        86561 :     const RangeLocks* pageLocks() const { return &m_pageLocks; }
     860              :     void addPageLock(const RangeLock* lock);
     861              :     void removePageLock(const RangeLock* lock);
     862              : 
     863              :     void rebuildFretBox();
     864              : 
     865            1 :     const std::map<size_t, std::array<SystemDivider*, 2> > systemDividers() const { return m_systemDividers; }
     866              :     SystemDivider* systemDivider(size_t systemIdx, SystemDividerType type) const;
     867              :     void addSystemDivider(size_t systemIdx, SystemDivider* divider);
     868              : 
     869              :     virtual AutomationDataConstPtr automationData() const;
     870              :     virtual void editAutomationPoints(const AutomationCurveKey& key, AutomationPointEdits& edits, bool undoable = true);
     871              : 
     872              :     friend class Chord;
     873              : 
     874              :     BracketType bracketType(staff_idx_t staffIdx, size_t idx) const;
     875              :     size_t bracketSpan(staff_idx_t staffIdx, size_t idx) const;
     876              :     const std::vector<BracketItem*>& brackets(staff_idx_t staffIdx) const;
     877              :     std::vector<BracketItem*>& brackets(staff_idx_t staffIdx);
     878              :     size_t bracketLevels(staff_idx_t staffIdx) const;
     879              : 
     880              : protected:
     881              :     virtual void onTimeInserted(const Fraction& tick, const Fraction& len, const std::vector<RepeatSegmentInfo>& oldSegments);
     882              : 
     883              :     friend class MasterScore;
     884              :     Score(const muse::modularity::ContextPtr& iocCtx);
     885              :     Score(MasterScore*, bool forcePartStyle = true);
     886              :     Score(MasterScore*, const MStyle&);
     887              : 
     888              :     int m_fileDivision = 0;   // division of current loading *.msc file
     889              :     SynthesizerState m_synthesizerState;
     890              : 
     891              : private:
     892              : 
     893              :     friend class read302::Read302;
     894              :     friend class read400::Read400;
     895              :     friend class read410::Read410;
     896              :     friend class read460::Read460;
     897              :     friend class read500::Read500;
     898              :     friend class write::Writer;
     899              : 
     900              :     static std::set<Score*> validScores;
     901              : 
     902              :     Note* getSelectedNote();
     903              :     ChordRest* findChordRestEndingBeforeTickInStaffAndVoice(const Fraction& tick, staff_idx_t staffIdx, bool forceVoice,
     904              :                                                             voice_idx_t voice) const;
     905              : 
     906              :     void checkScore();
     907              : 
     908              :     std::vector<Fraction> splitGapToMeasureBoundaries(ChordRest*, Fraction);
     909              : 
     910              :     void doSelect(EngravingItem* e, SelectType type, staff_idx_t staffIdx);
     911              :     void selectSingle(EngravingItem* e, staff_idx_t staffIdx);
     912              :     void selectAdd(EngravingItem* e);
     913              :     void selectRange(EngravingItem* e, staff_idx_t staffIdx);
     914              : 
     915              :     bool trySelectSimilarInRange(EngravingItem* e);
     916              :     bool tryExtendSingleSelectionToRange(EngravingItem* e, staff_idx_t staffIdx);
     917              :     bool tryExtendRangeSelectionToElem(EngravingItem* e);
     918              : 
     919              :     void rebuildTimeSigMap(Measure* m);
     920              : 
     921              :     void doUndoRemoveStaleTieJumpPoints(Tie* tie, bool undo = true);
     922              :     void doUndoResetPartialSlur(Slur* slur, bool undo);
     923              : 
     924              :     void deleteOrShortenOutSpannersFromRange(const Fraction& t1, const Fraction& t2, track_idx_t trackStart, track_idx_t trackEnd,
     925              :                                              const SelectionFilter& filter);
     926              :     void deleteSlursFromRange(const Fraction& t1, const Fraction& t2, track_idx_t trackStart, track_idx_t trackEnd,
     927              :                               const SelectionFilter& filter);
     928              :     void deleteAnnotationsFromRange(Segment* segStart, Segment* segEnd, track_idx_t trackStart, track_idx_t trackEnd,
     929              :                                     const SelectionFilter& filter);
     930              : 
     931              :     void deleteRangeAtTrack(std::vector<ChordRest*>& crsToSelect, const track_idx_t track, Segment* startSeg, const Fraction& endTick,
     932              :                             Tuplet* currentTuplet, const SelectionFilter& filter, bool selectionContainsMultiNoteChords);
     933              : 
     934              :     muse::ID newStaffId() const;
     935              :     muse::ID newPartId() const;
     936              : 
     937              :     void assignIdIfNeed(Staff& staff) const;
     938              :     void assignIdIfNeed(Part& part) const;
     939              : 
     940              :     void updateStavesNumberForSystems();
     941              : 
     942              :     FBox* findFretBox() const;
     943              : 
     944              :     MasterScore* m_masterScore = nullptr;
     945              :     std::list<MuseScoreView*> m_viewer;
     946              :     Excerpt* m_excerpt = nullptr;
     947              : 
     948              :     String m_mscoreVersion;
     949              :     int m_mscoreRevision = 0;
     950              : 
     951              :     std::shared_ptr<IEngravingFont> m_engravingFont = nullptr;
     952              : 
     953              :     int m_pageNumberOffset = 0;          // Offset for page numbers.
     954              : 
     955              :     UpdateState m_updateState;
     956              : 
     957              :     MeasureBaseList m_measures;            // here are the notes
     958              :     std::vector<Part*> m_parts;
     959              :     std::vector<Staff*> m_staves;
     960              :     std::vector<Staff*> m_systemObjectStaves;
     961              :     RangeLocks m_systemLocks;
     962              : 
     963              :     RangeLocks m_pageLocks;
     964              : 
     965              :     SpannerMap m_spanner;
     966              :     std::set<Spanner*> m_unmanagedSpanner;
     967              : 
     968              :     std::vector<std::vector<BracketItem*> > m_brackets;
     969              : 
     970              :     //
     971              :     // objects generated by layout:
     972              :     //
     973              :     std::vector<Page*> m_pages;            // pages are build from systems
     974              :     std::vector<System*> m_systems;        // measures are accumulated to systems
     975              : 
     976              :     std::map<size_t, std::array<SystemDivider*, 2> > m_systemDividers; // list of system dividers (left and right) indexed by system
     977              : 
     978              :     InputState m_is;
     979              :     MStyle m_style;
     980              :     ChordList m_chordList;
     981              : 
     982              :     bool m_showInvisible = true;
     983              :     bool m_showUnprintable = true;
     984              :     bool m_showFrames = true;
     985              :     bool m_showPageborders = false;
     986              :     bool m_showSoundFlags = true;
     987              :     bool m_markIrregularMeasures = true;
     988              :     bool m_showInstrumentNames = true;
     989              :     bool m_printing = false;                // True if we are drawing to a printer
     990              :     bool m_savedCapture = false;            // True if we saved an image capture
     991              :     bool m_corrupted = false;
     992              :     bool m_needUpdateTicksAndTimeSigMap = false;
     993              : 
     994              :     ShowAnchors m_showAnchors;
     995              : 
     996              :     ScoreOrder m_scoreOrder;                 // used for score ordering
     997              :     int m_mscVersion = Constants::MSC_VERSION;     // version of current loading *.msc file
     998              : 
     999              :     bool m_isOpen = false;
    1000              : 
    1001              :     std::map<String, String> m_metaTags;
    1002              : 
    1003              :     Selection m_selection;
    1004              :     SelectionFilter m_selectionFilter;
    1005              : 
    1006              :     RootItem* m_rootItem = nullptr;
    1007              :     DummyParent* m_dummy = nullptr;
    1008              :     LayoutOptions m_layoutOptions;
    1009              : 
    1010              :     muse::async::Channel<EngravingItem*> m_elementDestroyed;
    1011              : 
    1012              :     ShadowNote* m_shadowNote = nullptr;
    1013              : 
    1014              :     muse::async::Channel<LoopBoundaryType, unsigned> m_loopBoundaryTickChanged;
    1015              : 
    1016              :     muse::async::Channel<float> m_layoutProgressChannel;
    1017              : 
    1018              :     PaddingTables m_paddingTables;
    1019              :     double m_minimumPaddingUnit = 0.0;
    1020              : };
    1021              : 
    1022           14 : static inline Score* toScore(EngravingObject* e)
    1023              : {
    1024           14 :     assert(!e || e->isScore());
    1025           14 :     return static_cast<Score*>(e);
    1026              : }
    1027              : 
    1028            0 : static inline const Score* toScore(const EngravingObject* e)
    1029              : {
    1030            0 :     assert(!e || e->isScore());
    1031            0 :     return static_cast<const Score*>(e);
    1032              : }
    1033              : 
    1034              : //---------------------------------------------------------
    1035              : //   ScoreLoad
    1036              : //---------------------------------------------------------
    1037              : 
    1038              : class ScoreLoad
    1039              : {
    1040              :     static int m_loading;
    1041              : 
    1042              : public:
    1043         3189 :     ScoreLoad() { ++m_loading; }
    1044         3189 :     ~ScoreLoad() { --m_loading; }
    1045        17169 :     static bool loading() { return m_loading > 0; }
    1046              : };
    1047              : 
    1048              : DECLARE_OPERATORS_FOR_FLAGS(LayoutFlags)
    1049              : } // namespace mu::engraving
        

Generated by: LCOV version 2.0-1