From 6cd318d8facaa5b2817efe044f489b835cb593be Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Thu, 9 Jan 2025 16:21:55 +0100 Subject: [PATCH 1/7] make isDiagram const --- src/engraving/dom/harppedaldiagram.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engraving/dom/harppedaldiagram.h b/src/engraving/dom/harppedaldiagram.h index 0939d865c6b2c..76c5f8c813a76 100644 --- a/src/engraving/dom/harppedaldiagram.h +++ b/src/engraving/dom/harppedaldiagram.h @@ -69,7 +69,7 @@ class HarpPedalDiagram final : public TextBase String screenReaderInfo() const override; void setIsDiagram(bool diagram); - bool isDiagram() { return m_isDiagram; } + bool isDiagram() const { return m_isDiagram; } std::array getPedalState() const { return m_pedalState; } void setPedalState(std::array state); From 500906e975347b986fde98ea11ca55ef22b0608c Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Thu, 9 Jan 2025 16:28:23 +0100 Subject: [PATCH 2/7] remove superfluous check --- .../musicxml/internal/musicxml/export/exportmusicxml.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp index 1f860ecc85bdd..428b99b02e3ff 100644 --- a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp @@ -5248,10 +5248,6 @@ void ExportMusicXml::rehearsal(RehearsalMark const* const rmk, staff_idx_t staff void ExportMusicXml::harpPedals(HarpPedalDiagram const* const hpd, staff_idx_t staff) { - if (hpd->textStyleType() != TextStyleType::HARP_PEDAL_DIAGRAM) { - return; - } - directionTag(m_xml, m_attr, hpd); m_xml.startElement("direction-type"); XmlWriter::Attributes harpPedalAttrs; From 94d74341d11d8f3dfbc4db290ef6eb8f36950ddd Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Thu, 9 Jan 2025 16:33:09 +0100 Subject: [PATCH 3/7] also export harp pedal words --- .../musicxml/export/exportmusicxml.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp index 428b99b02e3ff..0bbfa57ceb26c 100644 --- a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp @@ -5255,16 +5255,20 @@ void ExportMusicXml::harpPedals(HarpPedalDiagram const* const hpd, staff_idx_t s harpPedalAttrs.push_back({ "placement", (hpd->placement() == PlacementV::BELOW) ? "below" : "above" }); } addColorAttr(hpd, harpPedalAttrs); - m_xml.startElement("harp-pedals", harpPedalAttrs); - const std::vector pedalSteps = { u"D", u"C", u"B", u"E", u"F", u"G", u"A" }; - for (size_t idx = 0; idx < pedalSteps.size(); idx++) { - m_xml.startElement("pedal-tuning"); - m_xml.tag("pedal-step", pedalSteps.at(idx)); - m_xml.tag("pedal-alter", static_cast(hpd->getPedalState().at(idx)) - 1); + if (!hpd->isDiagram()) { + m_xml.startElement("harp-pedals", harpPedalAttrs); + const std::vector pedalSteps = { u"D", u"C", u"B", u"E", u"F", u"G", u"A" }; + for (size_t idx = 0; idx < pedalSteps.size(); idx++) { + m_xml.startElement("pedal-tuning"); + m_xml.tag("pedal-step", pedalSteps.at(idx)); + m_xml.tag("pedal-alter", static_cast(hpd->getPedalState().at(idx)) - 1); + m_xml.endElement(); + } + m_xml.endElement(); m_xml.endElement(); + } else { + m_xml.tag("words", harpPedalAttrs, hpd->plainText()); } - m_xml.endElement(); - m_xml.endElement(); const int offset = calculateTimeDeltaInDivisions(hpd->tick(), tick(), m_div); if (offset) { m_xml.tag("offset", offset); From 3037a1e9e3581861d84c1f931c20c88cbdcebe16 Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Thu, 9 Jan 2025 16:35:09 +0100 Subject: [PATCH 4/7] fix invalid attribute --- .../musicxml/internal/musicxml/export/exportmusicxml.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp index 0bbfa57ceb26c..2c3acde5bd87a 100644 --- a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp @@ -5251,9 +5251,6 @@ void ExportMusicXml::harpPedals(HarpPedalDiagram const* const hpd, staff_idx_t s directionTag(m_xml, m_attr, hpd); m_xml.startElement("direction-type"); XmlWriter::Attributes harpPedalAttrs; - if (!hpd->isStyled(Pid::PLACEMENT)) { - harpPedalAttrs.push_back({ "placement", (hpd->placement() == PlacementV::BELOW) ? "below" : "above" }); - } addColorAttr(hpd, harpPedalAttrs); if (!hpd->isDiagram()) { m_xml.startElement("harp-pedals", harpPedalAttrs); From 1cf8851245048cdd999e2496d3b70eb9104e5f4d Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Thu, 9 Jan 2025 16:37:49 +0100 Subject: [PATCH 5/7] update test --- .../musicxml/tests/data/testHarpPedals.mscx | 7 ++-- .../tests/data/testHarpPedals_ref.xml | 34 ++----------------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/importexport/musicxml/tests/data/testHarpPedals.mscx b/src/importexport/musicxml/tests/data/testHarpPedals.mscx index 944ecbf241b2e..223b81a8f612c 100644 --- a/src/importexport/musicxml/tests/data/testHarpPedals.mscx +++ b/src/importexport/musicxml/tests/data/testHarpPedals.mscx @@ -176,8 +176,9 @@ + 0 - 1 + 0 2 1 1 @@ -185,7 +186,9 @@ 2 1 - harpPedalCenteredharpPedalLoweredharpPedalCenteredharpPedalDividerharpPedalCenteredharpPedalLoweredharpPedalLoweredharpPedalCentered + + GcsymAccidentalSharp +DcsymAccidentalFlat measure diff --git a/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml b/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml index 5c68dd7e679aa..216b600e04c03 100644 --- a/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml +++ b/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml @@ -209,38 +209,10 @@ - + - - - D - 0 - - - C - 1 - - - B - 0 - - - E - 0 - - - F - 1 - - - G - 1 - - - A - 0 - - + G +D 1 From eaf624608cc2b25dd3617f6060874db68bff5894 Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Thu, 9 Jan 2025 16:54:42 +0100 Subject: [PATCH 6/7] fix typo --- .../musicxml/internal/musicxml/export/exportmusicxml.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp index 2c3acde5bd87a..76076a6462e66 100644 --- a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp @@ -5252,7 +5252,7 @@ void ExportMusicXml::harpPedals(HarpPedalDiagram const* const hpd, staff_idx_t s m_xml.startElement("direction-type"); XmlWriter::Attributes harpPedalAttrs; addColorAttr(hpd, harpPedalAttrs); - if (!hpd->isDiagram()) { + if (hpd->isDiagram()) { m_xml.startElement("harp-pedals", harpPedalAttrs); const std::vector pedalSteps = { u"D", u"C", u"B", u"E", u"F", u"G", u"A" }; for (size_t idx = 0; idx < pedalSteps.size(); idx++) { From 7af62d2aa805c36d9cfb7a7367bf13863bd9cb63 Mon Sep 17 00:00:00 2001 From: rettinghaus Date: Thu, 9 Jan 2025 17:10:04 +0100 Subject: [PATCH 7/7] fix closing tag --- .../musicxml/internal/musicxml/export/exportmusicxml.cpp | 2 +- src/importexport/musicxml/tests/data/testHarpPedals_ref.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp index 76076a6462e66..ca51b9dc2357c 100644 --- a/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/export/exportmusicxml.cpp @@ -5262,10 +5262,10 @@ void ExportMusicXml::harpPedals(HarpPedalDiagram const* const hpd, staff_idx_t s m_xml.endElement(); } m_xml.endElement(); - m_xml.endElement(); } else { m_xml.tag("words", harpPedalAttrs, hpd->plainText()); } + m_xml.endElement(); const int offset = calculateTimeDeltaInDivisions(hpd->tick(), tick(), m_div); if (offset) { m_xml.tag("offset", offset); diff --git a/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml b/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml index 216b600e04c03..6cb4a7c872bc2 100644 --- a/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml +++ b/src/importexport/musicxml/tests/data/testHarpPedals_ref.xml @@ -55,7 +55,7 @@ - + D -1