Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/braille/internal/braille.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,8 +1448,8 @@ void Braille::brailleMeasureLyrics(BrailleEngravingItemList* beiz, Measure* meas
ChordRest* cr = seg->cr(staffCount * VOICES + voice);
if (cr && !cr->lyrics().empty()) {
for (Lyrics* l : cr->lyrics()) {
int no = l->no();
lyrics[no].addLyricsItem(l);
int verse = l->verse();
lyrics[verse].addLyricsItem(l);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/engraving/dom/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,20 +1136,20 @@ void ChordRest::setMelismaEnd(bool v)
// lyrics
//---------------------------------------------------------

Lyrics* ChordRest::lyrics(int no) const
Lyrics* ChordRest::lyrics(int verse) const
{
for (Lyrics* l : m_lyrics) {
if (l->no() == no) {
if (l->verse() == verse) {
return l;
}
}
return 0;
}

Lyrics* ChordRest::lyrics(int no, PlacementV p) const
Lyrics* ChordRest::lyrics(int verse, PlacementV p) const
{
for (Lyrics* l : m_lyrics) {
if (l->placement() == p && l->no() == no) {
if (l->placement() == p && l->verse() == verse) {
return l;
}
}
Expand All @@ -1167,8 +1167,8 @@ int ChordRest::lastVerse(PlacementV p) const
int lastVerse = -1;

for (Lyrics* l : m_lyrics) {
if (l->placement() == p && l->no() > lastVerse) {
lastVerse = l->no();
if (l->placement() == p && l->verse() > lastVerse) {
lastVerse = l->verse();
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/engraving/dom/lyrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ Lyrics::Lyrics(ChordRest* parent)
{
m_separator = 0;
initElementStyle(&lyricsElementStyle);
m_no = 0;
m_verse = 0;
m_ticks = Fraction(0, 1);
m_syllabic = LyricsSyllabic::SINGLE;
}

Lyrics::Lyrics(const Lyrics& l)
: TextBase(l)
{
m_no = l.m_no;
m_verse = l.m_verse;
m_ticks = l.m_ticks;
m_syllabic = l.m_syllabic;
m_separator = 0;
Expand All @@ -82,7 +82,7 @@ Lyrics::~Lyrics()

TranslatableString Lyrics::subtypeUserName() const
{
return TranslatableString("engraving", "Verse %1").arg(m_no + 1);
return TranslatableString("engraving", "Verse %1").arg(m_verse + 1);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -141,11 +141,11 @@ bool Lyrics::isMelisma() const
const ChordRest* trackNextCR = s ? s->nextChordRest(track) : nullptr;
if (trackNextCR) {
if (lyrTrack != track && lyrVoiceNextCR
&& !lyrVoiceNextCR->lyrics(m_no, placement()) && lyrVoiceNextCR->tick() < trackNextCR->tick()) {
&& !lyrVoiceNextCR->lyrics(m_verse, placement()) && lyrVoiceNextCR->tick() < trackNextCR->tick()) {
// There is an intermediary note in a different voice, this is a melisma
return true;
}
if (trackNextCR->lyrics(m_no, placement())) {
if (trackNextCR->lyrics(m_verse, placement())) {
// Next note has lyrics, not a melisma just a dash
return false;
}
Expand Down Expand Up @@ -378,7 +378,7 @@ void Lyrics::removeFromScore()
continue;
}
PartialLyricsLine* partialLine = toPartialLyricsLine(sp.value);
if (partialLine->isEndMelisma() || partialLine->no() != no() || partialLine->placement() != placement()) {
if (partialLine->isEndMelisma() || partialLine->verse() != verse() || partialLine->placement() != placement()) {
continue;
}
score()->undoRemoveElement(partialLine);
Expand Down Expand Up @@ -409,7 +409,7 @@ PropertyValue Lyrics::getProperty(Pid propertyId) const
case Pid::LYRIC_TICKS:
return m_ticks;
case Pid::VERSE:
return m_no;
return m_verse;
case Pid::AVOID_BARLINES:
return m_avoidBarlines;
default:
Expand Down Expand Up @@ -470,7 +470,7 @@ bool Lyrics::setProperty(Pid propertyId, const PropertyValue& v)
l->setNeedRemoveInvalidSegments();
}
bool followTextStyle = getProperty(Pid::TEXT_STYLE) == propertyDefault(Pid::TEXT_STYLE);
m_no = v.toInt();
m_verse = v.toInt();
if (followTextStyle) {
setProperty(Pid::TEXT_STYLE, propertyDefault(Pid::TEXT_STYLE));
}
Expand Down Expand Up @@ -564,11 +564,11 @@ void Score::forAllLyrics(std::function<void(Lyrics*)> f)

void Lyrics::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::VERSE && no() != v.toInt()) {
if (id == Pid::VERSE && verse() != v.toInt()) {
for (Lyrics* l : chordRest()->lyrics()) {
if (l->no() == v.toInt()) {
if (l->verse() == v.toInt()) {
// verse already exists, swap
l->TextBase::undoChangeProperty(id, no(), ps);
l->TextBase::undoChangeProperty(id, verse(), ps);
PlacementV p = l->placement();
l->TextBase::undoChangeProperty(Pid::PLACEMENT, int(placement()), ps);
TextBase::undoChangeProperty(Pid::PLACEMENT, int(p), ps);
Expand Down
19 changes: 11 additions & 8 deletions src/engraving/dom/lyrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ class Lyrics final : public TextBase

void scanElements(void* data, void (* func)(void*, EngravingItem*), bool all=true) override;

int subtype() const override { return m_no; }
int subtype() const override { return m_verse; }
TranslatableString subtypeUserName() const override;
void setNo(int n) { m_no = n; }
int no() const { return m_no; }
bool isEven() const { return m_no % 2; }
void setVerse(int n) { m_verse = n; }
int verse() const { return m_verse; }
bool isEven() const { return m_verse % 2; }
void setSyllabic(LyricsSyllabic s) { m_syllabic = s; }
LyricsSyllabic syllabic() const { return m_syllabic; }
void add(EngravingItem*) override;
Expand Down Expand Up @@ -105,7 +105,6 @@ class Lyrics final : public TextBase
void setAvoidBarlines(bool v) { m_avoidBarlines = v; }

protected:
int m_no = 0; // row index

private:

Expand All @@ -115,6 +114,7 @@ class Lyrics final : public TextBase

void undoChangeProperty(Pid id, const PropertyValue&, PropertyFlags ps) override;

int m_verse = 0; // row index
Fraction m_ticks; // if > 0 then draw an underline to tick() + _ticks (melisma)
LyricsSyllabic m_syllabic = LyricsSyllabic::SINGLE;
LyricsLine* m_separator = nullptr;
Expand Down Expand Up @@ -177,7 +177,7 @@ class LyricsLineSegment : public LineSegment

virtual double baseLineShift() const;

virtual int no() const { return lyrics()->no(); }
virtual int verse() const { return lyrics()->verse(); }
virtual bool lyricsPlaceAbove() const { return lyrics()->placeAbove(); }
virtual bool lyricsAddToSkyline() const { return lyrics()->addToSkyline(); }
virtual double lineSpacing() const { return lyrics()->lineSpacing(); }
Expand Down Expand Up @@ -206,7 +206,6 @@ class PartialLyricsLine final : public LyricsLine
OBJECT_ALLOCATOR(engraving, PartialLyricsLine)
DECLARE_CLASSOF(ElementType::PARTIAL_LYRICSLINE)

M_PROPERTY2(int, no, setNo, 0)
public:
PartialLyricsLine(EngravingItem* parent);
PartialLyricsLine(const PartialLyricsLine&);
Expand All @@ -218,6 +217,9 @@ class PartialLyricsLine final : public LyricsLine
void setIsEndMelisma(bool val) { m_isEndMelisma = val; }
bool isEndMelisma() const override { return m_isEndMelisma; }

void setVerse(int val) { m_verse = val; }
int verse() const { return m_verse; }

PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const PropertyValue&) override;
PropertyValue propertyDefault(Pid propertyId) const override;
Expand All @@ -231,6 +233,7 @@ class PartialLyricsLine final : public LyricsLine

private:
bool m_isEndMelisma = false;
int m_verse = 0;
};

class PartialLyricsLineSegment final : public LyricsLineSegment
Expand All @@ -246,7 +249,7 @@ class PartialLyricsLineSegment final : public LyricsLineSegment
PartialLyricsLine* lyricsLine() const { return toPartialLyricsLine(spanner()); }
Lyrics* lyrics() const override { return nullptr; }

int no() const override { return lyricsLine()->no(); }
int verse() const override { return lyricsLine()->verse(); }
double lineSpacing() const override;
bool lyricsPlaceAbove() const override { return lyricsLine()->placeAbove(); }// Delegate?
bool lyricsAddToSkyline() const override { return lyricsLine()->addToSkyline(); }
Expand Down
6 changes: 3 additions & 3 deletions src/engraving/dom/lyricsline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ PropertyValue PartialLyricsLine::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::VERSE:
return _no;
return m_verse;
default:
return LyricsLine::getProperty(propertyId);
}
Expand All @@ -205,7 +205,7 @@ bool PartialLyricsLine::setProperty(Pid propertyId, const PropertyValue& val)
{
switch (propertyId) {
case Pid::VERSE:
setNo(val.toInt());
setVerse(val.toInt());
break;
default:
return LyricsLine::setProperty(propertyId, val);
Expand Down Expand Up @@ -302,7 +302,7 @@ Lyrics* PartialLyricsLine::findLyricsInPreviousRepeatSeg() const
const std::vector<Measure*> measures = findPreviousRepeatMeasures(findStartMeasure());

for (const Measure* measure : measures) {
Lyrics* prev = lastLyricsInMeasure(measure->last(SegmentType::ChordRest), staffIdx(), no(), placement());
Lyrics* prev = lastLyricsInMeasure(measure->last(SegmentType::ChordRest), staffIdx(), verse(), placement());

if (!prev) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/navigate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ Lyrics* prevLyrics(const Lyrics* lyrics)
const track_idx_t etrack = strack + VOICES;
for (track_idx_t track = strack; track < etrack; ++track) {
EngravingItem* el = seg->element(track);
Lyrics* prevLyrics = el && el->isChord() ? toChordRest(el)->lyrics(lyrics->no(), lyrics->placement()) : nullptr;
Lyrics* prevLyrics = el && el->isChord() ? toChordRest(el)->lyrics(lyrics->verse(), lyrics->placement()) : nullptr;
if (prevLyrics) {
return prevLyrics;
}
Expand All @@ -1253,7 +1253,7 @@ Lyrics* nextLyrics(const Lyrics* lyrics)
const track_idx_t etrack = strack + VOICES;
for (track_idx_t track = strack; track < etrack; ++track) {
EngravingItem* el = nextSegment->element(track);
Lyrics* nextLyrics = el && el->isChord() ? toChordRest(el)->lyrics(lyrics->no(), lyrics->placement()) : nullptr;
Lyrics* nextLyrics = el && el->isChord() ? toChordRest(el)->lyrics(lyrics->verse(), lyrics->placement()) : nullptr;
if (nextLyrics) {
return nextLyrics;
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5529,7 +5529,7 @@ void Score::changeSelectedElementsVoice(voice_idx_t voice)

// Move lyrics
for (Lyrics* lyric : chord->lyrics()) {
if (!lyric || dstChord->lyrics(lyric->no(), lyric->placement())) {
if (!lyric || dstChord->lyrics(lyric->verse(), lyric->placement())) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/engraving/editing/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3419,7 +3419,7 @@ void Score::cmdMoveRest(Rest* rest, DirectionV dir)

void Score::cmdMoveLyrics(Lyrics* lyrics, DirectionV dir)
{
int verse = lyrics->no() + (dir == DirectionV::UP ? -1 : 1);
int verse = lyrics->verse() + (dir == DirectionV::UP ? -1 : 1);
if (verse < 0) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/editing/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ TextBase* Score::addText(TextStyleType type, EngravingItem* destinationElement)
}
const PartialLyricsLine* line = toPartialLyricsLine(spanner.value);

no = std::max(no, line->no() + 1);
no = std::max(no, line->verse() + 1);
}

// Also check how many partial lines there are
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/score/horizontalspacing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ KerningType HorizontalSpacing::computeLyricsKerningType(const Lyrics* lyrics1, c
{
if (item2->isLyrics()) {
const Lyrics* lyrics2 = toLyrics(item2);
if (lyrics1->no() == lyrics2->no()) {
if (lyrics1->verse() == lyrics2->verse()) {
return KerningType::NON_KERNING;
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/engraving/rendering/score/lyricslayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void LyricsLayout::layout(LyricsLine* item, LayoutContext& ctx)
} else { // dash(es)
item->setNextLyrics(searchNextLyrics(item->lyrics()->segment(),
item->staffIdx(),
item->lyrics()->no(),
item->lyrics()->verse(),
item->lyrics()->placement()
));
item->setTrack2(item->nextLyrics() ? item->nextLyrics()->track() : item->track());
Expand Down Expand Up @@ -306,7 +306,7 @@ void LyricsLayout::layoutDashes(LyricsLineSegment* item)
Lyrics* endLyrics = nullptr;
if (endCR) {
for (Lyrics* lyr : endCR->lyrics()) {
if (lyr->no() == item->no()) {
if (lyr->verse() == item->verse()) {
endLyrics = lyr;
break;
}
Expand Down Expand Up @@ -409,7 +409,7 @@ Lyrics* LyricsLayout::findNextLyrics(const ChordRest* endChordRest, int verseNum
}
ChordRest* nextCR = toChordRest(segment->elementAt(endChordRest->track()));
for (Lyrics* lyr : nextCR->lyrics()) {
if (lyr->no() == verseNumber) {
if (lyr->verse() == verseNumber) {
return lyr;
}
}
Expand Down Expand Up @@ -588,7 +588,7 @@ void LyricsLayout::collectLyricsVerses(staff_idx_t staffIdx, System* system, Lyr
continue;
}
for (Lyrics* lyrics : toChordRest(element)->lyrics()) {
int verse = lyrics->no();
int verse = lyrics->verse();
if (lyrics->placeAbove()) {
lyricsVersesAbove[verse].addLyrics(lyrics);
} else {
Expand All @@ -605,7 +605,7 @@ void LyricsLayout::collectLyricsVerses(staff_idx_t staffIdx, System* system, Lyr
continue;
}
LyricsLineSegment* lyricsLineSegment = toLyricsLineSegment(spannerSegment);
int verse = lyricsLineSegment->no();
int verse = lyricsLineSegment->verse();
if (lyricsLineSegment->lyricsPlaceAbove()) {
lyricsVersesAbove[verse].addLine(lyricsLineSegment);
} else {
Expand Down Expand Up @@ -876,7 +876,7 @@ void LyricsLayout::adjustLyricsLineYOffset(LyricsLineSegment* item, const Lyrics

// Partial melisma or dashes
if (lyricsLine->isPartialLyricsLine()) {
Lyrics* nextLyrics = findNextLyrics(endChordRest, item->no());
Lyrics* nextLyrics = findNextLyrics(endChordRest, item->verse());
item->ryoffset() = nextLyrics ? nextLyrics->offset().y() : item->offset().y();
return;
}
Expand All @@ -887,7 +887,7 @@ void LyricsLayout::adjustLyricsLineYOffset(LyricsLineSegment* item, const Lyrics
}

if (melisma || !endLyrics) {
Lyrics* nextLyrics = findNextLyrics(endChordRest, item->no());
Lyrics* nextLyrics = findNextLyrics(endChordRest, item->verse());
item->ryoffset() = nextLyrics ? nextLyrics->offset().y() : startLyrics->offset().y();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rw/read114/read114.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ static void readMeasure(Measure* m, int staffIdx, XmlReader& e, ReadContext& ctx
while (e.readNextStartElement()) {
const AsciiStringView t(e.name());
if (t == "no") {
l->setNo(e.readInt());
l->setVerse(e.readInt());
if (l->isEven()) {
l->initTextStyleType(TextStyleType::LYRICS_EVEN);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rw/read400/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2948,7 +2948,7 @@ bool TRead::readProperties(Lyrics* l, XmlReader& e, ReadContext& ctx)
const AsciiStringView tag(e.name());

if (tag == "no") {
l->setNo(e.readInt());
l->setVerse(e.readInt());
if (l->isEven()) {
l->initTextStyleType(TextStyleType::LYRICS_EVEN);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rw/read410/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3183,7 +3183,7 @@ bool TRead::readProperties(Lyrics* l, XmlReader& e, ReadContext& ctx)
const AsciiStringView tag(e.name());

if (tag == "no") {
l->setNo(e.readInt());
l->setVerse(e.readInt());
if (l->isEven()) {
l->initTextStyleType(TextStyleType::LYRICS_EVEN);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rw/read460/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3162,7 +3162,7 @@ bool TRead::readProperties(Lyrics* l, XmlReader& e, ReadContext& ctx)
const AsciiStringView tag(e.name());

if (tag == "no") {
l->setNo(e.readInt());
l->setVerse(e.readInt());
if (l->isEven()) {
l->initTextStyleType(TextStyleType::LYRICS_EVEN);
}
Expand Down
2 changes: 1 addition & 1 deletion src/importexport/capella/internal/capella.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ static Fraction readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, const
if (v.hyphen) {
l->setSyllabic(LyricsSyllabic::BEGIN);
}
l->setNo(v.num);
l->setVerse(v.num);
l->initTextStyleType(l->isEven() ? TextStyleType::LYRICS_EVEN : TextStyleType::LYRICS_ODD, /*preserveDifferent*/ true);
chord->add(l);
}
Expand Down
Loading
Loading