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 2765 : 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 410 : 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 6040 : 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 735711 : 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 73 : 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 3733 : Excerpt* excerpt() { return m_excerpt; }
329 218 : 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 :
343 : bool appendMeasuresFromScore(Score* score, const Fraction& startTick, const Fraction& endTick);
344 : bool appendScore(Score*, bool addPageBreak = false, bool addSectionBreak = true);
345 :
346 30017560 : const std::vector<Staff*>& staves() const { return m_staves; }
347 3936540 : size_t nstaves() const { return m_staves.size(); }
348 : size_t visibleStavesCount() const;
349 : bool allStavesInvisible() const;
350 5174067 : size_t ntracks() const { return m_staves.size() * VOICES; }
351 :
352 : staff_idx_t staffIdx(const Staff*) const;
353 : staff_idx_t staffIdx(const Part*) const;
354 38081124 : Staff* staff(size_t n) const { return (n < m_staves.size()) ? m_staves.at(n) : nullptr; }
355 : Staff* staffById(const muse::ID& staffId) const;
356 : Part* partById(const muse::ID& partId) const;
357 :
358 : void clearSystemObjectStaves();
359 : void addSystemObjectStaff(Staff* staff);
360 : void removeSystemObjectStaff(Staff* staff);
361 77111 : const std::vector<Staff*>& systemObjectStaves() const { return m_systemObjectStaves; }
362 : const std::vector<Staff*> systemObjectStavesWithTopStaff() const;
363 :
364 : MeasureBase* pos2measureBase(const PointF&, bool scanMeasuresOnly, staff_idx_t* staffIdx, int* pitch, Segment**, PointF* offset) const;
365 : Measure* pos2measure(const PointF& p, staff_idx_t* staffIdx, int* pitch, Segment** seg, PointF* offset) const;
366 : void dragPosition(const PointF&, staff_idx_t* staffIdx, Segment**, double spacingFactor = 0.5, bool allowTimeAnchor = false) const;
367 :
368 : void undoAddElement(EngravingItem* element, bool addToLinkedStaves = true, bool ctrlModifier = false,
369 : EngravingItem* elementToRelink = nullptr);
370 : void undoAddCR(ChordRest* element, Measure*, const Fraction& tick);
371 : void undoRemoveElement(EngravingItem* element, bool removeLinked = true);
372 : void undoRemoveHopoText(HammerOnPullOffText* hopoText);
373 : void undoChangeSpannerElements(Spanner* spanner, EngravingItem* startElement, EngravingItem* endElement);
374 : void undoChangeElement(EngravingItem* oldElement, EngravingItem* newElement);
375 : void undoChangeChordRestLen(ChordRest* cr, const TDuration&);
376 : void undoRemovePart(Part* part, size_t partIdx = muse::nidx);
377 : void undoInsertPart(Part* part, size_t targetPartIndex);
378 : void undoRemoveStaff(Staff* staff);
379 : void undoInsertStaff(Staff* staff, staff_idx_t idx, bool createRests=true);
380 : bool undoPropertyChanged(EngravingItem* item, Pid propId, const PropertyValue& propValue,
381 : PropertyFlags propFlags = PropertyFlags::NOSTYLE);
382 : void undoPropertyChanged(EngravingObject*, Pid, const PropertyValue& v, PropertyFlags ps = PropertyFlags::NOSTYLE);
383 : UndoStack* undoStack() const;
384 : TransactionManager* transactionManager() const;
385 : void undo(UndoableCommand*) const;
386 : void undoRemoveMeasures(Measure*, Measure*, bool preserveTies = false, bool moveStaffTypeChanges = true);
387 : void undoChangeMeasureRepeatCount(Measure* m, int count, staff_idx_t staffIdx);
388 : void undoInsertTime(const Fraction& tick, const Fraction& len);
389 : void undoChangeStyleVal(Sid idx, const PropertyValue& v);
390 : void undoChangeStyleValues(std::unordered_map<Sid, PropertyValue> values);
391 : void undoChangePageNumberOffset(int po);
392 : void undoChangeParent(EngravingItem* element, EngravingItem* parent, staff_idx_t _staff, bool changeLinksParents = true);
393 : void undoResetPlayCountTextSettings(BarLine* bl);
394 : void undoUpdatePlayCountText(Measure* m);
395 : void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStaves, bool replace = false);
396 :
397 : void updateInstrumentChangeTranspositions(KeySigEvent& key, Staff* staff, const Fraction& tick);
398 :
399 : Measure* undoGetMeasure(const Fraction& tick);
400 :
401 : Note* setGraceNote(Chord*, int pitch, NoteType type, int len);
402 :
403 : GuitarBend* addGuitarBend(GuitarBendType type, Note* note, Note* endNote = nullptr);
404 :
405 : Segment* setNoteRest(Segment*, track_idx_t track, NoteVal nval, Fraction, DirectionV stemDirection = DirectionV::AUTO,
406 : bool forceAccidental = false, const std::set<SymId>& articulationIds = {}, bool rhythmic = false,
407 : InputState* externalInputState = nullptr);
408 : void changeCRlen(ChordRest* cr, const TDuration&);
409 : void changeCRlen(ChordRest* cr, const Fraction&, bool fillWithRest=true);
410 : void createCRSequence(const Fraction& f, ChordRest* cr, const Fraction& tick);
411 :
412 : Fraction makeGap(Segment*, track_idx_t track, const Fraction&, Tuplet*, bool keepChord = false, bool deleteAnnotations = true);
413 : bool makeGapVoice(Segment* seg, track_idx_t track, Fraction len, const Fraction& tick, bool deleteAnnotations = true);
414 :
415 : Rest* addRest(const Fraction& tick, track_idx_t track, TDuration, Tuplet*);
416 : Rest* addRest(Segment* seg, track_idx_t track, TDuration d, Tuplet*);
417 : Chord* addChord(const Fraction& tick, TDuration d, Chord* oc, bool genTie, Tuplet* tuplet);
418 :
419 : Tuplet* addTuplet(ChordRest* destinationChordRest, Fraction ratio, TupletNumberType numberType, TupletBracketType bracketType);
420 : Tuplet* addTuplet(ChordRest* destinationChordRest, const Fraction& ratio, const TDuration& baseLen, TupletNumberType numberType,
421 : TupletBracketType bracketType);
422 : bool canAddTuplet(const ChordRest* chordRest, const Fraction& ratio, const TDuration& baseLen) const;
423 : bool canAddTuplet(const Segment* segment, track_idx_t track, const Fraction& ratio, const TDuration& baseLen) const;
424 : Fraction tupletEndTick(const ChordRest* chordRest, const Fraction& ratio, const TDuration& baseLen) const;
425 : void selectNewTuplet(Tuplet* tuplet);
426 :
427 : ChordRest* addClone(ChordRest* cr, const Fraction& tick, const TDuration& d);
428 : Rest* setRest(const Fraction& tick, track_idx_t track, const Fraction&, bool useDots, Tuplet* tuplet, bool useFullMeasureRest = true);
429 : std::vector<Rest*> setRests(const Fraction& tick, track_idx_t track, const Fraction& l, bool useDots, Tuplet* tuplet,
430 : bool useFullMeasureRest = true);
431 :
432 : ChordRest* searchNote(const Fraction& tick, track_idx_t track) const;
433 :
434 : // undo/redo ops
435 : void addElement(EngravingItem*);
436 : void doUndoAddElement(EngravingItem*);
437 : void removeElement(EngravingItem*);
438 : void doUndoRemoveElement(EngravingItem*);
439 :
440 : Slur* addSlur(ChordRest* firstChordRest, ChordRest* secondChordRest, const Slur* slurTemplate);
441 : TextBase* addText(TextStyleType type, EngravingItem* destinationElement = nullptr);
442 :
443 : void deleteItem(EngravingItem*);
444 : void deleteMeasures(MeasureBase* firstMeasure, MeasureBase* lastMeasure, bool preserveTies = false);
445 : void restoreInitialKeySigAndTimeSig();
446 : void reconnectSlurs(MeasureBase* mbStart, MeasureBase* mbLast);
447 : void cmdDeleteSelection();
448 : std::vector<ChordRest*> deleteRange(Segment* segStart, Segment* segEnd, track_idx_t trackStart, track_idx_t trackEnd,
449 : const SelectionFilter& filter, bool selectionContainsMultiNoteChords);
450 : void cmdFullMeasureRest();
451 :
452 : void startCmd(const TranslatableString& actionName); // start undoable command
453 : void endCmd(bool rollback = false, bool layoutAllParts = false, bool keepRolledBackElements = false); // end undoable command
454 : void update();
455 : void undoRedo(bool undo, EditData*);
456 :
457 : virtual muse::async::Channel<ScoreChanges> changesChannel() const;
458 :
459 : virtual void setUpdateAll();
460 : void setLayoutAll(staff_idx_t staff = muse::nidx, const EngravingItem* e = nullptr);
461 : void setLayout(const Fraction& tick, staff_idx_t staff, const EngravingItem* e = nullptr);
462 : void setLayout(const Fraction& tick1, const Fraction& tick2, staff_idx_t staff1, staff_idx_t staff2, const EngravingItem* e = nullptr);
463 : virtual CmdState& cmdState();
464 : virtual const CmdState& cmdState() const;
465 : virtual void addLayoutFlags(LayoutFlags);
466 : virtual void setInstrumentsChanged(bool);
467 :
468 : void cmdToggleAutoplace(bool all);
469 :
470 : bool playNote() const { return m_updateState.playNote; }
471 1160 : void setPlayNote(bool v) { m_updateState.playNote = v; }
472 0 : bool playChord() const { return m_updateState.playChord; }
473 552 : void setPlayChord(bool v) { m_updateState.playChord = v; }
474 0 : bool selectionEmpty() const { return m_selection.staffStart() == m_selection.staffEnd(); }
475 0 : bool selectionChanged() const { return m_updateState.selectionChanged; }
476 8049 : void setSelectionChanged(bool val) { m_updateState.selectionChanged = val; }
477 30 : const RectF& refreshRect() const { return m_updateState.refresh; }
478 : void addRefresh(const RectF&);
479 30 : void clearRefreshRect() { m_updateState.refresh = RectF(); }
480 :
481 : const std::vector<Part*>& parts() const;
482 : size_t visiblePartCount() const;
483 : std::vector<Part*> visibleParts() const;
484 : std::vector<SharedPart*> sharedParts() const;
485 : bool hasSharedParts() const;
486 :
487 : using StaffAccepted = std::function<bool (const Staff&)>;
488 : std::set<staff_idx_t> staffIdxSetFromRange(const track_idx_t trackFrom, const track_idx_t trackTo,
489 : StaffAccepted staffAccepted = StaffAccepted()) const;
490 :
491 : void appendPart(const InstrumentTemplate*);
492 : void sortSystemObjects(std::vector<staff_idx_t>& dst);
493 : void sortStaves(std::vector<staff_idx_t>& dst);
494 :
495 0 : bool isShowInvisible() const { return m_showInvisible; }
496 0 : bool showUnprintable() const { return m_showUnprintable; }
497 0 : bool showFrames() const { return m_showFrames; }
498 0 : bool showPageborders() const { return m_showPageborders; }
499 9 : bool showSoundFlags() const { return m_showSoundFlags; }
500 0 : bool markIrregularMeasures() const { return m_markIrregularMeasures; }
501 15965 : bool showInstrumentNames() const { return m_showInstrumentNames; }
502 : void setShowInvisible(bool v);
503 : void setShowUnprintable(bool v);
504 : void setShowFrames(bool v);
505 : void setShowPageborders(bool v);
506 : void setShowSoundFlags(bool v);
507 : void setMarkIrregularMeasures(bool v);
508 0 : void setShowInstrumentNames(bool v) { m_showInstrumentNames = v; }
509 :
510 0 : void hideAnchors() { m_showAnchors.reset(); }
511 : void setShowAnchors(const ShowAnchors& showAnchors);
512 0 : const ShowAnchors& showAnchors() const { return m_showAnchors; }
513 :
514 : ChordRest* getSelectedChordRest() const;
515 : std::set<ChordRest*> getSelectedChordRests() const;
516 : void getSelectedStartEndChordRests(ChordRest*& cr1, ChordRest*& cr2) const;
517 :
518 : void select(EngravingItem* item, SelectType = SelectType::SINGLE, staff_idx_t staff = 0);
519 : void select(const std::vector<EngravingItem*>& items, SelectType = SelectType::SINGLE, staff_idx_t staff = 0);
520 : void selectSimilar(EngravingItem* e, bool sameStaff);
521 : void selectSimilarInRange(EngravingItem* e);
522 : static void collectMatch(ElementPattern* p, EngravingItem* e);
523 : static void collectNoteMatch(NotePattern* p, EngravingItem* e);
524 : void deselect(EngravingItem* obj);
525 3288 : void deselectAll() { m_selection.deselectAll(); }
526 247 : void updateSelection() { m_selection.update(); }
527 42 : EngravingItem* getSelectedElement() const { return m_selection.element(); }
528 1542 : const Selection& selection() const { return m_selection; }
529 241558 : Selection& selection() { return m_selection; }
530 0 : const SelectionFilter& selectionFilter() const { return m_selectionFilter; }
531 37841 : SelectionFilter& selectionFilter() { return m_selectionFilter; }
532 : void setSelection(const Selection& s);
533 :
534 : bool canReselectItem(const EngravingItem* item) const;
535 :
536 : Fraction pos();
537 : Measure* tick2measure(const Fraction& tick) const;
538 : Measure* tick2measureMM(const Fraction& tick) const;
539 : MeasureBase* tick2measureBase(const Fraction& tick) const;
540 : Segment* tick2segment(const Fraction& tick, bool first, SegmentType st, bool useMMrest = false) const;
541 : Segment* tick2segment(const Fraction& tick) const;
542 : Segment* tick2segment(const Fraction& tick, bool first) const;
543 : Segment* tick2segmentMM(const Fraction& tick, bool first, SegmentType st) const;
544 : Segment* tick2segmentMM(const Fraction& tick) const;
545 : Segment* tick2segmentMM(const Fraction& tick, bool first) const;
546 : Segment* tick2leftSegment(const Fraction& tick, bool useMMrest = false, SegmentType segType = SegmentType::ChordRest) const;
547 : Segment* tick2rightSegment(const Fraction& tick, bool useMMrest = false, SegmentType segType = SegmentType::ChordRest) const;
548 0 : Segment* tick2leftSegmentMM(const Fraction& tick) { return tick2leftSegment(tick, /* useMMRest */ true); }
549 :
550 : void updateTicksAndTimeSigMap();
551 4615 : void updateTicksAndTimeSigMapLater() { m_needUpdateTicksAndTimeSigMap = true; }
552 1878 : bool needUpdateTicksAndTimeSigMap() const { return m_needUpdateTicksAndTimeSigMap; }
553 :
554 : EngravingItem* nextElement();
555 : EngravingItem* prevElement();
556 : ChordRest* nextTrack(ChordRest* cr, bool skipMeasureRepeatRests = true);
557 : ChordRest* prevTrack(ChordRest* cr, bool skipMeasureRepeatRests = true);
558 : ChordRest* cmdNextPrevSystem(ChordRest*, bool);
559 : Box* cmdNextPrevFrame(MeasureBase*, bool) const;
560 : EngravingItem* cmdNextPrevSection(EngravingItem*, bool) const;
561 : MeasureBase* getNextPrevSectionBreak(MeasureBase*, bool) const;
562 : EngravingItem* getScoreElementOfMeasureBase(MeasureBase*) const;
563 :
564 131 : int fileDivision(int t) const { return static_cast<int>(((int64_t)t * Constants::DIVISION + m_fileDivision / 2) / m_fileDivision); }
565 78 : void setFileDivision(int t) { m_fileDivision = t; }
566 :
567 : bool dirty() const;
568 : bool savedCapture() const { return m_savedCapture; }
569 : void setSavedCapture(bool v) { m_savedCapture = v; }
570 48 : bool printing() const { return m_printing; }
571 10 : void setPrinting(bool val) { m_printing = val; }
572 0 : bool hasCorruptedMeasures() const { return m_corrupted; }
573 93 : void setHasCorruptedMeasures(bool val) { m_corrupted = val; }
574 :
575 : bool isOpen() const;
576 : void setIsOpen(bool open);
577 :
578 36735 : ChordList* chordList() { return &m_chordList; }
579 : const ChordList* chordList() const { return &m_chordList; }
580 : void checkChordList();
581 :
582 19634664 : MStyle& style() { return m_style; }
583 4187807 : const MStyle& style() const { return m_style; }
584 :
585 : PageSizeGetAccessor pageSize() const { return PageSizeGetAccessor(m_style); }
586 0 : PageSizeSetAccessor pageSize() { return PageSizeSetAccessor(m_style); }
587 :
588 : void resetStyleValue(Sid styleToReset);
589 : void resetStyleValues(const StyleIdSet& styleIdSet);
590 :
591 : void setStyle(const MStyle& s, const bool overlap = false);
592 :
593 : TranslatableString getTextStyleUserName(TextStyleType tid) const;
594 :
595 : // These position are in ticks and not uticks
596 0 : Fraction loopInTick() const { return loopBoundaryTick(LoopBoundaryType::LoopIn); }
597 0 : Fraction loopOutTick() const { return loopBoundaryTick(LoopBoundaryType::LoopOut); }
598 0 : void setLoopInTick(const Fraction& tick) { setLoopBoundaryTick(LoopBoundaryType::LoopIn, tick); }
599 0 : void setLoopOutTick(const Fraction& tick) { setLoopBoundaryTick(LoopBoundaryType::LoopOut, tick); }
600 :
601 : Fraction loopBoundaryTick(LoopBoundaryType type) const;
602 : void setLoopBoundaryTick(LoopBoundaryType type, Fraction tick);
603 :
604 157 : bool noteEntryMode() const { return inputState().noteEntryMode(); }
605 0 : bool usingNoteEntryMethod(NoteEntryMethod m) { return inputState().usingNoteEntryMethod(m); }
606 229 : const InputState& inputState() const { return m_is; }
607 2305 : InputState& inputState() { return m_is; }
608 275 : void setInputState(const InputState& st) { m_is = st; }
609 :
610 : void spatiumChanged(double oldValue, double newValue);
611 : void styleChanged() override;
612 :
613 : BeatType tick2beatType(const Fraction& tick) const;
614 :
615 44927 : int mscVersion() const { return m_mscVersion; }
616 1103 : void setMscVersion(int v) { m_mscVersion = v; }
617 :
618 : void updateSwing();
619 :
620 : void updateCapo(bool ignoreNotationUpdate = false);
621 : void updateChannel();
622 :
623 : void cmdConcertPitchChanged(bool);
624 :
625 : virtual TimeSigMap* sigmap() const;
626 :
627 : BeatsPerSecond tempo(const Fraction& tick) const;
628 : BeatsPerSecond multipliedTempo(const Fraction& tick) const;
629 : BeatsPerSecond multipliedTempoAtUtick(int utick) const;
630 :
631 : Text* getText(TextStyleType subtype) const;
632 :
633 : ScoreOrder scoreOrder() const;
634 : void setScoreOrder(ScoreOrder order);
635 : void updateBracesAndBarlines(Part* part, size_t index);
636 : void setBracketsAndBarlines();
637 : void remapBracketsAndBarlines();
638 :
639 : void lassoSelect(const RectF&);
640 : void lassoSelectEnd();
641 :
642 : Page* searchPage(const PointF&) const;
643 : std::vector<System*> searchSystem(const PointF& p, bool includeMeasurelessSystems = true, const System* preferredSystem = nullptr,
644 : double spacingFactor = 0.5, double preferredSpacingFactor = 1.0) const;
645 : MeasureBase* searchMeasureBase(const PointF& p, bool scanMeasuresOnly = false, const System* preferredSystem = nullptr,
646 : double spacingFactor = 0.5, double preferredSpacingFactor = 1.0) const;
647 :
648 : bool getPosition(Position* pos, const PointF&, voice_idx_t voice) const;
649 :
650 : void cmdDeleteTuplet(Tuplet*, bool replaceWithRest);
651 :
652 : void adjustKeySigs(track_idx_t sidx, track_idx_t eidx, KeyList km);
653 : KeyList keyList() const;
654 :
655 : /// To be used together with setExpandRepeats.
656 : /// For bigger operations, where suboperations might also use it,
657 : /// where those need to have the same value for expandRepeats.
658 : const RepeatList& repeatList() const;
659 : /// For small, one-step operations, where you need to get the relevant repeatList just once
660 : const RepeatList& repeatList(bool expandRepeats, bool updateTies = true) const;
661 : /// Read-only snapshot, safe to call mid-edit (e.g. before a structural change invalidates the current repeatList)
662 : std::vector<RepeatSegmentInfo> repeatSegmentInfoList(bool expandRepeats) const;
663 : /// Always the repeat-expanded list, regardless of the current playback setting
664 : const RepeatList& expandedRepeatList() const;
665 :
666 : void invalidateRepeatList();
667 :
668 : double utick2utime(int tick) const;
669 : int utime2utick(double utime) const;
670 :
671 : const TempoTimeline& tempoTimeline() const;
672 : const TempoTimeline& tempoTimeline(bool expandRepeats) const;
673 : void setTempoTimelineOverride(std::optional<TempoTimeline> timeline);
674 :
675 5564 : virtual size_t npages() const { return m_pages.size(); }
676 804 : virtual page_idx_t pageIdx(const Page* page) const { return muse::indexOf(m_pages, page); }
677 20 : virtual const std::vector<Page*>& pages() const { return m_pages; }
678 13286 : virtual std::vector<Page*>& pages() { return m_pages; }
679 :
680 20173 : const std::vector<System*>& systems() const { return m_systems; }
681 34745 : std::vector<System*>& systems() { return m_systems; }
682 :
683 22688 : MeasureBaseList* measures() { return &m_measures; }
684 : bool checkHasMeasures() const;
685 : MeasureBase* first() const;
686 : MeasureBase* firstMM() const;
687 : MeasureBase* last() const;
688 : Measure* firstMeasure() const;
689 : Measure* firstMeasureMM() const;
690 : Measure* lastMeasure() const;
691 : Measure* lastMeasureMM() const;
692 : MeasureBase* measure(int idx) const;
693 : Measure* crMeasure(int idx) const;
694 :
695 : Fraction endTick() const;
696 :
697 : Segment* firstSegment(SegmentType s) const;
698 : Segment* firstSegmentMM(SegmentType s) const;
699 : Segment* lastSegment() const;
700 : Segment* lastSegmentMM() const;
701 :
702 : void connectTies(bool silent = false);
703 : void undoRemoveStaleTieJumpPoints(bool undo = true);
704 :
705 : void scanElementsInRange(std::function<void(EngravingItem*)> func);
706 26 : int fileDivision() const { return m_fileDivision; } ///< division of current loading *.msc file
707 : void splitStaff(staff_idx_t staffIdx, int splitPoint);
708 : FiguredBass* addFiguredBass();
709 : void expandVoice(Segment* s, track_idx_t track);
710 : void expandVoice();
711 :
712 : void cmdEnterRest(const TDuration& d);
713 : void enterRest(const TDuration& d, InputState* externalInputState = nullptr);
714 : void addInterval(int, const std::vector<Note*>&);
715 : void cmdCreateTuplet(ChordRest*, Tuplet*);
716 :
717 : bool autoLayoutEnabled() const;
718 :
719 : void doLayout();
720 : void doLayoutRange(const Fraction& st, const Fraction& et);
721 :
722 37 : SynthesizerState& synthesizerState() { return m_synthesizerState; }
723 : void setSynthesizerState(const SynthesizerState& s);
724 :
725 1052930 : MasterScore* masterScore() const { return m_masterScore; }
726 2553 : void setMasterScore(MasterScore* s) { m_masterScore = s; }
727 :
728 0 : const std::map<String, String>& metaTags() const { return m_metaTags; }
729 30636 : std::map<String, String>& metaTags() { return m_metaTags; }
730 0 : void setMetaTags(const std::map<String, String>& t) { m_metaTags = t; }
731 :
732 : String metaTag(const String& tag) const;
733 : void setMetaTag(const String& tag, const String& val);
734 :
735 40129 : int pageNumberOffset() const { return m_pageNumberOffset; }
736 99 : void setPageNumberOffset(int v) { m_pageNumberOffset = v; }
737 :
738 1178 : String mscoreVersion() const { return m_mscoreVersion; }
739 0 : int mscoreRevision() const { return m_mscoreRevision; }
740 504 : void setMscoreVersion(const String& val) { m_mscoreVersion = val; }
741 488 : void setMscoreRevision(int val) { m_mscoreRevision = val; }
742 :
743 0 : void addViewer(MuseScoreView* v) { m_viewer.push_back(v); }
744 : void removeViewer(MuseScoreView* v) { m_viewer.remove(v); }
745 604701 : const std::list<MuseScoreView*>& getViewer() const { return m_viewer; }
746 :
747 : //! NOTE Layout
748 608015 : const LayoutOptions& layoutOptions() const { return m_layoutOptions; }
749 3 : void setLayoutMode(LayoutMode lm) { m_layoutOptions.mode = lm; }
750 0 : void setShowVBox(bool v) { m_layoutOptions.isShowVBox = v; }
751 310955 : double noteHeadWidth() const { return m_layoutOptions.noteHeadWidth; }
752 0 : void setNoteHeadWidth(double n) { m_layoutOptions.noteHeadWidth = n; }
753 :
754 : // temporary methods
755 2790 : bool isLayoutMode(LayoutMode lm) const { return m_layoutOptions.isMode(lm); }
756 3 : LayoutMode layoutMode() const { return m_layoutOptions.mode; }
757 0 : bool lineMode() const { return m_layoutOptions.isMode(LayoutMode::LINE); }
758 5 : bool linearMode() const { return m_layoutOptions.isLinearMode(); }
759 : // ----
760 :
761 : void cmdSelectAll();
762 : void cmdSelectSection();
763 :
764 : struct InsertMeasureOptions {
765 360 : InsertMeasureOptions() {}
766 :
767 : bool createMeasureRests = false;
768 : bool moveSignaturesClef = true;
769 : bool needDeselectAll = true;
770 : bool cloneBoxToAllParts = true;
771 : bool moveStaffTypeChanges = true;
772 : bool ignoreBarLines = false;
773 : };
774 :
775 : MeasureBase* insertMeasure(ElementType type, MeasureBase* beforeMeasure = nullptr,
776 : const InsertMeasureOptions& options = InsertMeasureOptions());
777 : MeasureBase* insertBox(ElementType type, MeasureBase* beforeMeasure = nullptr,
778 : const InsertMeasureOptions& options = InsertMeasureOptions());
779 : MeasureBase* insertBox(MeasureBase* box, MeasureBase* beforeMeasure = nullptr,
780 : const InsertMeasureOptions& options = InsertMeasureOptions());
781 :
782 : std::list<Score*> scoreList();
783 :
784 : void appendMeasures(int numMeasures);
785 :
786 50844 : const std::multimap<int, Spanner*>& spanner() const { return m_spanner.map(); }
787 78532 : SpannerMap& spannerMap() { return m_spanner; }
788 73516 : const SpannerMap& spannerMap() const { return m_spanner; }
789 : std::vector<Spanner*> spannerList() const; // Return all spanners as a vector for Plugin API
790 : bool isSpannerStartEnd(const Fraction& tick, track_idx_t track) const;
791 : void removeSpanner(Spanner*);
792 : void addSpanner(Spanner*, bool computeStartEnd = true);
793 : void checkSpanner(const Fraction& startTick, const Fraction& lastTick, bool removeOrphans = true);
794 9492 : const std::set<Spanner*>& unmanagedSpanners() const { return m_unmanagedSpanner; }
795 : void addUnmanagedSpanner(Spanner*);
796 : void removeUnmanagedSpanner(Spanner*);
797 :
798 : ChordRest* findCR(Fraction tick, track_idx_t track) const;
799 : ChordRest* findChordRestEndingBeforeTickInStaff(const Fraction& tick, staff_idx_t staffIdx) const;
800 : ChordRest* findChordRestEndingBeforeTickInStaffAndVoice(const Fraction& tick, staff_idx_t staffIdx, voice_idx_t voice) const;
801 : ChordRest* findChordRestEndingBeforeTickInTrack(const Fraction& tick, track_idx_t trackIdx) const;
802 : void insertTime(const Fraction& tickPos, const Fraction& tickLen, const std::vector<RepeatSegmentInfo>& oldSegments);
803 :
804 2333992 : std::shared_ptr<IEngravingFont> engravingFont() const { return m_engravingFont; }
805 39 : void setEngravingFont(std::shared_ptr<IEngravingFont> f) { m_engravingFont = f; }
806 :
807 : std::vector<staff_idx_t> uniqueStaves() const;
808 :
809 : size_t nmeasures() const;
810 :
811 : bool hasHarmonies() const;
812 : int harmonyCount() const;
813 :
814 : bool hasLyrics() const;
815 : int lyricCount() const;
816 : std::vector<Lyrics*> lyrics() const;
817 : String extractLyrics() const;
818 :
819 : int keysig() const;
820 : int duration() const;
821 : int durationWithoutRepeats() const;
822 :
823 : void cmdRemoveEmptyTrailingMeasures();
824 :
825 : Measure* firstTrailingMeasure(ChordRest** cr = nullptr);
826 :
827 : muse::Ret sanityCheckLocal();
828 :
829 : bool checkKeys();
830 :
831 : void switchToPageMode();
832 :
833 : PropertyValue getProperty(Pid) const override;
834 : bool setProperty(Pid, const PropertyValue&) override;
835 : PropertyValue propertyDefault(Pid) const override;
836 :
837 : /// For MasterScores: returns the filename without extension
838 : /// For Scores: returns the excerpt name
839 : virtual String name() const;
840 :
841 : void cmdTimeDelete();
842 : bool checkTimeDelete(Segment* startSegment, Segment* endSegment);
843 : void doTimeDelete(Segment* startSegment, Segment* endSegment);
844 : void doTimeDeleteForMeasure(Measure*, Segment*, const Fraction&);
845 :
846 : void forAllLyrics(std::function<void(Lyrics*)> f);
847 :
848 : void updatePaddingTables();
849 4731040 : const PaddingTables& paddingTables() const { return m_paddingTables; }
850 :
851 83950 : const RangeLocks* systemLocks() const { return &m_systemLocks; }
852 : void addSystemLock(const RangeLock* lock);
853 : void removeSystemLock(const RangeLock* lock);
854 0 : void clearSystemLocks() { m_systemLocks.clear(); }
855 :
856 96533 : const RangeLocks* pageLocks() const { return &m_pageLocks; }
857 : void addPageLock(const RangeLock* lock);
858 : void removePageLock(const RangeLock* lock);
859 :
860 : void rebuildFretBox();
861 :
862 1 : const std::map<size_t, std::array<SystemDivider*, 2> > systemDividers() const { return m_systemDividers; }
863 : SystemDivider* systemDivider(size_t systemIdx, SystemDividerType type) const;
864 : void addSystemDivider(size_t systemIdx, SystemDivider* divider);
865 :
866 : virtual AutomationDataConstPtr automationData() const;
867 : virtual void editAutomationPoints(const AutomationCurveKey& key, AutomationPointEdits& edits, bool undoable = true);
868 :
869 : friend class Chord;
870 :
871 : BracketType bracketType(staff_idx_t staffIdx, size_t idx) const;
872 : size_t bracketSpan(staff_idx_t staffIdx, size_t idx) const;
873 : const std::vector<BracketItem*>& brackets(staff_idx_t staffIdx) const;
874 : std::vector<BracketItem*>& brackets(staff_idx_t staffIdx);
875 : size_t bracketLevels(staff_idx_t staffIdx) const;
876 :
877 : protected:
878 : virtual void onTimeInserted(const Fraction& tick, const Fraction& len, const std::vector<RepeatSegmentInfo>& oldSegments);
879 :
880 : friend class MasterScore;
881 : Score(const muse::modularity::ContextPtr& iocCtx);
882 : Score(MasterScore*, bool forcePartStyle = true);
883 : Score(MasterScore*, const MStyle&);
884 :
885 : int m_fileDivision = 0; // division of current loading *.msc file
886 : SynthesizerState m_synthesizerState;
887 :
888 : private:
889 :
890 : friend class read302::Read302;
891 : friend class read400::Read400;
892 : friend class read410::Read410;
893 : friend class read460::Read460;
894 : friend class read500::Read500;
895 : friend class write::Writer;
896 :
897 : static std::set<Score*> validScores;
898 :
899 : Note* getSelectedNote();
900 : ChordRest* findChordRestEndingBeforeTickInStaffAndVoice(const Fraction& tick, staff_idx_t staffIdx, bool forceVoice,
901 : voice_idx_t voice) const;
902 :
903 : void checkScore();
904 :
905 : std::vector<Fraction> splitGapToMeasureBoundaries(ChordRest*, Fraction);
906 :
907 : void doSelect(EngravingItem* e, SelectType type, staff_idx_t staffIdx);
908 : void selectSingle(EngravingItem* e, staff_idx_t staffIdx);
909 : void selectAdd(EngravingItem* e);
910 : void selectRange(EngravingItem* e, staff_idx_t staffIdx);
911 :
912 : bool trySelectSimilarInRange(EngravingItem* e);
913 : bool tryExtendSingleSelectionToRange(EngravingItem* e, staff_idx_t staffIdx);
914 : bool tryExtendRangeSelectionToElem(EngravingItem* e);
915 :
916 : void rebuildTimeSigMap(Measure* m);
917 :
918 : void doUndoRemoveStaleTieJumpPoints(Tie* tie, bool undo = true);
919 : void doUndoResetPartialSlur(Slur* slur, bool undo);
920 :
921 : void deleteOrShortenOutSpannersFromRange(const Fraction& t1, const Fraction& t2, track_idx_t trackStart, track_idx_t trackEnd,
922 : const SelectionFilter& filter);
923 : void deleteSlursFromRange(const Fraction& t1, const Fraction& t2, track_idx_t trackStart, track_idx_t trackEnd,
924 : const SelectionFilter& filter);
925 : void deleteAnnotationsFromRange(Segment* segStart, Segment* segEnd, track_idx_t trackStart, track_idx_t trackEnd,
926 : const SelectionFilter& filter);
927 :
928 : void deleteRangeAtTrack(std::vector<ChordRest*>& crsToSelect, const track_idx_t track, Segment* startSeg, const Fraction& endTick,
929 : Tuplet* currentTuplet, const SelectionFilter& filter, bool selectionContainsMultiNoteChords);
930 :
931 : muse::ID newStaffId() const;
932 : muse::ID newPartId() const;
933 :
934 : void assignIdIfNeed(Staff& staff) const;
935 : void assignIdIfNeed(Part& part) const;
936 :
937 : void updateStavesNumberForSystems();
938 :
939 : FBox* findFretBox() const;
940 :
941 : MasterScore* m_masterScore = nullptr;
942 : std::list<MuseScoreView*> m_viewer;
943 : Excerpt* m_excerpt = nullptr;
944 :
945 : String m_mscoreVersion;
946 : int m_mscoreRevision = 0;
947 :
948 : std::shared_ptr<IEngravingFont> m_engravingFont = nullptr;
949 :
950 : int m_pageNumberOffset = 0; // Offset for page numbers.
951 :
952 : UpdateState m_updateState;
953 :
954 : MeasureBaseList m_measures; // here are the notes
955 : std::vector<Part*> m_parts;
956 : std::vector<Staff*> m_staves;
957 : std::vector<Staff*> m_systemObjectStaves;
958 : RangeLocks m_systemLocks;
959 :
960 : RangeLocks m_pageLocks;
961 :
962 : SpannerMap m_spanner;
963 : std::set<Spanner*> m_unmanagedSpanner;
964 :
965 : std::vector<std::vector<BracketItem*> > m_brackets;
966 :
967 : //
968 : // objects generated by layout:
969 : //
970 : std::vector<Page*> m_pages; // pages are build from systems
971 : std::vector<System*> m_systems; // measures are accumulated to systems
972 :
973 : std::map<size_t, std::array<SystemDivider*, 2> > m_systemDividers; // list of system dividers (left and right) indexed by system
974 :
975 : InputState m_is;
976 : MStyle m_style;
977 : ChordList m_chordList;
978 :
979 : bool m_showInvisible = true;
980 : bool m_showUnprintable = true;
981 : bool m_showFrames = true;
982 : bool m_showPageborders = false;
983 : bool m_showSoundFlags = true;
984 : bool m_markIrregularMeasures = true;
985 : bool m_showInstrumentNames = true;
986 : bool m_printing = false; // True if we are drawing to a printer
987 : bool m_savedCapture = false; // True if we saved an image capture
988 : bool m_corrupted = false;
989 : bool m_needUpdateTicksAndTimeSigMap = false;
990 :
991 : ShowAnchors m_showAnchors;
992 :
993 : ScoreOrder m_scoreOrder; // used for score ordering
994 : int m_mscVersion = Constants::MSC_VERSION; // version of current loading *.msc file
995 :
996 : bool m_isOpen = false;
997 :
998 : std::map<String, String> m_metaTags;
999 :
1000 : Selection m_selection;
1001 : SelectionFilter m_selectionFilter;
1002 :
1003 : RootItem* m_rootItem = nullptr;
1004 : DummyParent* m_dummy = nullptr;
1005 : LayoutOptions m_layoutOptions;
1006 :
1007 : muse::async::Channel<EngravingItem*> m_elementDestroyed;
1008 :
1009 : ShadowNote* m_shadowNote = nullptr;
1010 :
1011 : muse::async::Channel<LoopBoundaryType, unsigned> m_loopBoundaryTickChanged;
1012 :
1013 : muse::async::Channel<float> m_layoutProgressChannel;
1014 :
1015 : PaddingTables m_paddingTables;
1016 : double m_minimumPaddingUnit = 0.0;
1017 : };
1018 :
1019 14 : static inline Score* toScore(EngravingObject* e)
1020 : {
1021 14 : assert(!e || e->isScore());
1022 14 : return static_cast<Score*>(e);
1023 : }
1024 :
1025 0 : static inline const Score* toScore(const EngravingObject* e)
1026 : {
1027 0 : assert(!e || e->isScore());
1028 0 : return static_cast<const Score*>(e);
1029 : }
1030 :
1031 : //---------------------------------------------------------
1032 : // ScoreLoad
1033 : //---------------------------------------------------------
1034 :
1035 : class ScoreLoad
1036 : {
1037 : static int m_loading;
1038 :
1039 : public:
1040 3380 : ScoreLoad() { ++m_loading; }
1041 3380 : ~ScoreLoad() { --m_loading; }
1042 18586 : static bool loading() { return m_loading > 0; }
1043 : };
1044 :
1045 : DECLARE_OPERATORS_FOR_FLAGS(LayoutFlags)
1046 : } // namespace mu::engraving
|