2015-02-04 22:12:13 +01:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
2017-01-18 14:16:33 +01:00
|
|
|
// Copyright (C) 2017 Werner Schweer
|
2015-02-04 22:12:13 +01:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __SCORE_ELEMENT_H__
|
|
|
|
#define __SCORE_ELEMENT_H__
|
|
|
|
|
2017-06-22 12:42:14 +02:00
|
|
|
#include "types.h"
|
|
|
|
|
2015-02-04 22:12:13 +01:00
|
|
|
namespace Ms {
|
|
|
|
|
2017-01-18 14:16:33 +01:00
|
|
|
class ScoreElement;
|
2016-03-10 10:41:31 +01:00
|
|
|
class MasterScore;
|
2016-11-19 11:51:21 +01:00
|
|
|
class XmlWriter;
|
2017-01-18 14:16:33 +01:00
|
|
|
class Measure;
|
|
|
|
class Staff;
|
|
|
|
class Part;
|
|
|
|
class Score;
|
|
|
|
class Sym;
|
|
|
|
class MuseScoreView;
|
|
|
|
class Segment;
|
|
|
|
class TextStyle;
|
|
|
|
class Element;
|
|
|
|
class BarLine;
|
|
|
|
class Articulation;
|
|
|
|
class Marker;
|
|
|
|
class Clef;
|
|
|
|
class KeySig;
|
|
|
|
class TimeSig;
|
|
|
|
class TempoText;
|
|
|
|
class Breath;
|
|
|
|
class Box;
|
|
|
|
class HBox;
|
|
|
|
class VBox;
|
|
|
|
class TBox;
|
|
|
|
class FBox;
|
|
|
|
class ChordRest;
|
|
|
|
class Slur;
|
|
|
|
class Tie;
|
|
|
|
class Glissando;
|
|
|
|
class GlissandoSegment;
|
|
|
|
class SystemDivider;
|
|
|
|
class RehearsalMark;
|
|
|
|
class Harmony;
|
|
|
|
class Volta;
|
|
|
|
class Jump;
|
|
|
|
class StaffText;
|
|
|
|
class Ottava;
|
|
|
|
class Note;
|
|
|
|
class Chord;
|
|
|
|
class Rest;
|
|
|
|
class LayoutBreak;
|
|
|
|
class Tremolo;
|
|
|
|
class System;
|
|
|
|
class Lyrics;
|
|
|
|
class LyricsLine;
|
|
|
|
class LyricsLineSegment;
|
|
|
|
class Stem;
|
|
|
|
class SlurSegment;
|
|
|
|
class TieSegment;
|
|
|
|
class OttavaSegment;
|
|
|
|
class Beam;
|
|
|
|
class Hook;
|
|
|
|
class StemSlash;
|
|
|
|
class Spacer;
|
|
|
|
class StaffLines;
|
|
|
|
class Ambitus;
|
|
|
|
class Bracket;
|
|
|
|
class InstrumentChange;
|
|
|
|
class Text;
|
|
|
|
class Hairpin;
|
|
|
|
class HairpinSegment;
|
|
|
|
class Bend;
|
|
|
|
class TremoloBar;
|
|
|
|
class RepeatMeasure;
|
|
|
|
class Tuplet;
|
|
|
|
class NoteDot;
|
|
|
|
class Dynamic;
|
|
|
|
class InstrumentName;
|
|
|
|
class DurationElement;
|
|
|
|
class Accidental;
|
|
|
|
class TextLine;
|
|
|
|
class TextLineSegment;
|
|
|
|
class Pedal;
|
|
|
|
class PedalSegment;
|
|
|
|
class LedgerLine;
|
|
|
|
class Icon;
|
|
|
|
class VoltaSegment;
|
|
|
|
class NoteLine;
|
|
|
|
class Trill;
|
|
|
|
class TrillSegment;
|
|
|
|
class Symbol;
|
|
|
|
class FSymbol;
|
|
|
|
class Fingering;
|
|
|
|
class NoteHead;
|
|
|
|
class FiguredBass;
|
|
|
|
class StaffState;
|
|
|
|
class Arpeggio;
|
|
|
|
class Image;
|
|
|
|
class ChordLine;
|
|
|
|
class SlurTieSegment;
|
|
|
|
class FretDiagram;
|
|
|
|
class StaffTypeChange;
|
|
|
|
class MeasureBase;
|
2017-01-19 16:06:40 +01:00
|
|
|
class Page;
|
2017-01-20 11:05:52 +01:00
|
|
|
class SystemText;
|
2017-03-31 13:03:15 +02:00
|
|
|
class BracketItem;
|
2017-12-20 16:49:30 +01:00
|
|
|
class Spanner;
|
|
|
|
class SpannerSegment;
|
|
|
|
class BagpipeEmbellishment;
|
|
|
|
class LineSegment;
|
|
|
|
class BSymbol;
|
|
|
|
class TextLineBase;
|
2015-02-12 11:41:39 +01:00
|
|
|
|
2017-11-27 09:56:41 +01:00
|
|
|
class LetRing;
|
|
|
|
class LetRingSegment;
|
|
|
|
class Vibrato;
|
|
|
|
class VibratoSegment;
|
2017-11-27 16:55:52 +01:00
|
|
|
class PalmMute;
|
|
|
|
class PalmMuteSegment;
|
2017-11-27 09:56:41 +01:00
|
|
|
|
2016-07-09 17:07:12 +02:00
|
|
|
enum class P_ID : int;
|
2017-01-16 20:51:12 +01:00
|
|
|
enum class PropertyFlags : char;
|
2016-07-09 17:07:12 +02:00
|
|
|
enum class StyleIdx : int;
|
|
|
|
|
2015-02-12 11:41:39 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// LinkedElements
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class LinkedElements : public QList<ScoreElement*> {
|
|
|
|
int _lid; // unique id for every linked list
|
|
|
|
|
|
|
|
public:
|
|
|
|
LinkedElements(Score*);
|
|
|
|
LinkedElements(Score*, int id);
|
2016-03-30 22:33:04 +02:00
|
|
|
|
2015-02-12 11:41:39 +01:00
|
|
|
void setLid(Score*, int val);
|
|
|
|
int lid() const { return _lid; }
|
|
|
|
};
|
2015-02-04 22:12:13 +01:00
|
|
|
|
2017-01-18 14:16:33 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ElementName
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
struct ElementName {
|
|
|
|
ElementType type;
|
|
|
|
const char* name;
|
|
|
|
const char* userName;
|
|
|
|
};
|
|
|
|
|
2015-02-04 22:12:13 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ScoreElement
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-02-17 15:09:28 +01:00
|
|
|
class ScoreElement {
|
2015-02-04 22:12:13 +01:00
|
|
|
Score* _score;
|
2016-03-10 10:41:31 +01:00
|
|
|
|
|
|
|
protected:
|
2016-03-30 22:33:04 +02:00
|
|
|
LinkedElements* _links { 0 };
|
2015-02-04 22:12:13 +01:00
|
|
|
|
|
|
|
public:
|
2017-02-17 15:09:28 +01:00
|
|
|
ScoreElement(Score* s) : _score(s) {}
|
2016-03-30 22:33:04 +02:00
|
|
|
ScoreElement(const ScoreElement& se);
|
|
|
|
virtual ~ScoreElement();
|
|
|
|
|
2015-02-04 22:12:13 +01:00
|
|
|
Score* score() const { return _score; }
|
2016-03-10 10:41:31 +01:00
|
|
|
MasterScore* masterScore() const;
|
2015-02-04 22:12:13 +01:00
|
|
|
virtual void setScore(Score* s) { _score = s; }
|
2017-03-04 15:01:42 +01:00
|
|
|
const char* name() const;
|
2017-01-18 14:16:33 +01:00
|
|
|
virtual QString userName() const;
|
|
|
|
virtual ElementType type() const = 0;
|
|
|
|
|
|
|
|
static ElementType name2type(const QStringRef&);
|
|
|
|
static const char* name(ElementType);
|
2015-02-04 22:12:13 +01:00
|
|
|
|
|
|
|
virtual QVariant getProperty(P_ID) const = 0;
|
|
|
|
virtual bool setProperty(P_ID, const QVariant&) = 0;
|
|
|
|
virtual QVariant propertyDefault(P_ID) const { return QVariant(); }
|
|
|
|
virtual void resetProperty(P_ID id);
|
2017-12-13 15:49:55 +01:00
|
|
|
|
|
|
|
virtual PropertyFlags& propertyFlags(P_ID);
|
|
|
|
|
|
|
|
virtual void setPropertyFlags(P_ID, PropertyFlags);
|
|
|
|
|
2016-07-09 17:07:12 +02:00
|
|
|
virtual StyleIdx getPropertyStyle(P_ID) const;
|
2015-02-04 22:12:13 +01:00
|
|
|
|
2017-01-18 14:16:33 +01:00
|
|
|
void undoChangeProperty(P_ID id, const QVariant&, PropertyFlags ps);
|
|
|
|
void undoChangeProperty(P_ID id, const QVariant&);
|
|
|
|
void undoResetProperty(P_ID id);
|
|
|
|
|
2015-02-04 22:12:13 +01:00
|
|
|
void undoPushProperty(P_ID);
|
2016-11-19 11:51:21 +01:00
|
|
|
void writeProperty(XmlWriter& xml, P_ID id) const;
|
2015-02-12 11:41:39 +01:00
|
|
|
|
|
|
|
QList<ScoreElement*> linkList() const;
|
|
|
|
|
|
|
|
void linkTo(ScoreElement*);
|
|
|
|
void unlink();
|
|
|
|
virtual void undoUnlink();
|
|
|
|
int lid() const { return _links ? _links->lid() : 0; }
|
|
|
|
const LinkedElements* links() const { return _links; }
|
|
|
|
void setLinks(LinkedElements* le) { _links = le; }
|
2017-01-18 14:16:33 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------
|
|
|
|
// check type
|
|
|
|
//
|
|
|
|
// Example for ChordRest:
|
|
|
|
//
|
|
|
|
// bool isChordRest()
|
|
|
|
//---------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#define CONVERT(a,b) \
|
|
|
|
bool is##a() const { return type() == ElementType::b; }
|
|
|
|
|
|
|
|
CONVERT(Note, NOTE)
|
|
|
|
CONVERT(Rest, REST)
|
|
|
|
CONVERT(Chord, CHORD)
|
|
|
|
CONVERT(BarLine, BAR_LINE)
|
|
|
|
CONVERT(Articulation, ARTICULATION)
|
|
|
|
CONVERT(Marker, MARKER)
|
|
|
|
CONVERT(Clef, CLEF)
|
|
|
|
CONVERT(KeySig, KEYSIG)
|
|
|
|
CONVERT(TimeSig, TIMESIG)
|
|
|
|
CONVERT(Measure, MEASURE)
|
|
|
|
CONVERT(TempoText, TEMPO_TEXT)
|
|
|
|
CONVERT(Breath, BREATH)
|
|
|
|
CONVERT(HBox, HBOX)
|
|
|
|
CONVERT(VBox, VBOX)
|
|
|
|
CONVERT(TBox, TBOX)
|
|
|
|
CONVERT(FBox, FBOX)
|
|
|
|
CONVERT(Tie, TIE)
|
|
|
|
CONVERT(Slur, SLUR)
|
|
|
|
CONVERT(Glissando, GLISSANDO)
|
|
|
|
CONVERT(GlissandoSegment, GLISSANDO_SEGMENT)
|
|
|
|
CONVERT(SystemDivider, SYSTEM_DIVIDER)
|
|
|
|
CONVERT(RehearsalMark, REHEARSAL_MARK)
|
|
|
|
CONVERT(Harmony, HARMONY)
|
|
|
|
CONVERT(Volta, VOLTA)
|
|
|
|
CONVERT(Jump, JUMP)
|
|
|
|
CONVERT(Ottava, OTTAVA)
|
|
|
|
CONVERT(LayoutBreak, LAYOUT_BREAK)
|
|
|
|
CONVERT(Segment, SEGMENT)
|
|
|
|
CONVERT(Tremolo, TREMOLO)
|
|
|
|
CONVERT(System, SYSTEM)
|
|
|
|
CONVERT(Lyrics, LYRICS)
|
|
|
|
CONVERT(Stem, STEM)
|
|
|
|
CONVERT(Beam, BEAM)
|
|
|
|
CONVERT(Hook, HOOK)
|
|
|
|
CONVERT(StemSlash, STEM_SLASH)
|
|
|
|
CONVERT(SlurSegment, SLUR_SEGMENT)
|
|
|
|
CONVERT(TieSegment, TIE_SEGMENT)
|
|
|
|
CONVERT(Spacer, SPACER)
|
|
|
|
CONVERT(StaffLines, STAFF_LINES)
|
|
|
|
CONVERT(Ambitus, AMBITUS)
|
|
|
|
CONVERT(Bracket, BRACKET)
|
|
|
|
CONVERT(InstrumentChange, INSTRUMENT_CHANGE)
|
|
|
|
CONVERT(StaffTypeChange, STAFFTYPE_CHANGE)
|
|
|
|
CONVERT(Hairpin, HAIRPIN)
|
|
|
|
CONVERT(HairpinSegment,HAIRPIN_SEGMENT)
|
|
|
|
CONVERT(Bend, BEND)
|
|
|
|
CONVERT(TremoloBar, TREMOLOBAR)
|
|
|
|
CONVERT(RepeatMeasure, REPEAT_MEASURE)
|
|
|
|
CONVERT(Tuplet, TUPLET)
|
|
|
|
CONVERT(NoteDot, NOTEDOT)
|
|
|
|
CONVERT(Dynamic, DYNAMIC)
|
|
|
|
CONVERT(InstrumentName, INSTRUMENT_NAME)
|
|
|
|
CONVERT(Accidental, ACCIDENTAL)
|
|
|
|
CONVERT(TextLine, TEXTLINE)
|
|
|
|
CONVERT(TextLineSegment, TEXTLINE_SEGMENT)
|
|
|
|
CONVERT(Pedal, PEDAL)
|
|
|
|
CONVERT(PedalSegment, PEDAL_SEGMENT)
|
|
|
|
CONVERT(OttavaSegment, OTTAVA_SEGMENT)
|
|
|
|
CONVERT(LedgerLine, LEDGER_LINE)
|
|
|
|
CONVERT(Icon, ICON)
|
|
|
|
CONVERT(VoltaSegment, VOLTA_SEGMENT)
|
|
|
|
CONVERT(NoteLine, NOTELINE)
|
|
|
|
CONVERT(Trill, TRILL)
|
|
|
|
CONVERT(TrillSegment, TRILL_SEGMENT)
|
2017-11-27 09:56:41 +01:00
|
|
|
CONVERT(LetRing, LET_RING)
|
|
|
|
CONVERT(LetRingSegment, LET_RING_SEGMENT)
|
|
|
|
CONVERT(Vibrato, VIBRATO)
|
2017-11-27 16:55:52 +01:00
|
|
|
CONVERT(PalmMute, PALM_MUTE)
|
|
|
|
CONVERT(PalmMuteSegment, PALM_MUTE_SEGMENT)
|
|
|
|
CONVERT(VibratoSegment, VIBRATO_SEGMENT)
|
2017-01-18 14:16:33 +01:00
|
|
|
CONVERT(Symbol, SYMBOL)
|
|
|
|
CONVERT(FSymbol, FSYMBOL)
|
|
|
|
CONVERT(Fingering, FINGERING)
|
|
|
|
CONVERT(NoteHead, NOTEHEAD)
|
|
|
|
CONVERT(LyricsLine, LYRICSLINE)
|
|
|
|
CONVERT(LyricsLineSegment, LYRICSLINE_SEGMENT)
|
|
|
|
CONVERT(FiguredBass, FIGURED_BASS)
|
|
|
|
CONVERT(StaffState, STAFF_STATE)
|
|
|
|
CONVERT(Arpeggio, ARPEGGIO)
|
|
|
|
CONVERT(Image, IMAGE)
|
|
|
|
CONVERT(ChordLine, CHORDLINE)
|
|
|
|
CONVERT(FretDiagram, FRET_DIAGRAM)
|
2017-01-19 16:06:40 +01:00
|
|
|
CONVERT(Page, PAGE)
|
2017-01-20 11:05:52 +01:00
|
|
|
CONVERT(SystemText, SYSTEM_TEXT)
|
2017-03-31 13:03:15 +02:00
|
|
|
CONVERT(BracketItem, BRACKET_ITEM)
|
2017-02-08 15:34:53 +01:00
|
|
|
CONVERT(Staff, STAFF)
|
2017-12-20 16:49:30 +01:00
|
|
|
CONVERT(BagpipeEmbellishment, BAGPIPE_EMBELLISHMENT)
|
2017-01-18 14:16:33 +01:00
|
|
|
#undef CONVERT
|
|
|
|
|
|
|
|
bool isChordRest() const { return isRest() || isChord() || isRepeatMeasure(); }
|
|
|
|
bool isDurationElement() const { return isChordRest() || isTuplet(); }
|
|
|
|
bool isSlurTieSegment() const { return isSlurSegment() || isTieSegment(); }
|
2017-01-23 10:54:57 +01:00
|
|
|
bool isStaffText() const { return type() == ElementType::STAFF_TEXT || type() == ElementType::SYSTEM_TEXT; }
|
2017-01-18 14:16:33 +01:00
|
|
|
bool isSLineSegment() const;
|
2017-02-23 11:41:53 +01:00
|
|
|
bool isBox() const { return isVBox() || isHBox() || isTBox() || isFBox(); }
|
|
|
|
bool isMeasureBase() const { return isMeasure() || isBox(); }
|
2017-01-18 14:16:33 +01:00
|
|
|
bool isText() const;
|
2017-12-20 16:49:30 +01:00
|
|
|
bool isTextLineBaseSegment() const {
|
|
|
|
return isHairpinSegment()
|
|
|
|
|| isLetRingSegment()
|
|
|
|
|| isTextLineSegment()
|
|
|
|
|| isOttavaSegment()
|
|
|
|
|| isPalmMuteSegment()
|
|
|
|
|| isPedalSegment()
|
|
|
|
|| isVoltaSegment()
|
|
|
|
;
|
|
|
|
}
|
|
|
|
bool isLineSegment() const {
|
|
|
|
return isGlissandoSegment()
|
|
|
|
|| isLyricsLineSegment()
|
|
|
|
|| isTextLineBaseSegment()
|
|
|
|
|| isTrillSegment()
|
|
|
|
|| isVibratoSegment()
|
|
|
|
;
|
|
|
|
}
|
|
|
|
bool isSpannerSegment() const { return isLineSegment() || isTextLineBaseSegment() || isSlurSegment() || isTieSegment(); }
|
|
|
|
bool isBSymbol() const { return isImage() || isSymbol(); }
|
|
|
|
bool isTextLineBase() const {
|
|
|
|
return isHairpin()
|
|
|
|
|| isLetRing()
|
|
|
|
|| isNoteLine()
|
|
|
|
|| isOttava()
|
|
|
|
|| isPalmMute()
|
|
|
|
|| isPedal()
|
|
|
|
|| isTextLine()
|
|
|
|
|| isVolta()
|
|
|
|
;
|
|
|
|
}
|
|
|
|
bool isSLine() const {
|
|
|
|
return isTextLineBase() || isTrill() || isGlissando() || isVibrato();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isSpanner() const {
|
|
|
|
return isSlur()
|
|
|
|
|| isTie()
|
|
|
|
|| isGlissando()
|
|
|
|
|| isLyricsLine()
|
|
|
|
|| isTextLineBase()
|
|
|
|
|| isSLine()
|
|
|
|
;
|
|
|
|
}
|
2015-02-04 22:12:13 +01:00
|
|
|
};
|
2017-01-18 14:16:33 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------
|
|
|
|
// safe casting of ScoreElement
|
|
|
|
//
|
|
|
|
// Example for ChordRest:
|
|
|
|
//
|
|
|
|
// ChordRest* toChordRest(Element* e)
|
|
|
|
//---------------------------------------------------
|
|
|
|
|
|
|
|
static inline ChordRest* toChordRest(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->type() == ElementType::CHORD || e->type() == ElementType::REST
|
|
|
|
|| e->type() == ElementType::REPEAT_MEASURE);
|
|
|
|
return (ChordRest*)e;
|
|
|
|
}
|
|
|
|
static inline const ChordRest* toChordRest(const ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->type() == ElementType::CHORD || e->type() == ElementType::REST
|
|
|
|
|| e->type() == ElementType::REPEAT_MEASURE);
|
|
|
|
return (const ChordRest*)e;
|
|
|
|
}
|
|
|
|
static inline DurationElement* toDurationElement(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->type() == ElementType::CHORD || e->type() == ElementType::REST
|
|
|
|
|| e->type() == ElementType::REPEAT_MEASURE || e->type() == ElementType::TUPLET);
|
|
|
|
return (DurationElement*)e;
|
|
|
|
}
|
|
|
|
static inline const DurationElement* toDurationElement(const ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->type() == ElementType::CHORD || e->type() == ElementType::REST
|
|
|
|
|| e->type() == ElementType::REPEAT_MEASURE || e->type() == ElementType::TUPLET);
|
|
|
|
return (const DurationElement*)e;
|
|
|
|
}
|
|
|
|
static inline SlurTieSegment* toSlurTieSegment(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->type() == ElementType::SLUR_SEGMENT || e->type() == ElementType::TIE_SEGMENT);
|
|
|
|
return (SlurTieSegment*)e;
|
|
|
|
}
|
|
|
|
static inline const SlurTieSegment* toSlurTieSegment(const ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->type() == ElementType::SLUR_SEGMENT || e->type() == ElementType::TIE_SEGMENT);
|
|
|
|
return (const SlurTieSegment*)e;
|
|
|
|
}
|
|
|
|
static inline const MeasureBase* toMeasureBase(const ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->isMeasure() || e->isVBox() || e->isHBox() || e->isTBox() || e->isFBox());
|
|
|
|
return (const MeasureBase*)e;
|
|
|
|
}
|
|
|
|
static inline MeasureBase* toMeasureBase(ScoreElement* e) {
|
2017-01-23 10:54:57 +01:00
|
|
|
Q_ASSERT(e == 0 || e->isMeasureBase());
|
2017-01-18 14:16:33 +01:00
|
|
|
return (MeasureBase*)e;
|
|
|
|
}
|
2017-02-23 11:41:53 +01:00
|
|
|
static inline Box* toBox(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->isBox());
|
|
|
|
return (Box*)e;
|
|
|
|
}
|
2017-12-20 16:49:30 +01:00
|
|
|
static inline Spanner* toSpanner(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->isSpanner());
|
|
|
|
return (Spanner*)e;
|
|
|
|
}
|
|
|
|
static inline SpannerSegment* toSpannerSegment(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->isSpannerSegment());
|
|
|
|
return (SpannerSegment*)e;
|
|
|
|
}
|
|
|
|
static inline LineSegment* toLineSegment(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->isLineSegment());
|
|
|
|
return (LineSegment*)e;
|
|
|
|
}
|
|
|
|
static inline BSymbol* toBSymbol(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->isBSymbol());
|
|
|
|
return (BSymbol*)e;
|
|
|
|
}
|
|
|
|
static inline TextLineBase* toTextLineBase(ScoreElement* e) {
|
|
|
|
Q_ASSERT(e == 0 || e->isTextLineBase());
|
|
|
|
return (TextLineBase*)e;
|
|
|
|
}
|
2017-01-18 14:16:33 +01:00
|
|
|
|
2017-01-23 10:54:57 +01:00
|
|
|
#define CONVERT(a) \
|
|
|
|
static inline a* to##a(ScoreElement* e) { Q_ASSERT(e == 0 || e->is##a()); return (a*)e; } \
|
|
|
|
static inline const a* to##a(const ScoreElement* e) { Q_ASSERT(e == 0 || e->is##a()); return (const a*)e; }
|
|
|
|
|
|
|
|
CONVERT(Note)
|
|
|
|
CONVERT(Rest)
|
|
|
|
CONVERT(Chord)
|
|
|
|
CONVERT(BarLine)
|
|
|
|
CONVERT(Articulation)
|
|
|
|
CONVERT(Marker)
|
|
|
|
CONVERT(Clef)
|
|
|
|
CONVERT(KeySig)
|
|
|
|
CONVERT(TimeSig)
|
|
|
|
CONVERT(Measure)
|
|
|
|
CONVERT(TempoText)
|
|
|
|
CONVERT(Breath)
|
|
|
|
CONVERT(HBox)
|
|
|
|
CONVERT(VBox)
|
|
|
|
CONVERT(TBox)
|
|
|
|
CONVERT(FBox)
|
|
|
|
CONVERT(Tie)
|
|
|
|
CONVERT(Slur)
|
|
|
|
CONVERT(Glissando)
|
|
|
|
CONVERT(GlissandoSegment)
|
|
|
|
CONVERT(SystemDivider)
|
|
|
|
CONVERT(RehearsalMark)
|
|
|
|
CONVERT(Harmony)
|
|
|
|
CONVERT(Volta)
|
|
|
|
CONVERT(Jump)
|
|
|
|
CONVERT(StaffText)
|
|
|
|
CONVERT(Ottava)
|
|
|
|
CONVERT(LayoutBreak)
|
|
|
|
CONVERT(Segment)
|
|
|
|
CONVERT(Tremolo)
|
|
|
|
CONVERT(System)
|
|
|
|
CONVERT(Lyrics)
|
|
|
|
CONVERT(Stem)
|
|
|
|
CONVERT(Beam)
|
|
|
|
CONVERT(Hook)
|
|
|
|
CONVERT(StemSlash)
|
|
|
|
CONVERT(SlurSegment)
|
|
|
|
CONVERT(TieSegment)
|
|
|
|
CONVERT(Spacer)
|
|
|
|
CONVERT(StaffLines)
|
|
|
|
CONVERT(Ambitus)
|
|
|
|
CONVERT(Bracket)
|
|
|
|
CONVERT(InstrumentChange)
|
|
|
|
CONVERT(StaffTypeChange)
|
|
|
|
CONVERT(Text)
|
|
|
|
CONVERT(Hairpin)
|
|
|
|
CONVERT(HairpinSegment)
|
|
|
|
CONVERT(Bend)
|
|
|
|
CONVERT(TremoloBar)
|
|
|
|
CONVERT(RepeatMeasure)
|
|
|
|
CONVERT(Tuplet)
|
|
|
|
CONVERT(NoteDot)
|
|
|
|
CONVERT(Dynamic)
|
|
|
|
CONVERT(InstrumentName)
|
|
|
|
CONVERT(Accidental)
|
|
|
|
CONVERT(TextLine)
|
|
|
|
CONVERT(TextLineSegment)
|
|
|
|
CONVERT(Pedal)
|
|
|
|
CONVERT(PedalSegment)
|
|
|
|
CONVERT(OttavaSegment)
|
|
|
|
CONVERT(LedgerLine)
|
|
|
|
CONVERT(Icon)
|
|
|
|
CONVERT(VoltaSegment)
|
|
|
|
CONVERT(NoteLine)
|
|
|
|
CONVERT(Trill)
|
|
|
|
CONVERT(TrillSegment)
|
2017-11-27 09:56:41 +01:00
|
|
|
CONVERT(LetRing)
|
|
|
|
CONVERT(LetRingSegment)
|
|
|
|
CONVERT(Vibrato)
|
|
|
|
CONVERT(VibratoSegment)
|
2017-11-27 16:55:52 +01:00
|
|
|
CONVERT(PalmMute)
|
|
|
|
CONVERT(PalmMuteSegment)
|
2017-01-23 10:54:57 +01:00
|
|
|
CONVERT(Symbol)
|
|
|
|
CONVERT(FSymbol)
|
|
|
|
CONVERT(Fingering)
|
|
|
|
CONVERT(NoteHead)
|
|
|
|
CONVERT(LyricsLine)
|
|
|
|
CONVERT(LyricsLineSegment)
|
|
|
|
CONVERT(FiguredBass)
|
|
|
|
CONVERT(StaffState)
|
|
|
|
CONVERT(Arpeggio)
|
|
|
|
CONVERT(Image)
|
|
|
|
CONVERT(ChordLine)
|
|
|
|
CONVERT(FretDiagram)
|
|
|
|
CONVERT(Page)
|
|
|
|
CONVERT(SystemText)
|
2017-03-31 13:03:15 +02:00
|
|
|
CONVERT(BracketItem)
|
2017-02-08 15:34:53 +01:00
|
|
|
CONVERT(Staff)
|
2017-12-20 16:49:30 +01:00
|
|
|
CONVERT(BagpipeEmbellishment)
|
2017-01-18 14:16:33 +01:00
|
|
|
#undef CONVERT
|
|
|
|
|
2015-02-04 22:12:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|