From 1b4fad318eeb22f2aff8bcaf261d92eb300391bc Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 1 Aug 2024 12:43:09 -0400 Subject: [PATCH] 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