From 1c02c633bc02d6e2abb9d346292b203535c9b9ae Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 8 Jul 2024 10:31:36 -0400 Subject: [PATCH 1/7] Fix nc and accid jumping after dragging staff Refs: https://github.com/DDMAL/Neon/issues/1231 --- src/editortoolkit_neume.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 50cf062f61d..341b04c5aa8 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -679,7 +679,6 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) SortStaves(); - m_doc->GetDrawingPage()->ResetAligners(); if (m_doc->IsTranscription() && m_doc->HasFacsimile()) m_doc->SyncFromFacsimileDoc(); return true; // Can't reorder by layer since staves contain layers From d02dc6f6b10daabcc716a073da9d02a509752ba5 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 8 Jul 2024 10:31:36 -0400 Subject: [PATCH 2/7] Fix nc and accid jumping after dragging staff Refs: https://github.com/DDMAL/Neon/issues/1231 --- src/editortoolkit_neume.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 50cf062f61d..341b04c5aa8 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -679,7 +679,6 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) SortStaves(); - m_doc->GetDrawingPage()->ResetAligners(); if (m_doc->IsTranscription() && m_doc->HasFacsimile()) m_doc->SyncFromFacsimileDoc(); return true; // Can't reorder by layer since staves contain layers From c63d38ea738624c96ee30fe82685fb34c7898722 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 1 Aug 2024 09:50:27 -0400 Subject: [PATCH 3/7] Fix nc and staff jumping after staff dragging --- src/calcligatureorneumeposfunctor.cpp | 21 ++++++++++++--------- src/editortoolkit_neume.cpp | 1 + src/page.cpp | 19 ++++++++++++------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/calcligatureorneumeposfunctor.cpp b/src/calcligatureorneumeposfunctor.cpp index a13226e6cfb..efefc3dc3f5 100644 --- a/src/calcligatureorneumeposfunctor.cpp +++ b/src/calcligatureorneumeposfunctor.cpp @@ -347,16 +347,19 @@ FunctorCode CalcLigatureOrNeumePosFunctor::VisitNeume(Neume *neume) } } - // If the nc overlaps with the previous, move it back from a line width - if (overlapWithPrevious) { - xRel -= lineWidth; - } + // xRel remains unset with facsimile + if (!m_doc->HasFacsimile()) { + // If the nc overlaps with the previous, move it back from a line width + if (overlapWithPrevious) { + xRel -= lineWidth; + } - nc->SetDrawingXRel(xRel); - // The first glyph set the spacing - unless we are starting a ligature, in which case no spacing should be added - // between the two nc - if (!previousLig) { - xRel += m_doc->GetGlyphWidth(nc->m_drawingGlyphs.at(0).m_fontNo, staffSize, false); + nc->SetDrawingXRel(xRel); + // The first glyph set the spacing - unless we are starting a ligature, in which case no spacing should be + // added between the two nc + if (!previousLig) { + xRel += m_doc->GetGlyphWidth(nc->m_drawingGlyphs.at(0).m_fontNo, staffSize, false); + } } previousNc = nc; diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 341b04c5aa8..8d6f62e5063 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -679,6 +679,7 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) SortStaves(); + m_doc->GetDrawingPage()->LayOutTranscription(true); if (m_doc->IsTranscription() && m_doc->HasFacsimile()) m_doc->SyncFromFacsimileDoc(); return true; // Can't reorder by layer since staves contain layers diff --git a/src/page.cpp b/src/page.cpp index f336123d746..17388407eb8 100644 --- a/src/page.cpp +++ b/src/page.cpp @@ -253,6 +253,9 @@ void Page::LayOutTranscription(bool force) CalcAlignmentPitchPosFunctor calcAlignmentPitchPos(doc); this->Process(calcAlignmentPitchPos); + CalcLigatureOrNeumePosFunctor calcLigatureOrNeumePos(doc); + this->Process(calcLigatureOrNeumePos); + CalcStemFunctor calcStem(doc); this->Process(calcStem); @@ -262,13 +265,15 @@ void Page::LayOutTranscription(bool force) CalcDotsFunctor calcDots(doc); this->Process(calcDots); - // Render it for filling the bounding box - View view; - view.SetDoc(doc); - BBoxDeviceContext bBoxDC(&view, 0, 0, BBOX_HORIZONTAL_ONLY); - // Do not do the layout in this view - otherwise we will loop... - view.SetPage(this->GetIdx(), false); - view.DrawCurrentPage(&bBoxDC, false); + if (!m_layoutDone) { + // Render it for filling the bounding box + View view; + view.SetDoc(doc); + BBoxDeviceContext bBoxDC(&view, 0, 0, BBOX_HORIZONTAL_ONLY); + // Do not do the layout in this view - otherwise we will loop... + view.SetPage(this->GetIdx(), false); + view.DrawCurrentPage(&bBoxDC, false); + } AdjustXRelForTranscriptionFunctor adjustXRelForTranscription; this->Process(adjustXRelForTranscription); From c3925f2d4553a3d0394a12f598ad0d15f40000ce Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 1 Aug 2024 10:00:24 -0400 Subject: [PATCH 4/7] Redo layout after insert nc --- src/editortoolkit_neume.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 8d6f62e5063..69ae37050fe 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1250,7 +1250,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in } layer->ReorderByXPos(); - m_doc->GetDrawingPage()->LayOutPitchPos(); + m_doc->GetDrawingPage()->LayOutTranscription(true); + if (m_doc->IsTranscription() && m_doc->HasFacsimile()) m_doc->SyncFromFacsimileDoc(); m_editInfo.import("status", status); From e16f7cd544020b93720b008bddafb9da0cd58ec7 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 1 Aug 2024 12:13:20 -0400 Subject: [PATCH 5/7] Redo layout after toggle ligature Refs: https://github.com/DDMAL/Neon/issues/1236 --- src/editortoolkit_neume.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 69ae37050fe..30d922dc302 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -3518,6 +3518,7 @@ bool EditorToolkitNeume::ToggleLigature(std::vector elementIds) return false; } + m_doc->GetDrawingPage()->LayOutTranscription(true); if (m_doc->IsTranscription() && m_doc->HasFacsimile()) m_doc->SyncFromFacsimileDoc(); m_editInfo.import("status", "OK"); From 1b4fad318eeb22f2aff8bcaf261d92eb300391bc Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 1 Aug 2024 12:43:09 -0400 Subject: [PATCH 6/7] Calculate clef displacement when inserting custos Refs: https://github.com/DDMAL/Neon/issues/1235 --- src/editortoolkit_neume.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 50cf062f61d..333d3362482 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -4248,6 +4248,14 @@ bool EditorToolkitNeume::AdjustPitchFromPosition(Object *obj, Clef *clef) } pi->SetOct(3); + // The default octave = 3, but the actual octave is calculated by + // taking into account the displacement of the clef + int octave = 3; + if (clef->GetDis() && clef->GetDisPlace()) { + octave += (clef->GetDisPlace() == STAFFREL_basic_above ? 1 : -1) * (clef->GetDis() / 7); + } + pi->SetOct(octave); + const int staffSize = m_doc->GetDrawingUnit(staff->m_drawingStaffSize); const int pitchDifference From e859bc1e1ab3f0ddc5f7b648a6839297fe877c21 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 2 Aug 2024 09:28:16 +0200 Subject: [PATCH 7/7] Fix formatting --- src/editortoolkit_neume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 7a60b37b4db..a93ed908165 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -680,7 +680,7 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) SortStaves(); m_doc->GetDrawingPage()->LayOutTranscription(true); - + if (m_doc->IsTranscription() && m_doc->HasFacsimile()) m_doc->SyncFromFacsimileDoc(); return true; // Can't reorder by layer since staves contain layers