Skip to content

Commit

Permalink
Merge commit 'a3a767abd3bb254e3029498173c3854108af2aad' into develop-…
Browse files Browse the repository at this point in the history
…facsimile-neume-line
  • Loading branch information
lpugin committed Jan 9, 2024
2 parents 2f2e538 + a3a767a commit e59c7b9
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## [unreleased]
* Support for `fTrem@unitdur` (@eNote-GmbH)

## [4.1.0] - 2023-12-15
* Support for staves ordered by `scoreDef`
Expand Down
3 changes: 3 additions & 0 deletions include/vrv/doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ class Doc : public Object {
///@{
Score *GetCorrespondingScore(const Object *object);
const Score *GetCorrespondingScore(const Object *object) const;
// Generic version that does not necessarily rely on precalculated visible scores
Score *GetCorrespondingScore(const Object *object, const std::list<Score *> &scores);
const Score *GetCorrespondingScore(const Object *object, const std::list<Score *> &scores) const;
///@}

/**
Expand Down
4 changes: 3 additions & 1 deletion include/vrv/setscoredeffunctor.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class ScoreDefSetCurrentPageFunctor : public DocFunctor {
*/
///@{
FunctorCode VisitPageEnd(Page *page) override;
FunctorCode VisitScore(Score *score) override;
///@}

protected:
Expand All @@ -97,7 +98,8 @@ class ScoreDefSetCurrentPageFunctor : public DocFunctor {
public:
//
private:
//
// The list of all scores
std::list<Score *> m_scores;
};

//----------------------------------------------------------------------------
Expand Down
19 changes: 13 additions & 6 deletions src/doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,9 +1294,6 @@ void Doc::ConvertToCastOffMensuralDoc(bool castOff)
m_isMensuralMusicOnly = false;
}

// Calling Doc::PrepareData is expected to collect visible scores
assert(m_dataPreparationDone);

// Make sure the document is not cast-off
this->UnCastOffDoc();

Expand Down Expand Up @@ -1555,10 +1552,20 @@ Score *Doc::GetCorrespondingScore(const Object *object)

const Score *Doc::GetCorrespondingScore(const Object *object) const
{
assert(!m_visibleScores.empty());
return this->GetCorrespondingScore(object, m_visibleScores);
}

Score *Doc::GetCorrespondingScore(const Object *object, const std::list<Score *> &scores)
{
return const_cast<Score *>(std::as_const(*this).GetCorrespondingScore(object, scores));
}

const Score *correspondingScore = m_visibleScores.front();
for (Score *score : m_visibleScores) {
const Score *Doc::GetCorrespondingScore(const Object *object, const std::list<Score *> &scores) const
{
assert(!scores.empty());

const Score *correspondingScore = scores.front();
for (Score *score : scores) {
if ((score == object) || Object::IsPreOrdered(score, object)) {
correspondingScore = score;
}
Expand Down
1 change: 0 additions & 1 deletion src/iohumdrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31612,7 +31612,6 @@ void HumdrumInput::finalizeDocument(Doc *doc)
if (m_mens) {
doc->SetMensuralMusicOnly(true);
doc->m_notationType = NOTATIONTYPE_mensural;
doc->PrepareData();
doc->ConvertToCastOffMensuralDoc(true);
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/setscoredeffunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,18 @@ FunctorCode ScoreDefSetCurrentPageFunctor::VisitPageEnd(Page *page)
{
const Object *firstSystem = page->GetFirst(SYSTEM);
const Object *reference = firstSystem ? firstSystem : page;
page->m_score = m_doc->GetCorrespondingScore(reference);
page->m_score = m_doc->GetCorrespondingScore(reference, m_scores);

const Object *lastSystem = page->GetLast(SYSTEM);
reference = lastSystem ? lastSystem : page;
page->m_scoreEnd = m_doc->GetCorrespondingScore(reference);
page->m_scoreEnd = m_doc->GetCorrespondingScore(reference, m_scores);

return FUNCTOR_CONTINUE;
}

FunctorCode ScoreDefSetCurrentPageFunctor::VisitScore(Score *score)
{
m_scores.push_back(score);

return FUNCTOR_CONTINUE;
}
Expand Down
1 change: 0 additions & 1 deletion src/verticalaligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void SystemAligner::Reset()
m_spacingTypes.clear();
m_system = NULL;

ArrayOfObjects &children = this->GetChildrenForModification();
m_bottomAlignment = new StaffAlignment();
m_bottomAlignment->SetStaff(NULL, NULL, this->GetAboveSpacingType(NULL));
m_bottomAlignment->SetParentSystem(this->GetSystem());
Expand Down
4 changes: 2 additions & 2 deletions src/view_beam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ void View::DrawFTremSegment(DeviceContext *dc, Staff *staff, FTrem *fTrem)
secondElement->m_x += (m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)) / 2;
}

// Number of bars to draw
const int allBars = fTrem->GetBeams();
// Number of beams to draw
const int allBars = fTrem->HasBeams() ? fTrem->GetBeams() : fTrem->GetUnitdur() - DURATION_4;
int floatingBars = fTrem->HasBeamsFloat() ? fTrem->GetBeamsFloat() : 0;
int fullBars = allBars - floatingBars;

Expand Down

0 comments on commit e59c7b9

Please sign in to comment.