From 39ba8dbfd4f2dc5fce748007cc3660b616a5dfac Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 18 Dec 2023 09:20:43 +0100 Subject: [PATCH 1/3] Add multiple page breaks if MusicXML encodes blank pages --- src/iomusxml.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index 7fa4fb31d3c..8bd7d0181b5 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -3694,7 +3694,12 @@ void MusicXmlInput::ReadMusicXmlPrint(pugi::xml_node node, Section *section) assert(node); assert(section); - if (node.attribute("new-page").as_bool()) { + int pageBreaks = node.attribute("blank-page").as_int(); + if (node.attribute("new-page").as_bool() || pageBreaks > 0) { + pageBreaks++; + } + + for (int i = 0; i < pageBreaks; i++) { Pb *pb = new Pb(); section->AddChild(pb); } From 65b544861ce10575273e2658a0c227f9f26e08c7 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 18 Dec 2023 11:52:36 +0100 Subject: [PATCH 2/3] Follow MusicXML specs: Only output blank pages if new-page="yes" --- src/iomusxml.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index 8bd7d0181b5..ffa16e0bd0b 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -3694,14 +3694,12 @@ void MusicXmlInput::ReadMusicXmlPrint(pugi::xml_node node, Section *section) assert(node); assert(section); - int pageBreaks = node.attribute("blank-page").as_int(); - if (node.attribute("new-page").as_bool() || pageBreaks > 0) { - pageBreaks++; - } - - for (int i = 0; i < pageBreaks; i++) { - Pb *pb = new Pb(); - section->AddChild(pb); + if (node.attribute("new-page").as_bool()) { + int pageBreaks = node.attribute("blank-page").as_int() + 1; + for (int i = 0; i < pageBreaks; ++i) { + Pb *pb = new Pb(); + section->AddChild(pb); + } } if (node.attribute("new-system").as_bool()) { From 5b73ba1ecffc30fa88132fadc883e73ab184fb94 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 19 Dec 2023 09:14:40 +0100 Subject: [PATCH 3/3] Make loop boundary a constant Co-authored-by: Laurent Pugin --- src/iomusxml.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index ffa16e0bd0b..e7501b40ae1 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -3695,7 +3695,7 @@ void MusicXmlInput::ReadMusicXmlPrint(pugi::xml_node node, Section *section) assert(section); if (node.attribute("new-page").as_bool()) { - int pageBreaks = node.attribute("blank-page").as_int() + 1; + const int pageBreaks = node.attribute("blank-page").as_int() + 1; for (int i = 0; i < pageBreaks; ++i) { Pb *pb = new Pb(); section->AddChild(pb);