MuseScore  3.4
Music composition and notation
score.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2012 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __SCORE_H__
14 #define __SCORE_H__
15 
21 #include "config.h"
22 #include "input.h"
23 #include "instrument.h"
24 #include "select.h"
25 #include "synthesizerstate.h"
26 #include "mscoreview.h"
27 #include "spannermap.h"
28 #include "layoutbreak.h"
29 #include "property.h"
30 
31 namespace Ms {
32 
33 class Articulation;
34 class Audio;
35 class BarLine;
36 class Beam;
37 class Bracket;
38 class BSymbol;
39 class Chord;
40 class ChordRest;
41 class Clef;
42 class Dynamic;
43 class ElementList;
44 class EventMap;
45 class Excerpt;
46 class FiguredBass;
47 class Fingering;
48 class Hairpin;
49 class Harmony;
50 class Instrument;
51 class KeyList;
52 class KeySig;
53 class KeySigEvent;
54 class LinkedElements;
55 class Lyrics;
56 class MasterSynthesizer;
57 class Measure;
58 class MeasureBase;
59 class MuseScoreView;
60 class Note;
61 class Omr;
62 class Page;
63 class Parameter;
64 class Part;
65 class RepeatList;
66 class Rest;
67 class Revisions;
68 class ScoreFont;
69 class Segment;
70 class Selection;
71 class SigEvent;
72 class Slur;
73 class Spanner;
74 class Staff;
75 class System;
76 class TempoMap;
77 class Text;
78 class TimeSig;
79 class TimeSigMap;
80 class Tuplet;
81 class Undo;
82 class UndoCommand;
83 class UndoStack;
84 class Volta;
85 class XmlWriter;
86 class Channel;
87 struct Interval;
88 struct TEvent;
89 struct LayoutContext;
90 
91 enum class Tid;
92 enum class ClefType : signed char;
93 enum class BeatType : char;
94 enum class SymId;
95 enum class Key;
96 enum class HairpinType : signed char;
97 enum class SegmentType;
98 enum class OttavaType : char;
99 
100 enum class POS : char { CURRENT, LEFT, RIGHT };
101 
102 enum class Pad : char {
103  NOTE00,
104  NOTE0,
105  NOTE1,
106  NOTE2,
107  NOTE4,
108  NOTE8,
109  NOTE16,
110  NOTE32,
111  NOTE64,
112  NOTE128,
113  //--------------------
114  REST,
115  DOT,
116  DOTDOT,
117  DOT3,
118  DOT4
119  };
120 
121 //---------------------------------------------------------
122 // LayoutMode
123 // PAGE The normal page view, honors page and line breaks.
124 // LINE The panoramic view, one long system
125 // FLOAT The "reflow" mode, ignore page and line breaks
126 // SYSTEM The "never ending page", page break are turned into line break
127 //---------------------------------------------------------
128 
129 enum class LayoutMode : char {
130  PAGE, FLOAT, LINE, SYSTEM
131  };
132 
133 //---------------------------------------------------------
134 // MeasureBaseList
135 //---------------------------------------------------------
136 
138  int _size;
141 
142  void push_back(MeasureBase* e);
143  void push_front(MeasureBase* e);
144 
145  public:
146  MeasureBaseList();
147  MeasureBase* first() const { return _first; }
148  MeasureBase* last() const { return _last; }
149  void clear() { _first = _last = 0; _size = 0; }
150  void add(MeasureBase*);
151  void remove(MeasureBase*);
152  void insert(MeasureBase*, MeasureBase*);
153  void remove(MeasureBase*, MeasureBase*);
154  void change(MeasureBase* o, MeasureBase* n);
155  int size() const { return _size; }
156  };
157 
158 //---------------------------------------------------------
159 // MidiMapping
160 //---------------------------------------------------------
161 
162 class MidiMapping {
164  std::unique_ptr<Channel> _articulation;
165  signed char _port;
166  signed char _channel;
169 
170  MidiMapping() = default; // should be created only within MasterScore
171  friend class MasterScore;
172 
173  public:
174  Part* part() { return _part; }
175  const Part* part() const { return _part; }
176  Channel* articulation() { return _articulation.get(); }
177  const Channel* articulation() const { return _articulation.get(); }
178  signed char port() const { return _port; }
179  signed char channel() const { return _channel; }
180  };
181 
182 //---------------------------------------------------------
183 // MidiInputEvent
184 //---------------------------------------------------------
185 
187  int pitch;
188  bool chord;
189  int velocity;
190  };
191 
192 //---------------------------------------------------------
193 // Position
194 //---------------------------------------------------------
195 
196 struct Position {
197  Segment* segment { 0 };
198  int staffIdx { -1 };
199  int line { 0 };
200  int fret { FRET_NONE };
201  QPointF pos;
202  };
203 
204 //---------------------------------------------------------
205 // LayoutFlag bits
206 //---------------------------------------------------------
207 
208 enum class LayoutFlag : char {
209  NO_FLAGS = 0,
210  FIX_PITCH_VELO = 1,
211  PLAY_EVENTS = 2
212  };
213 
214 typedef QFlags<LayoutFlag> LayoutFlags;
215 
216 //---------------------------------------------------------
217 // PlayMode
218 //---------------------------------------------------------
219 
220 enum class PlayMode : char {
221  SYNTHESIZER,
222  AUDIO
223  };
224 
225 //---------------------------------------------------------
226 // Layer
227 //---------------------------------------------------------
228 
229 struct Layer {
230  QString name;
231  uint tags;
232  };
233 
234 //---------------------------------------------------------
235 // UpdateMode
236 // There is an implied order from least invasive update
237 // to most invasive update. LayoutAll is fallback and
238 // recreates all.
239 //---------------------------------------------------------
240 
241 enum class UpdateMode {
242  DoNothing,
243  Update, // do screen refresh of QRectF "refresh"
244  UpdateAll, // do complete screen refresh
245  Layout, // do partial layout for tick range
246  };
247 
248 //---------------------------------------------------------
249 // CmdState
250 //
251 // the following variables are reset on startCmd()
252 // modified during cmd processing and used in endCmd() to
253 // determine what to layout and what to repaint:
254 //---------------------------------------------------------
255 
256 class CmdState {
258  Fraction _startTick {-1, 1}; // start tick for mode LayoutTick
259  Fraction _endTick {-1, 1}; // end tick for mode LayoutTick
260  int _startStaff = -1;
261  int _endStaff = -1;
262  const Element* _el = nullptr;
263  const MeasureBase* _mb = nullptr;
264  bool _oneElement = true;
265  bool _oneMeasureBase = true;
266 
267  bool _locked = false;
268 
269  void setMeasureBase(const MeasureBase* mb);
270 
271  public:
272  LayoutFlags layoutFlags;
273 
274  bool _excerptsChanged { false };
275  bool _instrumentsChanged { false };
276 
277  void reset();
278  UpdateMode updateMode() const { return _updateMode; }
279  void setUpdateMode(UpdateMode m);
280  void _setUpdateMode(UpdateMode m);
281  bool layoutRange() const { return _updateMode == UpdateMode::Layout; }
282  bool updateAll() const { return int(_updateMode) >= int(UpdateMode::UpdateAll); }
283  bool updateRange() const { return _updateMode == UpdateMode::Update; }
284  void setTick(const Fraction& t);
285  void setStaff(int staff);
286  void setElement(const Element* e);
287  void unsetElement(const Element* e);
288  Fraction startTick() const { return _startTick; }
289  Fraction endTick() const { return _endTick; }
290  int startStaff() const { return _startStaff; }
291  int endStaff() const { return _endStaff; }
292  const Element* element() const;
293 
294  void lock() { _locked = true; }
295  void unlock() { _locked = false; }
296 #ifndef NDEBUG
297  void dump();
298 #endif
299  };
300 
301 //---------------------------------------------------------
302 // UpdateState
303 //---------------------------------------------------------
304 
305 class UpdateState {
306  public:
307  QRectF refresh;
308  bool _playNote { false };
309  bool _playChord { false };
310  bool _selectionChanged { false };
311  QList<ScoreElement*> _deleteList;
312  };
313 
314 //---------------------------------------------------------
315 // ScoreContentState
316 //---------------------------------------------------------
317 
319  const Score* score;
320  int num;
321  public:
322  ScoreContentState() : score(nullptr), num(0) {}
323  ScoreContentState(const Score* s, int stateNum) : score(s), num(stateNum) {}
324 
325  bool operator==(const ScoreContentState& s2) const { return score == s2.score && num == s2.num; }
326  bool operator!=(const ScoreContentState& s2) const { return !(*this == s2); }
327 
328  bool isNewerThan(const ScoreContentState& s2) const { return score == s2.score && num > s2.num; }
329  };
330 
331 class MasterScore;
332 
333 //-----------------------------------------------------------------------------
334 // Movements
335 // A movement is a unit of a larger work that may stand
336 // by itself as a complete composition.
337 // A MuseScore score file can contain several movements represented as
338 // MasterScore's. A MasterScore can have several parts represented
339 // as Score. MasterScores are connected in a double linked list.
340 //-----------------------------------------------------------------------------
341 
342 class Movements : public std::vector<MasterScore*> {
344  QList<Page*> _pages; // pages are build from systems
346  Text* _headerText { 0 };
347  Text* _footerText { 0 };
348 
349  public:
350  Movements();
351  ~Movements();
352  int pageIdx(Page* page) const { return _pages.indexOf(page); }
353  int npages() const { return _pages.size(); }
354  const QList<Page*>& pages() const { return _pages; }
355  QList<Page*>& pages() { return _pages; }
356  UndoStack* undo() const { return _undo; }
357  MStyle& style() { return _style; }
358  const MStyle& style() const { return _style; }
359  Text* headerText() const { return _headerText; }
360  Text* footerText() const { return _footerText; }
361  void setHeaderText(Text* t) { _headerText = t; }
362  void setFooterText(Text* t) { _footerText = t; }
363  };
364 
365 //---------------------------------------------------------------------------------------
366 // @@ Score
367 // @P composer string composer of the score (read only)
368 // @P duration int duration of score in seconds (read only)
369 // @P excerpts array[Excerpt] the list of the excerpts (linked parts)
370 // @P firstMeasure Measure the first measure of the score (read only)
371 // @P firstMeasureMM Measure the first multi-measure rest measure of the score (read only)
372 // @P harmonyCount int number of harmony items (read only)
373 // @P hasHarmonies bool score has chord symbols (read only)
374 // @P hasLyrics bool score has lyrics (read only)
375 // @P keysig int key signature at the start of the score (read only)
376 // @P lastMeasure Measure the last measure of the score (read only)
377 // @P lastMeasureMM Measure the last multi-measure rest measure of the score (read only)
378 // @P lastSegment Segment the last score segment (read-only)
379 // @P lyricCount int number of lyric items (read only)
380 // @P name string name of the score
381 // @P nmeasures int number of measures (read only)
382 // @P npages int number of pages (read only)
383 // @P nstaves int number of staves (read only)
384 // @P ntracks int number of tracks (staves * 4) (read only)
385 // not to be documented?
386 // @P parts array[Part] the list of parts (read only)
387 //
388 // a Score has always an associated MasterScore
389 //---------------------------------------------------------------------------------------
390 
391 class Score : public QObject, public ScoreElement {
392  Q_OBJECT
393 
394  public:
395  enum class FileError : char {
396  FILE_NO_ERROR,
397  FILE_ERROR,
398  FILE_NOT_FOUND,
399  FILE_OPEN_ERROR,
400  FILE_BAD_FORMAT,
401  FILE_UNKNOWN_TYPE,
402  FILE_NO_ROOTFILE,
403  FILE_TOO_OLD,
404  FILE_TOO_NEW,
405  FILE_OLD_300_FORMAT,
406  FILE_CORRUPTED,
407  FILE_USER_ABORT,
408  FILE_IGNORE_ERROR
409  };
410 
411  private:
412  static std::set<Score*> validScores;
413  int _linkId { 0 };
414  MasterScore* _masterScore { 0 };
415  QList<MuseScoreView*> viewer;
416  Excerpt* _excerpt { 0 };
417 
418  QString _mscoreVersion;
420 
421  QString _layerTags[32];
422  QString _layerTagComments[32];
423  QList<Layer> _layer;
424  int _currentLayer { 0 };
425 
427  int _pageNumberOffset { 0 };
428 
430 
431  MeasureBaseList _measures; // here are the notes
432  QList<Part*> _parts;
433  QList<Staff*> _staves;
434 
436  std::set<Spanner*> _unmanagedSpanner;
437 
438  //
439  // objects generated by layout:
440  //
441  QList<Page*> _pages; // pages are build from systems
442  QList<System*> _systems; // measures are accumulated to systems
443 
446 
447  bool _created { false };
448  QString _tmpName;
449  QString _importedFilePath; // file from which the score was imported, or empty
450 
451  bool _showInvisible { true };
452  bool _showUnprintable { true };
453  bool _showFrames { true };
454  bool _showPageborders { false };
455  bool _markIrregularMeasures { true };
456  bool _showInstrumentNames { true };
457  bool _showVBox { true };
458  bool _printing { false };
459  bool _autosaveDirty { true };
460  bool _savedCapture { false };
461  bool _saved { false };
462  bool _defaultsRead { false };
465  bool _isPalette { false };
466 
467  int _mscVersion { MSCVERSION };
468 
469  QMap<QString, QString> _metaTags;
470 
471  constexpr static double _defaultTempo = 2.0; //default tempo is equal 120 bpm
472 
475  Audio* _audio { 0 };
477 
478  qreal _noteHeadWidth { 0.0 }; // cached value
479  QString accInfo;
480 
481  //------------------
482 
483  ChordRest* nextMeasure(ChordRest* element, bool selectBehavior = false, bool mmRest = false);
484  ChordRest* prevMeasure(ChordRest* element, bool mmRest = false);
485  void cmdSetBeamMode(Beam::Mode);
486  void cmdResetStyle();
487  void cmdFlip();
488  Note* getSelectedNote();
489  ChordRest* upStaff(ChordRest* cr);
490  ChordRest* downStaff(ChordRest* cr);
491  ChordRest* nextTrack(ChordRest* cr);
492  ChordRest* prevTrack(ChordRest* cr);
493 
494  void padToggle(Pad n, const EditData& ed);
495  void addTempo();
496  void addMetronome();
497 
498  void cmdResetBeamMode();
499 
500  void cmdInsertClef(ClefType);
501  void cmdAddGrace(NoteType, int);
502  void removeChordRest(ChordRest* cr, bool clearSegment);
503  void cmdMoveRest(Rest*, Direction);
504  void cmdMoveLyrics(Lyrics*, Direction);
505  void cmdIncDecDuration(int nSteps, bool stepDotted = false);
506  void cmdAddBracket();
507  void cmdAddParentheses();
508  void resetUserStretch();
509 
510  void createMMRest(Measure*, Measure*, const Fraction&);
511 
512  void beamGraceNotes(Chord*, bool);
513 
514 
515  void checkSlurs();
516  void checkScore();
517 
518  bool rewriteMeasures(Measure* fm, Measure* lm, const Fraction&, int staffIdx);
519  bool rewriteMeasures(Measure* fm, const Fraction& ns, int staffIdx);
520  void swingAdjustParams(Chord*, int&, int&, int, int);
521  bool isSubdivided(ChordRest*, int);
522  void addAudioTrack();
523  QList<Fraction> splitGapToMeasureBoundaries(ChordRest*, Fraction);
524  void pasteChordRest(ChordRest* cr, const Fraction& tick, const Interval&);
525 
526  void selectSingle(Element* e, int staffIdx);
527  void selectAdd(Element* e);
528  void selectRange(Element* e, int staffIdx);
529 
530  void cmdAddPitch(const EditData&, int note, bool addFlag, bool insert);
531  void cmdAddFret(int fret);
532  void cmdToggleVisible();
533 
534  void putNote(const Position&, bool replace);
535 
536  void resetSystems(bool layoutAll, LayoutContext& lc);
537  void collectLinearSystem(LayoutContext& lc);
538  void resetTempo();
539  void resetTempoRange(const Fraction& tick1, const Fraction& tick2);
540 
541  void deleteSpannersFromRange(const Fraction& t1, const Fraction& t2, int trackStart, int trackEnd, const SelectionFilter& filter);
542  void deleteAnnotationsFromRange(Segment* segStart, Segment* segEnd, int trackStart, int trackEnd, const SelectionFilter& filter);
543  ChordRest* deleteRange(Segment* segStart, Segment* segEnd, int trackStart, int trackEnd, const SelectionFilter& filter);
544 
545  void update(bool resetCmdState);
546 
547  protected:
549  LayoutMode _layoutMode { LayoutMode::PAGE };
551 
552  void createPlayEvents(Chord*);
553  void createGraceNotesPlayEvents(const Fraction& tick, Chord* chord, int& ontime, int& trailtime);
554  void cmdPitchUp();
555  void cmdPitchDown();
556  void cmdPitchUpOctave();
557  void cmdPitchDownOctave();
558  void cmdPadNoteIncreaseTAB(const EditData& ed);
559  void cmdPadNoteDecreaseTAB(const EditData& ed);
560  void cmdToggleMmrest();
561  void cmdToggleHideEmpty();
562  void cmdSetVisible();
563  void cmdUnsetVisible();
564  inline virtual Movements* movements();
565  inline virtual const Movements* movements() const;
566 
567  signals:
568  void posChanged(POS, unsigned);
569  void playlistChanged();
570 
571  public:
572  Score();
573  Score(MasterScore*, bool forcePartStyle = true);
574  Score(MasterScore*, const MStyle&);
575  Score(const Score&) = delete;
576  Score& operator=(const Score&) = delete;
577  virtual ~Score();
578  Score* clone();
579 
580  virtual bool isMaster() const { return false; }
581  virtual bool readOnly() const;
582 
583  static void onElementDestruction(Element* se);
584 
585  virtual inline QList<Excerpt*>& excerpts();
586  virtual inline const QList<Excerpt*>& excerpts() const;
587 
588  virtual ElementType type() const override { return ElementType::SCORE; }
589 
590  void rebuildBspTree();
591  bool noStaves() const { return _staves.empty(); }
592  void insertPart(Part*, int);
593  void removePart(Part*);
594  void insertStaff(Staff*, int);
595  void cmdRemoveStaff(int staffIdx);
596  void removeStaff(Staff*);
597  void addMeasure(MeasureBase*, MeasureBase*);
598  void readStaff(XmlReader&);
599  bool read(XmlReader&);
600 
601  Excerpt* excerpt() { return _excerpt; }
602  void setExcerpt(Excerpt* e) { _excerpt = e; }
603 
604  System* collectSystem(LayoutContext&);
605  void layoutSystemElements(System* system, LayoutContext& lc);
606  void getNextMeasure(LayoutContext&); // get next measure for layout
607 
608  void cmdRemovePart(Part*);
609  void cmdAddTie(bool addToChord = false);
610  void cmdToggleTie();
611  static std::vector<Note*> cmdTieNoteList(const Selection& selection, bool noteEntryMode);
612  void cmdAddOttava(OttavaType);
613  void cmdAddStretch(qreal);
614  void cmdResetNoteAndRestGroupings();
615  void cmdResetAllPositions();
616  void cmdDoubleDuration() { cmdIncDecDuration(-1, false); }
617  void cmdHalfDuration() { cmdIncDecDuration( 1, false); }
618  void cmdIncDurationDotted() { cmdIncDecDuration(-1, true); }
619  void cmdDecDurationDotted() { cmdIncDecDuration( 1, true); }
620  void cmdToggleLayoutBreak(LayoutBreak::Type);
621 
622  void addRemoveBreaks(int interval, bool lock);
623 
624  bool transpose(Note* n, Interval, bool useSharpsFlats);
625  void transposeKeys(int staffStart, int staffEnd, const Fraction& tickStart, const Fraction& tickEnd, const Interval&, bool useInstrument = false, bool flip = false);
627  bool trKeys, bool transposeChordNames, bool useDoubleSharpsFlats);
628 
629  bool appendMeasuresFromScore(Score* score, const Fraction& startTick, const Fraction& endTick);
630  bool appendScore(Score*, bool addPageBreak = false, bool addSectionBreak = true);
631 
632  void write(XmlWriter&, bool onlySelection);
633  void writeMovement(XmlWriter&, bool onlySelection);
634 
635  QList<Staff*>& staves() { return _staves; }
636  const QList<Staff*>& staves() const { return _staves; }
637  int nstaves() const { return _staves.size(); }
638  int ntracks() const { return _staves.size() * VOICES; }
639 
640  int staffIdx(const Part*) const;
641  Staff* staff(int n) const { return ((n >= 0) && (n < _staves.size())) ? _staves.at(n) : nullptr; }
642 
643  Measure* pos2measure(const QPointF&, int* staffIdx, int* pitch, Segment**, QPointF* offset) const;
644  void dragPosition(const QPointF&, int* staffIdx, Segment**) const;
645 
646  void undoAddElement(Element* element);
647  void undoAddCR(ChordRest* element, Measure*, const Fraction& tick);
648  void undoRemoveElement(Element* element);
649  void undoChangeSpannerElements(Spanner* spanner, Element* startElement, Element* endElement);
650  void undoChangeElement(Element* oldElement, Element* newElement);
651  void undoChangePitch(Note* note, int pitch, int tpc1, int tpc2);
652  void undoChangeFretting(Note* note, int pitch, int string, int fret, int tpc1, int tpc2);
653  void spellNotelist(std::vector<Note*>& notes);
654  void undoChangeTpc(Note* note, int tpc);
655  void undoChangeChordRestLen(ChordRest* cr, const TDuration&);
656  void undoTransposeHarmony(Harmony*, int, int);
657  void undoExchangeVoice(Measure* measure, int val1, int val2, int staff1, int staff2);
658  void undoRemovePart(Part* part, int idx);
659  void undoInsertPart(Part* part, int idx);
660  void undoRemoveStaff(Staff* staff);
661  void undoInsertStaff(Staff* staff, int idx, bool createRests=true);
662  void undoChangeInvisible(Element*, bool);
663  void undoChangeTuning(Note*, qreal);
664  void undoChangeUserMirror(Note*, MScore::DirectionH);
665  void undoChangeKeySig(Staff* ostaff, const Fraction& tick, KeySigEvent);
666  void undoChangeClef(Staff* ostaff, Element*, ClefType st);
667  bool undoPropertyChanged(Element* e, Pid t, const QVariant& st, PropertyFlags ps = PropertyFlags::NOSTYLE);
668  void undoPropertyChanged(ScoreElement*, Pid, const QVariant& v, PropertyFlags ps = PropertyFlags::NOSTYLE);
669  inline virtual UndoStack* undoStack() const;
670  void undo(UndoCommand*, EditData* = 0) const;
671  void undoRemoveMeasures(Measure*, Measure*);
672  void undoAddBracket(Staff* staff, int level, BracketType type, int span);
673  void undoRemoveBracket(Bracket*);
674  void undoInsertTime(const Fraction& tick, const Fraction& len);
675  void undoChangeStyleVal(Sid idx, const QVariant& v);
676  void undoChangePageNumberOffset(int po);
677 
678  Note* setGraceNote(Chord*, int pitch, NoteType type, int len);
679 
680  Segment* setNoteRest(Segment*, int track, NoteVal nval, Fraction, Direction stemDirection = Direction::AUTO, bool forceAccidental = false, bool rhythmic = false);
681  void changeCRlen(ChordRest* cr, const TDuration&);
682  void changeCRlen(ChordRest* cr, const Fraction&, bool fillWithRest=true);
683  void createCRSequence(const Fraction& f, ChordRest* cr, const Fraction& tick);
684 
685  Fraction makeGap(Segment*, int track, const Fraction&, Tuplet*, bool keepChord = false);
686  bool makeGap1(const Fraction& baseTick, int staffIdx, const Fraction& len, int voiceOffset[VOICES]);
687  bool makeGapVoice(Segment* seg, int track, Fraction len, const Fraction& tick);
688 
689  Rest* addRest(const Fraction& tick, int track, TDuration, Tuplet*);
690  Rest* addRest(Segment* seg, int track, TDuration d, Tuplet*);
691  Chord* addChord(const Fraction& tick, TDuration d, Chord* oc, bool genTie, Tuplet* tuplet);
692 
693  ChordRest* addClone(ChordRest* cr, const Fraction& tick, const TDuration& d);
694  Rest* setRest(const Fraction& tick, int track, const Fraction&, bool useDots, Tuplet* tuplet, bool useFullMeasureRest = true);
695 
696  void upDown(bool up, UpDownMode);
697  void upDownDelta(int pitchDelta);
698  ChordRest* searchNote(const Fraction& tick, int track) const;
699 
700  // undo/redo ops
701  void addArticulation(SymId);
702  bool addArticulation(Element*, Articulation* atr);
703  void toggleAccidental(AccidentalType, const EditData& ed);
704  void changeAccidental(AccidentalType);
705  void changeAccidental(Note* oNote, Ms::AccidentalType);
706 
707  void addElement(Element*);
708  void removeElement(Element*);
709 
710  Note* addPitch(NoteVal&, bool addFlag);
711  void addPitch(int pitch, bool addFlag, bool insert);
712  Note* addTiedMidiPitch(int pitch, bool addFlag, Chord* prevChord);
713  Note* addMidiPitch(int pitch, bool addFlag);
714  Note* addNote(Chord*, NoteVal& noteVal, bool forceAccidental = false);
715 
716  NoteVal noteValForPosition(Position pos, AccidentalType at, bool &error);
717 
718  void deleteItem(Element*);
719  void deleteMeasures(MeasureBase* firstMeasure, MeasureBase* lastMeasure);
720  void cmdDeleteSelection();
721  void cmdFullMeasureRest();
722 
723  void putNote(const QPointF&, bool replace, bool insert);
724  void insertChord(const Position&);
725  void localInsertChord(const Position&);
726  void globalInsertChord(const Position&);
727 
728  void cloneVoice(int strack, int dtrack, Segment* sf, const Fraction& lTick, bool link = true, bool spanner = true);
729 
730  void repitchNote(const Position& pos, bool replace);
731  void regroupNotesAndRests(const Fraction& startTick, const Fraction& endTick, int track);
732  bool checkTimeDelete(Segment*, Segment*);
733  void timeDelete(Measure*, Segment*, const Fraction&);
734 
735  void startCmd(); // start undoable command
736  void endCmd(bool rollback = false); // end undoable command
737  void update() { update(true); }
738  void undoRedo(bool undo, EditData*);
739 
740  void cmdRemoveTimeSig(TimeSig*);
741  void cmdAddTimeSig(Measure*, int staffIdx, TimeSig*, bool local);
742 
743  virtual inline void setUpdateAll();
744  inline void setLayoutAll(int staff = -1, const Element* e = nullptr);
745  inline void setLayout(const Fraction& tick, int staff, const Element* e = nullptr);
746  inline void setLayout(const Fraction& tick1, const Fraction& tick2, int staff1, int staff2, const Element* e = nullptr);
747  virtual inline CmdState& cmdState();
748  virtual inline const CmdState& cmdState() const;
749  virtual inline void addLayoutFlags(LayoutFlags);
750  virtual inline void setInstrumentsChanged(bool);
751  void addRefresh(const QRectF&);
752 
753  void cmdRelayout();
754  void cmdToggleAutoplace(bool all);
755 
756  bool playNote() const { return _updateState._playNote; }
757  void setPlayNote(bool v) { _updateState._playNote = v; }
758  bool playChord() const { return _updateState._playChord; }
759  void setPlayChord(bool v) { _updateState._playChord = v; }
760  bool selectionChanged() const { return _updateState._selectionChanged; }
761  void setSelectionChanged(bool val) { _updateState._selectionChanged = val; }
762  void deleteLater(ScoreElement* e) { _updateState._deleteList.push_back(e); }
763  void deletePostponed();
764 
765  void changeVoice(int);
766 
767  void colorItem(Element*);
768  QList<Part*>& parts() { return _parts; }
769  const QList<Part*>& parts() const { return _parts; }
770 
771  void appendPart(Part* p);
772  void updateStaffIndex();
773  void sortStaves(QList<int>& dst);
774 
775  bool showInvisible() const { return _showInvisible; }
776  bool showUnprintable() const { return _showUnprintable; }
777  bool showFrames() const { return _showFrames; }
778  bool showPageborders() const { return _showPageborders; }
779  bool markIrregularMeasures() const { return _markIrregularMeasures; }
780  bool showInstrumentNames() const { return _showInstrumentNames; }
781  bool showVBox() const { return _showVBox; }
782  void setShowInvisible(bool v);
783  void setShowUnprintable(bool v);
784  void setShowFrames(bool v);
785  void setShowPageborders(bool v);
786  void setMarkIrregularMeasures(bool v);
787  void setShowInstrumentNames(bool v) { _showInstrumentNames = v; }
788  void setShowVBox(bool v) { _showVBox = v; }
789 
790  bool saveFile(QFileInfo& info);
791  bool saveFile(QIODevice* f, bool msczFormat, bool onlySelection = false);
792  bool saveCompressedFile(QFileInfo&, bool onlySelection);
793  bool saveCompressedFile(QFileDevice*, QFileInfo&, bool onlySelection, bool createThumbnail = true);
794 
795  void print(QPainter* printer, int page);
796  ChordRest* getSelectedChordRest() const;
797  QSet<ChordRest*> getSelectedChordRests() const;
798  void getSelectedChordRest2(ChordRest** cr1, ChordRest** cr2) const;
799 
800  void select(Element* obj, SelectType = SelectType::SINGLE, int staff = 0);
801  void selectSimilar(Element* e, bool sameStaff);
802  void selectSimilarInRange(Element* e);
803  static void collectMatch(void* data, Element* e);
804  static void collectNoteMatch(void* data, Element* e);
805  void deselect(Element* obj);
806  void deselectAll() { _selection.deselectAll(); }
807  void updateSelection() { _selection.update(); }
808  Element* getSelectedElement() const { return _selection.element(); }
809  const Selection& selection() const { return _selection; }
810  Selection& selection() { return _selection; }
811  SelectionFilter& selectionFilter() { return _selectionFilter; }
812  void setSelection(const Selection& s);
813 
814  Fraction pos();
815  Measure* tick2measure(const Fraction& tick) const;
816  Measure* tick2measureMM(const Fraction& tick) const;
817  MeasureBase* tick2measureBase(const Fraction& tick) const;
818  Segment* tick2segment(const Fraction& tick, bool first, SegmentType st, bool useMMrest = false) const;
819  Segment* tick2segment(const Fraction& tick) const;
820  Segment* tick2segment(const Fraction& tick, bool first) const;
821  Segment* tick2segmentMM(const Fraction& tick, bool first, SegmentType st) const;
822  Segment* tick2segmentMM(const Fraction& tick) const;
823  Segment* tick2segmentMM(const Fraction& tick, bool first) const;
824  Segment* tick2leftSegment(const Fraction& tick) const;
825  Segment* tick2rightSegment(const Fraction& tick) const;
826  void fixTicks();
827  void rebuildTempoAndTimeSigMaps(Measure* m);
828  Element* nextElement();
829  Element* prevElement();
830 
831  void cmd(const QAction*, EditData&);
832  int fileDivision(int t) const { return ((qint64)t * MScore::division + _fileDivision/2) / _fileDivision; }
833  void setFileDivision(int t) { _fileDivision = t; }
834 
835  QString importedFilePath() const { return _importedFilePath; }
836  void setImportedFilePath(const QString& filePath);
837 
838  bool dirty() const;
839  ScoreContentState state() const;
840  void setCreated(bool val) { _created = val; }
841  bool created() const { return _created; }
842  bool savedCapture() const { return _savedCapture; }
843  bool saved() const { return _saved; }
844  void setSaved(bool v) { _saved = v; }
845  void setSavedCapture(bool v) { _savedCapture = v; }
846  bool printing() const { return _printing; }
847  void setPrinting(bool val) { _printing = val; }
848  void setAutosaveDirty(bool v) { _autosaveDirty = v; }
849  bool autosaveDirty() const { return _autosaveDirty; }
850  virtual bool playlistDirty() const;
851  virtual void setPlaylistDirty();
852 
853  void spell();
854  void spell(int startStaff, int endStaff, Segment* startSegment, Segment* endSegment);
855  void spell(Note*);
856  Fraction nextSeg(const Fraction& tick, int track);
857 
858  virtual MStyle& style() { return _style; }
859  virtual const MStyle& style() const { return _style; }
860 
861  void setStyle(const MStyle& s);
862  bool loadStyle(const QString&, bool ign = false);
863  bool saveStyle(const QString&);
864 
865  QVariant styleV(Sid idx) const { return style().value(idx); }
866  Spatium styleS(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"Ms::Spatium")); return style().value(idx).value<Spatium>(); }
867  qreal styleP(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"Ms::Spatium")); return style().pvalue(idx); }
868  QString styleSt(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"QString")); return style().value(idx).toString(); }
869  bool styleB(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"bool")); return style().value(idx).toBool(); }
870  qreal styleD(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"double")); return style().value(idx).toDouble(); }
871  int styleI(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"int")); return style().value(idx).toInt(); }
872 
873  void setStyleValue(Sid sid, QVariant value) { style().set(sid, value); }
874  QString getTextStyleUserName(Tid tid);
875  qreal spatium() const { return styleD(Sid::spatium); }
876  void setSpatium(qreal v) { setStyleValue(Sid::spatium, v); }
877 
878  bool genCourtesyTimesig() const { return styleB(Sid::genCourtesyTimesig); }
879  bool genCourtesyClef() const { return styleB(Sid::genCourtesyClef); }
880 
881  // These position are in ticks and not uticks
882  Fraction playPos() const { return pos(POS::CURRENT); }
883  void setPlayPos(const Fraction& tick) { setPos(POS::CURRENT, tick); }
884  Fraction loopInTick() const { return pos(POS::LEFT); }
885  Fraction loopOutTick() const { return pos(POS::RIGHT); }
886  void setLoopInTick(const Fraction& tick) { setPos(POS::LEFT, tick); }
887  void setLoopOutTick(const Fraction& tick) { setPos(POS::RIGHT, tick); }
888 
889  inline Fraction pos(POS pos) const;
890  inline void setPos(POS pos, Fraction tick);
891 
892  bool noteEntryMode() const { return inputState().noteEntryMode(); }
893  void setNoteEntryMode(bool val) { inputState().setNoteEntryMode(val); }
894  NoteEntryMethod noteEntryMethod() const { return inputState().noteEntryMethod(); }
895  void setNoteEntryMethod(NoteEntryMethod m) { inputState().setNoteEntryMethod(m); }
896  bool usingNoteEntryMethod(NoteEntryMethod m) { return inputState().usingNoteEntryMethod(m); }
897  Fraction inputPos() const;
898  int inputTrack() const { return inputState().track(); }
899  const InputState& inputState() const { return _is; }
900  InputState& inputState() { return _is; }
901  void setInputState(const InputState& st) { _is = st; }
902  void setInputTrack(int t) { inputState().setTrack(t); }
903 
904  void spatiumChanged(qreal oldValue, qreal newValue);
905  void styleChanged();
906 
907  void cmdPaste(const QMimeData* ms, MuseScoreView* view, Fraction scale = Fraction(1, 1));
908  bool pasteStaff(XmlReader&, Segment* dst, int staffIdx, Fraction scale = Fraction(1, 1));
909  void readAddConnector(ConnectorInfoReader* info, bool pasteMode) override;
910  void pasteSymbols(XmlReader& e, ChordRest* dst);
911  void renderMidi(EventMap* events, const SynthesizerState& synthState);
912  void renderMidi(EventMap* events, bool metronome, bool expandRepeats, const SynthesizerState& synthState);
913 
914  BeatType tick2beatType(const Fraction& tick);
915 
916  int mscVersion() const { return _mscVersion; }
917  void setMscVersion(int v) { _mscVersion = v; }
918 
919  void addLyrics(const Fraction& tick, int staffIdx, const QString&);
920 
921  void updateSwing();
922  void createPlayEvents(Measure* start = nullptr, Measure* end = nullptr);
923 
924  void updateCapo();
925  void updateVelo();
926  void updateChannel();
927 
928  void cmdConcertPitchChanged(bool, bool /*useSharpsFlats*/);
929 
930  virtual inline TempoMap* tempomap() const;
931  virtual inline TimeSigMap* sigmap() const;
932 
933  void setTempo(Segment*, qreal);
934  void setTempo(const Fraction& tick, qreal bps);
935  void removeTempo(const Fraction& tick);
936  void setPause(const Fraction& tick, qreal seconds);
937  qreal tempo(const Fraction& tick) const;
938 
939  bool defaultsRead() const { return _defaultsRead; }
940  void setDefaultsRead(bool b) { _defaultsRead = b; }
941  Text* getText(Tid subtype);
942 
943  bool isPalette() const { return _isPalette; }
944  void setPaletteMode(bool palette) { _isPalette = palette; }
945 
946  void lassoSelect(const QRectF&);
947  void lassoSelectEnd();
948 
949  Page* searchPage(const QPointF&) const;
950  QList<System*> searchSystem(const QPointF& p) const;
951  Measure* searchMeasure(const QPointF& p) const;
952 
953  bool getPosition(Position* pos, const QPointF&, int voice) const;
954 
955  void cmdDeleteTuplet(Tuplet*, bool replaceWithRest);
956 
957 // void moveBracket(int staffIdx, int srcCol, int dstCol);
958  Measure* getCreateMeasure(const Fraction& tick);
959 
960  void adjustBracketsDel(int sidx, int eidx);
961  void adjustBracketsIns(int sidx, int eidx);
962  void adjustKeySigs(int sidx, int eidx, KeyList km);
963 
964  Measure* searchLabel(const QString& s, Measure* startMeasure = nullptr, Measure* endMeasure = nullptr);
965  Measure* searchLabelWithinSectionFirst(const QString& s, Measure* sectionStartMeasure, Measure* sectionEndMeasure);
966  virtual inline const RepeatList& repeatList() const;
967  qreal utick2utime(int tick) const;
968  int utime2utick(qreal utime) const;
969 
970  void nextInputPos(ChordRest* cr, bool);
971  void cmdMirrorNoteHead();
972 
973  qreal loWidth() const;
974  qreal loHeight() const;
975 
976  virtual int npages() const { return _pages.size(); }
977  virtual int pageIdx(Page* page) const { return _pages.indexOf(page); }
978  virtual const QList<Page*>& pages() const { return _pages; }
979  virtual QList<Page*>& pages() { return _pages; }
980 
981  const QList<System*>& systems() const { return _systems; }
982  QList<System*>& systems() { return _systems; }
983 
984  MeasureBaseList* measures() { return &_measures; }
985  bool checkHasMeasures() const;
986  MeasureBase* first() const;
987  MeasureBase* firstMM() const;
988  MeasureBase* last() const;
989  Ms::Measure* firstMeasure() const;
990  Ms::Measure* firstMeasureMM() const;
991  Ms::Measure* lastMeasure() const;
992  Ms::Measure* lastMeasureMM() const;
993  MeasureBase* measure(int idx) const;
994  Measure* crMeasure(int idx) const;
995 
996  Fraction endTick() const;
997 
998  Segment* firstSegment(SegmentType s) const;
999  Segment* firstSegmentMM(SegmentType s) const;
1000  Segment* lastSegment() const;
1001 
1002  void connectTies(bool silent=false);
1003 
1004  qreal point(const Spatium sp) const { return sp.val() * spatium(); }
1005 
1006  void scanElements(void* data, void (*func)(void*, Element*), bool all=true);
1007  void scanElementsInRange(void* data, void (*func)(void*, Element*), bool all = true);
1008  int fileDivision() const { return _fileDivision; }
1009  void splitStaff(int staffIdx, int splitPoint);
1010  QString tmpName() const { return _tmpName; }
1011  void setTmpName(const QString& s) { _tmpName = s; }
1012  bool processMidiInput();
1013  Lyrics* addLyrics();
1014  FiguredBass* addFiguredBass();
1015  void expandVoice(Segment* s, int track);
1016  void expandVoice();
1017 
1018  Element* selectMove(const QString& cmd);
1019  Element* move(const QString& cmd);
1020  void cmdEnterRest(const TDuration& d);
1021  void cmdAddInterval(int, const std::vector<Note*>&);
1022  void cmdCreateTuplet(ChordRest*, Tuplet*);
1023  void removeAudio();
1024 
1025  void doLayout();
1026  void doLayoutRange(const Fraction&, const Fraction&);
1027  void layoutLinear(bool layoutAll, LayoutContext& lc);
1028 
1029  void layoutChords1(Segment* segment, int staffIdx);
1030  qreal layoutChords2(std::vector<Note*>& notes, bool up);
1031  void layoutChords3(std::vector<Note*>&, const Staff*, Segment*);
1032 
1033  SynthesizerState& synthesizerState() { return _synthesizerState; }
1034  void setSynthesizerState(const SynthesizerState& s);
1035 
1036  void updateHairpin(Hairpin*); // add/modify hairpin to pitchOffset list
1037  void removeHairpin(Hairpin*); // remove hairpin from pitchOffset list
1038 
1039  MasterScore* masterScore() const { return _masterScore; }
1040  void setMasterScore(MasterScore* s) { _masterScore = s; }
1041  void createRevision();
1042  void writeSegments(XmlWriter& xml, int strack, int etrack, Segment* sseg, Segment* eseg, bool, bool);
1043 
1044  const QMap<QString, QString>& metaTags() const { return _metaTags; }
1045  QMap<QString, QString>& metaTags() { return _metaTags; }
1046  void setMetaTags(const QMap<QString,QString>& t) { _metaTags = t; }
1047 
1048  //@ returns as a string the metatag named 'tag'
1049  QString metaTag(const QString& tag) const;
1050  //@ sets the metatag named 'tag' to 'val'
1051  void setMetaTag(const QString& tag, const QString& val);
1052 
1053  void cmdSplitMeasure(ChordRest*);
1054  void splitMeasure(Segment*);
1055  void cmdJoinMeasure(Measure*, Measure*);
1056  int pageNumberOffset() const { return _pageNumberOffset; }
1057  void setPageNumberOffset(int v) { _pageNumberOffset = v; }
1058 
1059  QString mscoreVersion() const { return _mscoreVersion; }
1060  int mscoreRevision() const { return _mscoreRevision; }
1061  void setMscoreVersion(const QString& val) { _mscoreVersion = val; }
1062  void setMscoreRevision(int val) { _mscoreRevision = val; }
1063 
1064  uint currentLayerMask() const { return _layer[_currentLayer].tags; }
1065  void setCurrentLayer(int val) { _currentLayer = val; }
1066  int currentLayer() const { return _currentLayer; }
1067  QString* layerTags() { return _layerTags; }
1068  QString* layerTagComments() { return _layerTagComments; }
1069  QList<Layer>& layer() { return _layer; }
1070  const QList<Layer>& layer() const { return _layer; }
1071  bool tagIsValid(uint tag) const { return tag & _layer[_currentLayer].tags; }
1072 
1073  void addViewer(MuseScoreView* v) { viewer.append(v); }
1074  void removeViewer(MuseScoreView* v) { viewer.removeAll(v); }
1075  const QList<MuseScoreView*>& getViewer() const { return viewer; }
1076 
1077  LayoutMode layoutMode() const { return _layoutMode; }
1078  void setLayoutMode(LayoutMode lm) { _layoutMode = lm; }
1079 
1080  bool floatMode() const { return layoutMode() == LayoutMode::FLOAT; }
1081  bool pageMode() const { return layoutMode() == LayoutMode::PAGE; }
1082  bool lineMode() const { return layoutMode() == LayoutMode::LINE; }
1083  bool systemMode() const { return layoutMode() == LayoutMode::SYSTEM; }
1084 
1085  Tuplet* searchTuplet(XmlReader& e, int id);
1086  void cmdSelectAll();
1087  void cmdSelectSection();
1088  void respace(std::vector<ChordRest*>* elements);
1089  void transposeSemitone(int semitone);
1090  void insertMeasure(ElementType type, MeasureBase*, bool createEmptyMeasures = false);
1091  Audio* audio() const { return _audio; }
1092  void setAudio(Audio* a) { _audio = a; }
1093  PlayMode playMode() const { return _playMode; }
1094  void setPlayMode(PlayMode v) { _playMode = v; }
1095 
1096  int linkId();
1097  void linkId(int);
1098  int getLinkId() const { return _linkId; }
1099 
1100  QList<Score*> scoreList();
1101  bool switchLayer(const QString& s);
1102  //@ appends to the score a named part as last part
1103  void appendPart(const QString&);
1104  //@ appends to the score a number of measures
1105  void appendMeasures(int);
1106 
1107  const std::multimap<int, Spanner*>& spanner() const { return _spanner.map(); }
1108  SpannerMap& spannerMap() { return _spanner; }
1109  bool isSpannerStartEnd(const Fraction& tick, int track) const;
1110  void removeSpanner(Spanner*);
1111  void addSpanner(Spanner*);
1112  void cmdAddSpanner(Spanner* spanner, const QPointF& pos, bool firstStaffOnly = false);
1113  void cmdAddSpanner(Spanner* spanner, int staffIdx, Segment* startSegment, Segment* endSegment);
1114  void checkSpanner(const Fraction& startTick, const Fraction& lastTick);
1115  const std::set<Spanner*> unmanagedSpanners() { return _unmanagedSpanner; }
1116  void addUnmanagedSpanner(Spanner*);
1117  void removeUnmanagedSpanner(Spanner*);
1118 
1119  Hairpin* addHairpin(HairpinType, const Fraction& tickStart, const Fraction& tickEnd, int track);
1120  Hairpin* addHairpin(HairpinType, ChordRest* cr1, ChordRest* cr2 = nullptr, bool toCr2End = true);
1121 
1122  ChordRest* findCR(Fraction tick, int track) const;
1123  ChordRest* findCRinStaff(const Fraction& tick, int staffIdx) const;
1124  void insertTime(const Fraction& tickPos, const Fraction&tickLen);
1125 
1126  ScoreFont* scoreFont() const { return _scoreFont; }
1127  void setScoreFont(ScoreFont* f) { _scoreFont = f; }
1128 
1129  qreal noteHeadWidth() const { return _noteHeadWidth; }
1130  void setNoteHeadWidth( qreal n) { _noteHeadWidth = n; }
1131 
1132  QList<int> uniqueStaves() const;
1133  void transpositionChanged(Part*, Interval, Fraction tickStart = { 0, 1 }, Fraction tickEnd = { -1, 1 } );
1134 
1135  void moveUp(ChordRest*);
1136  void moveDown(ChordRest*);
1137  Element* upAlt(Element*);
1138  Note* upAltCtrl(Note*) const;
1139  Element* downAlt(Element*);
1140  Note* downAltCtrl(Note*) const;
1141 
1142  Element* firstElement(bool frame = true);
1143  Element* lastElement(bool frame = true);
1144 
1145  int nmeasures() const;
1146  bool hasLyrics();
1147  bool hasHarmonies();
1148  int lyricCount();
1149  int harmonyCount();
1150  QString extractLyrics();
1151  int keysig();
1152  int duration();
1153 
1154  void cmdInsertClef(Clef* clef, ChordRest* cr);
1155 
1156  void cmdExplode();
1157  void cmdImplode();
1158  void cmdSlashFill();
1159  void cmdSlashRhythm();
1160  void cmdResequenceRehearsalMarks();
1161  void cmdExchangeVoice(int, int);
1162  void cmdRemoveEmptyTrailingMeasures();
1163 
1164  void setAccessibleInfo(QString s) { accInfo = s.remove(":").remove(";"); }
1165  QString accessibleInfo() const { return accInfo; }
1166 
1167  QImage createThumbnail();
1168  QString createRehearsalMarkText(RehearsalMark* current) const;
1169  QString nextRehearsalMarkText(RehearsalMark* previous, RehearsalMark* current) const;
1170 
1171  //@ ??
1172 // Q_INVOKABLE void cropPage(qreal margins);
1173  bool sanityCheck(const QString& name = QString());
1174 
1175  bool checkKeys();
1176  bool checkClefs();
1177 
1178  void switchToPageMode();
1179 
1180  virtual QVariant getProperty(Pid) const override;
1181  virtual bool setProperty(Pid, const QVariant&) override;
1182  virtual QVariant propertyDefault(Pid) const override;
1183 
1184  virtual inline QQueue<MidiInputEvent>* midiInputQueue();
1185  virtual inline std::list<MidiInputEvent>* activeMidiPitches();
1186 
1187  virtual QString title() const;
1188 
1189  void cmdTimeDelete();
1190  void localTimeDelete();
1191  void globalTimeDelete();
1192 
1193  bool isTopScore() const;
1194 
1195  Text* headerText() const { return movements()->headerText(); }
1196  Text* footerText() const { return movements()->footerText(); }
1197  void setHeaderText(Text* t) { movements()->setHeaderText(t); }
1198  void setFooterText(Text* t) { movements()->setFooterText(t); }
1199 
1200  void cmdAddPitch(int note, bool addFlag, bool insert);
1201  void forAllLyrics(std::function<void(Lyrics*)> f);
1202 
1203  System* getNextSystem(LayoutContext&);
1204  void hideEmptyStaves(System* system, bool isFirstSystem);
1205  void layoutLyrics(System*);
1206  void createBeams(Measure*);
1207 
1208  constexpr static double defaultTempo() { return _defaultTempo; }
1209 
1211  friend class Chord;
1212  };
1213 
1214 static inline Score* toScore(ScoreElement* e) {
1215  Q_ASSERT(!e || e->isScore());
1216  return static_cast<Score*>(e);
1217  }
1218 static inline const Score* toScore(const ScoreElement* e) {
1219  Q_ASSERT(!e || e->isScore());
1220  return static_cast<const Score*>(e);
1221  }
1222 
1223 //---------------------------------------------------------
1224 // MasterScore
1225 //---------------------------------------------------------
1226 
1227 class MasterScore : public Score {
1228  Q_OBJECT
1232  bool _expandRepeats { true };
1233  bool _playlistDirty { true };
1234  QList<Excerpt*> _excerpts;
1235  std::vector<PartChannelSettingsLink> _playbackSettingsLinks;
1236  Score* _playbackScore = nullptr;
1238  MasterScore* _next { 0 };
1239  MasterScore* _prev { 0 };
1240  Movements* _movements { 0 };
1241 
1242  bool _readOnly { false };
1243 
1244  CmdState _cmdState; // modified during cmd processing
1245 
1246  Omr* _omr { 0 };
1247  bool _showOmr { false };
1248 
1249  Fraction _pos[3];
1250 
1251  int _midiPortCount { 0 }; // A count of JACK/ALSA midi out ports
1252  QQueue<MidiInputEvent> _midiInputQueue; // MIDI events that have yet to be processed
1253  std::list<MidiInputEvent> _activeMidiPitches; // MIDI keys currently being held down
1254  std::vector<MidiMapping> _midiMapping;
1255  bool isSimpleMidiMaping; // midi mapping is simple if all ports and channels
1256  // don't decrease and don't have gaps
1257  QSet<int> occupiedMidiChannels; // each entry is port*16+channel, port range: 0-inf, channel: 0-15
1258  unsigned int searchMidiMappingFrom; // makes getting next free MIDI mapping faster
1259 
1260  void parseVersion(const QString&);
1261  void reorderMidiMapping();
1262  void rebuildExcerptsMidiMapping();
1263  void removeDeletedMidiMapping();
1264  int updateMidiMapping();
1265 
1267  QFileInfo info;
1268 
1269  bool read(XmlReader&);
1270  void setPrev(MasterScore* s) { _prev = s; }
1271  void setNext(MasterScore* s) { _next = s; }
1272 
1273  public:
1274  MasterScore();
1275  MasterScore(const MStyle&);
1276  virtual ~MasterScore();
1277  MasterScore* clone();
1278 
1279  virtual bool isMaster() const override { return true; }
1280  virtual bool readOnly() const override { return _readOnly; }
1281  void setReadOnly(bool ro) { _readOnly = ro; }
1282  virtual UndoStack* undoStack() const override { return _movements->undo(); }
1283  virtual TimeSigMap* sigmap() const override { return _sigmap; }
1284  virtual TempoMap* tempomap() const override { return _tempomap; }
1285 
1286  virtual bool playlistDirty() const override { return _playlistDirty; }
1287  virtual void setPlaylistDirty() override;
1288  void setPlaylistClean() { _playlistDirty = false; }
1289 
1290  void setExpandRepeats(bool expandRepeats);
1291  void updateRepeatListTempo();
1292  virtual const RepeatList& repeatList() const override;
1293 
1294  virtual QList<Excerpt*>& excerpts() override { return _excerpts; }
1295  virtual const QList<Excerpt*>& excerpts() const override { return _excerpts; }
1296  virtual QQueue<MidiInputEvent>* midiInputQueue() override { return &_midiInputQueue; }
1297  virtual std::list<MidiInputEvent>* activeMidiPitches() override { return &_activeMidiPitches; }
1298 
1299  MasterScore* next() const { return _next; }
1300  MasterScore* prev() const { return _prev; }
1301  virtual Movements* movements() override { return _movements; }
1302  virtual const Movements* movements() const override { return _movements; }
1303  void setMovements(Movements* m);
1304  void addMovement(MasterScore* score);
1305 
1306  virtual void setUpdateAll() override;
1307 
1308  void setLayoutAll(int staff = -1, const Element* e = nullptr);
1309  void setLayout(const Fraction& tick, int staff, const Element* e = nullptr);
1310  void setLayout(const Fraction& tick1, const Fraction& tick2, int staff1, int staff2, const Element* e = nullptr);
1311 
1312  virtual CmdState& cmdState() override { return _cmdState; }
1313  const CmdState& cmdState() const override { return _cmdState; }
1314  virtual void addLayoutFlags(LayoutFlags val) override { _cmdState.layoutFlags |= val; }
1315  virtual void setInstrumentsChanged(bool val) override { _cmdState._instrumentsChanged = val; }
1316 
1317  void setExcerptsChanged(bool val) { _cmdState._excerptsChanged = val; }
1318  bool excerptsChanged() const { return _cmdState._excerptsChanged; }
1319  bool instrumentsChanged() const { return _cmdState._instrumentsChanged; }
1320 
1321  Revisions* revisions() { return _revisions; }
1322 
1323  bool isSavable() const;
1324  void setTempomap(TempoMap* tm);
1325 
1326  bool saveFile();
1327  FileError read1(XmlReader&, bool ignoreVersionError);
1328  FileError loadCompressedMsc(QIODevice*, bool ignoreVersionError);
1329  FileError loadMsc(QString name, bool ignoreVersionError);
1330  FileError loadMsc(QString name, QIODevice*, bool ignoreVersionError);
1331  FileError read114(XmlReader&);
1332  FileError read206(XmlReader&);
1333  FileError read301(XmlReader&);
1334  QByteArray readToBuffer();
1335  QByteArray readCompressedToBuffer();
1336 
1337  Omr* omr() const { return _omr; }
1338  void setOmr(Omr* o) { _omr = o; }
1339  void removeOmr();
1340  bool showOmr() const { return _showOmr; }
1341  void setShowOmr(bool v) { _showOmr = v; }
1342 
1343  int midiPortCount() const { return _midiPortCount; }
1344  void setMidiPortCount(int val) { _midiPortCount = val; }
1345  std::vector<MidiMapping>& midiMapping() { return _midiMapping; }
1346  MidiMapping* midiMapping(int channel) { return &_midiMapping[channel]; }
1347  void addMidiMapping(Channel* channel, Part* part, int midiPort, int midiChannel);
1348  void updateMidiMapping(Channel* channel, Part* part, int midiPort, int midiChannel);
1349  int midiPort(int idx) const { return _midiMapping[idx].port(); }
1350  int midiChannel(int idx) const { return _midiMapping[idx].channel(); }
1351  void rebuildMidiMapping();
1352  void checkMidiMapping();
1353  bool exportMidiMapping() { return !isSimpleMidiMaping; }
1354  int getNextFreeMidiMapping(int p = -1, int ch = -1);
1355  int getNextFreeDrumMidiMapping();
1356  void enqueueMidiEvent(MidiInputEvent ev) { _midiInputQueue.enqueue(ev); }
1357  void rebuildAndUpdateExpressive(Synthesizer* synth);
1358  void updateExpressive(Synthesizer* synth);
1359  void updateExpressive(Synthesizer* synth, bool expressive, bool force = false);
1360  void setSoloMute();
1361 
1362  using Score::pos;
1363  Fraction pos(POS pos) const { return _pos[int(pos)]; }
1364  void setPos(POS pos, Fraction tick);
1365 
1366  void addExcerpt(Excerpt*);
1367  void removeExcerpt(Excerpt*);
1368  void deleteExcerpt(Excerpt*);
1369 
1370  void setPlaybackScore(Score*);
1371  Score* playbackScore() { return _playbackScore; }
1372  const Score* playbackScore() const { return _playbackScore; }
1373  Channel* playbackChannel(const Channel* c) { return _midiMapping[c->channel()].articulation(); }
1374  const Channel* playbackChannel(const Channel* c) const { return _midiMapping[c->channel()].articulation(); }
1375 
1376  MasterScore * unrollRepeats();
1377 
1378  QFileInfo* fileInfo() { return &info; }
1379  const QFileInfo* fileInfo() const { return &info; }
1380  void setName(const QString&);
1381 
1382  const QFileInfo& sessionStartBackupInfo() const { return _sessionStartBackupInfo; }
1383 
1384  virtual QString title() const override;
1385 
1386  virtual int pageIdx(Page* page) const override { return movements()->pageIdx(page); }
1387  virtual const QList<Page*>& pages() const override { return movements()->pages(); }
1388  virtual QList<Page*>& pages() override { return movements()->pages(); }
1389  virtual int npages() const override { return movements()->npages(); }
1390 
1391  virtual MStyle& style() override { return movements()->style(); }
1392  virtual const MStyle& style() const override { return movements()->style(); }
1393  };
1394 
1395 //---------------------------------------------------------
1396 // ScoreLoad
1397 //---------------------------------------------------------
1398 
1399 class ScoreLoad {
1400  static int _loading;
1401 
1402  public:
1403  ScoreLoad() { ++_loading; }
1404  ~ScoreLoad() { --_loading; }
1405  static bool loading() { return _loading > 0; }
1406  };
1407 
1408 inline UndoStack* Score::undoStack() const { return _masterScore->undoStack(); }
1409 inline const RepeatList& Score::repeatList() const { return _masterScore->repeatList(); }
1410 inline TempoMap* Score::tempomap() const { return _masterScore->tempomap(); }
1411 inline TimeSigMap* Score::sigmap() const { return _masterScore->sigmap(); }
1412 inline QList<Excerpt*>& Score::excerpts() { return _masterScore->excerpts(); }
1413 inline const QList<Excerpt*>& Score::excerpts() const { return _masterScore->excerpts(); }
1414 inline QQueue<MidiInputEvent>* Score::midiInputQueue() { return _masterScore->midiInputQueue(); }
1415 inline std::list<MidiInputEvent>* Score::activeMidiPitches() { return _masterScore->activeMidiPitches(); }
1416 
1417 inline void Score::setUpdateAll() { _masterScore->setUpdateAll(); }
1418 
1419 inline void Score::setLayoutAll(int staff, const Element* e) { _masterScore->setLayoutAll(staff, e); }
1420 inline void Score::setLayout(const Fraction& tick, int staff, const Element* e) { _masterScore->setLayout(tick, staff, e); }
1421 inline void Score::setLayout(const Fraction& tick1, const Fraction& tick2, int staff1, int staff2, const Element* e) { _masterScore->setLayout(tick1, tick2, staff1, staff2, e); }
1422 
1423 inline CmdState& Score::cmdState() { return _masterScore->cmdState(); }
1424 inline const CmdState& Score::cmdState() const { return _masterScore->cmdState(); }
1425 inline void Score::addLayoutFlags(LayoutFlags f) { _masterScore->addLayoutFlags(f); }
1426 inline void Score::setInstrumentsChanged(bool v) { _masterScore->setInstrumentsChanged(v); }
1427 inline Movements* Score::movements() { return _masterScore->movements(); }
1428 inline const Movements* Score::movements() const { return _masterScore->movements(); }
1429 
1430 inline Fraction Score::pos(POS pos) const { return _masterScore->pos(pos); }
1431 inline void Score::setPos(POS pos, Fraction tick) { _masterScore->setPos(pos, tick); }
1432 
1433 extern MasterScore* gscore;
1434 
1435 Q_DECLARE_OPERATORS_FOR_FLAGS(LayoutFlags);
1436 
1437 } // namespace Ms
1438 
1439 
1440 #endif
1441 
virtual int npages() const
Definition: score.h:976
int _fileDivision
division of current loading *.msc file
Definition: score.h:548
DirectionH
Definition: mscore.h:297
QString * layerTagComments()
Definition: score.h:1068
Helper class for reading beams, tuplets and spanners.
Definition: connector.h:96
bool chord
Definition: score.h:188
Pad
Definition: score.h:102
Selection _selection
Definition: score.h:473
Definition: select.h:136
qreal point(const Spatium sp) const
Definition: score.h:1004
MasterScore * prev() const
Definition: score.h:1300
Fraction startTick() const
Definition: score.h:288
NoteEntryMethod noteEntryMethod() const
Definition: score.h:894
const QList< Layer > & layer() const
Definition: score.h:1070
Definition: durationtype.h:28
void setAccessibleInfo(QString s)
Definition: score.h:1164
bool noteEntryMode() const
Definition: score.h:892
SelectionFilter & selectionFilter()
Definition: score.h:811
virtual const QList< Excerpt * > & excerpts() const override
Definition: score.h:1295
virtual Movements * movements()
Definition: score.h:1427
Global staff data not directly related to drawing.
Definition: staff.h:62
HairpinType
Definition: hairpin.h:27
Pid
Definition: property.h:62
Key
Definition: key.h:28
Virtual base class for Measure, HBox and VBox.
Definition: measurebase.h:61
MasterScore * next() const
Definition: score.h:1299
This class represents a time signature.
Definition: timesig.h:41
signed char _channel
Definition: score.h:166
Definition: tempomap.h:22
const Channel * playbackChannel(const Channel *c) const
Definition: score.h:1374
MidiMapping * midiMapping(int channel)
Definition: score.h:1346
int pageNumberOffset() const
Definition: score.h:1056
bool selectionChanged() const
Definition: score.h:760
Fraction pos(POS pos) const
Definition: score.h:1363
Definition: xml.h:67
void setNext(MasterScore *s)
Definition: score.h:1271
QList< Layer > _layer
Definition: score.h:423
Definition: revisions.h:51
int getLinkId() const
Definition: score.h:1098
void setFooterText(Text *t)
Definition: score.h:362
Definition: omr.h:124
bool operator==(const ScoreContentState &s2) const
Definition: score.h:325
void setHeaderText(Text *t)
Definition: score.h:361
bool saved() const
Definition: score.h:843
void setPlayNote(bool v)
Definition: score.h:757
const Part * part() const
Definition: score.h:175
virtual const RepeatList & repeatList() const
Definition: score.h:1409
bool defaultsRead() const
Definition: score.h:939
bool instrumentsChanged() const
Definition: score.h:1319
int styleI(Sid idx) const
Definition: score.h:871
virtual bool isMaster() const
Definition: score.h:580
virtual int npages() const override
Definition: score.h:1389
Definition: score.h:342
void setShowInstrumentNames(bool v)
Definition: score.h:787
qreal styleD(Sid idx) const
Definition: score.h:870
Definition: undo.h:1038
LayoutFlags layoutFlags
Definition: score.h:272
signed char _port
Definition: score.h:165
Definition: synthesizer.h:41
Virtual base class for slurs, ties, lines etc.
Definition: spanner.h:136
bool styleB(Sid idx) const
Definition: score.h:869
NoteEntryMethod
Definition: input.h:34
TempoMap * _tempomap
Definition: score.h:1230
bool exportMidiMapping()
Definition: score.h:1353
void setMasterScore(MasterScore *s)
Definition: score.h:1040
QString name
Definition: score.h:230
bool _selectionChanged
Definition: score.h:310
void setPos(POS pos, Fraction tick)
Definition: score.h:1431
MStyle _style
Definition: score.h:345
bool layoutRange() const
Definition: score.h:281
Definition: score.h:1399
one measure in a system
Definition: measure.h:65
void setPrev(MasterScore *s)
Definition: score.h:1270
bool isPalette() const
Definition: score.h:943
int _size
Definition: score.h:138
Definition: score.h:1227
SelectType
Definition: mscore.h:139
bool excerptsChanged() const
Definition: score.h:1318
QList< System * > & systems()
Definition: score.h:982
Definition: score.h:162
UndoStack * _undo
Definition: score.h:343
Fraction pos()
Definition: edit.cpp:139
OttavaType
Definition: ottava.h:35
void setShowVBox(bool v)
Definition: score.h:788
Definition: scoreElement.h:173
virtual std::list< MidiInputEvent > * activeMidiPitches()
Definition: score.h:1415
bool created() const
Definition: score.h:841
bool showOmr() const
Definition: score.h:1340
int midiChannel(int idx) const
Definition: score.h:1350
QString styleSt(Sid idx) const
Definition: score.h:868
QFileInfo info
Definition: score.h:1267
bool genCourtesyTimesig() const
Definition: score.h:878
virtual const QList< Page * > & pages() const override
Definition: score.h:1387
void setLayoutMode(LayoutMode lm)
Definition: score.h:1078
UpdateState _updateState
Definition: score.h:429
AccidentalType
Definition: types.h:152
bool markIrregularMeasures() const
Definition: score.h:779
int pitch
Definition: score.h:187
void setPlayPos(const Fraction &tick)
Definition: score.h:883
virtual void addLayoutFlags(LayoutFlags)
Definition: score.h:1425
Fraction endTick() const
Definition: score.h:289
SynthesizerState _synthesizerState
Definition: score.h:550
int pageIdx(Page *page) const
Definition: score.h:352
int startStaff() const
Definition: score.h:290
bool playNote() const
Definition: score.h:756
void setSavedCapture(bool v)
Definition: score.h:845
~ScoreLoad()
Definition: score.h:1404
static int _loading
Definition: score.h:1400
SymId
Definition: sym.h:30
Base class of score layout elements.
Definition: element.h:158
InputState _is
Definition: score.h:444
void deselectAll()
Definition: select.cpp:298
void setExcerpt(Excerpt *e)
Definition: score.h:602
LayoutMode layoutMode() const
Definition: score.h:1077
virtual std::list< MidiInputEvent > * activeMidiPitches() override
Definition: score.h:1297
int channel() const
Definition: instrument.h:175
int currentLayer() const
Definition: score.h:1066
virtual QList< Page * > & pages()
Definition: score.h:979
void cmdDoubleDuration()
Definition: score.h:616
virtual QList< Page * > & pages() override
Definition: score.h:1388
Graphic representation of a clef.
Definition: clef.h:132
QQueue< MidiInputEvent > _midiInputQueue
Definition: score.h:1252
Channel * articulation()
Definition: score.h:176
bool pageMode() const
Definition: score.h:1081
void setMidiPortCount(int val)
Definition: score.h:1344
virtual void setUpdateAll()
Definition: score.h:1417
virtual void setInstrumentsChanged(bool val) override
Definition: score.h:1315
virtual const QList< Page * > & pages() const
Definition: score.h:978
void setFooterText(Text *t)
Definition: score.h:1198
virtual const Movements * movements() const override
Definition: score.h:1302
A complete figured bass indication.
Definition: figuredbass.h:232
Measure * getNextMeasure(Measure *m)
Definition: measureproperties.cpp:69
QList< Page * > _pages
Definition: score.h:344
int num
Definition: score.h:320
void setSaved(bool v)
Definition: score.h:844
int mscoreRevision() const
Definition: score.h:1060
Definition: hairpin.h:84
bool _instrumentsChanged
Definition: score.h:275
bool _playChord
play whole chord for the selected note
Definition: score.h:309
uint tags
Definition: score.h:231
Definition: score.h:137
void setReadOnly(bool ro)
Definition: score.h:1281
Definition: score.h:391
void setNoteEntryMethod(NoteEntryMethod m)
Definition: score.h:895
virtual UndoStack * undoStack() const
Definition: score.h:1408
std::vector< PartChannelSettingsLink > _playbackSettingsLinks
Definition: score.h:1235
InputState & inputState()
Definition: score.h:900
Definition: keylist.h:28
bool _playNote
play selected note after command
Definition: score.h:308
signed char port() const
Definition: score.h:178
Definition: score.h:256
void setStyleValue(Sid sid, QVariant value)
Definition: score.h:873
void setPlaylistClean()
Definition: score.h:1288
MStyle & style()
Definition: score.h:357
virtual CmdState & cmdState()
Definition: score.h:1423
Definition: synthesizerstate.h:55
PropertyFlags
Definition: property.h:54
QFlags< LayoutFlag > LayoutFlags
Definition: score.h:214
Definition: repeatlist.h:53
void cmdDecDurationDotted()
Definition: score.h:619
constexpr qreal val() const
Definition: spatium.h:32
ScoreLoad()
Definition: score.h:1403
QFileInfo * fileInfo()
Definition: score.h:1378
void setShowOmr(bool v)
Definition: score.h:1341
QString * layerTags()
Definition: score.h:1067
Definition: bracket.h:29
const QList< Staff * > & staves() const
Definition: score.h:636
bool showInstrumentNames() const
Definition: score.h:780
const std::multimap< int, Spanner * > & map() const
Definition: spannermap.h:36
int mscVersion() const
Definition: score.h:916
virtual void setInstrumentsChanged(bool)
Definition: score.h:1426
RepeatList * _repeatList
Definition: score.h:1231
const QFileInfo * fileInfo() const
Definition: score.h:1379
PlayMode
Definition: score.h:220
QString accInfo
information used by the screen-reader
Definition: score.h:479
Definition: score.h:196
Example of 1/8 triplet: _baseLen = 1/8 _actualNotes = 3 _normalNotes = 2 (3 notes played in the time ...
Definition: tuplet.h:37
const InputState & inputState() const
Definition: score.h:899
void setLoopOutTick(const Fraction &tick)
Definition: score.h:887
Type
Definition: layoutbreak.h:30
Selection & selection()
Definition: score.h:810
const std::multimap< int, Spanner * > & spanner() const
Definition: score.h:1107
int ntracks() const
Definition: score.h:638
#define VOICES
Definition: mscore.h:72
void setInputState(const InputState &st)
Definition: score.h:901
void setSpatium(qreal v)
Definition: score.h:876
MasterScore * masterScore() const
Definition: score.h:1039
bool tagIsValid(uint tag) const
Definition: score.h:1071
void deleteLater(ScoreElement *e)
Definition: score.h:762
uint currentLayerMask() const
Definition: score.h:1064
Definition: layout.h:26
virtual QList< Excerpt * > & excerpts() override
Definition: score.h:1294
bool _excerptsChanged
Definition: score.h:274
int fileDivision(int t) const
Definition: score.h:832
std::list< MidiInputEvent > _activeMidiPitches
Definition: score.h:1253
virtual TimeSigMap * sigmap() const
Definition: score.h:1411
Spatium styleS(Sid idx) const
Definition: score.h:866
void setPrinting(bool val)
Definition: score.h:847
Omr * omr() const
Definition: score.h:1337
void undo(EditData *)
Definition: undo.cpp:372
Staff * staff(int n) const
Definition: score.h:641
int midiPortCount() const
Definition: score.h:1343
int npages() const
Definition: score.h:353
LayoutMode
Definition: score.h:129
const QList< MuseScoreView * > & getViewer() const
Definition: score.h:1075
PartChannelSettingsLink link
Definition: score.h:168
int midiPort(int idx) const
Definition: score.h:1349
bool updateRange() const
Definition: score.h:283
void setHeaderText(Text *t)
Definition: score.h:1197
SynthesizerState & synthesizerState()
Definition: score.h:1033
void clear()
Definition: score.h:149
MeasureBase * _last
Definition: score.h:140
Definition: input.h:42
void addViewer(MuseScoreView *v)
Definition: score.h:1073
int size() const
Definition: score.h:155
QString importedFilePath() const
Definition: score.h:835
SpannerMap _spanner
Definition: score.h:435
SegmentType
Definition: types.h:333
QFileInfo _sessionStartBackupInfo
Definition: score.h:1266
Tid
Enumerates the list of built-in text substyles.
Definition: types.h:371
bool showInvisible() const
Definition: score.h:775
Definition: sym.h:2768
const MStyle & style() const
Definition: score.h:358
Definition: select.h:115
ScoreContentState()
Definition: score.h:322
Definition: key.h:95
Part * _part
Definition: score.h:163
bool showUnprintable() const
Definition: score.h:776
void transposeInterval(int pitch, int tpc, int *rpitch, int *rtpc, Interval interval, bool useDoubleSharpsFlats)
Definition: transpose.cpp:90
void setPlayMode(PlayMode v)
Definition: score.h:1094
UpdateMode updateMode() const
Definition: score.h:278
Measure * tick2measure(int tick)
void setPlayChord(bool v)
Definition: score.h:759
static constexpr double defaultTempo()
Definition: score.h:1208
articulation marks
Definition: articulation.h:57
void setExcerptsChanged(bool val)
Definition: score.h:1317
FileError
Definition: score.h:395
void cmdIncDurationDotted()
Definition: score.h:618
Definition: interval.h:22
Definition: segment.h:50
Part * part()
Definition: score.h:174
virtual MStyle & style() override
Definition: score.h:1391
virtual bool readOnly() const override
Definition: score.h:1280
LayoutFlag
Definition: score.h:208
MeasureBase * last() const
Definition: score.h:148
Mode
Definition: beam.h:73
std::set< Spanner * > _unmanagedSpanner
Definition: score.h:436
const QMap< QString, QString > & metaTags() const
Definition: score.h:1044
ScoreFont * _scoreFont
Definition: score.h:426
Definition: aeolus.cpp:26
virtual TempoMap * tempomap() const
Definition: score.h:1410
void unlock()
Definition: score.h:295
QSet< int > occupiedMidiChannels
Definition: score.h:1257
void setAudio(Audio *a)
Definition: score.h:1092
Definition: score.h:305
const Channel * articulation() const
Definition: score.h:177
Definition: score.h:229
Definition: spatium.h:25
QList< Part * > _parts
Definition: score.h:432
MeasureBase * _first
Definition: score.h:139
virtual int pageIdx(Page *page) const override
Definition: score.h:1386
virtual int pageIdx(Page *page) const
Definition: score.h:977
Definition: spannermap.h:27
Sid
Definition: style.h:33
void setLoopInTick(const Fraction &tick)
Definition: score.h:886
virtual QList< Excerpt * > & excerpts()
Definition: score.h:1412
This class implements a rest.
Definition: rest.h:29
Definition: score.h:318
QString accessibleInfo() const
Definition: score.h:1165
void setPaletteMode(bool palette)
Definition: score.h:944
int nstaves() const
Definition: score.h:637
helper structure
Definition: note.h:164
Definition: xml.h:218
Excerpt * excerpt()
Definition: score.h:601
const QList< Part * > & parts() const
Definition: score.h:769
ScoreContentState(const Score *s, int stateNum)
Definition: score.h:323
bool autosaveDirty() const
Definition: score.h:849
bool usingNoteEntryMethod(NoteEntryMethod m)
Definition: score.h:896
QMap< QString, QString > _metaTags
Definition: score.h:469
const Selection & selection() const
Definition: score.h:809
QList< System * > _systems
Definition: score.h:442
NoteType
Definition: types.h:255
Text * footerText() const
Definition: score.h:360
virtual const MStyle & style() const
Definition: score.h:859
int endStaff() const
Definition: score.h:291
Definition: xmlwriter.h:26
virtual bool isMaster() const override
Definition: score.h:1279
QPointF pos
Definition: score.h:201
void setMetaTags(const QMap< QString, QString > &t)
Definition: score.h:1046
Fraction loopOutTick() const
Definition: score.h:885
QString _importedFilePath
Definition: score.h:449
signed char channel() const
Definition: score.h:179
UpDownMode
Definition: mscore.h:169
void setOmr(Omr *o)
Definition: score.h:1338
Channel * masterChannel
Definition: score.h:167
bool floatMode() const
Definition: score.h:1080
static int division
Definition: mscore.h:357
static const char * valueType(const Sid)
Definition: style.cpp:2424
MeasureBaseList _measures
Definition: score.h:431
Graphic representation of a chord.
Definition: chord.h:55
BeatType
Definition: sig.h:29
int inputTrack() const
Definition: score.h:898
Definition: tempo.h:45
void setNoteEntryMode(bool val)
Definition: score.h:893
static bool loading()
Definition: score.h:1405
void setCurrentLayer(int val)
Definition: score.h:1065
void setAutosaveDirty(bool v)
Definition: score.h:848
Fraction playPos() const
Definition: score.h:882
Key transposeKey(Key key, const Interval &interval)
Definition: key.cpp:108
bool printing() const
Definition: score.h:846
bool isSimpleMidiMaping
Definition: score.h:1255
bool operator!=(const ScoreContentState &s2) const
Definition: score.h:326
Definition: harmony.h:72
QMap< QString, QString > & metaTags()
Definition: score.h:1045
Definition: undo.h:156
Definition: chordrest.h:48
bool showVBox() const
Definition: score.h:781
int velocity
Definition: score.h:189
virtual UndoStack * undoStack() const override
Definition: score.h:1282
Direction
Definition: types.h:282
bool isNewerThan(const ScoreContentState &s2) const
Definition: score.h:328
UpdateMode
Definition: score.h:241
virtual QQueue< MidiInputEvent > * midiInputQueue() override
Definition: score.h:1296
qreal styleP(Sid idx) const
Definition: score.h:867
void setPageNumberOffset(int v)
Definition: score.h:1057
Definition: element.h:111
BracketType
Definition: mscore.h:107
MeasureBaseList * measures()
Definition: score.h:984
Definition: instrument.h:100
const std::set< Spanner * > unmanagedSpanners()
Definition: score.h:1115
QVariant styleV(Sid idx) const
Definition: score.h:865
void enqueueMidiEvent(MidiInputEvent ev)
Definition: score.h:1356
Definition: excerpt.h:34
const QList< Page * > & pages() const
Definition: score.h:354
void updateSelection()
Definition: score.h:807
bool systemMode() const
Definition: score.h:1083
const Score * score
Definition: score.h:319
virtual bool playlistDirty() const override
Definition: score.h:1286
QString mscoreVersion() const
Definition: score.h:1059
Fraction loopInTick() const
Definition: score.h:884
void setSelectionChanged(bool val)
Definition: score.h:761
virtual void addLayoutFlags(LayoutFlags val) override
Definition: score.h:1314
Channel * playbackChannel(const Channel *c)
Definition: score.h:1373
const QList< System * > & systems() const
Definition: score.h:981
int tpc(int idx, int pitch, int opt)
Definition: pitchspelling.cpp:539
TimeSigMap * _sigmap
Definition: score.h:1229
Element * getSelectedElement() const
Definition: score.h:808
virtual TempoMap * tempomap() const override
Definition: score.h:1284
QString _tmpName
auto saved with this name if not empty
Definition: score.h:448
int _mscoreRevision
Definition: score.h:419
QList< MuseScoreView * > viewer
Definition: score.h:415
std::vector< MidiMapping > _midiMapping
Definition: score.h:1254
bool updateAll() const
Definition: score.h:282
One row of measures for all instruments; a complete piece of the timeline.
Definition: system.h:79
virtual ElementType type() const override
Definition: score.h:588
QList< ScoreElement * > _deleteList
Definition: score.h:311
MeasureBase * first() const
Definition: score.h:147
void setInputTrack(int t)
Definition: score.h:902
virtual CmdState & cmdState() override
Definition: score.h:1312
Revisions * _revisions
Definition: score.h:1237
Graphic representation of a note.
Definition: note.h:212
Score * playbackScore()
Definition: score.h:1371
CmdState _cmdState
Definition: score.h:1244
void deselectAll()
Definition: score.h:806
bool lineMode() const
Definition: score.h:1082
QList< Excerpt * > _excerpts
Definition: score.h:1234
void update()
Set select flag for all Elements in select list.
Definition: select.cpp:639
bool noStaves() const
Definition: score.h:591
Text * footerText() const
Definition: score.h:1196
MasterScore * gscore
system score, used for palettes etc.
Definition: score.cpp:79
ClefType
Definition: clef.h:37
Definition: fraction.h:46
QList< Part * > & parts()
Definition: score.h:768
QRectF refresh
area to update, canvas coordinates
Definition: score.h:307
ElementType
Definition: types.h:34
bool isScore() const
Definition: scoreElement.h:351
virtual Movements * movements() override
Definition: score.h:1301
TransposeDirection
Definition: mscore.h:123
std::unique_ptr< Channel > _articulation
Definition: score.h:164
QList< Staff * > _staves
Definition: score.h:433
QList< Staff * > & staves()
Definition: score.h:635
virtual MStyle & style()
Definition: score.h:858
QList< Page * > & pages()
Definition: score.h:355
void setTmpName(const QString &s)
Definition: score.h:1011
Definition: event.h:325
MStyle _style
Definition: score.h:445
QString tmpName() const
Definition: score.h:1010
POS
Definition: score.h:100
Revisions * revisions()
Definition: score.h:1321
virtual QQueue< MidiInputEvent > * midiInputQueue()
Definition: score.h:1414
const QFileInfo & sessionStartBackupInfo() const
Definition: score.h:1382
void setLayoutAll(int staff=-1, const Element *e=nullptr)
Definition: score.h:1419
SelectionFilter _selectionFilter
Definition: score.h:474
static std::set< Score * > validScores
Definition: score.h:412
bool showPageborders() const
Definition: score.h:778
SpannerMap & spannerMap()
Definition: score.h:1108
UndoStack * undo() const
Definition: score.h:356
Audio * audio() const
Definition: score.h:1091
Definition: sig.h:127
void cmdHalfDuration()
Definition: score.h:617
QString _mscoreVersion
Definition: score.h:418
Definition: lyrics.h:27
void setFileDivision(int t)
Definition: score.h:833
void splitStaff(std::multimap< int, MTrack > &tracks, std::multimap< int, MTrack >::iterator &it)
Definition: importmidi_lrhand.cpp:363
Definition: part.h:47
void setLayout(const Fraction &tick, int staff, const Element *e=nullptr)
Definition: score.h:1420
QList< MidiArticulation > articulation
Definition: instrument.h:190
ScoreFont * scoreFont() const
Definition: score.h:1126
const CmdState & cmdState() const override
Definition: score.h:1313
const Score * playbackScore() const
Definition: score.h:1372
virtual const MStyle & style() const override
Definition: score.h:1392
Q_DECLARE_OPERATORS_FOR_FLAGS(ElementFlags)
Definition: text.h:24
unsigned int searchMidiMappingFrom
Definition: score.h:1258
Definition: audio.h:25
bool playChord() const
Definition: score.h:758
qreal spatium() const
Definition: score.h:875
Text * headerText() const
Definition: score.h:1195
bool genCourtesyClef() const
Definition: score.h:879
void removeViewer(MuseScoreView *v)
Definition: score.h:1074
QList< Layer > & layer()
Definition: score.h:1069
void setDefaultsRead(bool b)
Definition: score.h:940
void setCreated(bool val)
Definition: score.h:840
virtual TimeSigMap * sigmap() const override
Definition: score.h:1283
Text * headerText() const
Definition: score.h:359
std::vector< MidiMapping > & midiMapping()
Definition: score.h:1345
bool showFrames() const
Definition: score.h:777
qreal noteHeadWidth() const
Definition: score.h:1129
Definition: page.h:34
void setMscVersion(int v)
Definition: score.h:917
bool savedCapture() const
Definition: score.h:842
Definition: undo.h:96
Definition: score.h:186
void update()
Definition: score.h:737
Definition: style.h:1293
PlayMode playMode() const
Definition: score.h:1093
Definition: mscoreview.h:32
void lock()
Definition: score.h:294
void setMscoreRevision(int val)
Definition: score.h:1062
int fileDivision() const
division of current loading *.msc file
Definition: score.h:1008
TransposeMode
Definition: mscore.h:131
Definition: rehearsalmark.h:24
void setNoteHeadWidth(qreal n)
Definition: score.h:1130
void setScoreFont(ScoreFont *f)
Definition: score.h:1127
Definition: channel.h:23
Element * element() const
Definition: select.cpp:144
QList< Page * > _pages
Definition: score.h:441
void setMscoreVersion(const QString &val)
Definition: score.h:1061