Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/engraving/api/v1/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void Chord::remove(apiv1::EngravingItem* wrapped)
LOGW("PluginAPI::Chord::remove: Unable to retrieve element. %s", qPrintable(wrapped->name()));
} else if (s->explicitParent() != chord()) {
LOGW("PluginAPI::Chord::remove: The element is not a child of this chord. Use removeElement() instead.");
} else if (chord()->notes().size() <= 1 && s->type() == ElementType::NOTE) {
} else if (chord()->notes().size() <= 1 && s->isNote()) {
LOGW("PluginAPI::Chord::remove: Removal of final note is not allowed.");
} else {
chord()->score()->deleteItem(s); // Create undo op and remove the element.
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/compat/midi/compatmidirender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void CompatMidiRender::createPlayEvents(const Score* score, Measure const* start
ChordRestNavigateOptions options;
options.skipGrace = true;
if (ChordRest* chr = nextChordRest(chord, options); chr && chr->isChord()) {
nextChord = static_cast<Chord*>(chr);
nextChord = toChord(chr);
}

if (!nextChord) {
Expand Down Expand Up @@ -386,7 +386,7 @@ void CompatMidiRender::renderTremolo(Chord* chord, std::vector<NoteEventList>& e
}

Chord* c2 = toChord(s2El);
if (c2->type() == ElementType::CHORD) {
if (c2->isChord()) {
int notes2 = int(c2->notes().size());
int tnotes = std::max(notes, notes2);
int tticks = chord->ticks().ticks() * 2; // use twice the size
Expand Down Expand Up @@ -803,7 +803,7 @@ bool CompatMidiRender::renderNoteArticulation(NoteEventList* events, Note* note,

std::vector<int> onTimes;
for (Spanner* spanner : note->spannerFor()) {
if (spanner->type() == ElementType::GLISSANDO) {
if (spanner->isGlissando()) {
Glissando* glissando = toGlissando(spanner);
if (!isGlissandoValid(glissando)) {
glissandoState = GlissandoState::INVALID;
Expand Down Expand Up @@ -1086,7 +1086,7 @@ int CompatMidiRender::adjustTrailtime(int trailtime, Chord* currentChord, Chord*
bool CompatMidiRender::noteIsGlissandoStart(mu::engraving::Note* note)
{
for (Spanner* spanner : note->spannerFor()) {
if ((spanner->type() == ElementType::GLISSANDO)
if ((spanner->isGlissando())
&& spanner->endElement()
&& (ElementType::NOTE == spanner->endElement()->type())) {
return true;
Expand Down Expand Up @@ -1155,7 +1155,7 @@ std::set<size_t> CompatMidiRender::getNotesIndexesToRender(Chord* chord)
Glissando* CompatMidiRender::backGlissando(Note* note)
{
for (Spanner* spanner : note->spannerBack()) {
if ((spanner->type() == ElementType::GLISSANDO)
if ((spanner->isGlissando())
&& spanner->startElement()
&& (ElementType::NOTE == spanner->startElement()->type())) {
return toGlissando(spanner);
Expand Down
12 changes: 6 additions & 6 deletions src/engraving/compat/midi/compatmidirenderinternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ int toMilliseconds(float tempo, float midiTime)
bool isGlissandoFor(const Note* note)
{
for (Spanner* spanner : note->spannerFor()) {
if (spanner->type() == ElementType::GLISSANDO) {
if (spanner->isGlissando()) {
return true;
}
}
Expand All @@ -165,7 +165,7 @@ bool isGlissandoFor(const Note* note)
bool isGlissandoBack(const Note* note)
{
for (Spanner* spanner : note->spannerBack()) {
if (spanner->type() == ElementType::GLISSANDO) {
if (spanner->isGlissando()) {
return true;
}
}
Expand Down Expand Up @@ -204,7 +204,7 @@ static Fraction getPlayTicksForBend(const Note* note)
while (tie && tie->endNote()) {
nextNote = tie->endNote();
for (EngravingItem* e : nextNote->el()) {
if (e && (e->type() == ElementType::BEND)) {
if (e && (e->isBend())) {
return nextNote->chord()->tick() - stick;
}
}
Expand Down Expand Up @@ -263,7 +263,7 @@ static void playNote(EventsHolder& events, const Note* note, PlayNoteParams para
}
// adds portamento for continuous glissando
for (Spanner* spanner : note->spannerFor()) {
if (spanner->type() == ElementType::GLISSANDO) {
if (spanner->isGlissando()) {
Glissando* glissando = toGlissando(spanner);
if (glissando->glissandoStyle() == GlissandoStyle::PORTAMENTO) {
Note* nextNote = toNote(spanner->endElement());
Expand Down Expand Up @@ -893,7 +893,7 @@ static void collectNote(EventsHolder& events, const Note* note, const CollectNot
} else {
// old bends implementation
for (const EngravingItem* e : note->el()) {
if (!e || (e->type() != ElementType::BEND)) {
if (!e || (!e->isBend())) {
continue;
}

Expand Down Expand Up @@ -1527,7 +1527,7 @@ static Trill* findFirstTrill(Chord* chord)
{
auto spanners = chord->score()->spannerMap().findOverlapping(1 + chord->tick().ticks(), chord->endTick().ticks() - 1);
for (auto i : spanners) {
if (i.value->type() != ElementType::TRILL) {
if (!i.value->isTrill()) {
continue;
}
if (i.value->track() != chord->track()) {
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/accidental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ bool Accidental::acceptDrop(EditData& data) const
{
const EngravingItem* e = data.dropElement;

if (e->type() == ElementType::ACCIDENTAL) {
if (e->isAccidental()) {
return note();
}

Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/arpeggio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void Arpeggio::spatiumChanged(double oldValue, double newValue)

bool Arpeggio::acceptDrop(EditData& data) const
{
return data.dropElement->type() == ElementType::ARPEGGIO;
return data.dropElement->isArpeggio();
}

//---------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/engraving/dom/barline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,10 +990,10 @@ String BarLine::accessibleExtraInfo() const
if (!score()->selectionFilter().canSelect(e)) {
continue;
}
if (e->type() == ElementType::JUMP) {
if (e->isJump()) {
rez= String(u"%1 %2").arg(rez, e->screenReaderInfo());
}
if (e->type() == ElementType::MARKER) {
if (e->isMarker()) {
const Marker* m1 = toMarker(e);
if (m1->markerType() == MarkerType::FINE) {
rez = String(u"%1 %2").arg(rez, e->screenReaderInfo());
Expand Down Expand Up @@ -1025,7 +1025,7 @@ String BarLine::accessibleExtraInfo() const
if (!score()->selectionFilter().canSelect(s)) {
continue;
}
if (s->type() == ElementType::VOLTA) {
if (s->isVolta()) {
if (s->tick() == tick) {
rez += u"; " + muse::mtrc("engraving", "Start of %1").arg(s->screenReaderInfo());
}
Expand Down
6 changes: 3 additions & 3 deletions src/engraving/dom/box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ PropertyValue Box::propertyDefault(Pid id) const

bool Box::isTitleFrame() const
{
return this == score()->first() && type() == ElementType::VBOX;
return this == score()->first() && isVBox();
}

//---------------------------------------------------------
Expand Down Expand Up @@ -377,7 +377,7 @@ EngravingItem* Box::drop(EditData& data)
break;
}
for (EngravingItem* elem : el()) {
if (elem->type() == ElementType::LAYOUT_BREAK) {
if (elem->isLayoutBreak()) {
score()->undoChangeElement(elem, e);
break;
}
Expand Down Expand Up @@ -532,7 +532,7 @@ RectF HBox::drag(EditData& data)
RectF r(canvasBoundingRect());
double diff = data.evtDelta.x();
double x1 = offset().x() + diff;
if (explicitParent()->type() == ElementType::VBOX) {
if (explicitParent()->isVBox()) {
VBox* vb = toVBox(explicitParent());
double x2 = parentItem()->width() - width() - (vb->leftMargin() + vb->rightMargin()) * DPMM;
if (x1 < 0.0) {
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/bsymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ std::vector<LineF> BSymbol::dragAnchorLines() const

PointF BSymbol::pagePos() const
{
if (explicitParent() && (explicitParent()->type() == ElementType::SEGMENT)) {
if (explicitParent() && (explicitParent()->isSegment())) {
PointF p(pos());
System* system = segment()->measure()->system();
if (system) {
Expand All @@ -206,7 +206,7 @@ PointF BSymbol::pagePos() const

PointF BSymbol::canvasPos() const
{
if (explicitParent() && (explicitParent()->type() == ElementType::SEGMENT)) {
if (explicitParent() && (explicitParent()->isSegment())) {
PointF p(pos());
Segment* s = toSegment(explicitParent());

Expand Down
19 changes: 9 additions & 10 deletions src/engraving/dom/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void Chord::undoUnlink()
}

for (EngravingItem* e : el()) {
if (e->type() == ElementType::CHORDLINE) {
if (e->isChordLine()) {
e->undoUnlink();
}
}
Expand Down Expand Up @@ -946,7 +946,7 @@ Chord* Chord::prev() const
{
ChordRest* prev = prevChordRest(const_cast<Chord*>(this));
if (prev && prev->isChord()) {
return static_cast<Chord*>(prev);
return toChord(prev);
}
return nullptr;
}
Expand All @@ -955,7 +955,7 @@ Chord* Chord::next() const
{
ChordRest* next = nextChordRest(const_cast<Chord*>(this));
if (next && next->isChord()) {
return static_cast<Chord*>(next);
return toChord(next);
}
return nullptr;
}
Expand Down Expand Up @@ -1201,7 +1201,7 @@ PointF Chord::pagePos() const
}
p.rx() = pageX();

const Chord* pc = static_cast<const Chord*>(explicitParent());
const Chord* pc = toChord(explicitParent());
System* system = pc->segment()->system();
if (!system) {
return p;
Expand Down Expand Up @@ -1883,8 +1883,7 @@ void Chord::updateEndsNoteAnchoredLine()
// scan all chord notes for note anchored lines ending on this chord
for (Note* note : notes()) {
for (Spanner* sp : note->spannerBack()) {
bool isNoteAnchoredTextLine = sp->isNoteLine() && toNoteLine(sp)->enforceMinLength();
if (sp->type() == ElementType::GLISSANDO || isNoteAnchoredTextLine) {
if (sp->isGlissando() || (sp->isNoteLine() && toNoteLine(sp)->enforceMinLength())) {
m_endsNoteAnchoredLine = true;
return;
}
Expand Down Expand Up @@ -1969,7 +1968,7 @@ double Chord::mag() const
Segment* Chord::segment() const
{
EngravingItem* e = parentItem();
for (; e && e->type() != ElementType::SEGMENT; e = e->parentItem()) {
for (; e && !e->isSegment(); e = e->parentItem()) {
}
return toSegment(e);
}
Expand All @@ -1981,7 +1980,7 @@ Segment* Chord::segment() const
Measure* Chord::measure() const
{
EngravingItem* e = parentItem();
for (; e && e->type() != ElementType::MEASURE; e = e->parentItem()) {
for (; e && !e->isMeasure(); e = e->parentItem()) {
}
return toMeasure(e);
}
Expand Down Expand Up @@ -2361,7 +2360,7 @@ EngravingItem* Chord::nextElement()
SpannerSegment* s = toSpannerSegment(e);
Spanner* sp = s->spanner();
EngravingItem* elSt = sp->startElement();
assert(elSt->type() == ElementType::NOTE);
assert(elSt->isNote());
Note* n = toNote(elSt);
assert(n != NULL);
if (n == m_notes.front()) {
Expand Down Expand Up @@ -2530,7 +2529,7 @@ EngravingItem* Chord::nextSegmentElement()
for (track_idx_t v = track() + 1; staffIdx() == v / VOICES; ++v) {
EngravingItem* e = segment()->element(v);
if (e) {
if (e->type() == ElementType::CHORD) {
if (e->isChord()) {
return toChord(e)->notes().back();
}

Expand Down
6 changes: 3 additions & 3 deletions src/engraving/dom/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1095,12 +1095,12 @@ String ChordRest::accessibleExtraInfo() const
if (!score()->selectionFilter().canSelect(s)) {
continue;
}
if (s->type() == ElementType::VOLTA //voltas are added for barlines
|| s->type() == ElementType::TIE) { //ties are added in notes
// voltas are added for barlines, ties are added in notes
if (s->isVolta() || s->isTie()) {
continue;
}

if (s->type() == ElementType::SLUR) {
if (s->isSlur()) {
if (s->tick() == tick() && s->track() == track()) {
rez += u" " + muse::mtrc("engraving", "Start of %1").arg(s->screenReaderInfo());
}
Expand Down
3 changes: 1 addition & 2 deletions src/engraving/dom/clef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ double Clef::mag() const

bool Clef::acceptDrop(EditData& data) const
{
return data.dropElement->type() == ElementType::CLEF
|| (/*!generated() &&*/ data.dropElement->type() == ElementType::AMBITUS);
return data.dropElement->isClef() || (/*!generated() &&*/ data.dropElement->isAmbitus());
}

//---------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions src/engraving/dom/engravingitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ EngravingItem* EngravingItem::parentItem(bool explicitParent) const
{
EngravingObject* p = explicitParent ? this->explicitParent() : parent();
if (p && p->isEngravingItem()) {
return static_cast<EngravingItem*>(p);
return toEngravingItem(p);
}

return nullptr;
Expand All @@ -177,7 +177,7 @@ static void collectChildrenItems(const EngravingObject* item, EngravingItemList&
{
for (EngravingObject* ch : item->children()) {
if (ch->isEngravingItem()) {
list.push_back(static_cast<EngravingItem*>(ch));
list.push_back(toEngravingItem(ch));

if (all) {
collectChildrenItems(ch, list, all);
Expand Down Expand Up @@ -2477,7 +2477,7 @@ EngravingItem::BarBeat EngravingItem::barbeat() const
{
EngravingItem::BarBeat barBeat = { 0, 0, 0.0F };
const EngravingItem* parent = this;
while (parent && parent->type() != ElementType::SEGMENT && parent->type() != ElementType::MEASURE) {
while (parent && !parent->isSegment() && !parent->isMeasure()) {
parent = parent->parentItem();
}

Expand All @@ -2494,16 +2494,16 @@ EngravingItem::BarBeat EngravingItem::barbeat() const
const TimeSigMap* timeSigMap = score()->sigmap();
int ticksB = ticks_beat(timeSigMap->timesig(0).timesig().denominator());

if (parent->type() == ElementType::SEGMENT) {
const Segment* segment = static_cast<const Segment*>(parent);
if (parent->isSegment()) {
const Segment* segment = toSegment(parent);
timeSigMap->tickValues(segment->tick().ticks(), &bar, &beat, &ticks);
ticksB = ticks_beat(timeSigMap->timesig(segment->tick().ticks()).timesig().denominator());
measure = segment->findMeasure();
if (measure) {
displayedBar = measure->no();
}
} else if (parent->type() == ElementType::MEASURE) {
measure = static_cast<const Measure*>(parent);
} else if (parent->isMeasure()) {
measure = toMeasure(parent);
bar = measure->no();
displayedBar = bar;
beat = -1;
Expand Down
5 changes: 5 additions & 0 deletions src/engraving/dom/engravingobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ class RehearsalMark;
class Rest;
class Score;
class Segment;
class SLine;
class Slur;
class SlurSegment;
class SlurTie;
class SlurTieSegment;
class Spacer;
class Spanner;
Expand Down Expand Up @@ -465,6 +467,7 @@ class EngravingObject
bool isRestFamily() const { return isRest() || isMMRest() || isMeasureRepeat(); }
bool isChordRest() const { return isRestFamily() || isChord(); }
bool isDurationElement() const { return isChordRest() || isTuplet(); }
bool isSlurTie() const { return isSlur() || isTie(); }
bool isSlurTieSegment() const { return isSlurSegment() || isTieSegment(); }
bool isSLineSegment() const;
bool isBox() const { return isVBox() || isHBox() || isTBox() || isFBox(); }
Expand Down Expand Up @@ -672,11 +675,13 @@ CONVERT(Stem)
CONVERT(Beam)
CONVERT(Hook)
CONVERT(StemSlash)
CONVERT(SLine)
CONVERT(LineSegment)
CONVERT(Slur)
CONVERT(SlurSegment)
CONVERT(Tie)
CONVERT(TieSegment)
CONVERT(SlurTie)
CONVERT(SlurTieSegment)
CONVERT(LaissezVibSegment)
CONVERT(PartialTieSegment)
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/excerpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
// if this harmony is attached to an mmrest,
// be sure to transpose harmony in underlying measure as well
for (EngravingObject* se : h->linkList()) {
Harmony* hh = static_cast<Harmony*>(se);
Harmony* hh = toHarmony(se);
// skip links to other staves (including in other scores)
if (hh->staff() != h->staff()) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ std::unique_ptr<ElementGroup> Expression::getDragGroup(std::function<bool(const

bool Expression::acceptDrop(EditData& ed) const
{
return ed.dropElement->type() == ElementType::DYNAMIC || TextBase::acceptDrop(ed);
return ed.dropElement->isDynamic() || TextBase::acceptDrop(ed);
}

EngravingItem* Expression::drop(EditData& ed)
Expand Down
Loading
Loading